The Element class provides an interface for defining elements. More...
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 ReferenceElementInfo & | getInfo () 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 |
Element & | operator= (const Element &other) |
Element & | operator= (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 | |
OBinaryStream & | operator<<) (OBinaryStream &buf, const Element &element) |
IBinaryStream & | operator>>) (IBinaryStream &buf, Element &element) |
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.
bitpit::Element::Element | ( | ) |
Default constructor.
Definition at line 325 of file element.cpp.
bitpit::Element::Element | ( | long | id, |
ElementType | type, | ||
int | connectSize = 0 ) |
Creates a new element.
id | is the id that will be assigned to the element |
type | is the type of the element |
connectSize | is 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.
bitpit::Element::Element | ( | long | id, |
ElementType | type, | ||
std::unique_ptr< long[]> && | connectStorage ) |
Creates a new element.
id | is the id that will be assigned to the element |
type | is the type of the element |
connectStorage | is the storage the contains or will contain the connectivity of the element |
Definition at line 351 of file element.cpp.
bitpit::Element::Element | ( | const Element & | other | ) |
Copy constructor
other | is another element whose content is copied in this element |
Definition at line 361 of file element.cpp.
double bitpit::Element::evalArea | ( | const std::array< double, 3 > * | coordinates | ) | const |
Evaluates the area of the element.
coordinates | are the coordinate of the vertices |
Definition at line 1685 of file element.cpp.
std::array< double, 3 > bitpit::Element::evalCentroid | ( | const std::array< double, 3 > * | coordinates | ) | const |
Evaluates the centroid of the element.
coordinates | are the coordinate of the vertices |
Definition at line 1521 of file element.cpp.
double bitpit::Element::evalLength | ( | const std::array< double, 3 > * | coordinates | ) | const |
Evaluates the length of the element.
coordinates | are the coordinate of the vertices |
Definition at line 1724 of file element.cpp.
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.
coordinates | are the coordinate of the vertices |
orientation | is 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) |
point | are the element reference coordinates of the point where the normal should be evaluated |
Definition at line 1759 of file element.cpp.
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.
[in] | point | is the point |
coordinates | are the coordinate of the vertices |
Definition at line 1828 of file element.cpp.
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.
point | is the point | |
coordinates | are the coordinate of the vertices | |
[out] | projection | on output contains the projection point |
[out] | distance | on output contains the distance between the point and the projection |
Definition at line 1846 of file element.cpp.
double bitpit::Element::evalSize | ( | const std::array< double, 3 > * | coordinates | ) | const |
Evaluates the characteristics size of the element.
coordinates | are the coordinate of the vertices |
Definition at line 1549 of file element.cpp.
double bitpit::Element::evalVolume | ( | const std::array< double, 3 > * | coordinates | ) | const |
Evaluates the volume of the element.
coordinates | are the coordinate of the vertices |
Definition at line 1646 of file element.cpp.
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.
vertexId | is the vertex id |
Definition at line 1302 of file element.cpp.
unsigned int bitpit::Element::getBinarySize | ( | ) | const |
Returns the buffer size required to communicate cell data
Definition at line 2144 of file element.cpp.
long * bitpit::Element::getConnect | ( | ) |
Gets the vertex connectivity of the element.
Definition at line 619 of file element.cpp.
const long * bitpit::Element::getConnect | ( | ) | const |
Gets the vertex connectivity of the element.
Definition at line 609 of file element.cpp.
int bitpit::Element::getConnectSize | ( | ) | const |
Gets the size of the connectivity of the element.
Definition at line 629 of file element.cpp.
int bitpit::Element::getDimension | ( | ) | const |
Gets the dimension of the element.
Definition at line 1119 of file element.cpp.
|
static |
Gets the dimension of the element.
type | the type of the element |
Definition at line 1096 of file element.cpp.
ConstProxyVector< long > bitpit::Element::getEdgeConnect | ( | int | edge | ) | const |
Gets the connectivity of the specified edge of the element.
edge | is the edge for which the connectivity is reqested |
Definition at line 1052 of file element.cpp.
int bitpit::Element::getEdgeCount | ( | ) | const |
Gets the number of edges of the element.
Definition at line 922 of file element.cpp.
ConstProxyVector< int > bitpit::Element::getEdgeLocalConnect | ( | int | edge | ) | const |
Gets the local connectivity of the specified edge of the element.
edge | is the edge for which the connectivity is reqested |
Definition at line 994 of file element.cpp.
ConstProxyVector< int > bitpit::Element::getEdgeLocalVertexIds | ( | int | edge | ) | const |
Gets the list of local vertex ids for the specified edge of the element.
edge | is the edge for which the vertex ids is reqested |
Definition at line 1437 of file element.cpp.
ElementType bitpit::Element::getEdgeType | ( | int | edge | ) | const |
Gets the type of the specified edge of the element.
Definition at line 955 of file element.cpp.
int bitpit::Element::getEdgeVertexCount | ( | int | edge | ) | const |
Gets the number of vertices of the specified edge.
edge | is the edge for which the number of vertices is requested |
Definition at line 981 of file element.cpp.
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.
edge | is the edge for which the vertex id is reqested |
vertex | is the local index of the vertex |
Definition at line 1424 of file element.cpp.
ConstProxyVector< long > bitpit::Element::getEdgeVertexIds | ( | int | edge | ) | const |
Gets the list of vertex ids for the specified edge of the element.
edge | is the edge for which the vertex ids is reqested |
Definition at line 1410 of file element.cpp.
ConstProxyVector< long > bitpit::Element::getFaceConnect | ( | int | face | ) | const |
Gets the connectivity of the specified face of the element.
face | is the face for which the connectivity is reqested |
Definition at line 848 of file element.cpp.
int bitpit::Element::getFaceCount | ( | ) | const |
Gets the number of faces of the element.
Definition at line 678 of file element.cpp.
ConstProxyVector< int > bitpit::Element::getFaceLocalConnect | ( | int | face | ) | const |
Gets the local connectivity of the specified face of the element.
face | is the face for which the connectivity is reqested |
Definition at line 773 of file element.cpp.
ConstProxyVector< int > bitpit::Element::getFaceLocalVertexIds | ( | int | face | ) | const |
Gets the list of local vertex ids for the specified face of the element.
face | is the face for which the vertex ids is reqested |
Definition at line 1372 of file element.cpp.
std::vector< long > bitpit::Element::getFaceStream | ( | ) | const |
Gets the face stream that describes the element.
Definition at line 1982 of file element.cpp.
|
static |
Gets the position of the specified face in the face stream.
connectivity | is the the connectivity |
face | is the face |
Definition at line 2047 of file element.cpp.
int bitpit::Element::getFaceStreamPosition | ( | int | face | ) | const |
Gets the position of the specified face in the face stream.
face | is the face |
Definition at line 2035 of file element.cpp.
int bitpit::Element::getFaceStreamSize | ( | ) | const |
Gets the size of the face stream that describes the element.
Definition at line 1969 of file element.cpp.
ElementType bitpit::Element::getFaceType | ( | int | face | ) | const |
Gets the face type of the specified face of the element.
Definition at line 701 of file element.cpp.
int bitpit::Element::getFaceVertexCount | ( | int | face | ) | const |
Gets the number of vertices of the specified face.
face | is the face for which the number of vertices is requested |
Definition at line 743 of file element.cpp.
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.
face | is the face for which the vertex id is reqested |
vertex | is the local index of the vertex |
Definition at line 1343 of file element.cpp.
ConstProxyVector< long > bitpit::Element::getFaceVertexIds | ( | int | face | ) | const |
Gets the list of vertex ids for the specified face of the element.
face | is the face for which the vertex ids is reqested |
Definition at line 1320 of file element.cpp.
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.
Definition at line 510 of file element.cpp.
const ReferenceElementInfo & bitpit::Element::getInfo | ( | ) | const |
Gets the basic information of the element.
Definition at line 531 of file element.cpp.
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.
Definition at line 581 of file element.cpp.
ElementType bitpit::Element::getType | ( | ) | const |
int bitpit::Element::getVertexCount | ( | ) | const |
Gets the number of vertices of the element.
Definition at line 1152 of file element.cpp.
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.
vertex | is the local index of the vertex |
Definition at line 1269 of file element.cpp.
ConstProxyVector< long > bitpit::Element::getVertexIds | ( | ) | const |
Gets the list of the vertex ids.
Definition at line 1181 of file element.cpp.
|
static |
Gets the list of the vertex ids.
type | is the type of the element |
connectivity | is the the connectivity of the element |
Definition at line 1193 of file element.cpp.
bool bitpit::Element::hasInfo | ( | ) | const |
Check if the element is associated to a reference element.
Definition at line 521 of file element.cpp.
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.
other | is the other element |
Definition at line 655 of file element.cpp.
void bitpit::Element::initialize | ( | long | id, |
ElementType | type, | ||
int | connectSize = 0 ) |
Initializes the data structures of the element.
id | the id of the element |
type | the type of the element |
connectSize | is 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.
void bitpit::Element::initialize | ( | long | id, |
ElementType | type, | ||
std::unique_ptr< long[]> && | connectStorage ) |
Initializes the data structures of the element.
id | the id of the element |
type | the type of the element |
connectStorage | is the storage the contains or will contain the connectivity of the element |
Definition at line 428 of file element.cpp.
bool bitpit::Element::isThreeDimensional | ( | ) | const |
Returns true if the element is a three-dimensional element.
Definition at line 1142 of file element.cpp.
|
static |
Returns true if the element is a three-dimensional element.
type | the type of the element |
Definition at line 1131 of file element.cpp.
Copy-assignament operator.
other | is another element whose content is copied in this element |
Definition at line 384 of file element.cpp.
|
static |
Renumber the vertices of the specified face stream according to the given map.
map | is the vertex map |
faceStream | is the face stream to be renumbered |
Definition at line 2012 of file element.cpp.
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.
map | is the map that will be used for the renumbering |
Definition at line 1451 of file element.cpp.
void bitpit::Element::setConnect | ( | std::unique_ptr< long[]> && | connect | ) |
Sets the vertex connectivity of the element.
connect | a pointer to the connectivity of the element |
Definition at line 591 of file element.cpp.
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.
id | the id that identifies the element |
Definition at line 498 of file element.cpp.
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.
pid | is the part id associated to the element. |
Definition at line 566 of file element.cpp.
void bitpit::Element::setType | ( | ElementType | type | ) |
|
noexcept |
Exchanges the content of the element by the content the specified other element.
other | is another element whose content is swapped with that of this element |
Definition at line 399 of file element.cpp.
void bitpit::Element::unsetConnect | ( | ) |
Unsets the vertex connectivity of the element.
Definition at line 599 of file element.cpp.
|
static |
Definition at line 155 of file element.hpp.