Caribou
Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
caribou::topology::Mesh< WorldDimension, MatrixType > Class Template Reference
Inheritance diagram for caribou::topology::Mesh< WorldDimension, MatrixType >:
caribou::topology::BaseMesh

Public Types

using PositionsContainer = MatrixType
 
using Real = typename PositionsContainer::Scalar
 
using WorldCoordinates = Eigen::Matrix< Real, 1, Dimension >
 
template<typename Element , typename NodeIndex = UNSIGNED_INTEGER_TYPE>
using Domain = Domain< Mesh< Dimension, MatrixType >, Element, NodeIndex >
 

Public Member Functions

 Mesh ()=default
 
virtual ~Mesh ()=default
 
 Mesh (const std::vector< WorldCoordinates > &positions)
 Construct the unstructured mesh with a set of point positions from a position vector. More...
 
 Mesh (const MatrixType &positions)
 Construct the unstructured mesh with an Eigen matrix containing the position vector (NxD with N nodes of D world dimension). More...
 
template<typename EigenDerived >
 Mesh (const EigenDerived *positions)
 Construct the unstructured mesh with an Eigen matrix containing the position vector (NxD with N nodes of D world dimension) More...
 
 Mesh (const Mesh &other)
 
 Mesh (Mesh &&other) noexcept
 
auto operator= (Mesh other) noexcept -> Mesh &
 
auto dimension () const -> UNSIGNED_INTEGER_TYPE final
 
auto number_of_domains () const -> UNSIGNED_INTEGER_TYPE final
 
auto number_of_nodes () const -> UNSIGNED_INTEGER_TYPE final
 
auto domains () const -> std::vector< std::pair< std::string, const BaseDomain * >>
 
auto domain (const UNSIGNED_INTEGER_TYPE &i) const -> const BaseDomain *
 
auto domain (const std::string &name) const -> const BaseDomain *
 
template<typename Element , typename NodeIndex , typename... Args>
std::enable_if_t< std::is_integral_v< NodeIndex >, Domain< Element, NodeIndex > * > add_domain (const std::string &name, Args ...args)
 
template<typename Element , typename NodeIndex , typename... Args>
std::enable_if_t< std::is_integral_v< NodeIndex >, Domain< Element, NodeIndex > * > add_domain (Args ...args)
 
template<typename Element , typename... Args>
auto add_domain (const std::string &name, Args ...args) -> Domain< Element > *
 
template<typename Element , typename... Args>
auto add_domain (const char *name, Args ...args) -> Domain< Element > *
 
template<typename Element , typename... Args>
auto add_domain (Args ...args) -> Domain< Element > *
 
auto remove_domain (const std::string &name) -> bool
 
auto remove (const BaseDomain *domain) -> bool
 
auto position (UNSIGNED_INTEGER_TYPE index) const
 
template<typename IntegerType , std::size_t N>
auto positions (const IntegerType(&indices)[N]) const
 
template<typename IntegerType , std::size_t N>
auto positions (const std::array< IntegerType, N > &indices) const
 
template<typename IntegerType >
auto positions (const std::vector< IntegerType > &indices) const
 
template<typename EigenDerived >
auto positions (const Eigen::EigenBase< EigenDerived > &indices) const
 

Static Public Attributes

static constexpr INTEGER_TYPE Dimension = WorldDimension
 

Friends

void swap (Mesh &first, Mesh &second) noexcept
 

Constructor & Destructor Documentation

◆ Mesh() [1/6]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
caribou::topology::Mesh< WorldDimension, MatrixType >::Mesh ( )
default

Default constructor for an empty mesh.

◆ ~Mesh()

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
virtual caribou::topology::Mesh< WorldDimension, MatrixType >::~Mesh ( )
virtualdefault

Virtual default destructor

◆ Mesh() [2/6]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
caribou::topology::Mesh< WorldDimension, MatrixType >::Mesh ( const std::vector< WorldCoordinates > &  positions)
inlineexplicit

Construct the unstructured mesh with a set of point positions from a position vector.

Parameters
positions
Note
A copy of the full position vector is made.

◆ Mesh() [3/6]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
caribou::topology::Mesh< WorldDimension, MatrixType >::Mesh ( const MatrixType &  positions)
inlineexplicit

Construct the unstructured mesh with an Eigen matrix containing the position vector (NxD with N nodes of D world dimension).

Note
A copy of the full position vector is made.

◆ Mesh() [4/6]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
template<typename EigenDerived >
caribou::topology::Mesh< WorldDimension, MatrixType >::Mesh ( const EigenDerived *  positions)
inlineexplicit

Construct the unstructured mesh with an Eigen matrix containing the position vector (NxD with N nodes of D world dimension)

Note
Reference to the position vector is stored, no copy made.

◆ Mesh() [5/6]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
caribou::topology::Mesh< WorldDimension, MatrixType >::Mesh ( const Mesh< WorldDimension, MatrixType > &  other)
inline

Copy constructor

◆ Mesh() [6/6]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
caribou::topology::Mesh< WorldDimension, MatrixType >::Mesh ( Mesh< WorldDimension, MatrixType > &&  other)
inlinenoexcept

Move constructor

Member Function Documentation

◆ add_domain() [1/5]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
template<typename Element , typename NodeIndex , typename... Args>
std::enable_if_t<std::is_integral_v<NodeIndex>, Domain<Element, NodeIndex> *> caribou::topology::Mesh< WorldDimension, MatrixType >::add_domain ( Args ...  args)
inline

Adds a domain with the Element type supplied as a template parameter.

Template Parameters
ElementThe type of Element
NodeIndexThe integer type for stored node indices
Returns
A pointer to the newly created domain, or null if the creation failed
Note
The domain is managed by this mesh instance, and will be freed upon the deletion of the mesh.

◆ add_domain() [2/5]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
template<typename Element , typename... Args>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::add_domain ( Args ...  args) -> Domain<Element> *
inline

Adds a domain with the Element type supplied as a template parameter.

Template Parameters
ElementThe type of Element
Returns
A pointer to the newly created domain, or null if the creation failed
Note
The domain is managed by this mesh instance, and will be freed upon the deletion of the mesh.

◆ add_domain() [3/5]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
template<typename Element , typename... Args>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::add_domain ( const char *  name,
Args ...  args 
) -> Domain<Element> *
inline

Adds a domain with the Element type supplied as a template parameter.

Template Parameters
ElementThe type of Element
Parameters
name
Returns
A pointer to the newly created domain, or null if the creation failed
Note
The domain is managed by this mesh instance, and will be freed upon the deletion of the mesh.

◆ add_domain() [4/5]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
template<typename Element , typename NodeIndex , typename... Args>
std::enable_if_t<std::is_integral_v<NodeIndex>, Domain<Element, NodeIndex> *> caribou::topology::Mesh< WorldDimension, MatrixType >::add_domain ( const std::string &  name,
Args ...  args 
)
inline

Adds a domain with the Element type supplied as a template parameter.

Template Parameters
ElementThe type of Element
Parameters
name
Returns
A pointer to the newly created domain, or null if the creation failed
Note
The domain is managed by this mesh instance, and will be freed upon the deletion of the mesh.

◆ add_domain() [5/5]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
template<typename Element , typename... Args>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::add_domain ( const std::string &  name,
Args ...  args 
) -> Domain<Element> *
inline

Adds a domain with the Element type supplied as a template parameter.

Template Parameters
ElementThe type of Element
Parameters
name
Returns
A pointer to the newly created domain, or null if the creation failed
Note
The domain is managed by this mesh instance, and will be freed upon the deletion of the mesh.

◆ dimension()

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::dimension ( ) const -> UNSIGNED_INTEGER_TYPE
inlinefinalvirtual

Get the dimension of the mesh, ie, the number of coordinates of a point.

Implements caribou::topology::BaseMesh.

◆ domain() [1/2]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::domain ( const std::string &  name) const -> const BaseDomain *
inline

Get a domain of the mesh from its name. Returns null if no domain has the given name.

◆ domain() [2/2]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::domain ( const UNSIGNED_INTEGER_TYPE &  i) const -> const BaseDomain *
inline

Get the ith domain of the mesh. /note Undefined behavior is found if the given index is outside the size of domains in the mesh

◆ domains()

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::domains ( ) const -> std::vector<std::pair<std::string, const BaseDomain *>>
inline

Get the list of domains of the mesh.

◆ number_of_domains()

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::number_of_domains ( ) const -> UNSIGNED_INTEGER_TYPE
inlinefinalvirtual

Get the number of domains of the mesh.

Implements caribou::topology::BaseMesh.

◆ number_of_nodes()

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::number_of_nodes ( ) const -> UNSIGNED_INTEGER_TYPE
inlinefinalvirtual

Get the number of nodes of the mesh.

Implements caribou::topology::BaseMesh.

◆ operator=()

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::operator= ( Mesh< WorldDimension, MatrixType >  other) -> Mesh &
inlinenoexcept

copy-and-swap assigment (valid for both copy and move assigment)

◆ position()

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::position ( UNSIGNED_INTEGER_TYPE  index) const
inline

Get the position coordinates of a node from its index.

◆ positions() [1/4]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
template<typename EigenDerived >
auto caribou::topology::Mesh< WorldDimension, MatrixType >::positions ( const Eigen::EigenBase< EigenDerived > &  indices) const
inline

Get an array of positions from the given indices.

Template Parameters
EigenDerivedThe type of Eigen matrix/array containing the indices.
Parameters
indices[IN] he indices from which the positions array will be filled
Returns
The position coordinates of every nodes queried as an Eigen dense matrix.

Example:

using Nodes = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, Dimension, Eigen::RowMajor>;
Eigen::VectorXi indices(2);
indices << 55, 62;
Nodes positions = mesh.positions(indices);
auto p55 = positions.row(0); // Position vector of the node id 55

◆ positions() [2/4]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
template<typename IntegerType , std::size_t N>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::positions ( const IntegerType(&)  indices[N]) const
inline

Get an array of positions from the given indices.

Template Parameters
IntegerTypeInteger type of the indices passed
Parameters
indices[IN] The indices from which the positions array will be filled
Returns
The position coordinates of every nodes queried as an Eigen dense matrix.

Example:

using Nodes = Eigen::Matrix<FLOATING_POINT_TYPE, 2, Dimension, Eigen::RowMajor>;
Nodes positions = mesh.positions({55, 62});
auto p55 = positions.row(0); // Position vector of the node id 55

◆ positions() [3/4]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
template<typename IntegerType , std::size_t N>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::positions ( const std::array< IntegerType, N > &  indices) const
inline

Get an array of positions from the given indices.

Template Parameters
IntegerTypeInteger type of the indices passed
Parameters
indices[IN] The indices from which the positions array will be filled
Returns
The position coordinates of every nodes queried as an Eigen dense matrix.

Example:

using Nodes = Eigen::Matrix<FLOATING_POINT_TYPE, 2, Dimension, Eigen::RowMajor>;
std::array<int, 2> indices = {55, 62};
Nodes positions = mesh.positions(indices);
auto p55 = positions.row(0); // Position vector of the node id 55

◆ positions() [4/4]

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
template<typename IntegerType >
auto caribou::topology::Mesh< WorldDimension, MatrixType >::positions ( const std::vector< IntegerType > &  indices) const
inline

Get an array of positions from the given indices.

Template Parameters
IntegerTypeInteger type of the indices passed
Parameters
indices[IN] he indices from which the positions array will be filled
Returns
The position coordinates of every nodes queried as an Eigen dense matrix.

Example:

using Nodes = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, Dimension, Eigen::RowMajor>;
std::vector<int> indices = {55, 62};
Nodes positions = mesh.positions(indices);
auto p55 = positions.row(0); // Position vector of the node id 55

◆ remove()

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::remove ( const BaseDomain domain) -> bool
inline

Remove and destruct a domain of the mesh.

Parameters
domainPointer to the domain to remove.
Returns
bool True on success, false otherwise

◆ remove_domain()

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
auto caribou::topology::Mesh< WorldDimension, MatrixType >::remove_domain ( const std::string &  name) -> bool
inline

Remove and destruct a domain of the mesh.

Parameters
nameName of the domain
Returns
bool True on success, false otherwise

Friends And Related Function Documentation

◆ swap

template<UNSIGNED_INTEGER_TYPE WorldDimension, typename MatrixType = Eigen::Matrix<FLOATING_POINT_TYPE, Eigen::Dynamic, WorldDimension, (WorldDimension>1?Eigen::RowMajor:Eigen::ColMajor)>>
void swap ( Mesh< WorldDimension, MatrixType > &  first,
Mesh< WorldDimension, MatrixType > &  second 
)
friend

Swap the data of two meshes


The documentation for this class was generated from the following file:
caribou::topology::Mesh::positions
auto positions(const IntegerType(&indices)[N]) const
Definition: Mesh.h:309