Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
vulpes::fe::FeValues< Dim > Class Template Reference

This class works as a cache table for computing efficiently the value of the basis function and its derivatives for each cell. More...

#include <fe_values.hpp>

Classes

struct  ReferenceTables
 Reference-frame tables written by evalOnReferenceFrame. More...

Public Types

using real_t = double
using index_t = int32_t
using PhysicalQPts = Eigen::Matrix<real_t, Dim, -1>
using FeValuesScalar = Eigen::Matrix<real_t, -1, -1>
using FeValuesGrad = Eigen::Matrix<Eigen::Vector<real_t, Dim>, -1, -1>
using QuadtratureWeigths = Eigen::Vector<real_t, -1>

Public Member Functions

constexpr const auto & getShapeEval () const
constexpr const auto & getGradEval () const
constexpr const auto & weights () const
constexpr auto & weights ()
constexpr const auto & qpts () const
constexpr auto & qpts ()
constexpr const auto & weightsRef () const
constexpr auto & weightsRef ()
constexpr const auto & qptsRef () const
constexpr auto & qptsRef ()
constexpr const void * tabulatedBasis () const
 Basis tabulated by the last evalOnReferenceFrame, to compare by address.
constexpr std::uint64_t stamp () const
void setStampEnabled (bool enabled)
constexpr const Eigen::Vector< real_t, Dim > & getFaceNormal () const
void setFaceNormal (const Eigen::Vector< real_t, Dim > &normal)
constexpr bool hasFaceNeigh () const
void setHasFaceNeigh (bool has_neigh)
index_t getCellId () const
void setCellId (index_t cell_id)
real_t basisScaling () const
 sqrt(det J) of the cell mapping, the factor scaled bases are divided by
void setBasisScaling (real_t scaling)
index_t getFaceId () const
void setFaceId (index_t face_id)
template<typename FloatType, typename Polynomial>
void evalOnReferenceFrame (const std::vector< Polynomial > &basis, const qrule::QuadratureRule< FloatType, Dim > &qrule)
 Compute and cache the evaluation of the basis on the quadrature points passed as argument. This is usually called just once with quadrature points mapped on the reference cell.
void saveReferenceFrame (ReferenceTables &tables) const
 Copies the reference-frame tables of the last evalOnReferenceFrame.
void loadReferenceFrame (const ReferenceTables &tables)
template<typename MappingType>
void evalAndApplyMapping (const MappingType &mapping, UpdateFlagsType flags)
 Update the local cache values on the physical element by passing the mapping and a flag signaling which values to update (e.g., gradients, quadrature points, ...).
void createNeighValues ()
auto & neighValues ()
const auto & neighValues () const

Protected Member Functions

void resizeTables (int64_t basis_size, int64_t nodes_size)
template<typename FloatType, typename Polynomial>
void evalSparseBasis (const std::vector< Polynomial > &basis, const qrule::QuadratureRule< FloatType, Dim > &qrule)

Static Protected Member Functions

static std::uint64_t nextStamp ()

Protected Attributes

FeValuesScalar m_scalar_shapes
FeValuesGrad m_grads_shapes
PhysicalQPts m_physical_qpts
QuadtratureWeigths m_quadrature_weights
Eigen::Vector< real_t, Dim > m_face_normal
bool m_face_has_neigh
index_t m_cell_id
real_t m_basis_scaling = 1.0
index_t m_face_id
FeValuesScalar m_scalar_shapes_ref
FeValuesGrad m_grads_shapes_ref
PhysicalQPts m_physical_qpts_ref
QuadtratureWeigths m_quadrature_weights_ref
const void * m_tabulated_basis = nullptr
std::uint64_t m_stamp = 0
bool m_stamp_enabled = false
std::vector< double > m_pow_table
std::unique_ptr< FeValues< Dim > > m_fe_values_neigh

Detailed Description

template<std::size_t Dim>
class vulpes::fe::FeValues< Dim >

This class works as a cache table for computing efficiently the value of the basis function and its derivatives for each cell.

The values of the basis function and its derivatives are saved for the reference element (when calling evalOnReferenceFrame) and the then they are updated for each cell (when calling evalAndApplyMapping). Computing the values on the reference cell is usually expensive since the polynomial of the basis function is saved in arbitrary precision. The update is usually fast and involves computing some properties of the mapping function. We minimize the computations by indicating what needs an update using UpdateFlags.

In DG elements it happens that a cell needs the values of the neighbour. To accommodate this necessity the class owns a pointer to the FeValues of the neighbour.

Member Typedef Documentation

◆ FeValuesGrad

template<std::size_t Dim>
using vulpes::fe::FeValues< Dim >::FeValuesGrad = Eigen::Matrix<Eigen::Vector<real_t, Dim>, -1, -1>

◆ FeValuesScalar

template<std::size_t Dim>
using vulpes::fe::FeValues< Dim >::FeValuesScalar = Eigen::Matrix<real_t, -1, -1>

◆ index_t

template<std::size_t Dim>
using vulpes::fe::FeValues< Dim >::index_t = int32_t

◆ PhysicalQPts

template<std::size_t Dim>
using vulpes::fe::FeValues< Dim >::PhysicalQPts = Eigen::Matrix<real_t, Dim, -1>

◆ QuadtratureWeigths

template<std::size_t Dim>
using vulpes::fe::FeValues< Dim >::QuadtratureWeigths = Eigen::Vector<real_t, -1>

◆ real_t

template<std::size_t Dim>
using vulpes::fe::FeValues< Dim >::real_t = double

Member Function Documentation

◆ basisScaling()

template<std::size_t Dim>
real_t vulpes::fe::FeValues< Dim >::basisScaling ( ) const
inline

sqrt(det J) of the cell mapping, the factor scaled bases are divided by

◆ createNeighValues()

template<std::size_t Dim>
void vulpes::fe::FeValues< Dim >::createNeighValues ( )
inline

◆ evalAndApplyMapping()

template<std::size_t Dim>
template<typename MappingType>
void vulpes::fe::FeValues< Dim >::evalAndApplyMapping ( const MappingType & mapping,
UpdateFlagsType flags )
inline

Update the local cache values on the physical element by passing the mapping and a flag signaling which values to update (e.g., gradients, quadrature points, ...).

◆ evalOnReferenceFrame()

template<std::size_t Dim>
template<typename FloatType, typename Polynomial>
void vulpes::fe::FeValues< Dim >::evalOnReferenceFrame ( const std::vector< Polynomial > & basis,
const qrule::QuadratureRule< FloatType, Dim > & qrule )
inline

Compute and cache the evaluation of the basis on the quadrature points passed as argument. This is usually called just once with quadrature points mapped on the reference cell.

◆ evalSparseBasis()

template<std::size_t Dim>
template<typename FloatType, typename Polynomial>
void vulpes::fe::FeValues< Dim >::evalSparseBasis ( const std::vector< Polynomial > & basis,
const qrule::QuadratureRule< FloatType, Dim > & qrule )
inlineprotected

◆ getCellId()

template<std::size_t Dim>
index_t vulpes::fe::FeValues< Dim >::getCellId ( ) const
inline

◆ getFaceId()

template<std::size_t Dim>
index_t vulpes::fe::FeValues< Dim >::getFaceId ( ) const
inline

◆ getFaceNormal()

template<std::size_t Dim>
const Eigen::Vector< real_t, Dim > & vulpes::fe::FeValues< Dim >::getFaceNormal ( ) const
inlineconstexpr

◆ getGradEval()

template<std::size_t Dim>
const auto & vulpes::fe::FeValues< Dim >::getGradEval ( ) const
inlineconstexpr

◆ getShapeEval()

template<std::size_t Dim>
const auto & vulpes::fe::FeValues< Dim >::getShapeEval ( ) const
inlineconstexpr

◆ hasFaceNeigh()

template<std::size_t Dim>
bool vulpes::fe::FeValues< Dim >::hasFaceNeigh ( ) const
inlineconstexpr

◆ loadReferenceFrame()

template<std::size_t Dim>
void vulpes::fe::FeValues< Dim >::loadReferenceFrame ( const ReferenceTables & tables)
inline

Restores tables saved by saveReferenceFrame, with the same effect as the evalOnReferenceFrame call that produced them.

◆ neighValues() [1/2]

template<std::size_t Dim>
auto & vulpes::fe::FeValues< Dim >::neighValues ( )
inline

◆ neighValues() [2/2]

template<std::size_t Dim>
const auto & vulpes::fe::FeValues< Dim >::neighValues ( ) const
inline

◆ nextStamp()

template<std::size_t Dim>
std::uint64_t vulpes::fe::FeValues< Dim >::nextStamp ( )
inlinestaticprotected

◆ qpts() [1/2]

template<std::size_t Dim>
auto & vulpes::fe::FeValues< Dim >::qpts ( )
inlineconstexpr

◆ qpts() [2/2]

template<std::size_t Dim>
const auto & vulpes::fe::FeValues< Dim >::qpts ( ) const
inlineconstexpr

◆ qptsRef() [1/2]

template<std::size_t Dim>
auto & vulpes::fe::FeValues< Dim >::qptsRef ( )
inlineconstexpr

◆ qptsRef() [2/2]

template<std::size_t Dim>
const auto & vulpes::fe::FeValues< Dim >::qptsRef ( ) const
inlineconstexpr

◆ resizeTables()

template<std::size_t Dim>
void vulpes::fe::FeValues< Dim >::resizeTables ( int64_t basis_size,
int64_t nodes_size )
inlineprotected

◆ saveReferenceFrame()

template<std::size_t Dim>
void vulpes::fe::FeValues< Dim >::saveReferenceFrame ( ReferenceTables & tables) const
inline

Copies the reference-frame tables of the last evalOnReferenceFrame.

◆ setBasisScaling()

template<std::size_t Dim>
void vulpes::fe::FeValues< Dim >::setBasisScaling ( real_t scaling)
inline

◆ setCellId()

template<std::size_t Dim>
void vulpes::fe::FeValues< Dim >::setCellId ( index_t cell_id)
inline

◆ setFaceId()

template<std::size_t Dim>
void vulpes::fe::FeValues< Dim >::setFaceId ( index_t face_id)
inline

◆ setFaceNormal()

template<std::size_t Dim>
void vulpes::fe::FeValues< Dim >::setFaceNormal ( const Eigen::Vector< real_t, Dim > & normal)
inline

◆ setHasFaceNeigh()

template<std::size_t Dim>
void vulpes::fe::FeValues< Dim >::setHasFaceNeigh ( bool has_neigh)
inline

◆ setStampEnabled()

template<std::size_t Dim>
void vulpes::fe::FeValues< Dim >::setStampEnabled ( bool enabled)
inline

Enables stamp() here and on the neighbour values. Projected fields then reuse their values while the stamp is unchanged, so enable it only where their vectors cannot change in between, as integrators do for their own FeValues (every integrate() changes the stamp).

◆ stamp()

template<std::size_t Dim>
std::uint64_t vulpes::fe::FeValues< Dim >::stamp ( ) const
inlineconstexpr

Changes with the cell, the basis scaling (fields projected on scaled bases are divided by it) and every evalOnReferenceFrame, loadReferenceFrame and evalAndApplyMapping, taking the next value of a counter shared by all FeValues<Dim>. It does not follow writes through the non-const accessors, nor changes of the vectors behind projected fields. Zero unless enabled with setStampEnabled.

◆ tabulatedBasis()

template<std::size_t Dim>
const void * vulpes::fe::FeValues< Dim >::tabulatedBasis ( ) const
inlineconstexpr

Basis tabulated by the last evalOnReferenceFrame, to compare by address.

◆ weights() [1/2]

template<std::size_t Dim>
auto & vulpes::fe::FeValues< Dim >::weights ( )
inlineconstexpr

◆ weights() [2/2]

template<std::size_t Dim>
const auto & vulpes::fe::FeValues< Dim >::weights ( ) const
inlineconstexpr

◆ weightsRef() [1/2]

template<std::size_t Dim>
auto & vulpes::fe::FeValues< Dim >::weightsRef ( )
inlineconstexpr

◆ weightsRef() [2/2]

template<std::size_t Dim>
const auto & vulpes::fe::FeValues< Dim >::weightsRef ( ) const
inlineconstexpr

Member Data Documentation

◆ m_basis_scaling

template<std::size_t Dim>
real_t vulpes::fe::FeValues< Dim >::m_basis_scaling = 1.0
protected

◆ m_cell_id

template<std::size_t Dim>
index_t vulpes::fe::FeValues< Dim >::m_cell_id
protected

◆ m_face_has_neigh

template<std::size_t Dim>
bool vulpes::fe::FeValues< Dim >::m_face_has_neigh
protected

◆ m_face_id

template<std::size_t Dim>
index_t vulpes::fe::FeValues< Dim >::m_face_id
protected

◆ m_face_normal

template<std::size_t Dim>
Eigen::Vector<real_t, Dim> vulpes::fe::FeValues< Dim >::m_face_normal
protected

◆ m_fe_values_neigh

template<std::size_t Dim>
std::unique_ptr<FeValues<Dim> > vulpes::fe::FeValues< Dim >::m_fe_values_neigh
protected

◆ m_grads_shapes

template<std::size_t Dim>
FeValuesGrad vulpes::fe::FeValues< Dim >::m_grads_shapes
protected

◆ m_grads_shapes_ref

template<std::size_t Dim>
FeValuesGrad vulpes::fe::FeValues< Dim >::m_grads_shapes_ref
protected

◆ m_physical_qpts

template<std::size_t Dim>
PhysicalQPts vulpes::fe::FeValues< Dim >::m_physical_qpts
protected

◆ m_physical_qpts_ref

template<std::size_t Dim>
PhysicalQPts vulpes::fe::FeValues< Dim >::m_physical_qpts_ref
protected

◆ m_pow_table

template<std::size_t Dim>
std::vector<double> vulpes::fe::FeValues< Dim >::m_pow_table
protected

◆ m_quadrature_weights

template<std::size_t Dim>
QuadtratureWeigths vulpes::fe::FeValues< Dim >::m_quadrature_weights
protected

◆ m_quadrature_weights_ref

template<std::size_t Dim>
QuadtratureWeigths vulpes::fe::FeValues< Dim >::m_quadrature_weights_ref
protected

◆ m_scalar_shapes

template<std::size_t Dim>
FeValuesScalar vulpes::fe::FeValues< Dim >::m_scalar_shapes
protected

◆ m_scalar_shapes_ref

template<std::size_t Dim>
FeValuesScalar vulpes::fe::FeValues< Dim >::m_scalar_shapes_ref
protected

◆ m_stamp

template<std::size_t Dim>
std::uint64_t vulpes::fe::FeValues< Dim >::m_stamp = 0
protected

◆ m_stamp_enabled

template<std::size_t Dim>
bool vulpes::fe::FeValues< Dim >::m_stamp_enabled = false
protected

◆ m_tabulated_basis

template<std::size_t Dim>
const void* vulpes::fe::FeValues< Dim >::m_tabulated_basis = nullptr
protected

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