Skip to content
Snippets Groups Projects
Commit 80ea6fbe authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[PL] BC: Replace getIntersectionByNodes.

The creation of a mesh subset via intersection is
split into two functions; the first one handles the
nodes intersection (and the resulting memory is managed
by the current scope), and in the second step the
actual MeshSubset object is created, w/o any memory
management obligations.
parent 979b3a23
No related branches found
No related tags found
No related merge requests found
......@@ -55,8 +55,8 @@ GenericNaturalBoundaryCondition<BoundaryConditionData,
auto const& mesh_subset =
dof_table_bulk.getMeshSubset(variable_id, component_id);
MeshLib::MeshSubset bc_mesh_subset =
mesh_subset.getIntersectionByNodes(nodes);
_nodes_subset = nodesNodesIntersection(mesh_subset.getNodes(), nodes);
MeshLib::MeshSubset bc_mesh_subset(mesh_subset.getMesh(), &_nodes_subset);
// Create local DOF table from intersected mesh subsets for the given
// variable and component ids.
......
......@@ -55,6 +55,10 @@ private:
/// defined.
std::vector<MeshLib::Element*> _elements;
/// Intersection of boundary nodes and bulk mesh subset for the
/// variable_id/component_id pair.
std::vector<MeshLib::Node*> _nodes_subset;
/// Local dof table, a subset of the global one restricted to the
/// participating #_elements of the boundary condition.
std::unique_ptr<NumLib::LocalToGlobalIndexMap> _dof_table_boundary;
......
......@@ -43,7 +43,8 @@ NormalTractionBoundaryCondition<LocalAssemblerImplementation>::
// variable.
auto const& mesh_subset = dof_table_bulk.getMeshSubset(variable_id, 0);
auto bc_mesh_subset = mesh_subset.getIntersectionByNodes(nodes);
_nodes_subset = nodesNodesIntersection(mesh_subset.getNodes(), nodes);
MeshLib::MeshSubset bc_mesh_subset(mesh_subset.getMesh(), &_nodes_subset);
// Create component ids vector for the current variable.
auto const& number_of_components =
......
......@@ -57,6 +57,10 @@ private:
/// defined.
std::vector<MeshLib::Element*> _elements;
/// Intersection of boundary nodes and bulk mesh subset for the
/// variable_id/component_id pair.
std::vector<MeshLib::Node*> _nodes_subset;
std::unique_ptr<MeshLib::MeshSubset const> _mesh_subset_all_nodes;
/// Local dof table, a subset of the global one restricted to the
......
......@@ -101,8 +101,10 @@ TEST_F(NumLibLocalToGlobalIndexMapTest, DISABLED_SubsetByComponent)
// Find unique node ids of the selected elements for testing.
std::vector<MeshLib::Node*> selected_nodes = MeshLib::getUniqueNodes(some_elements);
auto selected_component =
nodesSubset->getIntersectionByNodes(selected_nodes);
std::vector<MeshLib::Node*> nodes_intersection =
nodesNodesIntersection(nodesSubset->getNodes(), selected_nodes);
MeshLib::MeshSubset selected_component(nodesSubset->getMesh(),
&nodes_intersection);
auto dof_map_subset = std::unique_ptr<NumLib::LocalToGlobalIndexMap>{
dof_map->deriveBoundaryConstrainedMap(1, // variable id
......
......@@ -69,8 +69,10 @@ public:
std::vector<MeL::Node*> nodes = MeL::getUniqueNodes(boundary_elements);
nodes_subset =
nodesNodesIntersection(mesh_items_all_nodes->getNodes(), nodes);
mesh_items_boundary = std::make_unique<MeshLib::MeshSubset>(
mesh_items_all_nodes->getIntersectionByNodes(nodes));
mesh_items_all_nodes->getMesh(), &nodes_subset);
}
~NumLibLocalToGlobalIndexMapMultiDOFTest() override
......@@ -150,6 +152,9 @@ public:
std::unique_ptr<MeL::MeshSubset const> mesh_items_boundary;
std::vector<MeL::Element*> boundary_elements;
/// Intersection of boundary nodes and bulk mesh subset.
std::vector<MeshLib::Node*> nodes_subset;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment