From 4ee6d73b82f22513b67d73a53db0cf26fa70a008 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue, 29 Nov 2022 15:30:09 +0100 Subject: [PATCH] Use getBulkIDString() --- .../DataView/DirectConditionGenerator.cpp | 3 ++- .../Utils/MeshEdit/ExtractBoundary.cpp | 7 +++++- .../Utils/MeshEdit/ExtractSurface.cpp | 5 ++-- Applications/Utils/MeshEdit/ReorderMesh.cpp | 23 +++++++++++-------- .../MeshGeoTools/VerticalSliceFromLayers.cpp | 5 +++- .../ComputeNodeAreasFromSurfaceMesh.cpp | 2 +- .../PartitionMesh/NodeWiseMeshPartitioner.cpp | 4 +++- .../PartitionMesh/PartitionMesh.cpp | 10 +++++--- .../ModelPreparation/createNeumannBc.cpp | 3 ++- MeshGeoToolsLib/IdentifySubdomainMesh.cpp | 19 +++++++++------ MeshLib/Mesh.cpp | 8 +++---- MeshLib/MeshEditing/AddLayerToMesh.cpp | 3 ++- MeshLib/MeshQuality/MeshValidation.cpp | 5 +++- NumLib/DOF/MeshComponentMap.cpp | 5 ++-- .../ConstraintDirichletBoundaryCondition.cpp | 6 +++-- .../CreateSourceTerm.cpp | 3 ++- .../DeactivatedSubdomainDirichlet.cpp | 6 +++-- ...letBoundaryConditionAuxiliaryFunctions.cpp | 7 +++--- .../GenericNaturalBoundaryCondition-impl.h | 2 +- ...tiveFreeComponentFlowBoundaryCondition.cpp | 6 +++-- ProcessLib/CreateDeactivatedSubdomain.cpp | 6 +++-- ProcessLib/Output/AddProcessDataToMesh.cpp | 6 +++-- ProcessLib/Output/Output.cpp | 4 ++-- ProcessLib/SurfaceFlux/SurfaceFlux.cpp | 6 +++-- Tests/NumLib/TestMeshComponentMap.cpp | 5 ++-- 25 files changed, 102 insertions(+), 57 deletions(-) diff --git a/Applications/DataExplorer/DataView/DirectConditionGenerator.cpp b/Applications/DataExplorer/DataView/DirectConditionGenerator.cpp index f9c0a49e081..3a490cad0a8 100644 --- a/Applications/DataExplorer/DataView/DirectConditionGenerator.cpp +++ b/Applications/DataExplorer/DataView/DirectConditionGenerator.cpp @@ -86,7 +86,8 @@ DirectConditionGenerator::directWithSurfaceIntegration( Eigen::Vector3d const dir({0.0, 0.0, -1.0}); double const angle(90); - std::string const prop_name("bulk_node_ids"); + std::string const prop_name = + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node); std::unique_ptr<MeshLib::Mesh> surface_mesh( MeshLib::MeshSurfaceExtraction::getMeshSurface(mesh, dir, angle, prop_name)); diff --git a/Applications/Utils/MeshEdit/ExtractBoundary.cpp b/Applications/Utils/MeshEdit/ExtractBoundary.cpp index 8003934868a..d939d51a16d 100644 --- a/Applications/Utils/MeshEdit/ExtractBoundary.cpp +++ b/Applications/Utils/MeshEdit/ExtractBoundary.cpp @@ -81,10 +81,15 @@ int main(int argc, char* argv[]) INFO("Mesh read: {:d} nodes, {:d} elements.", mesh->getNumberOfNodes(), mesh->getNumberOfElements()); + auto const bulk_node_ids_string = + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node); // extract surface std::unique_ptr<MeshLib::Mesh> surface_mesh( MeshLib::BoundaryExtraction::getBoundaryElementsAsMesh( - *mesh, "bulk_node_ids", "bulk_element_ids", "bulk_face_ids")); + *mesh, + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node), + MeshLib::getBulkIDString(MeshLib::MeshItemType::Cell), + MeshLib::getBulkIDString(MeshLib::MeshItemType::Face))); INFO("Created surface mesh: {:d} nodes, {:d} elements.", surface_mesh->getNumberOfNodes(), surface_mesh->getNumberOfElements()); diff --git a/Applications/Utils/MeshEdit/ExtractSurface.cpp b/Applications/Utils/MeshEdit/ExtractSurface.cpp index 21b33dcacab..01e8973e314 100644 --- a/Applications/Utils/MeshEdit/ExtractSurface.cpp +++ b/Applications/Utils/MeshEdit/ExtractSurface.cpp @@ -108,8 +108,9 @@ int main(int argc, char* argv[]) double const angle(angle_arg.getValue()); std::unique_ptr<MeshLib::Mesh> surface_mesh( MeshLib::MeshSurfaceExtraction::getMeshSurface( - *mesh, dir, angle, "bulk_node_ids", "bulk_element_ids", - "bulk_face_ids")); + *mesh, dir, angle, getBulkIDString(MeshLib::MeshItemType::Node), + getBulkIDString(MeshLib::MeshItemType::Cell), + getBulkIDString(MeshLib::MeshItemType::Face))); std::string out_fname(mesh_out.getValue()); if (out_fname.empty()) diff --git a/Applications/Utils/MeshEdit/ReorderMesh.cpp b/Applications/Utils/MeshEdit/ReorderMesh.cpp index a291a37a550..242819365d3 100644 --- a/Applications/Utils/MeshEdit/ReorderMesh.cpp +++ b/Applications/Utils/MeshEdit/ReorderMesh.cpp @@ -142,15 +142,17 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } + auto const bulk_node_ids_string = + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node); if (!mesh->getProperties().existsPropertyVector<std::size_t>( - "bulk_node_ids")) + bulk_node_ids_string)) { - OGS_FATAL( - "Property / data array 'bulk_node_ids' has not been found in the " - "mesh."); + OGS_FATAL("Property / data array '{}' has not been found in the mesh.", + bulk_node_ids_string); } auto const& bulk_node_ids = - *mesh->getProperties().getPropertyVector<std::size_t>("bulk_node_ids"); + *mesh->getProperties().getPropertyVector<std::size_t>( + bulk_node_ids_string); auto const& nodes = mesh->getNodes(); auto const node_ids_reverse_mapping( @@ -165,16 +167,17 @@ int main(int argc, char* argv[]) pos++; } + auto const bulk_element_ids_string = + MeshLib::getBulkIDString(MeshLib::MeshItemType::Cell); if (!mesh->getProperties().existsPropertyVector<std::size_t>( - "bulk_element_ids")) + bulk_element_ids_string)) { - OGS_FATAL( - "Property / data array 'bulk_element_ids' has not been found in " - "the mesh."); + OGS_FATAL("Property / data array '{}' has not been found in the mesh.", + bulk_element_ids_string); } auto const& bulk_element_ids = *mesh->getProperties().getPropertyVector<std::size_t>( - "bulk_element_ids"); + bulk_element_ids_string); std::vector<std::size_t> element_ids_reverse_mapping( generateBulkIDsReverseMapping(bulk_element_ids)); diff --git a/Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp b/Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp index 8b5d5d65276..5b17dbb5b1e 100644 --- a/Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp +++ b/Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp @@ -312,7 +312,10 @@ void extractBoundaries(MeshLib::Mesh const& mesh, double const eps = edge_length.first / 100.0; std::unique_ptr<MeshLib::Mesh> boundary_mesh( MeshLib::BoundaryExtraction::getBoundaryElementsAsMesh( - mesh, "bulk_node_ids", "bulk_element_ids", "bulk_face_ids")); + mesh, + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node), + MeshLib::getBulkIDString(MeshLib::MeshItemType::Cell), + MeshLib::getBulkIDString(MeshLib::MeshItemType::Face))); auto const& elems = boundary_mesh->getElements(); std::vector<std::size_t> left_bound_idx, right_bound_idx, top_bound_idx, diff --git a/Applications/Utils/ModelPreparation/ComputeNodeAreasFromSurfaceMesh.cpp b/Applications/Utils/ModelPreparation/ComputeNodeAreasFromSurfaceMesh.cpp index 0ea84232de1..fe5f14e1c93 100644 --- a/Applications/Utils/ModelPreparation/ComputeNodeAreasFromSurfaceMesh.cpp +++ b/Applications/Utils/ModelPreparation/ComputeNodeAreasFromSurfaceMesh.cpp @@ -79,7 +79,7 @@ int main(int argc, char* argv[]) TCLAP::ValueArg<std::string> id_prop_name( "", "id-prop-name", "the name of the property containing the id information", false, - "bulk_node_ids", "property name"); + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node), "property name"); cmd.add(id_prop_name); TCLAP::ValueArg<std::string> out_base_fname( "p", "output-base-name", diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp index e5735244d5f..faac0d75f30 100644 --- a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp +++ b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp @@ -807,9 +807,11 @@ void NodeWiseMeshPartitioner::renumberBulkElementIdsProperty( std::vector<Partition> NodeWiseMeshPartitioner::partitionOtherMesh( MeshLib::Mesh const& mesh) const { + auto const bulk_node_ids_string = + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node); auto const& bulk_node_ids = mesh.getProperties().getPropertyVector<std::size_t>( - "bulk_node_ids", MeshLib::MeshItemType::Node, 1); + bulk_node_ids_string, MeshLib::MeshItemType::Node, 1); std::vector<Partition> partitions(_partitions.size()); for (std::size_t part_id = 0; part_id < _partitions.size(); part_id++) diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/PartitionMesh.cpp b/Applications/Utils/ModelPreparation/PartitionMesh/PartitionMesh.cpp index b85114e1945..126e356c215 100644 --- a/Applications/Utils/ModelPreparation/PartitionMesh/PartitionMesh.cpp +++ b/Applications/Utils/ModelPreparation/PartitionMesh/PartitionMesh.cpp @@ -224,15 +224,19 @@ int main(int argc, char* argv[]) auto partitions = mesh_partitioner.partitionOtherMesh(*mesh); auto partitioned_properties = partitionProperties(mesh, partitions); + auto const bulk_node_ids_string = + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node); mesh_partitioner.renumberBulkNodeIdsProperty( partitioned_properties.getPropertyVector<std::size_t>( - "bulk_node_ids", MeshLib::MeshItemType::Node, 1), + bulk_node_ids_string, MeshLib::MeshItemType::Node, 1), partitions); - if (partitioned_properties.hasPropertyVector("bulk_element_ids")) + auto const bulk_element_ids_string = + MeshLib::getBulkIDString(MeshLib::MeshItemType::Cell); + if (partitioned_properties.hasPropertyVector(bulk_element_ids_string)) { mesh_partitioner.renumberBulkElementIdsProperty( partitioned_properties.getPropertyVector<std::size_t>( - "bulk_element_ids", MeshLib::MeshItemType::Cell, 1), + bulk_element_ids_string, MeshLib::MeshItemType::Cell, 1), partitions); } mesh_partitioner.writeOtherMesh( diff --git a/Applications/Utils/ModelPreparation/createNeumannBc.cpp b/Applications/Utils/ModelPreparation/createNeumannBc.cpp index 6050bacf494..c51f56c15d1 100644 --- a/Applications/Utils/ModelPreparation/createNeumannBc.cpp +++ b/Applications/Utils/ModelPreparation/createNeumannBc.cpp @@ -143,7 +143,8 @@ int main(int argc, char* argv[]) try { return surface_mesh->getProperties().getPropertyVector<std::size_t>( - "bulk_node_ids", MeshLib::MeshItemType::Node, 1); + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node), + MeshLib::MeshItemType::Node, 1); } catch (std::runtime_error const& e) { diff --git a/MeshGeoToolsLib/IdentifySubdomainMesh.cpp b/MeshGeoToolsLib/IdentifySubdomainMesh.cpp index 3431449ce08..e1b4948261b 100644 --- a/MeshGeoToolsLib/IdentifySubdomainMesh.cpp +++ b/MeshGeoToolsLib/IdentifySubdomainMesh.cpp @@ -100,7 +100,8 @@ std::vector<std::vector<std::size_t>> identifySubdomainMeshElements( { auto& properties = subdomain_mesh.getProperties(); auto const& bulk_node_ids = *properties.getPropertyVector<std::size_t>( - "bulk_node_ids", MeshLib::MeshItemType::Node, 1); + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node), + MeshLib::MeshItemType::Node, 1); // Allocate space for all elements for random insertion. std::vector<std::vector<std::size_t>> bulk_element_ids_map( @@ -200,8 +201,8 @@ void identifySubdomainMesh(MeshLib::Mesh& subdomain_mesh, identifySubdomainMeshNodes(subdomain_mesh, mesh_node_searcher); updateOrCheckExistingSubdomainProperty( - subdomain_mesh, "bulk_node_ids", bulk_node_ids, - MeshLib::MeshItemType::Node, force_overwrite); + subdomain_mesh, MeshLib::getBulkIDString(MeshLib::MeshItemType::Node), + bulk_node_ids, MeshLib::MeshItemType::Node, force_overwrite); auto const& bulk_element_ids = identifySubdomainMeshElements(subdomain_mesh, bulk_mesh); @@ -223,8 +224,10 @@ void identifySubdomainMesh(MeshLib::Mesh& subdomain_mesh, [](std::vector<std::size_t> const& v) { return v[0]; }); updateOrCheckExistingSubdomainProperty( - subdomain_mesh, "bulk_element_ids", unique_bulk_element_ids, - MeshLib::MeshItemType::Cell, force_overwrite); + subdomain_mesh, + MeshLib::getBulkIDString(MeshLib::MeshItemType::Cell), + unique_bulk_element_ids, MeshLib::MeshItemType::Cell, + force_overwrite); } else { @@ -247,8 +250,10 @@ void identifySubdomainMesh(MeshLib::Mesh& subdomain_mesh, subdomain_mesh, "number_bulk_elements", number_of_bulk_element_ids, MeshLib::MeshItemType::Cell, force_overwrite); updateOrCheckExistingSubdomainProperty( - subdomain_mesh, "bulk_element_ids", flat_bulk_element_ids, - MeshLib::MeshItemType::IntegrationPoint, force_overwrite); + subdomain_mesh, + MeshLib::getBulkIDString(MeshLib::MeshItemType::Cell), + flat_bulk_element_ids, MeshLib::MeshItemType::IntegrationPoint, + force_overwrite); } } } // namespace MeshGeoToolsLib diff --git a/MeshLib/Mesh.cpp b/MeshLib/Mesh.cpp index 06b317b5df5..ded58063da9 100644 --- a/MeshLib/Mesh.cpp +++ b/MeshLib/Mesh.cpp @@ -329,10 +329,10 @@ std::unique_ptr<MeshLib::Mesh> createMeshFromElementSelection( std::move(mesh_name), std::move(element_nodes), std::move(elements)); assert(mesh != nullptr); - addPropertyToMesh(*mesh, "bulk_element_ids", MeshLib::MeshItemType::Cell, 1, - bulk_element_ids); - addPropertyToMesh(*mesh, "bulk_node_ids", MeshLib::MeshItemType::Node, 1, - bulk_node_ids); + addPropertyToMesh(*mesh, getBulkIDString(MeshLib::MeshItemType::Cell), + MeshLib::MeshItemType::Cell, 1, bulk_element_ids); + addPropertyToMesh(*mesh, getBulkIDString(MeshLib::MeshItemType::Node), + MeshLib::MeshItemType::Node, 1, bulk_node_ids); return mesh; } diff --git a/MeshLib/MeshEditing/AddLayerToMesh.cpp b/MeshLib/MeshEditing/AddLayerToMesh.cpp index 207b9e05d48..b789b998e5c 100644 --- a/MeshLib/MeshEditing/AddLayerToMesh.cpp +++ b/MeshLib/MeshEditing/AddLayerToMesh.cpp @@ -91,7 +91,8 @@ MeshLib::Mesh* addLayerToMesh(MeshLib::Mesh const& mesh, double thickness, double const angle(90); std::unique_ptr<MeshLib::Mesh> sfc_mesh(nullptr); - std::string const prop_name("bulk_node_ids"); + std::string const prop_name = + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node); if (mesh.getDimension() == 3) { diff --git a/MeshLib/MeshQuality/MeshValidation.cpp b/MeshLib/MeshQuality/MeshValidation.cpp index e20cbad9d2e..d778a32e0a5 100644 --- a/MeshLib/MeshQuality/MeshValidation.cpp +++ b/MeshLib/MeshQuality/MeshValidation.cpp @@ -212,7 +212,10 @@ unsigned MeshValidation::detectHoles(MeshLib::Mesh const& mesh) } auto boundary_mesh = MeshLib::BoundaryExtraction::getBoundaryElementsAsMesh( - mesh, "bulk_node_ids", "bulk_element_ids", "bulk_face_ids"); + mesh, + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node), + MeshLib::getBulkIDString(MeshLib::MeshItemType::Cell), + MeshLib::getBulkIDString(MeshLib::MeshItemType::Face)); std::vector<MeshLib::Element*> const& elements( boundary_mesh->getElements()); diff --git a/NumLib/DOF/MeshComponentMap.cpp b/NumLib/DOF/MeshComponentMap.cpp index df12e28dd54..e94ff311312 100644 --- a/NumLib/DOF/MeshComponentMap.cpp +++ b/NumLib/DOF/MeshComponentMap.cpp @@ -78,7 +78,7 @@ MeshComponentMap MeshComponentMap::getSubset( // Mapping of the nodes in the new_mesh_subset to the bulk mesh nodes auto const& new_mesh_properties = new_mesh_subset.getMesh().getProperties(); if (!new_mesh_properties.template existsPropertyVector<std::size_t>( - "bulk_node_ids")) + getBulkIDString(MeshLib::MeshItemType::Node))) { OGS_FATAL( "Bulk node ids map expected in the construction of the mesh " @@ -86,7 +86,8 @@ MeshComponentMap MeshComponentMap::getSubset( } auto const& bulk_node_ids_map = *new_mesh_properties.template getPropertyVector<std::size_t>( - "bulk_node_ids", MeshLib::MeshItemType::Node, 1); + getBulkIDString(MeshLib::MeshItemType::Node), + MeshLib::MeshItemType::Node, 1); // New dictionary for the subset. ComponentGlobalIndexDict subset_dict; diff --git a/ProcessLib/BoundaryConditionAndSourceTerm/ConstraintDirichletBoundaryCondition.cpp b/ProcessLib/BoundaryConditionAndSourceTerm/ConstraintDirichletBoundaryCondition.cpp index df463487d78..5a94a91ba6b 100644 --- a/ProcessLib/BoundaryConditionAndSourceTerm/ConstraintDirichletBoundaryCondition.cpp +++ b/ProcessLib/BoundaryConditionAndSourceTerm/ConstraintDirichletBoundaryCondition.cpp @@ -72,10 +72,12 @@ ConstraintDirichletBoundaryCondition::ConstraintDirichletBoundaryCondition( // create _bulk_ids vector auto const* bulk_element_ids = _bc_mesh.getProperties().getPropertyVector<std::size_t>( - "bulk_element_ids", MeshLib::MeshItemType::Cell, 1); + MeshLib::getBulkIDString(MeshLib::MeshItemType::Cell), + MeshLib::MeshItemType::Cell, 1); auto const* bulk_node_ids = _bc_mesh.getProperties().getPropertyVector<std::size_t>( - "bulk_node_ids", MeshLib::MeshItemType::Node, 1); + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node), + MeshLib::MeshItemType::Node, 1); auto const& bulk_nodes = bulk_mesh.getNodes(); auto get_bulk_element_face_id = diff --git a/ProcessLib/BoundaryConditionAndSourceTerm/CreateSourceTerm.cpp b/ProcessLib/BoundaryConditionAndSourceTerm/CreateSourceTerm.cpp index 5f2d0863248..c7565d0c3ba 100644 --- a/ProcessLib/BoundaryConditionAndSourceTerm/CreateSourceTerm.cpp +++ b/ProcessLib/BoundaryConditionAndSourceTerm/CreateSourceTerm.cpp @@ -47,7 +47,8 @@ std::unique_ptr<SourceTerm> createSourceTerm( } if (!source_term_mesh.getProperties() - .template existsPropertyVector<std::size_t>("bulk_node_ids")) + .template existsPropertyVector<std::size_t>( + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node))) { OGS_FATAL( "The required bulk node ids map does not exist in the source term " diff --git a/ProcessLib/BoundaryConditionAndSourceTerm/DeactivatedSubdomainDirichlet.cpp b/ProcessLib/BoundaryConditionAndSourceTerm/DeactivatedSubdomainDirichlet.cpp index c92b1f43b62..7fa39ce62c0 100644 --- a/ProcessLib/BoundaryConditionAndSourceTerm/DeactivatedSubdomainDirichlet.cpp +++ b/ProcessLib/BoundaryConditionAndSourceTerm/DeactivatedSubdomainDirichlet.cpp @@ -58,11 +58,13 @@ void DeactivatedSubdomainDirichlet::getEssentialBCValues( [[maybe_unused]] auto const& bulk_node_ids = *_subdomain.mesh.getProperties() .template getPropertyVector<std::size_t>( - "bulk_node_ids", MeshLib::MeshItemType::Node, 1); + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node), + MeshLib::MeshItemType::Node, 1); [[maybe_unused]] auto const& bulk_element_ids = *_subdomain.mesh.getProperties() .template getPropertyVector<std::size_t>( - "bulk_element_ids", MeshLib::MeshItemType::Cell, 1); + MeshLib::getBulkIDString(MeshLib::MeshItemType::Cell), + MeshLib::MeshItemType::Cell, 1); auto is_inactive_id = [&](std::size_t const bulk_element_id) { return _is_active[bulk_element_id] == 0; }; diff --git a/ProcessLib/BoundaryConditionAndSourceTerm/DirichletBoundaryConditionAuxiliaryFunctions.cpp b/ProcessLib/BoundaryConditionAndSourceTerm/DirichletBoundaryConditionAuxiliaryFunctions.cpp index 53784cc981e..8eb09d49e79 100644 --- a/ProcessLib/BoundaryConditionAndSourceTerm/DirichletBoundaryConditionAuxiliaryFunctions.cpp +++ b/ProcessLib/BoundaryConditionAndSourceTerm/DirichletBoundaryConditionAuxiliaryFunctions.cpp @@ -40,7 +40,8 @@ void checkParametersOfDirichletBoundaryCondition( dof_table_bulk.getNumberOfVariableComponents(variable_id)); } - if (!bc_mesh.getProperties().hasPropertyVector("bulk_node_ids")) + if (!bc_mesh.getProperties().hasPropertyVector( + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node))) { OGS_FATAL( "The required bulk node ids map does not exist in the boundary " @@ -49,10 +50,10 @@ void checkParametersOfDirichletBoundaryCondition( } if (!bc_mesh.getProperties().existsPropertyVector<std::size_t>( - "bulk_node_ids")) + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node))) { OGS_FATAL( - "The required bulk node ids map exist in the boundary mesh '{:s}' " + "The required bulk node ids map exists in the boundary mesh '{:s}' " "but has wrong data type (should be equivalent to C++ data type " "std::size_t which is an unsigned integer of size {:d} or UInt64 " "in vtk terminology).", diff --git a/ProcessLib/BoundaryConditionAndSourceTerm/GenericNaturalBoundaryCondition-impl.h b/ProcessLib/BoundaryConditionAndSourceTerm/GenericNaturalBoundaryCondition-impl.h index 64e6358c0d8..b8e8707b06a 100644 --- a/ProcessLib/BoundaryConditionAndSourceTerm/GenericNaturalBoundaryCondition-impl.h +++ b/ProcessLib/BoundaryConditionAndSourceTerm/GenericNaturalBoundaryCondition-impl.h @@ -45,7 +45,7 @@ GenericNaturalBoundaryCondition<BoundaryConditionData, } if (!_bc_mesh.getProperties().template existsPropertyVector<std::size_t>( - "bulk_node_ids")) + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node))) { OGS_FATAL( "The required bulk node ids map does not exist in the boundary " diff --git a/ProcessLib/BoundaryConditionAndSourceTerm/HCNonAdvectiveFreeComponentFlowBoundaryCondition.cpp b/ProcessLib/BoundaryConditionAndSourceTerm/HCNonAdvectiveFreeComponentFlowBoundaryCondition.cpp index 32826bb31a3..2a18c7d1de6 100644 --- a/ProcessLib/BoundaryConditionAndSourceTerm/HCNonAdvectiveFreeComponentFlowBoundaryCondition.cpp +++ b/ProcessLib/BoundaryConditionAndSourceTerm/HCNonAdvectiveFreeComponentFlowBoundaryCondition.cpp @@ -53,10 +53,12 @@ createHCNonAdvectiveFreeComponentFlowBoundaryCondition( } auto const bulk_element_ids = bc_mesh.getProperties().template getPropertyVector<std::size_t>( - "bulk_element_ids", MeshLib::MeshItemType::Cell, 1); + MeshLib::getBulkIDString(MeshLib::MeshItemType::Cell), + MeshLib::MeshItemType::Cell, 1); auto const bulk_face_ids = bc_mesh.getProperties().template getPropertyVector<std::size_t>( - "bulk_face_ids", MeshLib::MeshItemType::Cell, 1); + MeshLib::getBulkIDString(MeshLib::MeshItemType::Face), + MeshLib::MeshItemType::Cell, 1); // In case of partitioned mesh the boundary could be empty, i.e. there is no // boundary condition. diff --git a/ProcessLib/CreateDeactivatedSubdomain.cpp b/ProcessLib/CreateDeactivatedSubdomain.cpp index 6684e1e7dd0..b64a3f3107f 100644 --- a/ProcessLib/CreateDeactivatedSubdomain.cpp +++ b/ProcessLib/CreateDeactivatedSubdomain.cpp @@ -34,7 +34,8 @@ extractInnerAndOuterNodes(MeshLib::Mesh const& mesh, { auto* const bulk_node_ids = sub_mesh.getProperties().template getPropertyVector<std::size_t>( - "bulk_node_ids", MeshLib::MeshItemType::Node, 1); + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node), + MeshLib::MeshItemType::Node, 1); if (bulk_node_ids == nullptr) { OGS_FATAL( @@ -73,7 +74,8 @@ static std::vector<std::vector<std::size_t>> extractElementsAlongOuterNodes( { auto const& bulk_node_ids = *sub_mesh.getProperties().template getPropertyVector<std::size_t>( - "bulk_node_ids", MeshLib::MeshItemType::Node, 1); + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node), + MeshLib::MeshItemType::Node, 1); auto to_bulk_node_id = ranges::views::transform([&bulk_node_ids](std::size_t const node_id) diff --git a/ProcessLib/Output/AddProcessDataToMesh.cpp b/ProcessLib/Output/AddProcessDataToMesh.cpp index e93d723f956..b70a16e0d6d 100644 --- a/ProcessLib/Output/AddProcessDataToMesh.cpp +++ b/ProcessLib/Output/AddProcessDataToMesh.cpp @@ -144,8 +144,10 @@ MeshLib::PropertyVector<std::size_t> const* getBulkNodeIdMapForPetscIfNecessary( if (&bulk_mesh_dof_table != &dof_table) { + auto const bulk_id_string = + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node); if (!mesh.getProperties().existsPropertyVector<std::size_t>( - "bulk_node_ids")) + bulk_id_string)) { OGS_FATAL( "The required bulk node ids map does not exist in " @@ -156,7 +158,7 @@ MeshLib::PropertyVector<std::size_t> const* getBulkNodeIdMapForPetscIfNecessary( mesh.getName(), sizeof(std::size_t)); } return mesh.getProperties().getPropertyVector<std::size_t>( - "bulk_node_ids"); + bulk_id_string); } #endif diff --git a/ProcessLib/Output/Output.cpp b/ProcessLib/Output/Output.cpp index 9e54b3bcb01..e3b35c20d59 100644 --- a/ProcessLib/Output/Output.cpp +++ b/ProcessLib/Output/Output.cpp @@ -47,10 +47,10 @@ void addBulkMeshPropertyToSubMesh(MeshLib::Mesh const& bulk_mesh, switch (mesh_item_type) { case MeshLib::MeshItemType::Node: - return "bulk_node_ids"; + return MeshLib::getBulkIDString(MeshLib::MeshItemType::Node); break; case MeshLib::MeshItemType::Cell: - return "bulk_element_ids"; + return MeshLib::getBulkIDString(MeshLib::MeshItemType::Cell); break; case MeshLib::MeshItemType::Edge: WARN( diff --git a/ProcessLib/SurfaceFlux/SurfaceFlux.cpp b/ProcessLib/SurfaceFlux/SurfaceFlux.cpp index 6e9bd39533e..da6cd312a11 100644 --- a/ProcessLib/SurfaceFlux/SurfaceFlux.cpp +++ b/ProcessLib/SurfaceFlux/SurfaceFlux.cpp @@ -40,10 +40,12 @@ SurfaceFlux::SurfaceFlux(MeshLib::Mesh& boundary_mesh, auto const bulk_element_ids = boundary_mesh.getProperties().template getPropertyVector<std::size_t>( - "bulk_element_ids", MeshLib::MeshItemType::Cell, 1); + MeshLib::getBulkIDString(MeshLib::MeshItemType::Cell), + MeshLib::MeshItemType::Cell, 1); auto const bulk_face_ids = boundary_mesh.getProperties().template getPropertyVector<std::size_t>( - "bulk_face_ids", MeshLib::MeshItemType::Cell, 1); + MeshLib::getBulkIDString(MeshLib::MeshItemType::Face), + MeshLib::MeshItemType::Cell, 1); ProcessLib::createLocalAssemblers<SurfaceFluxLocalAssembler>( boundary_mesh.getDimension() + 1, // or bulk_mesh.getDimension()? diff --git a/Tests/NumLib/TestMeshComponentMap.cpp b/Tests/NumLib/TestMeshComponentMap.cpp index e62ec6c38ab..2f550c172d3 100644 --- a/Tests/NumLib/TestMeshComponentMap.cpp +++ b/Tests/NumLib/TestMeshComponentMap.cpp @@ -158,8 +158,9 @@ MeshLib::Mesh createMeshFromSelectedNodes( // The resulting mesh without elements containing the selected nodes. MeshLib::Mesh result("boundary_mesh", some_nodes, {}); - addPropertyToMesh(result, "bulk_node_ids", MeshLib::MeshItemType::Node, 1, - selected_nodes); + addPropertyToMesh(result, + MeshLib::getBulkIDString(MeshLib::MeshItemType::Node), + MeshLib::MeshItemType::Node, 1, selected_nodes); return result; } -- GitLab