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

[MeL/ME] Clang format DuplicateMeshComponents.

parent 916d9508
No related branches found
No related tags found
No related merge requests found
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
namespace MeshLib namespace MeshLib
{ {
std::vector<MeshLib::Node*> copyNodeVector(
std::vector<MeshLib::Node*> copyNodeVector(const std::vector<MeshLib::Node*> &nodes) const std::vector<MeshLib::Node*>& nodes)
{ {
const std::size_t nNodes(nodes.size()); const std::size_t nNodes(nodes.size());
std::vector<MeshLib::Node*> new_nodes; std::vector<MeshLib::Node*> new_nodes;
...@@ -33,7 +33,9 @@ std::vector<MeshLib::Node*> copyNodeVector(const std::vector<MeshLib::Node*> &no ...@@ -33,7 +33,9 @@ std::vector<MeshLib::Node*> copyNodeVector(const std::vector<MeshLib::Node*> &no
return new_nodes; return new_nodes;
} }
std::vector<MeshLib::Element*> copyElementVector(const std::vector<MeshLib::Element*> &elements, const std::vector<MeshLib::Node*> &nodes) std::vector<MeshLib::Element*> copyElementVector(
const std::vector<MeshLib::Element*>& elements,
const std::vector<MeshLib::Node*>& nodes)
{ {
const std::size_t nElements(elements.size()); const std::size_t nElements(elements.size());
std::vector<MeshLib::Element*> new_elements; std::vector<MeshLib::Element*> new_elements;
...@@ -45,7 +47,8 @@ std::vector<MeshLib::Element*> copyElementVector(const std::vector<MeshLib::Elem ...@@ -45,7 +47,8 @@ std::vector<MeshLib::Element*> copyElementVector(const std::vector<MeshLib::Elem
return new_elements; return new_elements;
} }
MeshLib::Element* copyElement(MeshLib::Element const*const element, const std::vector<MeshLib::Node*> &nodes) MeshLib::Element* copyElement(MeshLib::Element const* const element,
const std::vector<MeshLib::Node*>& nodes)
{ {
if (element->getGeomType() == MeshElemType::LINE) if (element->getGeomType() == MeshElemType::LINE)
{ {
...@@ -76,12 +79,13 @@ MeshLib::Element* copyElement(MeshLib::Element const*const element, const std::v ...@@ -76,12 +79,13 @@ MeshLib::Element* copyElement(MeshLib::Element const*const element, const std::v
return copyElement<MeshLib::Prism>(element, nodes); return copyElement<MeshLib::Prism>(element, nodes);
} }
ERR ("Error: Unknown element type."); ERR("Error: Unknown element type.");
return nullptr; return nullptr;
} }
template <typename E> template <typename E>
MeshLib::Element* copyElement(MeshLib::Element const*const element, const std::vector<MeshLib::Node*> &nodes) MeshLib::Element* copyElement(MeshLib::Element const* const element,
const std::vector<MeshLib::Node*>& nodes)
{ {
auto** new_nodes = new MeshLib::Node*[element->getNumberOfNodes()]; auto** new_nodes = new MeshLib::Node*[element->getNumberOfNodes()];
for (unsigned i = 0; i < element->getNumberOfNodes(); ++i) for (unsigned i = 0; i < element->getNumberOfNodes(); ++i)
...@@ -102,4 +106,4 @@ std::vector<MeshLib::Element*> cloneElements( ...@@ -102,4 +106,4 @@ std::vector<MeshLib::Element*> cloneElements(
return cloned_elements; return cloned_elements;
} }
} // namespace MeshLib } // namespace MeshLib
...@@ -18,30 +18,36 @@ ...@@ -18,30 +18,36 @@
namespace MeshLib namespace MeshLib
{ {
class Mesh;
class Mesh; class Node;
class Node; class Element;
class Element;
/// Creates a deep copy of a Node vector
/// Creates a deep copy of a Node vector std::vector<MeshLib::Node*> copyNodeVector(
std::vector<MeshLib::Node*> copyNodeVector(const std::vector<MeshLib::Node*> &nodes); const std::vector<MeshLib::Node*>& nodes);
/** 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. This should be consistent with the original node vector. * @param nodes The new node vector used for the duplicated element vector.
* @return A deep copy of the elements vector using the new nodes vector. * This should be consistent with the original node vector.
*/ * @return A deep copy of the elements vector using the new nodes vector.
std::vector<MeshLib::Element*> copyElementVector(const std::vector<MeshLib::Element*> &elements, const std::vector<MeshLib::Node*> &nodes); */
std::vector<MeshLib::Element*> copyElementVector(
/// Copies an element without change, using the nodes vector from the result mesh. const std::vector<MeshLib::Element*>& elements,
MeshLib::Element* copyElement(MeshLib::Element const*const element, const std::vector<MeshLib::Node*>& nodes);
const std::vector<MeshLib::Node*> &nodes);
/// 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.
template <typename E> MeshLib::Element* copyElement(MeshLib::Element const* const element,
MeshLib::Element* copyElement(MeshLib::Element const*const element, const std::vector<MeshLib::Node*> &nodes); const std::vector<MeshLib::Node*>& nodes);
/// Clones a vector of elements using the Element::clone() function. /// Copies an element without change, using the nodes vector from the result
std::vector<MeshLib::Element*> cloneElements( /// mesh.
std::vector<MeshLib::Element*> const& elements); template <typename E>
} // end namespace MeshLib MeshLib::Element* copyElement(MeshLib::Element const* const element,
const std::vector<MeshLib::Node*>& nodes);
/// Clones a vector of elements using the Element::clone() function.
std::vector<MeshLib::Element*> cloneElements(
std::vector<MeshLib::Element*> const& elements);
} // end namespace MeshLib
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