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

[MeL] Make computation of element neighbors optional

parent 394c9cd8
No related branches found
No related tags found
No related merge requests found
......@@ -64,6 +64,7 @@ Mesh::Mesh(std::string name,
nodes,
std::vector<Element*>
elements,
bool const compute_element_neighbors,
Properties const& properties)
: _id(global_mesh_counter++),
_mesh_dimension(0),
......@@ -71,7 +72,8 @@ Mesh::Mesh(std::string name,
_name(std::move(name)),
_nodes(std::move(nodes)),
_elements(std::move(elements)),
_properties(properties)
_properties(properties),
_compute_element_neighbors(compute_element_neighbors)
{
this->resetNodeIDs();
this->resetElementIDs();
......@@ -79,7 +81,10 @@ Mesh::Mesh(std::string name,
_elements_connected_to_nodes = findElementsConnectedToNodes(*this);
this->setElementNeighbors();
if (_compute_element_neighbors)
{
this->setElementNeighbors();
}
}
Mesh::Mesh(const Mesh& mesh)
......@@ -89,7 +94,8 @@ Mesh::Mesh(const Mesh& mesh)
_name(mesh.getName()),
_nodes(mesh.getNumberOfNodes()),
_elements(mesh.getNumberOfElements()),
_properties(mesh._properties)
_properties(mesh._properties),
_compute_element_neighbors(mesh._compute_element_neighbors)
{
const std::vector<Node*>& nodes(mesh.getNodes());
const std::size_t nNodes(nodes.size());
......@@ -114,8 +120,12 @@ Mesh::Mesh(const Mesh& mesh)
{
this->setDimension();
}
_elements_connected_to_nodes = findElementsConnectedToNodes(*this);
this->setElementNeighbors();
if (_compute_element_neighbors)
{
this->setElementNeighbors();
}
}
Mesh::Mesh(Mesh&& mesh) = default;
......
......@@ -51,12 +51,15 @@ public:
/// @param name Mesh name.
/// @param nodes A vector of mesh nodes.
/// @param elements An array of mesh elements.
/// @param compute_element_neighbors switch to compute element neighbors or
/// not
/// @param properties Mesh properties.
Mesh(std::string name,
std::vector<Node*>
nodes,
std::vector<Element*>
elements,
bool const compute_element_neighbors = false,
Properties const& properties = Properties());
/// Copy constructor
......@@ -158,6 +161,7 @@ protected:
std::vector<std::vector<Element const*>> _elements_connected_to_nodes;
bool _is_axially_symmetric = false;
bool const _compute_element_neighbors;
}; /* class */
/// Computes the element-connectivity of nodes. Two nodes i and j are
......
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