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

NWMP; Add bulk_node_ids map to findNonGhostNodes.

parent 65f98ab7
No related branches found
No related tags found
No related merge requests found
...@@ -129,19 +129,27 @@ void splitOffHigherOrderNode(std::vector<MeshLib::Node*> const& nodes, ...@@ -129,19 +129,27 @@ void splitOffHigherOrderNode(std::vector<MeshLib::Node*> const& nodes,
/// vector, and /// vector, and
/// 2 collect non-linear element nodes belonging to the partition part_id in /// 2 collect non-linear element nodes belonging to the partition part_id in
/// extra nodes vector. /// extra nodes vector.
/// If \c node_id_mapping is given, it will be used to map the mesh node ids to
/// other ids; used by boundary meshes, for example.
/// \return a pair of base node and extra nodes. /// \return a pair of base node and extra nodes.
std::pair<std::vector<MeshLib::Node*>, std::vector<MeshLib::Node*>> std::pair<std::vector<MeshLib::Node*>, std::vector<MeshLib::Node*>>
findNonGhostNodesInPartition(std::size_t const part_id, findNonGhostNodesInPartition(
const bool is_mixed_high_order_linear_elems, std::size_t const part_id,
std::size_t const n_base_nodes, const bool is_mixed_high_order_linear_elems,
std::vector<MeshLib::Node*> const& nodes, std::size_t const n_base_nodes,
std::vector<std::size_t> const& partition_ids) std::vector<MeshLib::Node*> const& nodes,
std::vector<std::size_t> const& partition_ids,
std::vector<std::size_t> const* node_id_mapping = nullptr)
{ {
auto node_id = [&node_id_mapping](MeshLib::Node const* const n) {
return node_id_mapping ? (*node_id_mapping)[n->getID()] : n->getID();
};
// Find nodes belonging to a given partition id. // Find nodes belonging to a given partition id.
std::vector<MeshLib::Node*> partition_nodes; std::vector<MeshLib::Node*> partition_nodes;
copy_if( copy_if(
begin(nodes), end(nodes), std::back_inserter(partition_nodes), begin(nodes), end(nodes), std::back_inserter(partition_nodes),
[&](auto const& n) { return partition_ids[n->getID()] == part_id; }); [&](auto const& n) { return partition_ids[node_id(n)] == part_id; });
// Space for resulting vectors. // Space for resulting vectors.
std::vector<MeshLib::Node*> base_nodes; std::vector<MeshLib::Node*> base_nodes;
...@@ -160,7 +168,7 @@ findNonGhostNodesInPartition(std::size_t const part_id, ...@@ -160,7 +168,7 @@ findNonGhostNodesInPartition(std::size_t const part_id,
std::back_inserter(extra_nodes), std::back_inserter(extra_nodes),
[&](MeshLib::Node* const n) { [&](MeshLib::Node* const n) {
return !is_mixed_high_order_linear_elems || return !is_mixed_high_order_linear_elems ||
n->getID() > n_base_nodes; node_id(n) > n_base_nodes;
}); });
return {base_nodes, extra_nodes}; return {base_nodes, extra_nodes};
......
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