Caribou
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
caribou::topology::BarycentricContainer< Domain > Class Template Reference

Detailed Description

template<typename Domain>
class caribou::topology::BarycentricContainer< Domain >

The BarycentricContainer class allows to embed nodes into a container domain.

The embedded nodes do not need to match the nodes of the container domain. However, an embedded node must be found in exactly one of the element of the container, or at the boundary between elements (for example, an embedded node lying on a face between two elements of the container is valid). If an embedded node is lying outside of the container domain (ie is not located inside any of the container elements), the BarycentricContainer will ignore it. The list of ignored nodes can be retrieved.

Template Parameters
DomainThe type of the container domain.

#include <BarycentricContainer.h>

Classes

struct  BarycentricPoint
 A barycentric point is a structure that contains the element index and the local coordinates within that element of the point in the world space. More...
 

Public Types

using Mesh = typename Domain::MeshType
 
using ContainerElement = typename Domain::ElementType
 
using ElementIndex = INTEGER_TYPE
 
using LocalCoordinates = typename ContainerElement::LocalCoordinates
 
using WorldCoordinates = typename ContainerElement::WorldCoordinates
 
using HashGridT = HashGrid< ContainerElement >
 

Public Member Functions

 BarycentricContainer ()=delete
 Default constructor is not permitted.
 
template<typename Derived >
 BarycentricContainer (const Domain *container_domain, const Eigen::MatrixBase< Derived > &embedded_points)
 Construct the container from the given domain. More...
 
 BarycentricContainer (const Domain *container_domain)
 Construct the container from the given domain. More...
 
auto barycentric_point (const WorldCoordinates &p) const -> BarycentricPoint
 Get an element that contains the given point (in world coordinates) and its local coordinates within this element. More...
 
auto closest_elements (const WorldCoordinates &p) const -> std::vector< BarycentricPoint >
 Get the list of closest elements to a point and its barycentric coordinates within these elements.
 
template<typename Derived1 , typename Derived2 >
void interpolate (const Eigen::MatrixBase< Derived1 > &container_field_values, Eigen::MatrixBase< Derived2 > &embedded_field_values) const
 Interpolate a field (scalar or vector field) from the container domain to the embedded nodes. More...
 
auto barycentric_points () const -> const std::vector< BarycentricPoint > &
 Barycentric points of the embedded nodes. More...
 
auto outside_nodes () const -> const std::vector< UNSIGNED_INTEGER_TYPE > &
 Indices of nodes found outside of the domain (ie, nodes that were not found inside any container elements of the domain).
 

Static Public Attributes

static constexpr INTEGER_TYPE Dimension = ContainerElement::Dimension
 

Constructor & Destructor Documentation

◆ BarycentricContainer() [1/2]

template<typename Domain >
template<typename Derived >
caribou::topology::BarycentricContainer< Domain >::BarycentricContainer ( const Domain container_domain,
const Eigen::MatrixBase< Derived > &  embedded_points 
)
inline

Construct the container from the given domain.

This will create an HashGrid class instance to be able to quickly retrieve the container element of a given world position. The size of the HashGrid cells will be set to the mean size of the container elements.

This constructs the BarycentricContainer with a set of embedded points where the barycentric coordinates will be computed.

Template Parameters
DerivedNXD Eigen matrix representing the D dimensional coordinates of the N embedded positions.
Parameters
container_domainThe mesh domain that will contain the embedded meshes.
embedded_pointsThe positions (in world coordinates) embedded in the container mesh for which the barycentric points have to be found.

◆ BarycentricContainer() [2/2]

template<typename Domain >
caribou::topology::BarycentricContainer< Domain >::BarycentricContainer ( const Domain container_domain)
inlineexplicit

Construct the container from the given domain.

This will create an HashGrid class instance to be able to quickly retrieve the container element of a given world position. The size of the HashGrid cells will be set to the mean size of the container elements.

Parameters
container_domainThe mesh domain that will contain the embedded nodes.

Member Function Documentation

◆ barycentric_point()

template<typename Domain >
auto caribou::topology::BarycentricContainer< Domain >::barycentric_point ( const WorldCoordinates &  p) const -> BarycentricPoint
inline

Get an element that contains the given point (in world coordinates) and its local coordinates within this element.

Parameters
pThe queried point in world coordinates.
Returns
A pair where the first member is an element index within the containing domain, or -1 if the given point was not inside any elements. The second member returned by this method is the local coordinates of the point within the containing element. See BarycentricContainer::BarycentricPoint for more details.
Warning
If the given point lies directly between two or more elements (for example, if the point is on a face, an edge or a node of the domain), the first element found containing the point will be return.

◆ barycentric_points()

template<typename Domain >
auto caribou::topology::BarycentricContainer< Domain >::barycentric_points ( ) const -> const std::vector<BarycentricPoint> &
inline

Barycentric points of the embedded nodes.

See BarycentricContainer::BarycentricPoint for more details.

◆ interpolate()

template<typename Domain >
template<typename Derived1 , typename Derived2 >
void caribou::topology::BarycentricContainer< Domain >::interpolate ( const Eigen::MatrixBase< Derived1 > &  container_field_values,
Eigen::MatrixBase< Derived2 > &  embedded_field_values 
) const
inline

Interpolate a field (scalar or vector field) from the container domain to the embedded nodes.

This methods take an input field values (one value per node of the container mesh) and interpolate it onto the values of the embedded nodes (outputs one value per embedded node). Embedded nodes that are found outside of the containing domain (ie, no elements containing the node can be found) are ignored and their interpolated values won't be computed.

Template Parameters
Derived1The matrix (Eigen) type of the input field values.
Derived2The matrix (Eigen) type of the output field valuse.
Parameters
container_field_values[INPUT] The field values on every nodes of the container domain. This should be a matrix (Eigen) having one field value (scalar or vector) per rows. The number of rows should match the number of nodes of the container domain.
embedded_field_values[OUTPUT] The matrix (Eigen) where the interpolated field values should be written to. This should be a matrix (Eigen) having one field value (scalar or vector) per rows. The number of rows should match the number of embedded nodes.

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