PolyFEM
Loading...
Searching...
No Matches
polyfem::basis::ElementBases Class Reference

Stores the basis functions for a given element in a mesh (facet in 2d, cell in 3d). More...

#include <ElementBases.hpp>

Public Types

typedef std::function< Eigen::VectorXi(const int local_index, const mesh::Mesh &mesh)> LocalNodeFromPrimitiveFunc
 
typedef std::function< void(const Eigen::MatrixXd &uv, std::vector< assembler::AssemblyValues > &basis_values)> EvalBasesFunc
 
typedef std::function< void(quadrature::Quadrature &quadrature)> QuadratureFunction
 

Public Member Functions

Eigen::MatrixXd nodes () const
 Assemble the global nodal positions of the bases.
 
void compute_quadrature (quadrature::Quadrature &quadrature) const
 quadrature points to evaluate the basis functions inside the element
 
void compute_mass_quadrature (quadrature::Quadrature &quadrature) const
 
Eigen::VectorXi local_nodes_for_primitive (const int local_index, const mesh::Mesh &mesh) const
 
void eval_geom_mapping (const Eigen::MatrixXd &samples, Eigen::MatrixXd &mapped) const
 Map the sample positions in the parametric domain to the object domain (if the element has no parameterization, e.g.
 
void eval_geom_mapping_grads (const Eigen::MatrixXd &samples, std::vector< Eigen::MatrixXd > &grads) const
 Evaluate the gradients of the geometric mapping defined above.
 
bool is_complete () const
 Checks if all the bases are complete.
 
void set_quadrature (const QuadratureFunction &fun)
 
void set_mass_quadrature (const QuadratureFunction &fun)
 
void evaluate_bases (const Eigen::MatrixXd &uv, std::vector< assembler::AssemblyValues > &basis_values) const
 evaluate stored bases at given points on the reference element saves results to basis_values

 
void evaluate_grads (const Eigen::MatrixXd &uv, std::vector< assembler::AssemblyValues > &basis_values) const
 evaluate gradient of stored bases at given points on the reference element saves results to basis_values

 
void set_bases_func (EvalBasesFunc fun)
 
void set_grads_func (EvalBasesFunc fun)
 
void set_local_node_from_primitive_func (LocalNodeFromPrimitiveFunc fun)
 sets mapping from local nodes to global nodes
 

Public Attributes

std::vector< Basisbases
 one basis function per node in the element
 
bool has_parameterization = true
 

Private Member Functions

void evaluate_bases_default (const Eigen::MatrixXd &uv, std::vector< assembler::AssemblyValues > &basis_values) const
 default to simply calling the Basis evaluation functions
 
void evaluate_grads_default (const Eigen::MatrixXd &uv, std::vector< assembler::AssemblyValues > &basis_values) const
 

Private Attributes

EvalBasesFunc eval_bases_func_
 
EvalBasesFunc eval_grads_func_
 
QuadratureFunction quadrature_builder_
 
QuadratureFunction mass_quadrature_builder_
 
LocalNodeFromPrimitiveFunc local_node_from_primitive_
 

Friends

std::ostream & operator<< (std::ostream &os, const ElementBases &obj)
 

Detailed Description

Stores the basis functions for a given element in a mesh (facet in 2d, cell in 3d).

Definition at line 16 of file ElementBases.hpp.

Member Typedef Documentation

◆ EvalBasesFunc

typedef std::function<void(const Eigen::MatrixXd &uv, std::vector<assembler::AssemblyValues> &basis_values)> polyfem::basis::ElementBases::EvalBasesFunc

Definition at line 22 of file ElementBases.hpp.

◆ LocalNodeFromPrimitiveFunc

typedef std::function<Eigen::VectorXi(const int local_index, const mesh::Mesh &mesh)> polyfem::basis::ElementBases::LocalNodeFromPrimitiveFunc

Definition at line 19 of file ElementBases.hpp.

◆ QuadratureFunction

Definition at line 25 of file ElementBases.hpp.

Member Function Documentation

◆ compute_mass_quadrature()

void polyfem::basis::ElementBases::compute_mass_quadrature ( quadrature::Quadrature quadrature) const
inline

Definition at line 34 of file ElementBases.hpp.

References mass_quadrature_builder_, and quadrature.

Referenced by polyfem::assembler::AssemblyValsCache::compute().

Here is the caller graph for this function:

◆ compute_quadrature()

void polyfem::basis::ElementBases::compute_quadrature ( quadrature::Quadrature quadrature) const
inline

quadrature points to evaluate the basis functions inside the element

Definition at line 33 of file ElementBases.hpp.

References quadrature, and quadrature_builder_.

Referenced by polyfem::assembler::ElementAssemblyValues::compute(), and polyfem::assembler::ElementAssemblyValues::is_geom_mapping_positive().

Here is the caller graph for this function:

◆ eval_geom_mapping()

void polyfem::basis::ElementBases::eval_geom_mapping ( const Eigen::MatrixXd &  samples,
Eigen::MatrixXd &  mapped 
) const

Map the sample positions in the parametric domain to the object domain (if the element has no parameterization, e.g.

harmonic bases, then the parametric domain = object domain, and the mapping is identity)

Parameters
[in]samples#S x dim matrix of sample positions to evaluate
[out]mapped#S x dim matrix of mapped positions

Definition at line 19 of file ElementBases.cpp.

References bases, evaluate_bases(), polyfem::basis::Basis::global(), and has_parameterization.

Referenced by polyfem::assembler::MassMatrixAssembler::assemble_cross(), polyfem::solver::OperatorSplittingSolver::calculate_local_pts(), and polyfem::assembler::RhsAssembler::lsq_bc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ eval_geom_mapping_grads()

void polyfem::basis::ElementBases::eval_geom_mapping_grads ( const Eigen::MatrixXd &  samples,
std::vector< Eigen::MatrixXd > &  grads 
) const

Evaluate the gradients of the geometric mapping defined above.

Parameters
[in]samples#S x dim matrix of input sample positions
[out]grads#S list of dim x dim matrices of gradients

Definition at line 82 of file ElementBases.cpp.

References bases, evaluate_grads(), polyfem::basis::Basis::global(), and has_parameterization.

Referenced by polyfem::solver::OperatorSplittingSolver::calculate_local_pts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluate_bases()

void polyfem::basis::ElementBases::evaluate_bases ( const Eigen::MatrixXd &  uv,
std::vector< assembler::AssemblyValues > &  basis_values 
) const
inline

evaluate stored bases at given points on the reference element saves results to basis_values

Definition at line 71 of file ElementBases.hpp.

References eval_bases_func_, and evaluate_bases_default().

Referenced by polyfem::assembler::MassMatrixAssembler::assemble_cross(), polyfem::assembler::ElementAssemblyValues::compute(), eval_geom_mapping(), polyfem::io::Evaluator::interpolate_function(), and polyfem::assembler::RhsAssembler::lsq_bc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluate_bases_default()

void polyfem::basis::ElementBases::evaluate_bases_default ( const Eigen::MatrixXd &  uv,
std::vector< assembler::AssemblyValues > &  basis_values 
) const
private

default to simply calling the Basis evaluation functions

Definition at line 48 of file ElementBases.cpp.

References bases, and val.

Referenced by evaluate_bases().

Here is the caller graph for this function:

◆ evaluate_grads()

void polyfem::basis::ElementBases::evaluate_grads ( const Eigen::MatrixXd &  uv,
std::vector< assembler::AssemblyValues > &  basis_values 
) const
inline

evaluate gradient of stored bases at given points on the reference element saves results to basis_values

Definition at line 84 of file ElementBases.hpp.

References eval_grads_func_, and evaluate_grads_default().

Referenced by polyfem::assembler::ElementAssemblyValues::compute(), eval_geom_mapping_grads(), and polyfem::assembler::ElementAssemblyValues::is_geom_mapping_positive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluate_grads_default()

void polyfem::basis::ElementBases::evaluate_grads_default ( const Eigen::MatrixXd &  uv,
std::vector< assembler::AssemblyValues > &  basis_values 
) const
private

Definition at line 65 of file ElementBases.cpp.

References bases.

Referenced by evaluate_grads().

Here is the caller graph for this function:

◆ is_complete()

bool polyfem::basis::ElementBases::is_complete ( ) const

Checks if all the bases are complete.

Definition at line 9 of file ElementBases.cpp.

References bases.

◆ local_nodes_for_primitive()

Eigen::VectorXi polyfem::basis::ElementBases::local_nodes_for_primitive ( const int  local_index,
const mesh::Mesh mesh 
) const
inline

Definition at line 35 of file ElementBases.hpp.

References local_node_from_primitive_.

Referenced by polyfem::solver::LayerThicknessForm::build_collision_mesh(), polyfem::solver::ProxyContactForceForm::build_collision_mesh(), polyfem::assembler::RhsAssembler::compute_energy_hess(), polyfem::io::OutGeometryData::extract_boundary_mesh(), and polyfem::assembler::RhsAssembler::sample_bc().

Here is the caller graph for this function:

◆ nodes()

Eigen::MatrixXd polyfem::basis::ElementBases::nodes ( ) const

Assemble the global nodal positions of the bases.

Definition at line 134 of file ElementBases.cpp.

References bases.

Referenced by polyfem::assembler::MassMatrixAssembler::assemble_cross().

Here is the caller graph for this function:

◆ set_bases_func()

void polyfem::basis::ElementBases::set_bases_func ( EvalBasesFunc  fun)
inline

Definition at line 96 of file ElementBases.hpp.

References eval_bases_func_.

Referenced by polyfem::basis::PolygonalBasis2d::build_bases(), polyfem::basis::PolygonalBasis3d::build_bases(), and polyfem::basis::BarycentricBasis2d::build_bases().

Here is the caller graph for this function:

◆ set_grads_func()

void polyfem::basis::ElementBases::set_grads_func ( EvalBasesFunc  fun)
inline

Definition at line 97 of file ElementBases.hpp.

References eval_grads_func_.

Referenced by polyfem::basis::PolygonalBasis2d::build_bases(), polyfem::basis::PolygonalBasis3d::build_bases(), and polyfem::basis::BarycentricBasis2d::build_bases().

Here is the caller graph for this function:

◆ set_local_node_from_primitive_func()

void polyfem::basis::ElementBases::set_local_node_from_primitive_func ( LocalNodeFromPrimitiveFunc  fun)
inline

sets mapping from local nodes to global nodes

Definition at line 100 of file ElementBases.hpp.

References local_node_from_primitive_.

Referenced by polyfem::basis::SplineBasis2d::build_bases(), polyfem::basis::SplineBasis3d::build_bases(), and polyfem::basis::BarycentricBasis2d::build_bases().

Here is the caller graph for this function:

◆ set_mass_quadrature()

void polyfem::basis::ElementBases::set_mass_quadrature ( const QuadratureFunction fun)
inline

Definition at line 67 of file ElementBases.hpp.

References mass_quadrature_builder_.

Referenced by polyfem::basis::PolygonalBasis2d::build_bases(), polyfem::basis::PolygonalBasis3d::build_bases(), polyfem::basis::SplineBasis2d::build_bases(), polyfem::basis::SplineBasis3d::build_bases(), and polyfem::basis::BarycentricBasis2d::build_bases().

Here is the caller graph for this function:

◆ set_quadrature()

void polyfem::basis::ElementBases::set_quadrature ( const QuadratureFunction fun)
inline

Definition at line 66 of file ElementBases.hpp.

References quadrature_builder_.

Referenced by polyfem::basis::PolygonalBasis2d::build_bases(), polyfem::basis::PolygonalBasis3d::build_bases(), polyfem::basis::SplineBasis2d::build_bases(), polyfem::basis::SplineBasis3d::build_bases(), and polyfem::basis::BarycentricBasis2d::build_bases().

Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const ElementBases obj 
)
friend

Definition at line 57 of file ElementBases.hpp.

Member Data Documentation

◆ bases

◆ eval_bases_func_

EvalBasesFunc polyfem::basis::ElementBases::eval_bases_func_
private

Definition at line 108 of file ElementBases.hpp.

Referenced by evaluate_bases(), and set_bases_func().

◆ eval_grads_func_

EvalBasesFunc polyfem::basis::ElementBases::eval_grads_func_
private

Definition at line 109 of file ElementBases.hpp.

Referenced by evaluate_grads(), and set_grads_func().

◆ has_parameterization

◆ local_node_from_primitive_

LocalNodeFromPrimitiveFunc polyfem::basis::ElementBases::local_node_from_primitive_
private

◆ mass_quadrature_builder_

QuadratureFunction polyfem::basis::ElementBases::mass_quadrature_builder_
private

Definition at line 111 of file ElementBases.hpp.

Referenced by compute_mass_quadrature(), and set_mass_quadrature().

◆ quadrature_builder_

QuadratureFunction polyfem::basis::ElementBases::quadrature_builder_
private

Definition at line 110 of file ElementBases.hpp.

Referenced by compute_quadrature(), and set_quadrature().


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