Skip to content
Snippets Groups Projects
Commit cbd16ba8 authored by Tom Fischer's avatar Tom Fischer
Browse files

[MeL/ME] Add an opt. node map. to copyElementVector.

parent 5e586651
No related branches found
No related tags found
No related merge requests found
...@@ -34,15 +34,15 @@ std::vector<MeshLib::Node*> copyNodeVector( ...@@ -34,15 +34,15 @@ std::vector<MeshLib::Node*> copyNodeVector(
} }
std::vector<MeshLib::Element*> copyElementVector( std::vector<MeshLib::Element*> copyElementVector(
const std::vector<MeshLib::Element*>& elements, std::vector<MeshLib::Element*> const& elements,
const std::vector<MeshLib::Node*>& nodes) std::vector<MeshLib::Node*> const& new_nodes,
std::vector<std::size_t> const* const node_id_map)
{ {
const std::size_t nElements(elements.size());
std::vector<MeshLib::Element*> new_elements; std::vector<MeshLib::Element*> new_elements;
new_elements.reserve(nElements); new_elements.reserve(elements.size());
for (std::size_t k = 0; k < nElements; ++k) for (auto element : elements)
{ {
new_elements.push_back(copyElement(elements[k], nodes)); new_elements.push_back(copyElement(element, new_nodes, node_id_map));
} }
return new_elements; return new_elements;
} }
......
...@@ -28,16 +28,19 @@ std::vector<MeshLib::Node*> copyNodeVector( ...@@ -28,16 +28,19 @@ std::vector<MeshLib::Node*> copyNodeVector(
/** Creates a deep copy of an element vector using the given Node vector. /** Creates a deep copy of an element vector using the given Node vector.
* @param elements The element vector that should be duplicated. * @param elements The element vector that should be duplicated.
* @param nodes The new node vector used for the duplicated element vector. * @param new_nodes The new node vector used for the duplicated element vector.
* This should be consistent with the original node vector. * @param node_id_map An optional mapping from the nodes the 'old' elements
* based on to the new nodes. This should be consistent with the original node
* vector.
* @return A deep copy of the elements vector using the new nodes vector. * @return A deep copy of the elements vector using the new nodes vector.
*/ */
std::vector<MeshLib::Element*> copyElementVector( std::vector<MeshLib::Element*> copyElementVector(
const std::vector<MeshLib::Element*>& elements, std::vector<MeshLib::Element*> const& elements,
const std::vector<MeshLib::Node*>& nodes); std::vector<MeshLib::Node*> const& new_nodes,
std::vector<std::size_t> const* const node_id_map = nullptr);
/// Copies an element without change, using the nodes vector from the result /// Copies an element without change, using the nodes vector from the result
/// mesh. /// mesh and an optional mapping from the nodes the 'old' elements.
MeshLib::Element* copyElement( MeshLib::Element* copyElement(
MeshLib::Element const* const element, MeshLib::Element const* const element,
const std::vector<MeshLib::Node*>& nodes, const std::vector<MeshLib::Node*>& 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