PTEMS  0.1.0-dev+git.81fd0e4
PolyTopic Element Method Solver
ptems::Polytope< DIM > Class Template Reference

Class for specifying indices of vertices for defining a DIM-dimensional polytope. More...

#include <ptems/polytope.hpp>

Public Member Functions

 Polytope ()
 Creates an empty polytope. More...
 
template<typename It >
 Polytope (It begin, It end)
 Creates a polytope from a list of (DIM-1)-dimensional polytopes denoting the faces of this polytope. More...
 
 Polytope (std::set< Polytope< DIM-1 >> &&faces)
 Creates a polytope from a list of DIM-1 dimensional polytopes denoting the faces of this polytope. More...
 
 Polytope (const std::initializer_list< Polytope< DIM-1 >> &faces)
 Creates a polytope from a list of DIM-1 dimensional polytopes denoting the faces of this polytope. More...
 
void AddFace (Polytope< DIM-1 > &&face)
 Adds a face to the polytope. More...
 
void AddFace (const Polytope< DIM-1 > &face)
 Adds a face to the polytope. More...
 
template<typename... ARGS>
void AddFace (const ARGS &... face)
 Adds a face to the polytope by in-place construction. More...
 
const std::set< Polytope< DIM-1 > > Faces () const
 Gets a list of the faces in the polytope. More...
 
template<typename V >
bool Validate ([[maybe_unused]] const V &vertexList) const
 Checks if the polytope defines a valid polytope. More...
 
int Compare (const Polytope &rhs) const
 Compares this polytope to the specified polytope with strict ordering. More...
 

Related Functions

(Note that these are not member functions.)

template<std::size_t DIM>
bool operator== (const Polytope< DIM > &lhs, const Polytope< DIM > &rhs)
 Checks if the specified polytopes are equivalent (same faces) More...
 
template<std::size_t DIM>
bool operator!= (const Polytope< DIM > &lhs, const Polytope< DIM > &rhs)
 Checks if the specified polytopes are not equivalent (different faces) More...
 
template<std::size_t DIM>
bool operator< (const Polytope< DIM > &lhs, const Polytope< DIM > &rhs)
 Less than operator for strict ordering of polytopes. More...
 
template<std::size_t DIM>
bool operator<= (const Polytope< DIM > &lhs, const Polytope< DIM > &rhs)
 Less than or equal operator for strict ordering of polytopes. More...
 
template<std::size_t DIM>
bool operator> (const Polytope< DIM > &lhs, const Polytope< DIM > &rhs)
 Greater than operator for strict ordering of polytopes. More...
 
template<std::size_t DIM>
bool operator>= (const Polytope< DIM > &lhs, const Polytope< DIM > &rhs)
 Greater than or equal operator for strict ordering of polytopes. More...
 
Polytope< 3 > CreateTetrahedron (std::size_t p1, std::size_t p2, std::size_t p3, std::size_t apex)
 Creates a polytope for a tetrahedron element. More...
 
Polytope< 3 > CreatePyramid (std::size_t p1, std::size_t p2, std::size_t p3, std::size_t p4, std::size_t apex)
 Creates a polytope for a pyramid element. More...
 
Polytope< 3 > CreateHexahedron (std::size_t p1, std::size_t p2, std::size_t p3, std::size_t p4, std::size_t p5, std::size_t p6, std::size_t p7, std::size_t p8)
 Creates a polytope for a hexahedron element. More...
 
Polytope< 3 > CreatePrism (std::size_t p1, std::size_t p2, std::size_t p3, std::size_t p4, std::size_t p5, std::size_t p6)
 Creates a polytope for a triangular prism element. More...
 
Polytope< 3 > CreatePolygonalPrism (const std::initializer_list< std::size_t > &points)
 Creates a polytope for a polygon extruded as a prism. More...
 
template<typename... T>
Polytope< 3 > CreatePolygonalPrism (std::size_t p1, T... pN)
 Creates a polytope for a polygon extruded as a prism. More...
 
Polytope< 3 > CreatePolygonalPyramid (const std::initializer_list< std::size_t > &points)
 Creates a polytope for a pyramid by extending polygon to a point. More...
 
template<typename... T>
Polytope< 3 > CreatePolygonalPyramid (std::size_t p1, T... pN)
 Creates a polytope for a pyramid by extending polygon to a point. More...
 

Detailed Description

template<std::size_t DIM>
class ptems::Polytope< DIM >

Class for specifying indices of vertices for defining a DIM-dimensional polytope.

Template Parameters
Dimensionof the polytope

Constructor & Destructor Documentation

◆ Polytope() [1/4]

template<std::size_t DIM>
ptems::Polytope< DIM >::Polytope ( )
inline

Creates an empty polytope.

◆ Polytope() [2/4]

template<std::size_t DIM>
template<typename It >
ptems::Polytope< DIM >::Polytope ( It  begin,
It  end 
)
inline

Creates a polytope from a list of (DIM-1)-dimensional polytopes denoting the faces of this polytope.

Template Parameters
ItThe type of the iterator over the list of faces
Parameters
beginThe begin iterator to the list of faces
endThe end iterator to the list of faces

◆ Polytope() [3/4]

template<std::size_t DIM>
ptems::Polytope< DIM >::Polytope ( std::set< Polytope< DIM-1 >> &&  faces)
inline

Creates a polytope from a list of DIM-1 dimensional polytopes denoting the faces of this polytope.

Parameters
facesList (set) of faces

◆ Polytope() [4/4]

template<std::size_t DIM>
ptems::Polytope< DIM >::Polytope ( const std::initializer_list< Polytope< DIM-1 >> &  faces)
inline

Creates a polytope from a list of DIM-1 dimensional polytopes denoting the faces of this polytope.

Parameters
facesList of faces

Member Function Documentation

◆ AddFace() [1/3]

template<std::size_t DIM>
template<typename... ARGS>
void ptems::Polytope< DIM >::AddFace ( const ARGS &...  face)
inline

Adds a face to the polytope by in-place construction.

Parameters
faceList of arguments to Polytope<DIM-1> constructor for the polytope defining the face

◆ AddFace() [2/3]

template<std::size_t DIM>
void ptems::Polytope< DIM >::AddFace ( const Polytope< DIM-1 > &  face)
inline

Adds a face to the polytope.

Parameters
faceThe face to add to the polytope

◆ AddFace() [3/3]

template<std::size_t DIM>
void ptems::Polytope< DIM >::AddFace ( Polytope< DIM-1 > &&  face)
inline

Adds a face to the polytope.

Parameters
faceThe face to add to the polytope

◆ Compare()

template<std::size_t DIM>
int ptems::Polytope< DIM >::Compare ( const Polytope< DIM > &  rhs) const
inline

Compares this polytope to the specified polytope with strict ordering.

Parameters
rhsThe right hand polytope to compare to
Returns
0 if this polytope is equal to rhs; -1 if in the ordered list of subfaces the first "different" subface polytope for this is less than the rhs (or this has less subfaces than rhs but all faces are equal upto that point); 1 this polytope is greater than rhs (opposite to -1).

◆ Faces()

template<std::size_t DIM>
const std::set<Polytope<DIM-1> > ptems::Polytope< DIM >::Faces ( ) const
inline

Gets a list of the faces in the polytope.

◆ Validate()

template<std::size_t DIM>
template<typename V >
bool ptems::Polytope< DIM >::Validate ( [[maybe_unused] ] const V &  vertexList) const
inline

Checks if the polytope defines a valid polytope.

This check does not need to be complete (returning true does not guarantee a valid polytope), but at least the following conditions should be met:

  • At least DIM+1 faces
  • Each face of a face of this polytope appears exactly twice (shared between exactly two faces).
  • Each face also returns true for Validate(vertexList)
  • Two dimensional (sub)faces are planar

This SHOULD guarantee a closed polytope, but no guarantee about simplicity

Template Parameters
VType of vertex list - must be indexable
Parameters
vertexListList of vertices to look up the polytope vertices in
Returns
true if valid; false otherwise

Friends And Related Function Documentation

◆ CreateHexahedron()

template<std::size_t DIM>
Polytope< 3 > CreateHexahedron ( std::size_t  p1,
std::size_t  p2,
std::size_t  p3,
std::size_t  p4,
std::size_t  p5,
std::size_t  p6,
std::size_t  p7,
std::size_t  p8 
)
related

Creates a polytope for a hexahedron element.

Parameters
p1,p2,p3,p4The points of base of the hexahedron in CCW order (viewed from the top)
p5,p6,p7,p8The points of top of the hexahedron in CCW order (viewed from the top)

<3>

◆ CreatePolygonalPrism() [1/2]

template<std::size_t DIM>
Polytope< 3 > CreatePolygonalPrism ( const std::initializer_list< std::size_t > &  points)
related

Creates a polytope for a polygon extruded as a prism.

Exceptions
std::invalid_argumentIf number of points is odd or less than 6
Parameters
pointsList of points defining the prism. The first half of the points define the base polygon of the prism and the second half of the points define the top polygon of the prism, both in CCW order (viewed from the top)

<3>

◆ CreatePolygonalPrism() [2/2]

template<typename... T>
Polytope< 3 > CreatePolygonalPrism ( std::size_t  p1,
T...  pN 
)
related

Creates a polytope for a polygon extruded as a prism.

Template Parameters
TShould be convertible to std::size_t
Parameters
p1,pNList of points defining the prism. The first half of the points define the base polygon of the prism and the second half of the points define the top polygon of the prism, both in CCW order (viewed from the top)

<3>

◆ CreatePolygonalPyramid() [1/2]

template<std::size_t DIM>
Polytope< 3 > CreatePolygonalPyramid ( const std::initializer_list< std::size_t > &  points)
related

Creates a polytope for a pyramid by extending polygon to a point.

Exceptions
std::invalid_argumentIf number of points is less than 4
Parameters
pointsList of points defining the prism. The last point denotes the apex of the pyramid, the rest denote the points of the base of the pyramid in CCW order (viewed from the top)

<3>

◆ CreatePolygonalPyramid() [2/2]

template<typename... T>
Polytope< 3 > CreatePolygonalPyramid ( std::size_t  p1,
T...  pN 
)
related

Creates a polytope for a pyramid by extending polygon to a point.

Template Parameters
TShould be convertible to std::size_t
Parameters
p1,pNList of points defining the prism. The last point denotes the apex of the pyramid, the rest denote the points of the base of the pyramid in CCW order (viewed from the top)

<3>

◆ CreatePrism()

template<std::size_t DIM>
Polytope< 3 > CreatePrism ( std::size_t  p1,
std::size_t  p2,
std::size_t  p3,
std::size_t  p4,
std::size_t  p5,
std::size_t  p6 
)
related

Creates a polytope for a triangular prism element.

Parameters
p1,p2,p3The points of base triangle of the prism in CCW order (viewed from the top)
p4,p5,p6The points of top triangle of the prism in CCW order (viewed from the top)

<3>

◆ CreatePyramid()

template<std::size_t DIM>
Polytope< 3 > CreatePyramid ( std::size_t  p1,
std::size_t  p2,
std::size_t  p3,
std::size_t  p4,
std::size_t  apex 
)
related

Creates a polytope for a pyramid element.

Parameters
p1,p2,p3,p4The base points of the pyramid in CCW order (viewed from the top)
apexThe apex point

<3>

◆ CreateTetrahedron()

template<std::size_t DIM>
Polytope< 3 > CreateTetrahedron ( std::size_t  p1,
std::size_t  p2,
std::size_t  p3,
std::size_t  apex 
)
related

Creates a polytope for a tetrahedron element.

Parameters
p1,p2,p3The base points of the tetrahedon in CCW order (viewed from the top)
apexThe apex point

<3>

◆ operator!=()

template<std::size_t DIM>
bool operator!= ( const Polytope< DIM > &  lhs,
const Polytope< DIM > &  rhs 
)
related

Checks if the specified polytopes are not equivalent (different faces)

Returns
true if not equivalent; false otherwise

◆ operator<()

template<std::size_t DIM>
bool operator< ( const Polytope< DIM > &  lhs,
const Polytope< DIM > &  rhs 
)
related

Less than operator for strict ordering of polytopes.

Returns
lhs.Compare(rhs) < 0

◆ operator<=()

template<std::size_t DIM>
bool operator<= ( const Polytope< DIM > &  lhs,
const Polytope< DIM > &  rhs 
)
related

Less than or equal operator for strict ordering of polytopes.

Returns
lhs.Compare(rhs) <= 0

◆ operator==()

template<std::size_t DIM>
bool operator== ( const Polytope< DIM > &  lhs,
const Polytope< DIM > &  rhs 
)
related

Checks if the specified polytopes are equivalent (same faces)

Returns
true if equivalent; false otherwise

◆ operator>()

template<std::size_t DIM>
bool operator> ( const Polytope< DIM > &  lhs,
const Polytope< DIM > &  rhs 
)
related

Greater than operator for strict ordering of polytopes.

Returns
lhs.Compare(rhs) > 0

◆ operator>=()

template<std::size_t DIM>
bool operator>= ( const Polytope< DIM > &  lhs,
const Polytope< DIM > &  rhs 
)
related

Greater than or equal operator for strict ordering of polytopes.

Returns
lhs.Compare(rhs) >= 0

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