35 #include "MutableElement.hpp"
36 #include "RandomNumberGenerator.hpp"
40 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
46 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
51 if (SPACE_DIM == ELEMENT_DIM)
57 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
62 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
65 for (
unsigned i=0; i<this->mNodes.size(); i++)
67 this->mNodes[i]->AddElement(this->mIndex);
71 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
75 this->mIsDeleted =
true;
78 for (
unsigned i=0; i<this->GetNumNodes(); i++)
80 this->mNodes[i]->RemoveElement(this->mIndex);
84 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
87 for (
unsigned i=0; i<this->GetNumNodes(); i++)
89 this->mNodes[i]->RemoveElement(this->mIndex);
95 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
98 assert(rIndex < this->mNodes.size());
101 this->mNodes[rIndex]->RemoveElement(this->mIndex);
104 this->mNodes[rIndex] = pNode;
107 this->mNodes[rIndex]->
AddElement(this->mIndex);
110 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
113 assert(rIndex < this->mNodes.size());
116 this->mNodes[rIndex]->RemoveElement(this->mIndex);
119 this->mNodes.erase(this->mNodes.begin() + rIndex);
122 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
130 if (this->mNodes.empty())
133 this->mNodes.push_back(pNode);
136 this->mNodes[0]->AddElement(this->mIndex);
140 assert(rIndex < this->mNodes.size());
143 this->mNodes.insert(this->mNodes.begin() + rIndex+1, pNode);
146 this->mNodes[rIndex+1]->AddElement(this->mIndex);
150 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
153 unsigned local_index = UINT_MAX;
154 for (
unsigned i=0; i<this->mNodes.size(); i++)
156 if (this->GetNodeGlobalIndex(i) == globalIndex)
164 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
167 bool is_element_on_boundary =
false;
168 for (
unsigned i=0; i<this->mNodes.size(); i++)
170 if (this->GetNode(i)->IsBoundaryNode())
172 is_element_on_boundary =
true;
176 return is_element_on_boundary;
189 template<
unsigned SPACE_DIM>
194 assert(this->
mNodes.size() == 2);
195 assert(SPACE_DIM > 0);
198 template<
unsigned SPACE_DIM>
203 template<
unsigned SPACE_DIM>
206 for (
unsigned i=0; i<this->
mNodes.size(); i++)
212 template<
unsigned SPACE_DIM>
225 template <
unsigned SPACE_DIM>
236 template<
unsigned SPACE_DIM>
239 assert(rIndex < this->
mNodes.size());
245 this->
mNodes[rIndex] = pNode;
251 template<
unsigned SPACE_DIM>
254 assert(rIndex < this->
mNodes.size());
263 template<
unsigned SPACE_DIM>
266 assert(rIndex < this->
mNodes.size());
269 this->
mNodes.insert(this->
mNodes.begin() + rIndex+1, pNode);
275 template<
unsigned SPACE_DIM>
278 unsigned local_index = UINT_MAX;
279 for (
unsigned i=0; i<this->
mNodes.size(); i++)
289 template<
unsigned SPACE_DIM>
292 bool is_element_on_boundary =
false;
293 for (
unsigned i=0; i<this->
mNodes.size(); i++)
295 if (this->
GetNode(i)->IsBoundaryNode())
297 is_element_on_boundary =
true;
301 return is_element_on_boundary;
void UpdateNode(const unsigned &rIndex, Node< SPACE_DIM > *pNode)
unsigned GetNodeGlobalIndex(unsigned localIndex) const
Node< SPACE_DIM > * GetNode(unsigned localIndex) const
void ResetIndex(unsigned index)
std::vector< Node< SPACE_DIM > * > mNodes
void AddNode(Node< SPACE_DIM > *pNode, const unsigned &rIndex)
unsigned GetNumNodes() const
MutableElement(unsigned index)
void AddElement(unsigned index)
bool IsElementOnBoundary() const
void DeleteNode(const unsigned &rIndex)
unsigned GetNodeLocalIndex(unsigned globalIndex) const