Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
bitpit::Element Class Reference

The Element class provides an interface for defining elements. More...

Inheritance diagram for bitpit::Element:
Inheritance graph
[legend]

Classes

struct  IdHasher
 

Public Member Functions

 Element ()
 
 Element (const Element &other)
 
 Element (Element &&other)=default
 
 Element (long id, ElementType type, int connectSize=0)
 
 Element (long id, ElementType type, std::unique_ptr< long[]> &&connectStorage)
 
double evalArea (const std::array< double, 3 > *coordinates) const
 
std::array< double, 3 > evalCentroid (const std::array< double, 3 > *coordinates) const
 
double evalLength (const std::array< double, 3 > *coordinates) const
 
std::array< double, 3 > evalNormal (const std::array< double, 3 > *coordinates, const std::array< double, 3 > &orientation={{0., 0., 1.}}, const std::array< double, 3 > &point={{0.5, 0.5, 0.5}}) const
 
double evalPointDistance (const std::array< double, 3 > &point, const std::array< double, 3 > *coordinates) const
 
void evalPointProjection (const std::array< double, 3 > &point, const std::array< double, 3 > *coordinates, std::array< double, 3 > *projection, double *distance) const
 
double evalSize (const std::array< double, 3 > *coordinates) const
 
double evalVolume (const std::array< double, 3 > *coordinates) const
 
int findVertex (long vertexId) const
 
unsigned int getBinarySize () const
 
long * getConnect ()
 
const long * getConnect () const
 
int getConnectSize () const
 
int getDimension () const
 
ConstProxyVector< long > getEdgeConnect (int edge) const
 
int getEdgeCount () const
 
ConstProxyVector< int > getEdgeLocalConnect (int edge) const
 
ConstProxyVector< int > getEdgeLocalVertexIds (int edge) const
 
ElementType getEdgeType (int edge) const
 
int getEdgeVertexCount (int edge) const
 
long getEdgeVertexId (int edge, int vertex) const
 
ConstProxyVector< long > getEdgeVertexIds (int edge) const
 
ConstProxyVector< long > getFaceConnect (int face) const
 
int getFaceCount () const
 
ConstProxyVector< int > getFaceLocalConnect (int face) const
 
ConstProxyVector< int > getFaceLocalVertexIds (int face) const
 
std::vector< long > getFaceStream () const
 
int getFaceStreamPosition (int face) const
 
int getFaceStreamSize () const
 
ElementType getFaceType (int face) const
 
int getFaceVertexCount (int face) const
 
long getFaceVertexId (int face, int vertex) const
 
ConstProxyVector< long > getFaceVertexIds (int face) const
 
long getId () const
 
const ReferenceElementInfogetInfo () const
 
int getPID () const
 
ElementType getType () const
 
int getVertexCount () const
 
long getVertexId (int vertex) const
 
ConstProxyVector< long > getVertexIds () const
 
bool hasInfo () const
 
bool hasSameConnect (const Element &other) const
 
void initialize (long id, ElementType type, int connectSize=0)
 
void initialize (long id, ElementType type, std::unique_ptr< long[]> &&connectStorage)
 
bool isThreeDimensional () const
 
Elementoperator= (const Element &other)
 
Elementoperator= (Element &&other)=default
 
int renumberVertices (const std::unordered_map< long, long > &map)
 
void setConnect (std::unique_ptr< long[]> &&connect)
 
void setId (long id)
 
void setPID (int pid)
 
void setType (ElementType type)
 
void swap (Element &other) noexcept
 
void unsetConnect ()
 

Static Public Member Functions

static int getDimension (ElementType type)
 
static int getFaceStreamPosition (const long *connectivity, int face)
 
static ConstProxyVector< long > getVertexIds (ElementType type, const long *connectivity)
 
static bool isThreeDimensional (ElementType type)
 
static void renumberFaceStream (const PiercedStorage< long, long > &map, std::vector< long > *faceStream)
 

Static Public Attributes

static BITPIT_PUBLIC_API const long NULL_ID = std::numeric_limits<long>::min()
 

Friends

OBinaryStreamoperator<<) (OBinaryStream &buf, const Element &element)
 
IBinaryStreamoperator>>) (IBinaryStream &buf, Element &element)
 

Detailed Description

The Element class provides an interface for defining elements.

Element is the base class for defining elements like cells and intefaces.

Definition at line 46 of file element.hpp.

Constructor & Destructor Documentation

◆ Element() [1/4]

bitpit::Element::Element ( )

Default constructor.

Definition at line 325 of file element.cpp.

◆ Element() [2/4]

bitpit::Element::Element ( long id,
ElementType type,
int connectSize = 0 )

Creates a new element.

Parameters
idis the id that will be assigned to the element
typeis the type of the element
connectSizeis the size of the connectivity, this is only used if the element is not associated to a reference element

Definition at line 338 of file element.cpp.

◆ Element() [3/4]

bitpit::Element::Element ( long id,
ElementType type,
std::unique_ptr< long[]> && connectStorage )

Creates a new element.

Parameters
idis the id that will be assigned to the element
typeis the type of the element
connectStorageis the storage the contains or will contain the connectivity of the element

Definition at line 351 of file element.cpp.

◆ Element() [4/4]

bitpit::Element::Element ( const Element & other)

Copy constructor

Parameters
otheris another element whose content is copied in this element

Definition at line 361 of file element.cpp.

Member Function Documentation

◆ evalArea()

double bitpit::Element::evalArea ( const std::array< double, 3 > * coordinates) const

Evaluates the area of the element.

Parameters
coordinatesare the coordinate of the vertices
Returns
The area of the specified element.

Definition at line 1685 of file element.cpp.

◆ evalCentroid()

std::array< double, 3 > bitpit::Element::evalCentroid ( const std::array< double, 3 > * coordinates) const

Evaluates the centroid of the element.

Parameters
coordinatesare the coordinate of the vertices
Returns
The centroid of the element.

Definition at line 1521 of file element.cpp.

◆ evalLength()

double bitpit::Element::evalLength ( const std::array< double, 3 > * coordinates) const

Evaluates the length of the element.

Parameters
coordinatesare the coordinate of the vertices
Returns
The length of the element.

Definition at line 1724 of file element.cpp.

◆ evalNormal()

std::array< double, 3 > bitpit::Element::evalNormal ( const std::array< double, 3 > * coordinates,
const std::array< double, 3 > & orientation = {{0., 0., 1.}},
const std::array< double, 3 > & point = {{0.5, 0.5, 0.5}} ) const

Evaluates the normal of an element.

Parameters
coordinatesare the coordinate of the vertices
orientationis a vector carring the additional information needed to un-ambigously define a normal to the element (e.g., when evaluating the normal of a one-dimensional element, this versor is perpendicular to the plane where the normal should lie)
pointare the element reference coordinates of the point where the normal should be evaluated
Returns
The normal of the element.

Definition at line 1759 of file element.cpp.

◆ evalPointDistance()

double bitpit::Element::evalPointDistance ( const std::array< double, 3 > & point,
const std::array< double, 3 > * coordinates ) const

Evaluates the distance between the element and the specified point.

Parameters
[in]pointis the point
coordinatesare the coordinate of the vertices
Returns
The distance between the element and the specified point.

Definition at line 1828 of file element.cpp.

◆ evalPointProjection()

void bitpit::Element::evalPointProjection ( const std::array< double, 3 > & point,
const std::array< double, 3 > * coordinates,
std::array< double, 3 > * projection,
double * distance ) const

Evaluates the projection of the point on the element.

Parameters
pointis the point
coordinatesare the coordinate of the vertices
[out]projectionon output contains the projection point
[out]distanceon output contains the distance between the point and the projection

Definition at line 1846 of file element.cpp.

◆ evalSize()

double bitpit::Element::evalSize ( const std::array< double, 3 > * coordinates) const

Evaluates the characteristics size of the element.

Parameters
coordinatesare the coordinate of the vertices
Returns
The characteristics size of the element.

Definition at line 1549 of file element.cpp.

◆ evalVolume()

double bitpit::Element::evalVolume ( const std::array< double, 3 > * coordinates) const

Evaluates the volume of the element.

Parameters
coordinatesare the coordinate of the vertices
Returns
The volume of the element.

Definition at line 1646 of file element.cpp.

◆ findVertex()

int bitpit::Element::findVertex ( long vertexId) const

Given the id of a vertex, evaluates thhe local index of that vertex within the element. If the specified vertex does not exist in the element connectivity list, a negative number is returned.

Parameters
vertexIdis the vertex id
Returns
The local index of the vertex if the element contains the vertex, a negative number otherwise.

Definition at line 1302 of file element.cpp.

◆ getBinarySize()

unsigned int bitpit::Element::getBinarySize ( ) const

Returns the buffer size required to communicate cell data

Returns
buffer size (in bytes)

Definition at line 2144 of file element.cpp.

◆ getConnect() [1/2]

long * bitpit::Element::getConnect ( )

Gets the vertex connectivity of the element.

Returns
A pointer to the connectivity of the element

Definition at line 619 of file element.cpp.

◆ getConnect() [2/2]

const long * bitpit::Element::getConnect ( ) const

Gets the vertex connectivity of the element.

Returns
A constant pointer to the connectivity of the element

Definition at line 609 of file element.cpp.

◆ getConnectSize()

int bitpit::Element::getConnectSize ( ) const

Gets the size of the connectivity of the element.

Returns
The size of the connectivity of the element.

Definition at line 629 of file element.cpp.

◆ getDimension() [1/2]

int bitpit::Element::getDimension ( ) const

Gets the dimension of the element.

Returns
The dimension of the element

Definition at line 1119 of file element.cpp.

◆ getDimension() [2/2]

int bitpit::Element::getDimension ( ElementType type)
static

Gets the dimension of the element.

Parameters
typethe type of the element
Returns
The dimension of the element

Definition at line 1096 of file element.cpp.

◆ getEdgeConnect()

ConstProxyVector< long > bitpit::Element::getEdgeConnect ( int edge) const

Gets the connectivity of the specified edge of the element.

Parameters
edgeis the edge for which the connectivity is reqested
Returns
The connectivity of the specified edge of the element.

Definition at line 1052 of file element.cpp.

◆ getEdgeCount()

int bitpit::Element::getEdgeCount ( ) const

Gets the number of edges of the element.

Returns
The number of edges of the element

Definition at line 922 of file element.cpp.

◆ getEdgeLocalConnect()

ConstProxyVector< int > bitpit::Element::getEdgeLocalConnect ( int edge) const

Gets the local connectivity of the specified edge of the element.

Parameters
edgeis the edge for which the connectivity is reqested
Returns
The local connectivity of the specified edge of the element.

Definition at line 994 of file element.cpp.

◆ getEdgeLocalVertexIds()

ConstProxyVector< int > bitpit::Element::getEdgeLocalVertexIds ( int edge) const

Gets the list of local vertex ids for the specified edge of the element.

Parameters
edgeis the edge for which the vertex ids is reqested
Returns
The list of local vertex ids for the specified edge of the element.

Definition at line 1437 of file element.cpp.

◆ getEdgeType()

ElementType bitpit::Element::getEdgeType ( int edge) const

Gets the type of the specified edge of the element.

Returns
The type of specified edge of the element

Definition at line 955 of file element.cpp.

◆ getEdgeVertexCount()

int bitpit::Element::getEdgeVertexCount ( int edge) const

Gets the number of vertices of the specified edge.

Parameters
edgeis the edge for which the number of vertices is requested
Returns
The number of vertices of the specified edge.

Definition at line 981 of file element.cpp.

◆ getEdgeVertexId()

long bitpit::Element::getEdgeVertexId ( int edge,
int vertex ) const

Gets the vertex id of the specified local vertex in the given edge of the element.

Parameters
edgeis the edge for which the vertex id is reqested
vertexis the local index of the vertex
Returns
The vertex id of the specified local vertex in the given edge of the element.

Definition at line 1424 of file element.cpp.

◆ getEdgeVertexIds()

ConstProxyVector< long > bitpit::Element::getEdgeVertexIds ( int edge) const

Gets the list of vertex ids for the specified edge of the element.

Parameters
edgeis the edge for which the vertex ids is reqested
Returns
The list of vertex ids for the specified edge of the element.

Definition at line 1410 of file element.cpp.

◆ getFaceConnect()

ConstProxyVector< long > bitpit::Element::getFaceConnect ( int face) const

Gets the connectivity of the specified face of the element.

Parameters
faceis the face for which the connectivity is reqested
Returns
The connectivity of the specified face of the element.

Definition at line 848 of file element.cpp.

◆ getFaceCount()

int bitpit::Element::getFaceCount ( ) const

Gets the number of faces of the element.

Returns
The number of faces of the element

Definition at line 678 of file element.cpp.

◆ getFaceLocalConnect()

ConstProxyVector< int > bitpit::Element::getFaceLocalConnect ( int face) const

Gets the local connectivity of the specified face of the element.

Parameters
faceis the face for which the connectivity is reqested
Returns
The local connectivity of the specified face of the element.

Definition at line 773 of file element.cpp.

◆ getFaceLocalVertexIds()

ConstProxyVector< int > bitpit::Element::getFaceLocalVertexIds ( int face) const

Gets the list of local vertex ids for the specified face of the element.

Parameters
faceis the face for which the vertex ids is reqested
Returns
The list of local vertex ids for the specified face of the element.

Definition at line 1372 of file element.cpp.

◆ getFaceStream()

std::vector< long > bitpit::Element::getFaceStream ( ) const

Gets the face stream that describes the element.

Returns
The face stream that describes the element.

Definition at line 1982 of file element.cpp.

◆ getFaceStreamPosition() [1/2]

int bitpit::Element::getFaceStreamPosition ( const long * connectivity,
int face )
static

Gets the position of the specified face in the face stream.

Parameters
connectivityis the the connectivity
faceis the face
Returns
The position of the specified face in the face stream.

Definition at line 2047 of file element.cpp.

◆ getFaceStreamPosition() [2/2]

int bitpit::Element::getFaceStreamPosition ( int face) const

Gets the position of the specified face in the face stream.

Parameters
faceis the face
Returns
The position of the specified face in the face stream.

Definition at line 2035 of file element.cpp.

◆ getFaceStreamSize()

int bitpit::Element::getFaceStreamSize ( ) const

Gets the size of the face stream that describes the element.

Returns
The size of the face stream that describes the element.

Definition at line 1969 of file element.cpp.

◆ getFaceType()

ElementType bitpit::Element::getFaceType ( int face) const

Gets the face type of the specified face of the element.

Returns
The face type of specified face of the element

Definition at line 701 of file element.cpp.

◆ getFaceVertexCount()

int bitpit::Element::getFaceVertexCount ( int face) const

Gets the number of vertices of the specified face.

Parameters
faceis the face for which the number of vertices is requested
Returns
The number of vertices of the specified face.

Definition at line 743 of file element.cpp.

◆ getFaceVertexId()

long bitpit::Element::getFaceVertexId ( int face,
int vertex ) const

Gets the vertex id of the specified local vertex in the given face of the element.

Parameters
faceis the face for which the vertex id is reqested
vertexis the local index of the vertex
Returns
The vertex id of the specified local vertex in the given face of the element.

Definition at line 1343 of file element.cpp.

◆ getFaceVertexIds()

ConstProxyVector< long > bitpit::Element::getFaceVertexIds ( int face) const

Gets the list of vertex ids for the specified face of the element.

Parameters
faceis the face for which the vertex ids is reqested
Returns
The list of vertex ids for the specified face of the element.

Definition at line 1320 of file element.cpp.

◆ getId()

long bitpit::Element::getId ( ) const

Gets the id that identifies the element.

This is the id that will be used by the PatchKernel class to identify the element.

Returns
The id that identifies the element.

Definition at line 510 of file element.cpp.

◆ getInfo()

const ReferenceElementInfo & bitpit::Element::getInfo ( ) const

Gets the basic information of the element.

Returns
A constant reference to the basic information of the element.

Definition at line 531 of file element.cpp.

◆ getPID()

int bitpit::Element::getPID ( ) const

Gets the part id associated with the element.

The part id is an arbitrary id that can be associated with the element. The part id value is not used by the Element class nor by the PatchKernel class, its purpose is to provide a way to group elements into categories. For example, part id can be used to associate a boundary condition to a boundary element.

Returns
The part id associated with the element.

Definition at line 581 of file element.cpp.

◆ getType()

ElementType bitpit::Element::getType ( ) const

Gets the element type.

Returns
The element type

Definition at line 551 of file element.cpp.

◆ getVertexCount()

int bitpit::Element::getVertexCount ( ) const

Gets the number of vertices of the element.

Returns
The number of vertices of the element

Definition at line 1152 of file element.cpp.

◆ getVertexId()

long bitpit::Element::getVertexId ( int vertex) const

Gets the vertex id of the specified local vertex.

If more than one vertex is needed, the function getVertexIds may be a better choice. This is specially true for polygons and polyhedra, where the whole list of vertex ids has to be evaluated at each function call.

Parameters
vertexis the local index of the vertex
Returns
The id of the specified vertex.

Definition at line 1269 of file element.cpp.

◆ getVertexIds() [1/2]

ConstProxyVector< long > bitpit::Element::getVertexIds ( ) const

Gets the list of the vertex ids.

Returns
The list of the vertex ids.

Definition at line 1181 of file element.cpp.

◆ getVertexIds() [2/2]

ConstProxyVector< long > bitpit::Element::getVertexIds ( ElementType type,
const long * connectivity )
static

Gets the list of the vertex ids.

Parameters
typeis the type of the element
connectivityis the the connectivity of the element
Returns
The list of the vertex ids.

Definition at line 1193 of file element.cpp.

◆ hasInfo()

bool bitpit::Element::hasInfo ( ) const

Check if the element is associated to a reference element.

Returns
Returns true if the element is associated to a reference element, false otherwise.

Definition at line 521 of file element.cpp.

◆ hasSameConnect()

bool bitpit::Element::hasSameConnect ( const Element & other) const

Checks if the connectivity of this element and the connectivity of the other element are the same.

Parameters
otheris the other element
Returns
True if the connectivity of this element and the connectivity of the other element are the same, false otherwise.

Definition at line 655 of file element.cpp.

◆ initialize() [1/2]

void bitpit::Element::initialize ( long id,
ElementType type,
int connectSize = 0 )

Initializes the data structures of the element.

Parameters
idthe id of the element
typethe type of the element
connectSizeis the size of the connectivity, this is only used if the element is not associated to a reference element

Definition at line 415 of file element.cpp.

◆ initialize() [2/2]

void bitpit::Element::initialize ( long id,
ElementType type,
std::unique_ptr< long[]> && connectStorage )

Initializes the data structures of the element.

Parameters
idthe id of the element
typethe type of the element
connectStorageis the storage the contains or will contain the connectivity of the element

Definition at line 428 of file element.cpp.

◆ isThreeDimensional() [1/2]

bool bitpit::Element::isThreeDimensional ( ) const

Returns true if the element is a three-dimensional element.

Returns
Returns true if the element is a three-dimensional element, false otherwise.

Definition at line 1142 of file element.cpp.

◆ isThreeDimensional() [2/2]

bool bitpit::Element::isThreeDimensional ( ElementType type)
static

Returns true if the element is a three-dimensional element.

Parameters
typethe type of the element
Returns
Returns true if the element is a three-dimensional element, false otherwise.

Definition at line 1131 of file element.cpp.

◆ operator=()

Element & bitpit::Element::operator= ( const Element & other)

Copy-assignament operator.

Parameters
otheris another element whose content is copied in this element

Definition at line 384 of file element.cpp.

◆ renumberFaceStream()

void bitpit::Element::renumberFaceStream ( const PiercedStorage< long, long > & map,
std::vector< long > * faceStream )
static

Renumber the vertices of the specified face stream according to the given map.

Parameters
mapis the vertex map
faceStreamis the face stream to be renumbered

Definition at line 2012 of file element.cpp.

◆ renumberVertices()

int bitpit::Element::renumberVertices ( const std::unordered_map< long, long > & map)

Renumber the vertices of a cell.

If the provided map doesn't contain the id of a vertex, its id will remain unchanged.

Parameters
mapis the map that will be used for the renumbering
Returns
The number of vertices that have been renumbered

Definition at line 1451 of file element.cpp.

◆ setConnect()

void bitpit::Element::setConnect ( std::unique_ptr< long[]> && connect)

Sets the vertex connectivity of the element.

Parameters
connecta pointer to the connectivity of the element

Definition at line 591 of file element.cpp.

◆ setId()

void bitpit::Element::setId ( long id)

Sets the id that identifies the element.

This is the id that will be used by the PatchKernel class to identify the element. It's up to the caller to guarantee that the provided id uniquely identifes the element.

Parameters
idthe id that identifies the element

Definition at line 498 of file element.cpp.

◆ setPID()

void bitpit::Element::setPID ( int pid)

Sets the part id associated to the element.

The part id is an arbitrary id that can be associated with the element. The part id value is not used by the Element class nor by the PatchKernel class, its purpose is to provide a way to group elements into categories. For example, part id can be used to associate a boundary condition to a boundary element.

Parameters
pidis the part id associated to the element.

Definition at line 566 of file element.cpp.

◆ setType()

void bitpit::Element::setType ( ElementType type)

Sets the element type.

Parameters
typethe element type

Definition at line 541 of file element.cpp.

◆ swap()

void bitpit::Element::swap ( Element & other)
noexcept

Exchanges the content of the element by the content the specified other element.

Parameters
otheris another element whose content is swapped with that of this element

Definition at line 399 of file element.cpp.

◆ unsetConnect()

void bitpit::Element::unsetConnect ( )

Unsets the vertex connectivity of the element.

Definition at line 599 of file element.cpp.

Member Data Documentation

◆ NULL_ID

const long bitpit::Element::NULL_ID = std::numeric_limits<long>::min()
static

Definition at line 155 of file element.hpp.


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