36 #include "AbstractElement.hpp" 47 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
53 mpElementAttributes(nullptr)
56 assert(ELEMENT_DIM <= SPACE_DIM);
59 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
67 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
73 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
76 assert(pOldNode != pNewNode);
77 for (
unsigned i=0; i<this->
mNodes.size(); i++)
79 if (this->
mNodes[i] == pOldNode)
85 EXCEPTION(
"You didn't have that node to start with.");
88 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
91 assert(dimension < SPACE_DIM);
92 assert((
unsigned)localIndex <
mNodes.size());
93 return mNodes[localIndex]->rGetLocation()[dimension];
101 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
104 assert((
unsigned)localIndex <
mNodes.size());
105 return mNodes[localIndex]->rGetLocation();
108 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
111 assert((
unsigned)localIndex <
mNodes.size());
112 return mNodes[localIndex]->GetIndex();
115 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
118 assert((
unsigned)localIndex <
mNodes.size());
119 return mNodes[localIndex];
122 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
128 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
134 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
140 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
146 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
152 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
158 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
164 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
172 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
180 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
184 unsigned unsigned_attr = (
unsigned) (double_attr + 0.5);
188 EXCEPTION(
"Element attribute '"<< double_attr <<
"' cannot be converted to an unsigned.");
190 return unsigned_attr;
193 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
202 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
210 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
215 EXCEPTION(
"Element has no attributes associated with it. Construct attributes first");
221 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
void SetAttribute(double attribute)
ElementAttributes< ELEMENT_DIM, SPACE_DIM > * mpElementAttributes
void AddElementAttribute(double attribute)
static bool WithinAnyTolerance(double number1, double number2, double relTol=DBL_EPSILON, double absTol=DBL_EPSILON, bool printError=false)
unsigned GetNodeGlobalIndex(unsigned localIndex) const
void SetIndex(unsigned index)
#define EXCEPTION(message)
void ReplaceNode(Node< SPACE_DIM > *pOldNode, Node< SPACE_DIM > *pNewNode)
void SetOwnership(bool ownership)
unsigned GetNumElementAttributes()
Node< SPACE_DIM > * GetNode(unsigned localIndex) const
AbstractElement(unsigned index, const std::vector< Node< SPACE_DIM > * > &rNodes)
bool GetOwnership() const
std::vector< Node< SPACE_DIM > * > mNodes
void ConstructElementAttributes()
std::vector< double > & rGetElementAttributes()
unsigned GetNumNodes() const
virtual ~AbstractElement()
unsigned GetUnsignedAttribute()
unsigned GetIndex() const
void AddNode(Node< SPACE_DIM > *pNode)
double GetNodeLocation(unsigned localIndex, unsigned dimension) const
virtual void UpdateNode(const unsigned &rIndex, Node< SPACE_DIM > *pNode)=0