OFELI's Logo

An Object Oriented Finite Element Library

To store and treat finite element geometric information. More...

#include <Element.h>

Public Member Functions

 Element ()
 Default constructor.
 
 Element (size_t label, const string &shape)
 Constructor initializing label, shape of element. More...
 
 Element (size_t label, int shape)
 Constructor initializing label, shape of element. More...
 
 Element (size_t label, const string &shape, int c)
 Constructor initializing label, shape and code of element. More...
 
 Element (size_t label, int shape, int c)
 Constructor initializing label, shape and code of element. More...
 
 Element (const Element &el)
 Copy constructor.
 
 ~Element ()
 Destructor.
 
void setLabel (size_t i)
 Define label of element. More...
 
void setCode (int c)
 Define code of element. More...
 
void Add (Node *node)
 Insert a node at end of list of nodes of element. More...
 
void Add (Node *node, int n)
 Insert a node and set its local node number. More...
 
void Replace (size_t label, Node *node)
 Replace a node at a given local label. More...
 
void Replace (size_t label, Side *side)
 Replace a side at a given local label. More...
 
void Add (Side *sd)
 Assign Side to Element. More...
 
void Add (Side *sd, int k)
 Assign Side to Element with assigned local label. More...
 
void Add (Element *el)
 Add a neighbor element. More...
 
void set (Element *el, int n)
 Add a neighbor element and set its label. More...
 
void setDOF (size_t i, size_t dof)
 Define label of DOF. More...
 
void setCode (size_t dof, int code)
 Assign code to a DOF. More...
 
void setNode (size_t i, Node *node)
 Assign a node given by its pointer as the i-th node of element.
 
void setNbDOF (size_t i)
 Set number of degrees of freedom of element.
 
void setFirstDOF (size_t i)
 Set label of first DOF in element.
 
int getShape () const
 Return element shape.
 
size_t getLabel () const
 Return label of element.
 
size_t n () const
 Return label of element.
 
int getCode () const
 Return code of element.
 
size_t getNbNodes () const
 Return number of element nodes.
 
size_t getNbVertices () const
 Return number of element vertices.
 
size_t getNbSides () const
 Return number of element sides (Constant version)
 
size_t getNbEq () const
 Return number of element equations.
 
size_t getNbDOF () const
 return element nb of DOF
 
size_t getDOF (size_t i=1) const
 Return element DOF label.
 
size_t getFirstDOF () const
 Return element first DOF label.
 
size_t getNodeLabel (size_t n) const
 Return global label of node of local label i.
 
size_t getSideLabel (size_t n) const
 Return global label of side of local label i.
 
NodegetPtrNode (size_t i) const
 Return pointer to node of label i (Local labelling).
 
Nodeoperator() (size_t i) const
 Operator (). More...
 
SidegetPtrSide (size_t i) const
 Return pointer to side of label i (Local labelling).
 
int Contains (const Node *nd) const
 Say if element contains given node. More...
 
int Contains (const Node &nd) const
 Say if element contains given node. More...
 
int Contains (const Side *sd) const
 Say if element contains given side. More...
 
int Contains (const Side &sd) const
 Say if element contains given side. More...
 
ElementgetNeighborElement (size_t i) const
 Return pointer to element Neighboring element. More...
 
size_t getNbNeigElements () const
 Return number of neigboring elements. More...
 
real_t getMeasure () const
 Return measure of element. More...
 
Point< real_tgetCenter () const
 Return coordinates of center of element.
 
Point< real_tgetUnitNormal (size_t i) const
 Return outward unit normal to i-th side of element. More...
 
bool isOnBoundary () const
 Say if current element is a boundary element or not. More...
 
Nodeoperator() (size_t i)
 Operator (). More...
 
int setSide (size_t n, size_t *nd)
 Initialize information on element sides. More...
 
bool isActive () const
 Return true or false whether element is active or not.
 
int getLevel () const
 Return element level Element level decreases when element is refined (starting from 0). If the level is 0, then the element has no father.
 
void setChild (Element *el)
 Assign element as child of current one and assign current element as father This function is principally used when refining is invoked (e.g. for mesh adaption) More...
 
ElementgetChild (size_t i) const
 Return pointer to i-th child element Return null pointer is no childs.
 
size_t getNbChilds () const
 Return number of children of element.
 
ElementgetParent () const
 Return pointer to parent element Return null if no parent.
 
size_t IsIn (const Node *nd)
 Check if a given node belongs to current element. More...
 

Detailed Description

To store and treat finite element geometric information.

Class Element enables defining an element of a finite element mesh. The element is given in particular by its shape and a list of nodes. Each node can be accessed by the member function getPtrNode. Moreover, class Mesh can generate for each element its list of sides. The string that defines the element shape must be chosen according to the following list:

Shape Shape name Dimension Min. number of nodes Line line 2 2 Triangle tria 2 3 Quadrilateral quad 2 4 Tetrahedron tetra 3 4 Pentahedron penta 3 6 Hexahedron hexa 3 8

Remarks
Once a Mesh instance is constructed, one has access for each Element of the mesh to pointers to element sides provided the member function getAllSides of Mesh has been invoked. With this, an element can be tested to see if it is on the boundary, i.e. if it has at least one side on the boundary
Author
Rachid Touzani

Constructor & Destructor Documentation

◆ Element() [1/4]

Element ( size_t  label,
const string &  shape 
)

Constructor initializing label, shape of element.

Parameters
[in]labelLabel to assign to element.
[in]shapeShape of element (See class description).

◆ Element() [2/4]

Element ( size_t  label,
int  shape 
)

Constructor initializing label, shape of element.

Parameters
[in]labelLabel to assign to element.
[in]shapeShape of element (See enum ElementShape in Mesh)

◆ Element() [3/4]

Element ( size_t  label,
const string &  shape,
int  c 
)

Constructor initializing label, shape and code of element.

Parameters
[in]labelLabel to assign to element.
[in]shapeShape of element (See class description).
[in]cCode to assign to element (useful for media properties).

◆ Element() [4/4]

Element ( size_t  label,
int  shape,
int  c 
)

Constructor initializing label, shape and code of element.

Parameters
[in]labelLabel to assign to element.
[in]shapeShape of element (See enum ElementShape in Mesh).
[in]cCode to assign to element (useful for media properties).

Member Function Documentation

◆ Add() [1/5]

void Add ( Element el)

Add a neighbor element.

Parameters
[in]elPointer to Element instance

◆ Add() [2/5]

void Add ( Node node)

Insert a node at end of list of nodes of element.

Parameters
[in]nodePointer to Node instance.

◆ Add() [3/5]

void Add ( Node node,
int  n 
)

Insert a node and set its local node number.

Parameters
node[in] Pointer to Node instance
[in]nElement node number to assign

◆ Add() [4/5]

void Add ( Side sd)

Assign Side to Element.

Parameters
[in]sdPointer to Side instance.

◆ Add() [5/5]

void Add ( Side sd,
int  k 
)

Assign Side to Element with assigned local label.

Parameters
[in]sdPointer to Side instance.
[in]kLocal label.

◆ Contains() [1/4]

int Contains ( const Node nd) const

Say if element contains given node.

This function tests if the element contains a node with the same label at the sought one

Parameters
[in]ndReference to Node instance
Returns
Local node label in element. If 0, the element does not contain this node

◆ Contains() [2/4]

int Contains ( const Node nd) const

Say if element contains given node.

This function tests if the element contains a node with the same pointer at the sought one

Parameters
[in]ndPointer to Node instance
Returns
Local node label in element. If 0, the element does not contain this node

◆ Contains() [3/4]

int Contains ( const Side sd) const

Say if element contains given side.

This function tests if the element contains a side with the same label at the sought one

Parameters
[in]sdReference to Side instance
Returns
Local side label in element. If 0, the element does not contain this side

◆ Contains() [4/4]

int Contains ( const Side sd) const

Say if element contains given side.

This function tests if the element contains a side with the same pointer at the sought one

Parameters
[in]sdPointer to Side instance
Returns
Local side label in element. If 0, the element does not contain this side

◆ getMeasure()

real_t getMeasure ( ) const

Return measure of element.

This member function returns length, area or volume of element. In case of quadrilaterals and hexahedrals it returns determinant of Jacobian of mapping between reference and actual element

◆ getNbNeigElements()

size_t getNbNeigElements ( ) const

Return number of neigboring elements.

Note
This method returns valid information only if the Mesh member function Mesh::getElementNeighborElements() has been called before.

◆ getNeighborElement()

Element * getNeighborElement ( size_t  i) const

Return pointer to element Neighboring element.

Parameters
[in]iIndex of element to look for.
Note
This method returns valid information only if the Mesh member function Mesh::getElementNeighborElements() has been called before.

◆ getUnitNormal()

Point< real_t > getUnitNormal ( size_t  i) const

Return outward unit normal to i-th side of element.

Sides are ordered [node_1,node_2], [node_2,node_3], ...

◆ IsIn()

size_t IsIn ( const Node nd)

Check if a given node belongs to current element.

Parameters
[in]ndPointer to node to locate
Returns
local label of node if this one is found, 0 otherwise

◆ isOnBoundary()

bool isOnBoundary ( ) const

Say if current element is a boundary element or not.

Note
this information is available only if boundary elements were determined i.e. if member function Mesh::getBoundarySides or Mesh::getAllSides has been invoked before.

◆ operator()() [1/2]

Node * operator() ( size_t  i)

Operator ().

Return pointer to node of local label i.

◆ operator()() [2/2]

Node * operator() ( size_t  i) const

Operator ().

Return pointer to node of local label i.

◆ Replace() [1/2]

void Replace ( size_t  label,
Node node 
)

Replace a node at a given local label.

Parameters
[in]labelNode to replace.
[in]nodePointer to Node instance to copy to current instance.

◆ Replace() [2/2]

void Replace ( size_t  label,
Side side 
)

Replace a side at a given local label.

Parameters
[in]labelSide to replace.
[in]sidePointer to Side instance to copy to current instance.

◆ set()

void set ( Element el,
int  n 
)

Add a neighbor element and set its label.

Parameters
[in]elPointer to Element instance
[in]nNeighbor element number to assign

◆ setChild()

void setChild ( Element el)

Assign element as child of current one and assign current element as father This function is principally used when refining is invoked (e.g. for mesh adaption)

Parameters
[in]elPointer to element to assign

◆ setCode() [1/2]

void setCode ( int  c)

Define code of element.

Parameters
[in]cCode to assign to element.

◆ setCode() [2/2]

void setCode ( size_t  dof,
int  code 
)

Assign code to a DOF.

Parameters
[in]dofIndex of dof for assignment.
[in]codeCode to assign.

◆ setDOF()

void setDOF ( size_t  i,
size_t  dof 
)

Define label of DOF.

Parameters
[in]iIndex of DOF.
[in]dofLabel of DOF to assign.

◆ setLabel()

void setLabel ( size_t  i)

Define label of element.

Parameters
[in]iLabel to assign to element

◆ setSide()

int setSide ( size_t  n,
size_t *  nd 
)

Initialize information on element sides.

This function is to be used to initialize loops over sides.

Parameters
[in]nLabel of side.
[in]ndArray of pointers to nodes of the side (nd[0], nd[1], ... point to first, second nodes, ...





Copyright © 1998-2022 Rachid Touzani