To store and treat finite element sides (edges in 2-D or faces in 3-D) More...

#include <Side.h>

Public Types

enum  SideType {
  INTERNAL_SIDE = 0 ,
  EXTERNAL_BOUNDARY = 1 ,
  INTERNAL_BOUNDARY = 2
}
 

Public Member Functions

 Side ()
 Default Constructor.
 
 Side (size_t label, const string &shape)
 Constructor initializing side label and shape.
 
 Side (size_t label, int shape)
 Constructor initializing side label and shape.
 
 Side (const Side &sd)
 Copy constructor.
 
 ~Side ()
 Destructor.
 
void Add (Node *node)
 Insert a node at end of list of nodes of side.
 
void Add (Edge *edge)
 Insert an edge at end of list of edges of side.
 
void setLabel (size_t i)
 Define label of side.
 
void setFirstDOF (size_t n)
 Define First DOF.
 
void setNbDOF (size_t nb_dof)
 Set number of degrees of freedom (DOF).
 
void DOF (size_t i, size_t dof)
 Define label of DOF.
 
void setDOF (size_t &first_dof, size_t nb_dof)
 Define number of DOF.
 
void setCode (size_t dof, int code)
 Assign code to a DOF.
 
void Replace (size_t label, Node *node)
 Replace a node at a given local label.
 
void Add (Element *el)
 Set pointer to neighbor element.
 
void set (Element *el, size_t i)
 Set pointer to neighbor element.
 
void setNode (size_t i, Node *node)
 Assign a node given by its pointer as the i-th node of side.
 
void setOnBoundary ()
 Say that the side is on the boundary.
 
int getShape () const
 Return side's shape.
 
size_t getLabel () const
 Return label of side.
 
size_t n () const
 Return label of side.
 
size_t getNbNodes () const
 Return number of side nodes.
 
size_t getNbVertices () const
 Return number of side vertices.
 
size_t getNbEq () const
 Return number of side equations.
 
size_t getNbDOF () const
 Return number of DOF.
 
int getCode (size_t dof=1) const
 Return code for a given DOF of node.
 
size_t getDOF (size_t i) const
 Return label of i-th dof.
 
size_t getFirstDOF () const
 Return label of first dof of node.
 
NodegetPtrNode (size_t i) const
 Return pointer to node of local label i.
 
Nodeoperator() (size_t i) const
 Operator ().
 
size_t getNodeLabel (size_t i) const
 Return global label of node with given local label.
 
ElementgetNeighborElement (size_t i) const
 Return pointer to i-th side neighboring element.
 
ElementgetOtherNeighborElement (Element *el) const
 Return pointer to other neighboring element than given one.
 
Point< real_t > getNormal () const
 Return normal vector to side.
 
Point< real_t > getUnitNormal () const
 Return unit normal vector to side.
 
int isOnBoundary () const
 Boundary side or not.
 
int isReferenced ()
 Say if side has a nonzero code or not.
 
real_t getMeasure () const
 Return measure of side.
 
Point< real_t > getCenter () const
 Return coordinates of center of side.
 
size_t Contains (const Node *nd) const
 Say if a given node belongs to current side.
 
void setActive (bool opt=true)
 Set side is active (default) or not if argument is false
 
bool isActive () const
 Return true or false whether side is active or not.
 
int getLevel () const
 Return side level Side level increases when side is refined (starting from 0). If the level is 0, then the element has no father.
 
void setChild (Side *sd)
 Assign side as child of current one and assign current side as father.
 
SidegetParent () const
 Return pointer to parent side Return null if no parent.
 
SidegetChild (size_t i) const
 Return pointer to i-th child side Returns null pointer is no childs.
 
size_t getNbChilds () const
 Return number of children of side.
 

Detailed Description

To store and treat finite element sides (edges in 2-D or faces in 3-D)

Defines a side of a finite element mesh. The sides are given in particular by their shapes and a list of nodes. Each node can be accessed by the member function getPtrNode(). The string defining the element shape must be chosen according to the following list:

Shape Shape name Dimension Min. number of nodes Line line 3 2 Triangle tria 3 3 Quadrilateral quad 3 4

Author
Rachid Touzani

Member Enumeration Documentation

◆ SideType

enum SideType

To select side type (boundary side or not).

Enumerator
INTERNAL_SIDE 

Internal side

EXTERNAL_BOUNDARY 

Side on external boundary

INTERNAL_BOUNDARY 

Side on internal boundary

Constructor & Destructor Documentation

◆ Side() [1/2]

Side ( size_t  label,
const string &  shape 
)

Constructor initializing side label and shape.

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

◆ Side() [2/2]

Side ( size_t  label,
int  shape 
)

Constructor initializing side label and shape.

Parameters
[in]labelto assign to side.
[in]shapeof side (See enum ElementShape in Mesh).

Member Function Documentation

◆ Add()

void Add ( Element el)

Set pointer to neighbor element.

Parameters
[in]elPointer to element to add as a neigbor element
Remarks
This function adds the pointer el only if this one is not a null pointer

◆ Contains()

size_t Contains ( const Node nd) const

Say if a given node belongs to current side.

Parameters
[in]ndPointer to searched node
Returns
index (local label) of node if found, 0 if not

◆ DOF()

void DOF ( size_t  i,
size_t  dof 
)

Define label of DOF.

Parameters
[in]iDOF index
[in]dofIts label

◆ getCode()

int getCode ( size_t  dof = 1) const

Return code for a given DOF of node.

Parameters
[in]dofLocal label of degree of freedom. [Default: 1]

◆ getMeasure()

real_t getMeasure ( ) const

Return measure of side.

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

◆ getNeighborElement()

Element * getNeighborElement ( size_t  i) const

Return pointer to i-th side neighboring element.

Parameters
[in]iLocal label of neighbor element (must be equal to 1 or 2).

◆ getNormal()

Point< real_t > getNormal ( ) const

Return normal vector to side.

The normal vector is oriented from the first neighbor element to the second one.

Warning
The norm of this vector is equal to the measure of the side (length of the edge in 2-D and area of the face in 3-D), and To get the unit normal, use rather the member function getUnitNormal.

◆ getOtherNeighborElement()

Element * getOtherNeighborElement ( Element el) const

Return pointer to other neighboring element than given one.

Parameters
[in]elPointer to a given neighbor element
Remarks
If the side is on the boundary this function returns null pointer

◆ getUnitNormal()

Point< real_t > getUnitNormal ( ) const

Return unit normal vector to side.

The unit normal vector is oriented from the first neighbor element to the second one.

Remarks
The norm of this vector is equal to one.

◆ isOnBoundary()

int isOnBoundary ( ) const

Boundary side or not.

Returns 1 or -1 if side is on boundary Depending on whether the first or the second neighbor element is defined Returns 0 if side is an inner one

Remarks
This member function is valid only if member function Mesh::getAllSides() or Mesh::getBoundarySides() has been called before.

◆ operator()()

Node * operator() ( size_t  i) const

Operator ().

Return pointer to node of local label i.

◆ set()

void set ( Element el,
size_t  i 
)

Set pointer to neighbor element.

Parameters
[in]elPointer to element to set as a neighbor element
[in]iLocal number of neighbor element
Remarks
This function differs from the Add by the fact that the local label of neighbor element is given

◆ setChild()

void setChild ( Side sd)

Assign side as child of current one and assign current side as father.

This function is principally used when refining is invoked (e.g. for mesh adaption)

Parameters
[in]sdPointer to side to assign

◆ setCode()

void setCode ( size_t  dof,
int  code 
)

Assign code to a DOF.

Parameters
[in]dofDOF to which code is assigned
[in]codeCode to assign

◆ setDOF()

void setDOF ( size_t &  first_dof,
size_t  nb_dof 
)

Define number of DOF.

Parameters
[in,out]first_dofLabel of the first DOF in input that is actualized
[in]nb_dofNumber of DOF