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

[MeL/Elements] TemplateElement: Preparations for removing the element value.

parent 2e9068f4
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,16 @@ TemplateElement<ELEMENT_RULE>::TemplateElement(Node* nodes[n_all_nodes], unsigne
this->_content = ELEMENT_RULE::computeVolume(this->_nodes);
}
template <class ELEMENT_RULE>
TemplateElement<ELEMENT_RULE>::TemplateElement(Node* nodes[n_all_nodes], std::size_t id)
: Element(id)
{
this->_nodes = nodes;
this->_neighbors = new Element*[getNNeighbors()];
std::fill(this->_neighbors, this->_neighbors + getNNeighbors(), nullptr);
this->_content = ELEMENT_RULE::computeVolume(this->_nodes);
}
template <class ELEMENT_RULE>
TemplateElement<ELEMENT_RULE>::TemplateElement(std::array<Node*, n_all_nodes> const& nodes, unsigned value, std::size_t id)
: Element(value, id)
......@@ -33,9 +43,20 @@ TemplateElement<ELEMENT_RULE>::TemplateElement(std::array<Node*, n_all_nodes> co
this->_content = ELEMENT_RULE::computeVolume(this->_nodes);
}
template <class ELEMENT_RULE>
TemplateElement<ELEMENT_RULE>::TemplateElement(std::array<Node*, n_all_nodes> const& nodes, std::size_t id)
: Element(id)
{
this->_nodes = new Node*[n_all_nodes];
std::copy(nodes.begin(), nodes.end(), this->_nodes);
this->_neighbors = new Element*[getNNeighbors()];
std::fill(this->_neighbors, this->_neighbors + getNNeighbors(), nullptr);
this->_content = ELEMENT_RULE::computeVolume(this->_nodes);
}
template <class ELEMENT_RULE>
TemplateElement<ELEMENT_RULE>::TemplateElement(const TemplateElement &e)
: Element(e.getValue(), e.getID())
: Element(e.getID())
{
this->_nodes = new Node*[n_all_nodes];
for (unsigned i=0; i<n_all_nodes; i++)
......
......@@ -48,7 +48,15 @@ public:
* @param value element value, e.g. material ID
* @param id element id
*/
TemplateElement(Node* nodes[n_all_nodes], unsigned value = 0, std::size_t id = std::numeric_limits<std::size_t>::max());
TemplateElement(Node* nodes[n_all_nodes], unsigned value, std::size_t id);
/**
* Constructor with an array of mesh nodes.
*
* @param nodes an array of pointers of mesh nodes which form this element
* @param id element id
*/
TemplateElement(Node* nodes[n_all_nodes], std::size_t id = std::numeric_limits<std::size_t>::max());
/**
* Constructor with an array of mesh nodes
......@@ -57,7 +65,15 @@ public:
* @param value element value, e.g. material ID
* @param id element id
*/
TemplateElement(std::array<Node*, n_all_nodes> const& nodes, unsigned value = 0, std::size_t id = std::numeric_limits<std::size_t>::max());
TemplateElement(std::array<Node*, n_all_nodes> const& nodes, unsigned value, std::size_t id);
/**
* Constructor with an array of mesh nodes
*
* @param nodes an array of pointers of mesh nodes which form this element
* @param id element id
*/
TemplateElement(std::array<Node*, n_all_nodes> const& nodes, std::size_t id = std::numeric_limits<std::size_t>::max());
/// Copy constructor
TemplateElement(const TemplateElement &e);
......
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