IFEM  90A354
Public Member Functions | Static Public Attributes | Protected Types | Protected Attributes | Private Attributes | List of all members
ElementBlock Class Reference

Class for storage of a standard FE grid block. More...

#include <ElementBlock.h>

Inheritance diagram for ElementBlock:
Inheritance graph
[legend]
Collaboration diagram for ElementBlock:
Collaboration graph
[legend]

Public Member Functions

 ElementBlock (size_t nenod=8)
 The constructor defines the number of nodes per element nenod.
 
virtual ~ElementBlock ()=default
 Empty destructor.
 
void resize (size_t nI, size_t nJ=1, size_t nK=1)
 Reallocates the internal arrays to fit a structured grid. More...
 
void unStructResize (size_t nEl, size_t nPts, size_t nMNPC=0)
 Reallocates the internal arrays to fit an unstructured grid. More...
 
bool setCoor (size_t i, size_t j, Real x)
 Defines the j'th coordinate of node i.
 
bool setCoor (size_t i, const Vec3 &X)
 Defines the coordinates of node i.
 
bool setCoor (size_t i, Real x, Real y, Real z)
 Defines the coordinates of node i.
 
bool setParams (size_t i, Real u, Real v, Real w=Real(0))
 Defines the parameter values for node i.
 
bool setNode (size_t i, int nodeNumb)
 Defines the global number of element node i.
 
bool endOfElm (size_t &i)
 Marks the end of current element for unstructured grids.
 
bool addLine (Real x1, Real y1, Real z1, Real x2, Real y2, Real z2)
 Adds a line element to the grid, assuming nen is equal to two.
 
size_t addLine (size_t i1, const Vec3 &X2, int elmId=-1)
 Adds a line element to the grid, assuming nen is equal to two. More...
 
void setElmId (size_t i, int iel)
 Assigns an external ID to an element.
 
int getElmId (size_t i) const
 Returns the external ID of an element.
 
size_t getElmIndex (size_t i) const
 Returns the internal index of an element in case of mixed types.
 
size_t getNoNodes () const
 Returns the total number of nodes in the block.
 
size_t getNoElms () const
 Returns the total number of elements in the block.
 
size_t getNoElmNodes () const
 Returns the number of nodes per element.
 
void setNoElmNodes (size_t nenod)
 Sets the number of nodes per element.
 
void merge (const ElementBlock *other, std::vector< int > &nodeNums, bool uniqNodes=true)
 Merges another element block into this one.
 
void merge (const ElementBlock &other, bool uniqNodes=true)
 Merges another element block into this one.
 
void transform (const Matrix &Tlg)
 Applies a transformation matrix from local to global system.
 
std::vector< Vec3 >::const_iterator begin_XYZ () const
 Returns the beginning of the coordinate array.
 
std::vector< Vec3 >::const_iterator end_XYZ () const
 Returns the end of the coordinate array.
 
const Vec3getCoord (size_t i) const
 Returns the coordinate of a given node.
 
const RealgetParam (size_t i) const
 Returns a pointer to the parameter values of a given node.
 
const int * getElements () const
 Returns a pointer to the element connectivity array.
 
bool getElements (std::vector< int > &mnpc, size_t nenod) const
 Get element connectivity array for elements with nenod nodes.
 
utl::Point getCenter (size_t i) const
 Returns the coordinates of the center of the given element.
 
void removeElement (int iel)
 Removes all elements with the specified external ID.
 

Static Public Attributes

static double eps = 0.0
 Element shrinkage factor.
 

Protected Types

using Prm3 = std::array< Real, 3 >
 Convenience type.
 

Protected Attributes

std::vector< Vec3coord
 Vector of nodal coordinates.
 
std::vector< Prm3param
 Vector of parameter values of the nodal points.
 
std::vector< int > MMNPC
 Matrix of Matrices of Nodal Point Correspondance.
 
std::vector< int > MINEX
 Matrix of Internal to External element numbers.
 
size_t nen
 Number of Element Nodes.
 

Private Attributes

std::vector< size_t > elmIdx
 Internal element order in case of mixed types.
 

Detailed Description

Class for storage of a standard FE grid block.

Member Function Documentation

◆ addLine()

size_t ElementBlock::addLine ( size_t  i1,
const Vec3 X2,
int  elmId = -1 
)

Adds a line element to the grid, assuming nen is equal to two.

Parameters
[in]i1Index of existing node to use as start point
[in]X2Coordinates of new node to use as end point
[in]elmIdExternal element ID (generate if negative)

References coord, MINEX, MMNPC, and nen.

◆ resize()

void ElementBlock::resize ( size_t  nI,
size_t  nJ = 1,
size_t  nK = 1 
)

Reallocates the internal arrays to fit a structured grid.

Parameters
[in]nINumber of nodes in I-direction
[in]nJNumber of nodes in J-direction
[in]nKNumber of nodes in K-direction

References coord, MINEX, MMNPC, nen, and param.

Referenced by CubeBlock::CubeBlock(), PlaneBlock::PlaneBlock(), ASMs1DLag::tesselate(), ASMs2DTri::tesselate(), ASMs1D::tesselate(), ASMs2D::tesselate(), and ASMs3D::tesselate().

◆ unStructResize()

void ElementBlock::unStructResize ( size_t  nEl,
size_t  nPts,
size_t  nMNPC = 0 
)

Reallocates the internal arrays to fit an unstructured grid.

Parameters
[in]nElNumber of elements
[in]nPtsNumber of nodes
[in]nMNPCTotal size of element connectivity array

References coord, MINEX, MMNPC, nen, and param.

Referenced by CylinderBlock::CylinderBlock(), SphereBlock::SphereBlock(), Hole2D::tesselate(), Oval2D::tesselate(), ASMsupel::tesselate(), ASMu1DLag::tesselate(), ASMu2DLag::tesselate(), ASMu2D::tesselate(), and ASMu3D::tesselate().


The documentation for this class was generated from the following files: