|
PolyFEM
|
Caches basis evaluation and geometric mapping at every element. More...
#include <AssemblyValsCache.hpp>
Public Member Functions | |
| void | init (const bool is_volume, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const bool is_mass=false) |
| computes the basis evaluation and geometric mapping for each of the given ElementBases in bases initializes cache member. | |
| void | init_empty (const bool is_mass=false) |
| initialize an empty cache. | |
| void | compute (const int el_index, const bool is_volume, const basis::ElementBases &basis, const basis::ElementBases &gbasis, ElementAssemblyValues &vals) const |
| Copies cached values into vals, or computes into vals when the cache is empty. | |
| const ElementAssemblyValues & | get_or_compute (const int el_index, const bool is_volume, const basis::ElementBases &basis, const basis::ElementBases &gbasis, ElementAssemblyValues &scratch) const |
| Returns cached values, or computes into scratch when the cache is empty. | |
| void | update (const int el_index, const bool is_volume, const basis::ElementBases &basis, const basis::ElementBases &gbasis) |
| void | clear () |
| bool | is_initialized () const |
| const ElementAssemblyValues & | cached_values (const int element) const |
| bool | is_mass () const |
Private Attributes | |
| std::vector< ElementAssemblyValues > | cache |
| vector of basis values and geometric mapping with one entry per element | |
| bool | is_mass_ |
Caches basis evaluation and geometric mapping at every element.
Definition at line 10 of file AssemblyValsCache.hpp.
|
inline |
Definition at line 45 of file AssemblyValsCache.hpp.
References cache.
Referenced by get_or_compute().
|
inline |
Definition at line 38 of file AssemblyValsCache.hpp.
References cache.
Referenced by init_empty().
| void polyfem::assembler::AssemblyValsCache::compute | ( | const int | el_index, |
| const bool | is_volume, | ||
| const basis::ElementBases & | basis, | ||
| const basis::ElementBases & | gbasis, | ||
| ElementAssemblyValues & | vals | ||
| ) | const |
Copies cached values into vals, or computes into vals when the cache is empty.
Definition at line 52 of file AssemblyValsCache.cpp.
References cache, is_mass_, quadrature, and vals.
Referenced by polyfem::varform::GrowthElasticVarForm::accumulate_dissipation(), polyfem::varform::GrowthElasticVarForm::assemble_growth_node_weights(), polyfem::solver::AdjointTools::compute_shape_derivative_functional_term(), polyfem::solver::AdjointTools::dJ_du_step(), polyfem::varform::GrowthElasticVarForm::element_mean_growth(), polyfem::varform::GrowthElasticVarForm::evaluate_threshold_state(), polyfem::solver::BodyForceDerivative::force_shape_derivative(), polyfem::solver::InertiaForceDerivative::force_shape_derivative(), get_or_compute(), and polyfem::solver::AdjointTools::integrate_objective().
|
inline |
Returns cached values, or computes into scratch when the cache is empty.
The returned reference is valid while its cache entry or scratch remains unchanged.
Definition at line 28 of file AssemblyValsCache.hpp.
References cached_values(), compute(), and is_initialized().
Referenced by polyfem::assembler::RhsAssembler::assemble(), polyfem::solver::NavierStokesFSIAveragePressureForm::compute_constraint(), polyfem::assembler::RhsAssembler::compute_energy(), and polyfem::assembler::RhsAssembler::time_bc().
| void polyfem::assembler::AssemblyValsCache::init | ( | const bool | is_volume, |
| const std::vector< basis::ElementBases > & | bases, | ||
| const std::vector< basis::ElementBases > & | gbases, | ||
| const bool | is_mass = false |
||
| ) |
computes the basis evaluation and geometric mapping for each of the given ElementBases in bases initializes cache member.
will clear the old cache if exists.
Definition at line 11 of file AssemblyValsCache.cpp.
References cache, is_mass(), is_mass_, polyfem::utils::maybe_parallel_for(), and quadrature.
Referenced by polyfem::varform::NavierStokesFSIVarForm::build_basis(), polyfem::varform::BilaplacianVarForm::build_basis(), polyfem::varform::FluidVarForm::build_basis(), polyfem::varform::GrowthElasticVarForm::build_basis(), polyfem::varform::IncompressibleElasticVarForm::build_basis(), polyfem::varform::OperatorSplittingVarForm::build_basis(), polyfem::varform::ScalarVarForm::build_basis(), polyfem::varform::ThermoElasticVarForm::build_basis(), and polyfem::varform::ElasticVarForm::build_elastic_basis().
| void polyfem::assembler::AssemblyValsCache::init_empty | ( | const bool | is_mass = false | ) |
initialize an empty cache.
does not computes the basis evaluation and geometric mapping. will clear the old cache if exists.
Definition at line 34 of file AssemblyValsCache.cpp.
References clear(), is_mass(), and is_mass_.
Referenced by polyfem::varform::NavierStokesFSIVarForm::build_basis(), polyfem::varform::BilaplacianVarForm::build_basis(), polyfem::varform::FluidVarForm::build_basis(), polyfem::varform::GrowthElasticVarForm::build_basis(), polyfem::varform::IncompressibleElasticVarForm::build_basis(), polyfem::varform::OperatorSplittingVarForm::build_basis(), polyfem::varform::ScalarVarForm::build_basis(), polyfem::varform::ThermoElasticVarForm::build_basis(), polyfem::varform::ElasticVarForm::build_elastic_basis(), polyfem::varform::BilaplacianVarForm::reset(), polyfem::varform::ElasticVarForm::reset(), polyfem::varform::FluidVarForm::reset(), polyfem::varform::GrowthElasticVarForm::reset(), polyfem::varform::IncompressibleElasticVarForm::reset(), polyfem::varform::NavierStokesFSIVarForm::reset(), polyfem::varform::OperatorSplittingVarForm::reset(), polyfem::varform::ScalarVarForm::reset(), and polyfem::varform::ThermoElasticVarForm::reset().
|
inline |
Definition at line 43 of file AssemblyValsCache.hpp.
References cache.
Referenced by get_or_compute(), and polyfem::assembler::RhsAssembler::RhsAssembler().
|
inline |
Definition at line 51 of file AssemblyValsCache.hpp.
References is_mass_.
Referenced by init(), init_empty(), and polyfem::assembler::RhsAssembler::RhsAssembler().
| void polyfem::assembler::AssemblyValsCache::update | ( | const int | el_index, |
| const bool | is_volume, | ||
| const basis::ElementBases & | basis, | ||
| const basis::ElementBases & | gbasis | ||
| ) |
Definition at line 40 of file AssemblyValsCache.cpp.
References cache, is_mass_, and quadrature.
|
private |
vector of basis values and geometric mapping with one entry per element
Definition at line 54 of file AssemblyValsCache.hpp.
Referenced by cached_values(), clear(), compute(), init(), is_initialized(), and update().
|
private |
Definition at line 55 of file AssemblyValsCache.hpp.
Referenced by compute(), init(), init_empty(), is_mass(), and update().