From 0c56ed89bccd63a5994596902c0d239ab70d5570 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Fri, 29 Dec 2023 14:58:32 +0100 Subject: [PATCH] Pass flag for computing element neighbors --- Applications/FileIO/GMSInterface.cpp | 3 ++- Applications/FileIO/Gmsh/GmshReader.cpp | 3 ++- .../FileIO/GocadIO/GocadAsciiReader.cpp | 4 +++- .../FileIO/GocadIO/GocadSGridReader.cpp | 8 ++++--- Applications/FileIO/TetGenInterface.cpp | 3 ++- .../Utils/MeshEdit/PVTU2VTU/PVTU2VTU.cpp | 3 ++- Applications/Utils/MeshEdit/ReorderMesh.cpp | 1 + .../IntegrateBoreholesIntoMesh.cpp | 3 ++- MeshGeoToolsLib/AppendLinesAlongPolyline.cpp | 3 ++- MeshLib/IO/Legacy/MeshIO.cpp | 2 +- MeshLib/IO/VtkIO/VtkMeshConverter.cpp | 3 ++- MeshLib/NodePartitionedMesh.cpp | 3 ++- .../Utils/createMeshFromElementSelection.cpp | 3 ++- MeshToolsLib/MeshEditing/AddLayerToMesh.cpp | 3 ++- .../MeshEditing/ConvertToLinearMesh.cpp | 1 + MeshToolsLib/MeshEditing/FlipElements.cpp | 5 +++-- MeshToolsLib/MeshEditing/MeshRevision.cpp | 1 + .../MeshEditing/RemoveMeshComponents.cpp | 2 ++ .../MeshGenerators/LayeredMeshGenerator.cpp | 6 +++++- MeshToolsLib/MeshGenerators/MeshGenerator.cpp | 21 ++++++++++++------- .../MeshGenerators/MeshLayerMapper.cpp | 3 ++- .../MeshGenerators/QuadraticMeshGenerator.cpp | 1 + MeshToolsLib/MeshSurfaceExtraction.cpp | 10 +++++---- MeshToolsLib/convertMeshToGeo.cpp | 3 ++- .../TestIs2DMeshOnRotatedVerticalPlane.cpp | 8 +++---- Tests/MeshLib/TestMeshValidation.cpp | 3 ++- Tests/MeshLib/TestTriLineMesh.cpp | 3 ++- 27 files changed, 75 insertions(+), 37 deletions(-) diff --git a/Applications/FileIO/GMSInterface.cpp b/Applications/FileIO/GMSInterface.cpp index 107b6026147..994ef3d96f7 100644 --- a/Applications/FileIO/GMSInterface.cpp +++ b/Applications/FileIO/GMSInterface.cpp @@ -339,7 +339,8 @@ MeshLib::Mesh* GMSInterface::readMesh(const std::string& filename) ERR("Ignoring Material IDs information (does not match number of " "elements)."); } - return new MeshLib::Mesh(mesh_name, nodes, elements, properties); + return new MeshLib::Mesh(mesh_name, nodes, elements, + true /* compute_element_neighbors */, properties); } } // namespace FileIO diff --git a/Applications/FileIO/Gmsh/GmshReader.cpp b/Applications/FileIO/Gmsh/GmshReader.cpp index ff170768138..c7b19ad51ea 100644 --- a/Applications/FileIO/Gmsh/GmshReader.cpp +++ b/Applications/FileIO/Gmsh/GmshReader.cpp @@ -373,7 +373,8 @@ MeshLib::Mesh* readGMSHMesh(std::string const& fname) } MeshLib::Mesh* mesh(new MeshLib::Mesh( - BaseLib::extractBaseNameWithoutExtension(fname), nodes, elements)); + BaseLib::extractBaseNameWithoutExtension(fname), nodes, elements, + true /* compute_element_neighbors */)); auto* const material_ids = mesh->getProperties().createNewPropertyVector<int>( diff --git a/Applications/FileIO/GocadIO/GocadAsciiReader.cpp b/Applications/FileIO/GocadIO/GocadAsciiReader.cpp index 74224ea7ee7..0abfbf366df 100644 --- a/Applications/FileIO/GocadIO/GocadAsciiReader.cpp +++ b/Applications/FileIO/GocadIO/GocadAsciiReader.cpp @@ -569,7 +569,9 @@ MeshLib::Mesh* createMesh(std::ifstream& in, DataType type, std::for_each(nodes.begin(), nodes.end(), [](MeshLib::Node* n) { (*n)[2] *= -1; }); } - return new MeshLib::Mesh(mesh_name, nodes, elems, mesh_prop); + return new MeshLib::Mesh(mesh_name, nodes, elems, + true /* compute_element_neighbors */, + mesh_prop); } ERR("Error parsing {:s} {:s}.", dataType2ShortString(type), mesh_name); BaseLib::cleanupVectorElements(nodes, elems); diff --git a/Applications/FileIO/GocadIO/GocadSGridReader.cpp b/Applications/FileIO/GocadIO/GocadSGridReader.cpp index 37ae2259b85..6c43372f071 100644 --- a/Applications/FileIO/GocadIO/GocadSGridReader.cpp +++ b/Applications/FileIO/GocadIO/GocadSGridReader.cpp @@ -186,7 +186,8 @@ std::unique_ptr<MeshLib::Mesh> GocadSGridReader::getMesh() const DBUG("Creating mesh from Gocad SGrid."); std::unique_ptr<MeshLib::Mesh> mesh(new MeshLib::Mesh( - BaseLib::extractBaseNameWithoutExtension(_fname), nodes, elements)); + BaseLib::extractBaseNameWithoutExtension(_fname), nodes, elements, + true /* compute_element_neighbors */)); addGocadPropertiesToMesh(*mesh); DBUG("Mesh created."); @@ -785,8 +786,9 @@ std::unique_ptr<MeshLib::Mesh> GocadSGridReader::getFaceSetMesh( } std::string const mesh_name("FaceSet-" + std::to_string(face_set_number)); - return std::make_unique<MeshLib::Mesh>(mesh_name, face_set_nodes, - face_set_elements); + return std::make_unique<MeshLib::Mesh>( + mesh_name, face_set_nodes, face_set_elements, + true /* compute_element_neighbors */); } void GocadSGridReader::addFaceSetQuad( diff --git a/Applications/FileIO/TetGenInterface.cpp b/Applications/FileIO/TetGenInterface.cpp index f7e423563bd..ea9b7c7f419 100644 --- a/Applications/FileIO/TetGenInterface.cpp +++ b/Applications/FileIO/TetGenInterface.cpp @@ -269,7 +269,8 @@ MeshLib::Mesh* TetGenInterface::readTetGenMesh(std::string const& nodes_fname, const std::string mesh_name( BaseLib::extractBaseNameWithoutExtension(nodes_fname)); - return new MeshLib::Mesh(mesh_name, nodes, elements, properties); + return new MeshLib::Mesh(mesh_name, nodes, elements, + true /* compute_element_neighbors */, properties); } bool TetGenInterface::readNodesFromStream(std::ifstream& ins, diff --git a/Applications/Utils/MeshEdit/PVTU2VTU/PVTU2VTU.cpp b/Applications/Utils/MeshEdit/PVTU2VTU/PVTU2VTU.cpp index 1c78d061a34..19e801c02da 100644 --- a/Applications/Utils/MeshEdit/PVTU2VTU/PVTU2VTU.cpp +++ b/Applications/Utils/MeshEdit/PVTU2VTU/PVTU2VTU.cpp @@ -372,7 +372,8 @@ int main(int argc, char* argv[]) // The Node pointers of 'merged_nodes' and Element pointers of // 'regular_elements' are shared with 'meshes', the partitioned meshes. MeshLib::Mesh merged_mesh = - MeshLib::Mesh("pvtu_merged_mesh", merged_nodes, regular_elements); + MeshLib::Mesh("pvtu_merged_mesh", merged_nodes, regular_elements, + true /* compute_element_neighbors */); auto const& properties = meshes[0]->getProperties(); diff --git a/Applications/Utils/MeshEdit/ReorderMesh.cpp b/Applications/Utils/MeshEdit/ReorderMesh.cpp index 871f7db3e3b..220571ce22a 100644 --- a/Applications/Utils/MeshEdit/ReorderMesh.cpp +++ b/Applications/Utils/MeshEdit/ReorderMesh.cpp @@ -207,6 +207,7 @@ int main(int argc, char* argv[]) // is implemented are copied MeshLib::Mesh reordered_mesh{ "reordered_mesh", reordered_nodes, reordered_elements, + false /* compute_element_neighbors */, original_properties.excludeCopyProperties(exclude_property_vectors)}; auto& properties = reordered_mesh.getProperties(); diff --git a/Applications/Utils/MeshGeoTools/IntegrateBoreholesIntoMesh.cpp b/Applications/Utils/MeshGeoTools/IntegrateBoreholesIntoMesh.cpp index 440b29a617a..6f0f5b701cd 100644 --- a/Applications/Utils/MeshGeoTools/IntegrateBoreholesIntoMesh.cpp +++ b/Applications/Utils/MeshGeoTools/IntegrateBoreholesIntoMesh.cpp @@ -252,7 +252,8 @@ int main(int argc, char* argv[]) } } - MeshLib::Mesh const result("result", new_nodes, new_elems, props); + MeshLib::Mesh const result("result", new_nodes, new_elems, + true /* compute_element_neighbors */, props); MeshLib::IO::VtuInterface vtu(&result); vtu.writeToFile(output_name); #ifdef USE_PETSC diff --git a/MeshGeoToolsLib/AppendLinesAlongPolyline.cpp b/MeshGeoToolsLib/AppendLinesAlongPolyline.cpp index 6bcbf4a6920..5c834ac4ba6 100644 --- a/MeshGeoToolsLib/AppendLinesAlongPolyline.cpp +++ b/MeshGeoToolsLib/AppendLinesAlongPolyline.cpp @@ -74,7 +74,8 @@ std::unique_ptr<MeshLib::Mesh> appendLinesAlongPolylines( // generate a mesh const std::string name = mesh.getName() + "_with_lines"; auto new_mesh = - std::make_unique<MeshLib::Mesh>(name, vec_new_nodes, vec_new_eles); + std::make_unique<MeshLib::Mesh>(name, vec_new_nodes, vec_new_eles, + true /* compute_element_neighbors */); auto new_material_ids = new_mesh->getProperties().createNewPropertyVector<int>( "MaterialIDs", MeshLib::MeshItemType::Cell); diff --git a/MeshLib/IO/Legacy/MeshIO.cpp b/MeshLib/IO/Legacy/MeshIO.cpp index 6c845f031d2..faf2e8b7f3d 100644 --- a/MeshLib/IO/Legacy/MeshIO.cpp +++ b/MeshLib/IO/Legacy/MeshIO.cpp @@ -367,7 +367,7 @@ MeshLib::Mesh* MeshIO::loadMeshFromFile(const std::string& file_name) MeshLib::Mesh* mesh(new MeshLib::Mesh( BaseLib::extractBaseNameWithoutExtension(file_name), nodes, - elements)); + elements, true /* compute_element_neighbors */)); auto* const material_ids = mesh->getProperties().createNewPropertyVector<int>( diff --git a/MeshLib/IO/VtkIO/VtkMeshConverter.cpp b/MeshLib/IO/VtkIO/VtkMeshConverter.cpp index 85217e0c71e..00a05a7d952 100644 --- a/MeshLib/IO/VtkIO/VtkMeshConverter.cpp +++ b/MeshLib/IO/VtkIO/VtkMeshConverter.cpp @@ -229,7 +229,8 @@ MeshLib::Mesh* VtkMeshConverter::convertUnstructuredGrid( elements[i] = elem; } - MeshLib::Mesh* mesh = new MeshLib::Mesh(mesh_name, nodes, elements); + MeshLib::Mesh* mesh = new MeshLib::Mesh( + mesh_name, nodes, elements, true /* compute_element_neighbors */); convertScalarArrays(*grid, *mesh); return mesh; diff --git a/MeshLib/NodePartitionedMesh.cpp b/MeshLib/NodePartitionedMesh.cpp index c76341caf83..faecde4abca 100644 --- a/MeshLib/NodePartitionedMesh.cpp +++ b/MeshLib/NodePartitionedMesh.cpp @@ -41,7 +41,8 @@ NodePartitionedMesh::NodePartitionedMesh( const std::size_t n_regular_nodes, std::vector<std::size_t>&& n_regular_base_nodes_at_rank, std::vector<std::size_t>&& n_regular_high_order_nodes_at_rank) - : Mesh(name, nodes, elements, properties), + : Mesh(name, nodes, elements, true /* compute_element_neighbors */, + properties), _global_node_ids(glb_node_ids), _n_global_base_nodes(n_global_base_nodes), _n_global_nodes(n_global_nodes), diff --git a/MeshLib/Utils/createMeshFromElementSelection.cpp b/MeshLib/Utils/createMeshFromElementSelection.cpp index 635b377c539..8b1f453374c 100644 --- a/MeshLib/Utils/createMeshFromElementSelection.cpp +++ b/MeshLib/Utils/createMeshFromElementSelection.cpp @@ -76,7 +76,8 @@ std::unique_ptr<MeshLib::Mesh> createMeshFromElementSelection( nodes_map | ranges::views::keys | ranges::to<std::vector>; auto mesh = std::make_unique<MeshLib::Mesh>( - std::move(mesh_name), std::move(element_nodes), std::move(elements)); + std::move(mesh_name), std::move(element_nodes), std::move(elements), + true /* compute_element_neighbors */); assert(mesh != nullptr); addPropertyToMesh(*mesh, getBulkIDString(MeshLib::MeshItemType::Cell), diff --git a/MeshToolsLib/MeshEditing/AddLayerToMesh.cpp b/MeshToolsLib/MeshEditing/AddLayerToMesh.cpp index f4db3bcf22e..4c661e58b9f 100644 --- a/MeshToolsLib/MeshEditing/AddLayerToMesh.cpp +++ b/MeshToolsLib/MeshEditing/AddLayerToMesh.cpp @@ -164,7 +164,8 @@ MeshLib::Mesh* addLayerToMesh(MeshLib::Mesh const& mesh, double thickness, subsfc_nodes, *sfc_elements[k], *node_id_pv, subsfc_sfc_id_map)); } - auto new_mesh = new MeshLib::Mesh(name, subsfc_nodes, subsfc_elements); + auto new_mesh = new MeshLib::Mesh(name, subsfc_nodes, subsfc_elements, + true /* compute_element_neighbors */); if (!mesh.getProperties().existsPropertyVector<int>("MaterialIDs")) { diff --git a/MeshToolsLib/MeshEditing/ConvertToLinearMesh.cpp b/MeshToolsLib/MeshEditing/ConvertToLinearMesh.cpp index 716416114b9..e56c59cf42c 100644 --- a/MeshToolsLib/MeshEditing/ConvertToLinearMesh.cpp +++ b/MeshToolsLib/MeshEditing/ConvertToLinearMesh.cpp @@ -115,6 +115,7 @@ std::unique_ptr<MeshLib::Mesh> convertToLinearMesh( auto new_mesh = std::make_unique<MeshLib::Mesh>( new_mesh_name, new_mesh_nodes, vec_new_eles, + true /* compute_element_neighbors */, mesh.getProperties().excludeCopyProperties( std::vector<MeshLib::MeshItemType>(1, MeshLib::MeshItemType::Node))); diff --git a/MeshToolsLib/MeshEditing/FlipElements.cpp b/MeshToolsLib/MeshEditing/FlipElements.cpp index 207d5ad80ab..e0baa2397d7 100644 --- a/MeshToolsLib/MeshEditing/FlipElements.cpp +++ b/MeshToolsLib/MeshEditing/FlipElements.cpp @@ -73,8 +73,9 @@ std::unique_ptr<MeshLib::Mesh> createFlippedMesh(MeshLib::Mesh const& mesh) createFlippedElement(*elems[i], new_nodes).release()); } - return std::make_unique<MeshLib::Mesh>("FlippedElementMesh", new_nodes, - new_elems, mesh.getProperties()); + return std::make_unique<MeshLib::Mesh>( + "FlippedElementMesh", new_nodes, new_elems, + true /* compute_element_neighbors */, mesh.getProperties()); } } // namespace MeshToolsLib diff --git a/MeshToolsLib/MeshEditing/MeshRevision.cpp b/MeshToolsLib/MeshEditing/MeshRevision.cpp index b4b1f22a657..377d4ecd819 100644 --- a/MeshToolsLib/MeshEditing/MeshRevision.cpp +++ b/MeshToolsLib/MeshEditing/MeshRevision.cpp @@ -1083,6 +1083,7 @@ MeshLib::Mesh* MeshRevision::simplifyMesh(const std::string& new_mesh_name, if (!new_elements.empty()) { return new MeshLib::Mesh(new_mesh_name, new_nodes, new_elements, + true /* compute_element_neighbors */, new_properties); } diff --git a/MeshToolsLib/MeshEditing/RemoveMeshComponents.cpp b/MeshToolsLib/MeshEditing/RemoveMeshComponents.cpp index ad7a8eeda58..77f00d940b5 100644 --- a/MeshToolsLib/MeshEditing/RemoveMeshComponents.cpp +++ b/MeshToolsLib/MeshEditing/RemoveMeshComponents.cpp @@ -88,6 +88,7 @@ MeshLib::Mesh* removeElements( { MeshLib::Mesh* new_mesh = new MeshLib::Mesh(new_mesh_name, new_nodes, new_elems, + true /* compute_element_neighbors */, mesh.getProperties().excludeCopyProperties( removed_element_ids, removed_node_ids)); return new_mesh; @@ -167,6 +168,7 @@ MeshLib::Mesh* removeNodes(const MeshLib::Mesh& mesh, { MeshLib::Mesh* new_mesh = new MeshLib::Mesh(new_mesh_name, new_nodes, new_elems, + true /* compute_element_neighbors */, mesh.getProperties().excludeCopyProperties( removed_element_ids, del_nodes_idx)); return new_mesh; diff --git a/MeshToolsLib/MeshGenerators/LayeredMeshGenerator.cpp b/MeshToolsLib/MeshGenerators/LayeredMeshGenerator.cpp index 3d2b4cef945..7378e5dcf94 100644 --- a/MeshToolsLib/MeshGenerators/LayeredMeshGenerator.cpp +++ b/MeshToolsLib/MeshGenerators/LayeredMeshGenerator.cpp @@ -89,7 +89,11 @@ std::unique_ptr<MeshLib::Mesh> LayeredMeshGenerator::getMesh( } std::unique_ptr<MeshLib::Mesh> result( - new MeshLib::Mesh(mesh_name, _nodes, _elements, properties)); + new MeshLib::Mesh(mesh_name, + _nodes, + _elements, + true /* compute_element_neighbors */, + properties)); MeshLib::NodeSearch ns(*result); if (ns.searchUnused() > 0) { diff --git a/MeshToolsLib/MeshGenerators/MeshGenerator.cpp b/MeshToolsLib/MeshGenerators/MeshGenerator.cpp index 4a7ce8649bb..14cc336d385 100644 --- a/MeshToolsLib/MeshGenerators/MeshGenerator.cpp +++ b/MeshToolsLib/MeshGenerators/MeshGenerator.cpp @@ -193,7 +193,8 @@ MeshLib::Mesh* MeshGenerator::generateLineMesh(const BaseLib::ISubdivision& div, elements.push_back(new MeshLib::Line({nodes[i], nodes[i + 1]})); } - return new MeshLib::Mesh(mesh_name, nodes, elements); + return new MeshLib::Mesh(mesh_name, nodes, elements, + true /* compute_element_neighbors */); } MeshLib::Mesh* MeshGenerator::generateRegularQuadMesh( @@ -275,7 +276,8 @@ MeshLib::Mesh* MeshGenerator::generateRegularQuadMesh( } } - return new MeshLib::Mesh(mesh_name, nodes, elements); + return new MeshLib::Mesh(mesh_name, nodes, elements, + true /* compute_element_neighbors */); } MeshLib::Mesh* MeshGenerator::generateRegularHexMesh( @@ -382,7 +384,8 @@ MeshLib::Mesh* MeshGenerator::generateRegularHexMesh( } } - return new MeshLib::Mesh(mesh_name, nodes, elements); + return new MeshLib::Mesh(mesh_name, nodes, elements, + true /* compute_element_neighbors */); } MeshLib::Mesh* MeshGenerator::generateRegularPyramidMesh( @@ -479,7 +482,8 @@ MeshLib::Mesh* MeshGenerator::generateRegularPyramidMesh( } } } - return new MeshLib::Mesh(mesh_name, nodes, elements); + return new MeshLib::Mesh(mesh_name, nodes, elements, + true /* compute_element_neighbors */); } MeshLib::Mesh* MeshGenerator::generateRegularTriMesh( @@ -564,7 +568,8 @@ MeshLib::Mesh* MeshGenerator::generateRegularTriMesh( } } - return new MeshLib::Mesh(mesh_name, nodes, elements); + return new MeshLib::Mesh(mesh_name, nodes, elements, + true /* compute_element_neighbors */); } MeshLib::Mesh* MeshGenerator::generateRegularPrismMesh( @@ -735,7 +740,8 @@ MeshLib::Mesh* MeshGenerator::generateRegularTetMesh( } } - return new MeshLib::Mesh(mesh_name, nodes, elements); + return new MeshLib::Mesh(mesh_name, nodes, elements, + true /* compute_element_neighbors */); } MeshLib::Mesh* MeshGenerator::createSurfaceMesh( @@ -775,7 +781,8 @@ MeshLib::Mesh* MeshGenerator::createSurfaceMesh( } } - return new MeshLib::Mesh(mesh_name, nodes, sfc_eles); + return new MeshLib::Mesh(mesh_name, nodes, sfc_eles, + true /* compute_element_neighbors */); } } // namespace MeshToolsLib diff --git a/MeshToolsLib/MeshGenerators/MeshLayerMapper.cpp b/MeshToolsLib/MeshGenerators/MeshLayerMapper.cpp index cbd2df31f6d..f7884402681 100644 --- a/MeshToolsLib/MeshGenerators/MeshLayerMapper.cpp +++ b/MeshToolsLib/MeshGenerators/MeshLayerMapper.cpp @@ -140,7 +140,8 @@ MeshLib::Mesh* MeshLayerMapper::createStaticLayers( materials->push_back(mat_id); } } - return new MeshLib::Mesh(mesh_name, new_nodes, new_elems, properties); + return new MeshLib::Mesh(mesh_name, new_nodes, new_elems, + true /* compute_element_neighbors */, properties); } bool MeshLayerMapper::createRasterLayers( diff --git a/MeshToolsLib/MeshGenerators/QuadraticMeshGenerator.cpp b/MeshToolsLib/MeshGenerators/QuadraticMeshGenerator.cpp index 8e6db00809f..cc7161c7d71 100644 --- a/MeshToolsLib/MeshGenerators/QuadraticMeshGenerator.cpp +++ b/MeshToolsLib/MeshGenerators/QuadraticMeshGenerator.cpp @@ -245,6 +245,7 @@ std::unique_ptr<MeshLib::Mesh> createQuadraticOrderMesh( return std::make_unique<MeshLib::Mesh>( linear_mesh.getName(), quadratic_mesh_nodes, quadratic_elements, + true /* compute_element_neighbors */, linear_mesh.getProperties().excludeCopyProperties( std::vector<MeshLib::MeshItemType>(1, MeshLib::MeshItemType::Node))); diff --git a/MeshToolsLib/MeshSurfaceExtraction.cpp b/MeshToolsLib/MeshSurfaceExtraction.cpp index d463dd471ce..c606cc2d54f 100644 --- a/MeshToolsLib/MeshSurfaceExtraction.cpp +++ b/MeshToolsLib/MeshSurfaceExtraction.cpp @@ -281,8 +281,9 @@ MeshLib::Mesh* MeshSurfaceExtraction::getMeshSurface( std::vector<std::size_t> const id_map(sfc_node_ids.begin(), sfc_node_ids.end()); - MeshLib::Mesh* result(new MeshLib::Mesh(subsfc_mesh.getName() + "-Surface", - sfc_nodes, new_elements)); + MeshLib::Mesh* result( + new MeshLib::Mesh(subsfc_mesh.getName() + "-Surface", sfc_nodes, + new_elements, true /* compute_element_neighbors */)); addBulkIDPropertiesToMesh(*result, subsfc_node_id_prop_name, id_map, subsfc_element_id_prop_name, element_ids_map, @@ -504,8 +505,9 @@ std::unique_ptr<MeshLib::Mesh> getBoundaryElementsAsMesh( std::vector<std::size_t> const nodes_to_bulk_nodes_id_map( boundary_node_ids.begin(), boundary_node_ids.end()); - std::unique_ptr<MeshLib::Mesh> boundary_mesh(new MeshLib::Mesh( - bulk_mesh.getName() + "-boundary", boundary_nodes, new_elements)); + std::unique_ptr<MeshLib::Mesh> boundary_mesh( + new MeshLib::Mesh(bulk_mesh.getName() + "-boundary", boundary_nodes, + new_elements, true /* compute_element_neighbors */)); addBulkIDPropertiesToMesh( *boundary_mesh, subsfc_node_id_prop_name, nodes_to_bulk_nodes_id_map, diff --git a/MeshToolsLib/convertMeshToGeo.cpp b/MeshToolsLib/convertMeshToGeo.cpp index 13f0297b087..08b096dc082 100644 --- a/MeshToolsLib/convertMeshToGeo.cpp +++ b/MeshToolsLib/convertMeshToGeo.cpp @@ -170,7 +170,8 @@ MeshLib::Mesh* convertSurfaceToMesh(const GeoLib::Surface& sfc, nodes.push_back(tri_nodes[j]); } } - MeshLib::Mesh mesh_with_duplicated_nodes(mesh_name, nodes, elements); + MeshLib::Mesh mesh_with_duplicated_nodes( + mesh_name, nodes, elements, true /* compute_element_neighbors */); // remove duplicated nodes MeshToolsLib::MeshRevision rev(mesh_with_duplicated_nodes); diff --git a/Tests/MeshLib/TestIs2DMeshOnRotatedVerticalPlane.cpp b/Tests/MeshLib/TestIs2DMeshOnRotatedVerticalPlane.cpp index c0682903951..6b7a9ba867a 100644 --- a/Tests/MeshLib/TestIs2DMeshOnRotatedVerticalPlane.cpp +++ b/Tests/MeshLib/TestIs2DMeshOnRotatedVerticalPlane.cpp @@ -35,8 +35,8 @@ void testAsNoVerticalPlaneMesh( element_nodes.end()); std::vector<std::unique_ptr<MeshLib::Mesh>> meshes; - meshes.push_back( - std::make_unique<MeshLib::Mesh>("a_mesh", nodes, elements)); + meshes.push_back(std::make_unique<MeshLib::Mesh>( + "a_mesh", nodes, elements, true /* compute_element_neighbors */)); MeshLib::setMeshSpaceDimension(meshes); ASSERT_EQ(expected_space_dimension, elements[0]->space_dimension_); @@ -60,8 +60,8 @@ void testAsVerticalPlaneMesh(const unsigned expected_space_dimension, element_nodes.end()); std::vector<std::unique_ptr<MeshLib::Mesh>> meshes; - meshes.push_back( - std::make_unique<MeshLib::Mesh>("a_mesh", nodes, elements)); + meshes.push_back(std::make_unique<MeshLib::Mesh>( + "a_mesh", nodes, elements, true /* compute_element_neighbors */)); MeshLib::setMeshSpaceDimension(meshes); diff --git a/Tests/MeshLib/TestMeshValidation.cpp b/Tests/MeshLib/TestMeshValidation.cpp index 852f5eaf0b2..c233016e6cf 100644 --- a/Tests/MeshLib/TestMeshValidation.cpp +++ b/Tests/MeshLib/TestMeshValidation.cpp @@ -39,7 +39,8 @@ void detectHoles(MeshLib::Mesh const& mesh, delete elems[pos]; elems.erase(elems.begin() + pos); } - MeshLib::Mesh mesh2("mesh2", nodes, elems); + MeshLib::Mesh mesh2( + "mesh2", nodes, elems, true /* compute_element_neighbors */); ASSERT_EQ(expected_n_holes, MeshToolsLib::MeshValidation::detectHoles(mesh2)); }; diff --git a/Tests/MeshLib/TestTriLineMesh.cpp b/Tests/MeshLib/TestTriLineMesh.cpp index ba522c76ee1..b954d0b2811 100644 --- a/Tests/MeshLib/TestTriLineMesh.cpp +++ b/Tests/MeshLib/TestTriLineMesh.cpp @@ -42,7 +42,8 @@ public: l_nodes[1] = nodes[2]; elements.push_back(new MeshLib::Line(l_nodes)); - mesh = new MeshLib::Mesh("M", nodes, elements); + mesh = new MeshLib::Mesh("M", nodes, elements, + true /* compute_element_neighbors */); } ~MeshLibTriLineMesh() override -- GitLab