From c51a1cab3a5c59e2c144ddacdb69384a80802067 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue, 13 Nov 2018 14:51:59 +0100 Subject: [PATCH] [PL/*] Use new {exists,get}PropertyVector. This versions check if the PropertyVector is assigned to the requested mesh item type and has the required number of components. --- ProcessLib/LIE/Common/MeshUtils.cpp | 4 ++-- ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp | 4 ++-- ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp | 7 ++++--- ProcessLib/RichardsFlow/CreateRichardsFlowProcess.cpp | 8 ++++++-- ProcessLib/SurfaceFlux/SurfaceFlux.cpp | 4 ++-- .../CreateTwoPhaseFlowWithPPProcess.cpp | 7 ++++--- 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ProcessLib/LIE/Common/MeshUtils.cpp b/ProcessLib/LIE/Common/MeshUtils.cpp index 9fa1349ee32..0e13861aaea 100644 --- a/ProcessLib/LIE/Common/MeshUtils.cpp +++ b/ProcessLib/LIE/Common/MeshUtils.cpp @@ -84,8 +84,8 @@ void getFractureMatrixDataInMesh( vec_matrix_elements.size(), all_fracture_elements.size()); // get fracture material IDs - auto opt_material_ids( - mesh.getProperties().getPropertyVector<int>("MaterialIDs")); + auto opt_material_ids(mesh.getProperties().getPropertyVector<int>( + "MaterialIDs", MeshLib::MeshItemType::Cell, 1)); for (MeshLib::Element* e : all_fracture_elements) vec_fracture_mat_IDs.push_back((*opt_material_ids)[e->getID()]); BaseLib::makeVectorUnique(vec_fracture_mat_IDs); diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp index d1c64ca41ef..48f9b926593 100644 --- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp @@ -318,8 +318,8 @@ 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"); + auto mesh_prop_matid = mesh.getProperties().getPropertyVector<int>( + "MaterialIDs", MeshLib::MeshItemType::Cell, 1); auto frac = _process_data.fracture_property.get(); for (MeshLib::Element const* e : _mesh.getElements()) { diff --git a/ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp b/ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp index 51a53a7ddb1..f8fc4511dc3 100644 --- a/ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp +++ b/ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp @@ -91,12 +91,13 @@ 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")) + if (mesh.getProperties().existsPropertyVector<int>( + "MaterialIDs", MeshLib::MeshItemType::Cell, 1)) { INFO("The liquid flow is in heterogeneous porous media."); const bool has_material_ids = true; - auto const& mat_ids = - mesh.getProperties().getPropertyVector<int>("MaterialIDs"); + 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), diff --git a/ProcessLib/RichardsFlow/CreateRichardsFlowProcess.cpp b/ProcessLib/RichardsFlow/CreateRichardsFlowProcess.cpp index f0651c3825b..ab9694e8661 100644 --- a/ProcessLib/RichardsFlow/CreateRichardsFlowProcess.cpp +++ b/ProcessLib/RichardsFlow/CreateRichardsFlowProcess.cpp @@ -80,8 +80,12 @@ 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().getPropertyVector<int>("MaterialIDs"); + auto const* material_ids = + mesh.getProperties().existsPropertyVector<int>( + "MaterialIDs", MeshLib::MeshItemType::Cell, 1) + ? mesh.getProperties().getPropertyVector<int>( + "MaterialIDs", MeshLib::MeshItemType::Cell, 1) + : nullptr; if (material_ids != nullptr) { INFO("The Richards flow is in heterogeneous porous media."); diff --git a/ProcessLib/SurfaceFlux/SurfaceFlux.cpp b/ProcessLib/SurfaceFlux/SurfaceFlux.cpp index 35996b53126..a5735a825e8 100644 --- a/ProcessLib/SurfaceFlux/SurfaceFlux.cpp +++ b/ProcessLib/SurfaceFlux/SurfaceFlux.cpp @@ -40,10 +40,10 @@ SurfaceFlux::SurfaceFlux( auto const bulk_element_ids = boundary_mesh.getProperties().template getPropertyVector<std::size_t>( - "bulk_element_ids"); + "bulk_element_ids", MeshLib::MeshItemType::Cell, 1); auto const bulk_face_ids = boundary_mesh.getProperties().template getPropertyVector<std::size_t>( - "bulk_face_ids"); + "bulk_face_ids", MeshLib::MeshItemType::Cell, 1); ProcessLib::createLocalAssemblers<SurfaceFluxLocalAssembler>( boundary_mesh.getDimension() + 1, // or bulk_mesh.getDimension()? diff --git a/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPProcess.cpp b/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPProcess.cpp index b210b4c7352..e46d4d4d76e 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPProcess.cpp +++ b/ProcessLib/TwoPhaseFlowWithPP/CreateTwoPhaseFlowWithPPProcess.cpp @@ -79,11 +79,12 @@ std::unique_ptr<Process> createTwoPhaseFlowWithPPProcess( auto const& mat_config = config.getConfigSubtree("material_property"); boost::optional<MeshLib::PropertyVector<int> const&> material_ids; - if (mesh.getProperties().existsPropertyVector<int>("MaterialIDs")) + if (mesh.getProperties().existsPropertyVector<int>( + "MaterialIDs", MeshLib::MeshItemType::Cell, 1)) { INFO("The twophase flow is in heterogeneous porous media."); - material_ids = - *mesh.getProperties().getPropertyVector<int>("MaterialIDs"); + material_ids = *mesh.getProperties().getPropertyVector<int>( + "MaterialIDs", MeshLib::MeshItemType::Cell, 1); } else { -- GitLab