diff --git a/Applications/DataExplorer/DataView/ElementTreeModel.cpp b/Applications/DataExplorer/DataView/ElementTreeModel.cpp index bc407df5d31e2afafc6ac316a8c2ab918cf5c01b..d3cf487d6ffda64ab40c4f0e6ebe8dfdbecdd852 100644 --- a/Applications/DataExplorer/DataView/ElementTreeModel.cpp +++ b/Applications/DataExplorer/DataView/ElementTreeModel.cpp @@ -65,12 +65,7 @@ void ElementTreeModel::setElement(vtkUnstructuredGridAlgorithm const*const grid, auto* typeItem = new TreeItem(typeData, elemItem); elemItem->appendChild(typeItem); - MeshLib::PropertyVector<int> const* const mat_ids = - mesh->getProperties().existsPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1) - ? mesh->getProperties().getPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1) - : nullptr; + auto const mat_ids = materialIDs(*mesh); QString matIdString = !mat_ids ? QString("not defined") : QString::number((*mat_ids)[elem->getID()]); QList<QVariant> materialData; materialData << "MaterialID: " << matIdString; diff --git a/Applications/Utils/FileConverter/generateMatPropsFromMatID.cpp b/Applications/Utils/FileConverter/generateMatPropsFromMatID.cpp index 31b7c3162bd58a8abb3f41d37b11b221cbde032a..24d0743225f2ac032ea8c4c0ac9ffdddfa90f31b 100644 --- a/Applications/Utils/FileConverter/generateMatPropsFromMatID.cpp +++ b/Applications/Utils/FileConverter/generateMatPropsFromMatID.cpp @@ -61,16 +61,10 @@ int main (int argc, char* argv[]) return EXIT_FAILURE; } - MeshLib::PropertyVector<int>* materialIds = nullptr; - try + auto const materialIds = materialIDs(*mesh); + if (!materialIds) { - materialIds = mesh->getProperties().getPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1); - } - catch (std::runtime_error const& e) - { - WARN("%s", e.what()); - return EXIT_FAILURE; + OGS_FATAL("Mesh contains no int-property vector named 'MaterialIDs'."); } std::size_t const n_properties(materialIds->size()); diff --git a/Applications/Utils/MeshEdit/queryMesh.cpp b/Applications/Utils/MeshEdit/queryMesh.cpp index 44bd0156e2a282ca49a1ccf351fb0eca109f93f3..ec0908e5fec28b68f819f5d726e712847856b52a 100644 --- a/Applications/Utils/MeshEdit/queryMesh.cpp +++ b/Applications/Utils/MeshEdit/queryMesh.cpp @@ -68,12 +68,7 @@ int main(int argc, char *argv[]) } selected_node_ids.insert(selected_node_ids.end(), nodeId_arg.getValue().begin(), nodeId_arg.getValue().end()); - MeshLib::PropertyVector<int> const* const materialIds = - mesh->getProperties().existsPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1) - ? mesh->getProperties().getPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1) - : nullptr; + auto const materialIds = materialIDs(*mesh); for (auto ele_id : eleId_arg.getValue()) { std::stringstream out; diff --git a/MaterialLib/PorousMedium/CreatePorousMediaProperties.cpp b/MaterialLib/PorousMedium/CreatePorousMediaProperties.cpp index 45ac97c4f86566aed8564ea31b7b6d61dfef172c..4e524bd1380baa2ec6e70ad99d258f010f80c70b 100644 --- a/MaterialLib/PorousMedium/CreatePorousMediaProperties.cpp +++ b/MaterialLib/PorousMedium/CreatePorousMediaProperties.cpp @@ -76,19 +76,11 @@ PorousMediaProperties createPorousMediaProperties( BaseLib::reorderVector(porosity_models, mat_ids); BaseLib::reorderVector(storage_models, mat_ids); - std::vector<int> material_ids(mesh.getNumberOfElements()); - if (mesh.getProperties().existsPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1)) - { - auto const& mesh_material_ids = - mesh.getProperties().getPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1); - material_ids.reserve(mesh_material_ids->size()); - std::copy(mesh_material_ids->cbegin(), mesh_material_ids->cend(), - material_ids.begin()); - } + auto const material_ids = materialIDs(mesh); int const max_material_id = - *std::max_element(material_ids.cbegin(), material_ids.cend()); + !material_ids + ? 0 + : *std::max_element(begin(*material_ids), end(*material_ids)); if (max_material_id > static_cast<int>(mat_ids.size() - 1)) OGS_FATAL( @@ -112,8 +104,7 @@ PorousMediaProperties createPorousMediaProperties( return PorousMediaProperties{std::move(porosity_models), std::move(intrinsic_permeability_models), - std::move(storage_models), - std::move(material_ids)}; + std::move(storage_models), material_ids}; } } // namespace ComponentTransport diff --git a/MaterialLib/PorousMedium/PorousMediaProperties.cpp b/MaterialLib/PorousMedium/PorousMediaProperties.cpp index cdc37f81d5844fef7a9523b500f73d0ee68d5112..4213be83705deeddfec8774e3ffdb612ee511747 100644 --- a/MaterialLib/PorousMedium/PorousMediaProperties.cpp +++ b/MaterialLib/PorousMedium/PorousMediaProperties.cpp @@ -18,8 +18,7 @@ namespace PorousMedium int PorousMediaProperties::getMaterialID( ProcessLib::SpatialPosition const& pos) const { - int const element_id = pos.getElementID().get(); - return _material_ids[element_id]; + return _material_ids ? (*_material_ids)[pos.getElementID().get()] : 0; } MaterialLib::PorousMedium::Porosity const& PorousMediaProperties::getPorosity( diff --git a/MaterialLib/PorousMedium/PorousMediaProperties.h b/MaterialLib/PorousMedium/PorousMediaProperties.h index b37766dfdccffde83346e2aa34741d195e9de3ff..4424ccf0c9b0c445edf333204d89d64c55c9184c 100644 --- a/MaterialLib/PorousMedium/PorousMediaProperties.h +++ b/MaterialLib/PorousMedium/PorousMediaProperties.h @@ -36,23 +36,16 @@ public: intrinsic_permeability_models, std::vector<std::unique_ptr<MaterialLib::PorousMedium::Storage>>&& specific_storage_models, - std::vector<int>&& material_ids) + MeshLib::PropertyVector<int> const* const material_ids) : _porosity_models(std::move(porosity_models)), _intrinsic_permeability_models( std::move(intrinsic_permeability_models)), _specific_storage_models(std::move(specific_storage_models)), - _material_ids(std::move(material_ids)) + _material_ids(material_ids) { } - PorousMediaProperties(PorousMediaProperties&& other) - : _porosity_models(std::move(other._porosity_models)), - _intrinsic_permeability_models( - std::move(other._intrinsic_permeability_models)), - _specific_storage_models(std::move(other._specific_storage_models)), - _material_ids(other._material_ids) - { - } + PorousMediaProperties(PorousMediaProperties&& other) = default; MaterialLib::PorousMedium::Porosity const& getPorosity( double t, ProcessLib::SpatialPosition const& pos) const; @@ -72,7 +65,7 @@ private: _intrinsic_permeability_models; std::vector<std::unique_ptr<MaterialLib::PorousMedium::Storage>> _specific_storage_models; - std::vector<int> _material_ids; + MeshLib::PropertyVector<int> const* const _material_ids; }; } diff --git a/MeshGeoToolsLib/AppendLinesAlongPolyline.cpp b/MeshGeoToolsLib/AppendLinesAlongPolyline.cpp index c107c4d10896e4f90037229c9677bd25b273cd1b..6294d27cbec3e4c0174613d22f5fda7e07a623a9 100644 --- a/MeshGeoToolsLib/AppendLinesAlongPolyline.cpp +++ b/MeshGeoToolsLib/AppendLinesAlongPolyline.cpp @@ -1,4 +1,3 @@ - /** * @copyright * Copyright (c) 2012-2018, OpenGeoSys Community (http://www.opengeosys.org) @@ -32,22 +31,13 @@ std::unique_ptr<MeshLib::Mesh> appendLinesAlongPolylines( std::vector<MeshLib::Node*> vec_new_nodes = MeshLib::copyNodeVector(mesh.getNodes()); std::vector<MeshLib::Element*> vec_new_eles = MeshLib::copyElementVector(mesh.getElements(), vec_new_nodes); - std::vector<int> new_mat_ids; - try - { - auto ids = mesh.getProperties().getPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1); - new_mat_ids.reserve(ids->size()); - std::copy(ids->cbegin(), ids->cend(), std::back_inserter(new_mat_ids)); - } - catch (std::runtime_error const& e) - { - WARN("%s", e.what()); - } - int max_matID(0); - if (!new_mat_ids.empty()) - max_matID = *(std::max_element(new_mat_ids.cbegin(), new_mat_ids.cend())); + auto const material_ids = materialIDs(mesh); + int const max_matID = + material_ids + ? *(std::max_element(begin(*material_ids), end(*material_ids))) + : 0; + std::vector<int> new_mat_ids; const std::size_t n_ply (ply_vec.size()); // for each polyline for (std::size_t k(0); k < n_ply; k++) @@ -81,14 +71,25 @@ std::unique_ptr<MeshLib::Mesh> appendLinesAlongPolylines( const std::string name = mesh.getName() + "_with_lines"; auto new_mesh = std::make_unique<MeshLib::Mesh>(name, vec_new_nodes, vec_new_eles); - auto opt_mat_pv = new_mesh->getProperties().createNewPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell); - if (opt_mat_pv) { - auto & mat_pv = *opt_mat_pv; - mat_pv.reserve(new_mat_ids.size()); - std::copy(new_mat_ids.cbegin(), new_mat_ids.cend(), - std::back_inserter(mat_pv)); + auto new_material_ids = + new_mesh->getProperties().createNewPropertyVector<int>( + "MaterialIDs", MeshLib::MeshItemType::Cell); + if (!new_material_ids) + { + OGS_FATAL("Could not create MaterialIDs cell vector in new mesh."); + } + new_material_ids->reserve(new_mesh->getNumberOfElements()); + if (material_ids != nullptr) + { + std::copy(begin(*material_ids), end(*material_ids), + std::back_inserter(*new_material_ids)); + } + else + { + new_material_ids->resize(mesh.getNumberOfElements()); } + std::copy(begin(new_mat_ids), end(new_mat_ids), + std::back_inserter(*new_material_ids)); return new_mesh; } diff --git a/ProcessLib/LIE/Common/MeshUtils.cpp b/ProcessLib/LIE/Common/MeshUtils.cpp index 0e13861aaeab0eabc9d8f0e65e76bc4b2347033e..b0f608a78efc9f2e65f56b950cdcaec6dfdd3091 100644 --- a/ProcessLib/LIE/Common/MeshUtils.cpp +++ b/ProcessLib/LIE/Common/MeshUtils.cpp @@ -84,10 +84,13 @@ void getFractureMatrixDataInMesh( vec_matrix_elements.size(), all_fracture_elements.size()); // get fracture material IDs - auto opt_material_ids(mesh.getProperties().getPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1)); + auto const material_ids = materialIDs(mesh); + if (!material_ids) + { + OGS_FATAL("Could not access MaterialIDs property from mesh."); + } for (MeshLib::Element* e : all_fracture_elements) - vec_fracture_mat_IDs.push_back((*opt_material_ids)[e->getID()]); + vec_fracture_mat_IDs.push_back((*material_ids)[e->getID()]); BaseLib::makeVectorUnique(vec_fracture_mat_IDs); DBUG("-> found %d fracture material groups", vec_fracture_mat_IDs.size()); @@ -101,7 +104,7 @@ void getFractureMatrixDataInMesh( std::copy_if(all_fracture_elements.begin(), all_fracture_elements.end(), std::back_inserter(vec_elements), [&](MeshLib::Element* e) { - return (*opt_material_ids)[e->getID()] == frac_mat_id; + return (*material_ids)[e->getID()] == frac_mat_id; }); DBUG("-> found %d elements on the fracture %d", vec_elements.size(), frac_id); diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp index 48f9b926593c22f8f67dbf17ec7cccdb8f51ab7f..f507f5646aa1b4291ba6be3f9228d2c890dbfb68 100644 --- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp @@ -318,8 +318,11 @@ void HydroMechanicsProcess<GlobalDim>::initializeConcreteProcess( const_cast<MeshLib::Mesh&>(mesh), "aperture", MeshLib::MeshItemType::Cell, 1); mesh_prop_b->resize(mesh.getNumberOfElements()); - auto mesh_prop_matid = mesh.getProperties().getPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1); + auto const mesh_prop_matid = materialIDs(mesh); + if (!mesh_prop_matid) + { + OGS_FATAL("Could not access MaterialIDs property from mesh."); + } auto frac = _process_data.fracture_property.get(); for (MeshLib::Element const* e : _mesh.getElements()) { diff --git a/ProcessLib/LiquidFlow/CreateLiquidFlowMaterialProperties.cpp b/ProcessLib/LiquidFlow/CreateLiquidFlowMaterialProperties.cpp index f699249430ea53658a984834ba1847ba3ab41cdd..1e94afb1f573f6de41d693a583c06b1b61a16f80 100644 --- a/ProcessLib/LiquidFlow/CreateLiquidFlowMaterialProperties.cpp +++ b/ProcessLib/LiquidFlow/CreateLiquidFlowMaterialProperties.cpp @@ -40,8 +40,7 @@ std::unique_ptr<LiquidFlowMaterialProperties> createLiquidFlowMaterialProperties( BaseLib::ConfigTree const& config, std::vector<std::unique_ptr<ParameterBase>> const& parameters, - bool const has_material_ids, - MeshLib::PropertyVector<int> const& material_ids) + MeshLib::PropertyVector<int> const* const material_ids) { DBUG("Reading material properties of liquid flow process."); @@ -99,8 +98,7 @@ createLiquidFlowMaterialProperties( return std::make_unique<LiquidFlowMaterialProperties>( std::move(fluid_properties), std::move(intrinsic_permeability_models), - std::move(porosity_models), std::move(storage_models), has_material_ids, - material_ids); + std::move(porosity_models), std::move(storage_models), material_ids); } } // end of namespace diff --git a/ProcessLib/LiquidFlow/CreateLiquidFlowMaterialProperties.h b/ProcessLib/LiquidFlow/CreateLiquidFlowMaterialProperties.h index eb908fbe7bf1dee5b31882a3180aadc1f7a6bbe6..b8ae712e80d956172fbfc42455a25daf09a3107d 100644 --- a/ProcessLib/LiquidFlow/CreateLiquidFlowMaterialProperties.h +++ b/ProcessLib/LiquidFlow/CreateLiquidFlowMaterialProperties.h @@ -45,8 +45,7 @@ std::unique_ptr<LiquidFlowMaterialProperties> createLiquidFlowMaterialProperties( BaseLib::ConfigTree const& config, std::vector<std::unique_ptr<ParameterBase>> const& parameters, - bool const has_material_ids, - MeshLib::PropertyVector<int> const& material_ids); + MeshLib::PropertyVector<int> const* const material_ids); } // end of namespace } // end of namespace diff --git a/ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp b/ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp index f8fc4511dc3923cc35a2f3b2e4b2e6f42516462c..3264dd7e1ce2801e1c4f3f6c976986e3ad2d65c2 100644 --- a/ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp +++ b/ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp @@ -91,39 +91,21 @@ std::unique_ptr<Process> createLiquidFlowProcess( //! \ogs_file_param{prj__processes__process__LIQUID_FLOW__material_property} auto const& mat_config = config.getConfigSubtree("material_property"); - if (mesh.getProperties().existsPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1)) + auto const material_ids = materialIDs(mesh); + if (material_ids) { INFO("The liquid flow is in heterogeneous porous media."); - const bool has_material_ids = true; - auto const& mat_ids = mesh.getProperties().getPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1); - return std::unique_ptr<Process>{new LiquidFlowProcess{ - mesh, std::move(jacobian_assembler), parameters, integration_order, - std::move(process_variables), std::move(secondary_variables), - std::move(named_function_caller), *mat_ids, has_material_ids, - gravity_axis_id, g, reference_temperature, mat_config}}; } - - INFO("The liquid flow is in homogeneous porous media."); - - MeshLib::Properties dummy_property; - // For a reference argument of LiquidFlowProcess(...). - auto const& dummy_property_vector = - dummy_property.createNewPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1); - - // Since dummy_property_vector is only visible in this function, - // the following constant, has_material_ids, is employed to indicate - // that material_ids does not exist. - const bool has_material_ids = false; + else + { + INFO("The liquid flow is in homogeneous porous media."); + } return std::unique_ptr<Process>{new LiquidFlowProcess{ mesh, std::move(jacobian_assembler), parameters, integration_order, std::move(process_variables), std::move(secondary_variables), - std::move(named_function_caller), *dummy_property_vector, - has_material_ids, gravity_axis_id, g, reference_temperature, - mat_config}}; + std::move(named_function_caller), material_ids, gravity_axis_id, g, + reference_temperature, mat_config}}; } } // end of namespace diff --git a/ProcessLib/LiquidFlow/LiquidFlowMaterialProperties.cpp b/ProcessLib/LiquidFlow/LiquidFlowMaterialProperties.cpp index bc7aa51c7ccea8e9d12fe01c44a8bfa6b491b6c6..da7a9e0c464e3252a1b31f8d9346089421cf5d8f 100644 --- a/ProcessLib/LiquidFlow/LiquidFlowMaterialProperties.cpp +++ b/ProcessLib/LiquidFlow/LiquidFlowMaterialProperties.cpp @@ -33,13 +33,13 @@ namespace LiquidFlow int LiquidFlowMaterialProperties::getMaterialID( const SpatialPosition& pos) const { - if (!_has_material_ids) + if (!_material_ids) { return 0; } - assert(pos.getElementID().get() < _material_ids.size()); - return _material_ids[pos.getElementID().get()]; + assert(pos.getElementID().get() < _material_ids->size()); + return (*_material_ids)[pos.getElementID().get()]; } double LiquidFlowMaterialProperties::getLiquidDensity(const double p, diff --git a/ProcessLib/LiquidFlow/LiquidFlowMaterialProperties.h b/ProcessLib/LiquidFlow/LiquidFlowMaterialProperties.h index bafb35327de3896175649b9e922939c41b9a4b50..d95374c6b2fbb3684c5a33a4f399cfe0b37349b5 100644 --- a/ProcessLib/LiquidFlow/LiquidFlowMaterialProperties.h +++ b/ProcessLib/LiquidFlow/LiquidFlowMaterialProperties.h @@ -56,10 +56,8 @@ public: porosity_models, std::vector<std::unique_ptr<MaterialLib::PorousMedium::Storage>>&& storage_models, - bool const has_material_ids, - MeshLib::PropertyVector<int> const& material_ids) - : _has_material_ids(has_material_ids), - _material_ids(material_ids), + MeshLib::PropertyVector<int> const* const material_ids) + : _material_ids(material_ids), _fluid_properties(std::move(fluid_properties)), _intrinsic_permeability_models( std::move(intrinsic_permeability_models)), @@ -106,13 +104,10 @@ public: const double porosity_variable, const double T) const; private: - /// A flag to indicate whether the reference member, _material_ids, - /// is not assigned. - const bool _has_material_ids; /** Use porous medium models for different material zones. * Material IDs must be given as mesh element properties. */ - MeshLib::PropertyVector<int> const& _material_ids; + MeshLib::PropertyVector<int> const* const _material_ids; const std::unique_ptr<MaterialLib::Fluid::FluidProperties> _fluid_properties; diff --git a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp index 8c04ad6d3c694ddf6aed3ec7fffc903b057f01c4..3e113c5d9679f546997c2887dbcad06c48503218 100644 --- a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp +++ b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp @@ -39,8 +39,7 @@ LiquidFlowProcess::LiquidFlowProcess( process_variables, SecondaryVariableCollection&& secondary_variables, NumLib::NamedFunctionCaller&& named_function_caller, - MeshLib::PropertyVector<int> const& material_ids, - bool const has_material_ids, + MeshLib::PropertyVector<int> const* const material_ids, int const gravitational_axis_id, double const gravitational_acceleration, double const reference_temperature, @@ -51,8 +50,8 @@ LiquidFlowProcess::LiquidFlowProcess( _gravitational_axis_id(gravitational_axis_id), _gravitational_acceleration(gravitational_acceleration), _reference_temperature(reference_temperature), - _material_properties(createLiquidFlowMaterialProperties( - config, parameters, has_material_ids, material_ids)) + _material_properties( + createLiquidFlowMaterialProperties(config, parameters, material_ids)) { DBUG("Create Liquid flow process."); } diff --git a/ProcessLib/LiquidFlow/LiquidFlowProcess.h b/ProcessLib/LiquidFlow/LiquidFlowProcess.h index 0383591dfcaeee4f0da792765d8d8b01cbe834e9..c12501bceec21f2bee81dd9dbe386c303687657c 100644 --- a/ProcessLib/LiquidFlow/LiquidFlowProcess.h +++ b/ProcessLib/LiquidFlow/LiquidFlowProcess.h @@ -66,8 +66,7 @@ public: process_variables, SecondaryVariableCollection&& secondary_variables, NumLib::NamedFunctionCaller&& named_function_caller, - MeshLib::PropertyVector<int> const& material_ids, - bool const has_material_ids, + MeshLib::PropertyVector<int> const* const material_ids, int const gravitational_axis_id, double const gravitational_acceleration, double const reference_temperature, diff --git a/ProcessLib/RichardsFlow/CreateRichardsFlowProcess.cpp b/ProcessLib/RichardsFlow/CreateRichardsFlowProcess.cpp index ab9694e8661834adef9fe385a57a5e7b055c3729..a134239f0aefdbf719de50100b086b4bb22da0c9 100644 --- a/ProcessLib/RichardsFlow/CreateRichardsFlowProcess.cpp +++ b/ProcessLib/RichardsFlow/CreateRichardsFlowProcess.cpp @@ -80,12 +80,7 @@ std::unique_ptr<Process> createRichardsFlowProcess( //! \ogs_file_param{prj__processes__process__RICHARDS_FLOW__material_property} auto const& mat_config = config.getConfigSubtree("material_property"); - auto const* material_ids = - mesh.getProperties().existsPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1) - ? mesh.getProperties().getPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1) - : nullptr; + auto const material_ids = materialIDs(mesh); if (material_ids != nullptr) { INFO("The Richards flow is in heterogeneous porous media."); diff --git a/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPMaterialProperties.cpp b/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPMaterialProperties.cpp index aa1d7abbd7535d2c4fb2f89bccd9a0f362087a01..2b7977f7cd6a979f20464990ceb1be9c878470cf 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPMaterialProperties.cpp +++ b/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPMaterialProperties.cpp @@ -31,8 +31,7 @@ namespace TwoPhaseFlowWithPP std::unique_ptr<TwoPhaseFlowWithPPMaterialProperties> createTwoPhaseFlowWithPPMaterialProperties( BaseLib::ConfigTree const& config, - boost::optional<MeshLib::PropertyVector<int> const&> - material_ids, + MeshLib::PropertyVector<int> const* const material_ids, std::vector<std::unique_ptr<ParameterBase>> const& parameters) { DBUG("Reading material properties of two-phase flow process."); diff --git a/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPMaterialProperties.h b/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPMaterialProperties.h index 96aee324a320804d143dd7834da22f9c2fdced96..32bcea1ad506c9119f0a8a9ce56fdb0d90741ecd 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPMaterialProperties.h +++ b/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPMaterialProperties.h @@ -23,8 +23,7 @@ namespace TwoPhaseFlowWithPP std::unique_ptr<TwoPhaseFlowWithPPMaterialProperties> createTwoPhaseFlowWithPPMaterialProperties( BaseLib::ConfigTree const& config, - boost::optional<MeshLib::PropertyVector<int> const&> - material_ids, + MeshLib::PropertyVector<int> const* const material_ids, std::vector<std::unique_ptr<ParameterBase>> const& parameters); } // end namespace diff --git a/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPProcess.cpp b/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPProcess.cpp index e46d4d4d76e63058a9b0ec78e9285be558a3a5a5..23560f7c35e230e1b32edc3e95246efb30897c06 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPProcess.cpp +++ b/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPProcess.cpp @@ -78,13 +78,10 @@ std::unique_ptr<Process> createTwoPhaseFlowWithPPProcess( //! \ogs_file_param{prj__processes__process__TWOPHASE_FLOW_PP__material_property} auto const& mat_config = config.getConfigSubtree("material_property"); - boost::optional<MeshLib::PropertyVector<int> const&> material_ids; - if (mesh.getProperties().existsPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1)) + auto const material_ids = materialIDs(mesh); + if (material_ids) { INFO("The twophase flow is in heterogeneous porous media."); - material_ids = *mesh.getProperties().getPropertyVector<int>( - "MaterialIDs", MeshLib::MeshItemType::Cell, 1); } else { diff --git a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPMaterialProperties.cpp b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPMaterialProperties.cpp index 0e05e4c974c0122a6e13c077597e1ec977403ffd..c6230eee39f9accaf30b67e4eef3a55a954f7bf8 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPMaterialProperties.cpp +++ b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPMaterialProperties.cpp @@ -27,7 +27,7 @@ namespace ProcessLib namespace TwoPhaseFlowWithPP { TwoPhaseFlowWithPPMaterialProperties::TwoPhaseFlowWithPPMaterialProperties( - boost::optional<MeshLib::PropertyVector<int> const&> const material_ids, + MeshLib::PropertyVector<int> const* const material_ids, std::unique_ptr<MaterialLib::Fluid::FluidProperty> liquid_density, std::unique_ptr<MaterialLib::Fluid::FluidProperty> diff --git a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPMaterialProperties.h b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPMaterialProperties.h index 6f4c48882205e98048d1134da5ada3d512a7cca6..d84849e6be5dfdd84a148d18d938880fdafb8a16 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPMaterialProperties.h +++ b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPMaterialProperties.h @@ -46,7 +46,7 @@ public: using ArrayType = MaterialLib::Fluid::FluidProperty::ArrayType; TwoPhaseFlowWithPPMaterialProperties( - boost::optional<MeshLib::PropertyVector<int> const&> const material_ids, + MeshLib::PropertyVector<int> const* const material_ids, std::unique_ptr<MaterialLib::Fluid::FluidProperty> liquid_density, std::unique_ptr<MaterialLib::Fluid::FluidProperty> @@ -110,7 +110,7 @@ protected: /** Use two phase models for different material zones. * Material IDs must be given as mesh element properties. */ - boost::optional<MeshLib::PropertyVector<int> const&> const _material_ids; + MeshLib::PropertyVector<int> const* const _material_ids; std::vector<std::unique_ptr<MaterialLib::PorousMedium::Permeability>> _intrinsic_permeability_models;