PolyFEM
Loading...
Searching...
No Matches
polyfem::assembler::AssemblyValsCache Class Reference

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_
 

Detailed Description

Caches basis evaluation and geometric mapping at every element.

Definition at line 10 of file AssemblyValsCache.hpp.

Member Function Documentation

◆ cached_values()

const ElementAssemblyValues & polyfem::assembler::AssemblyValsCache::cached_values ( const int  element) const
inline

Definition at line 45 of file AssemblyValsCache.hpp.

References cache.

Referenced by get_or_compute().

Here is the caller graph for this function:

◆ clear()

void polyfem::assembler::AssemblyValsCache::clear ( )
inline

Definition at line 38 of file AssemblyValsCache.hpp.

References cache.

Referenced by init_empty().

Here is the caller graph for this function:

◆ compute()

void polyfem::assembler::AssemblyValsCache::compute ( const int  el_index,
const bool  is_volume,
const basis::ElementBases &  basis,
const basis::ElementBases &  gbasis,
ElementAssemblyValues &  vals 
) const

◆ get_or_compute()

const ElementAssemblyValues & polyfem::assembler::AssemblyValsCache::get_or_compute ( const int  el_index,
const bool  is_volume,
const basis::ElementBases &  basis,
const basis::ElementBases &  gbasis,
ElementAssemblyValues &  scratch 
) const
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().

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

◆ init()

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().

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

◆ init_empty()

void polyfem::assembler::AssemblyValsCache::init_empty ( const bool  is_mass = false)

◆ is_initialized()

bool polyfem::assembler::AssemblyValsCache::is_initialized ( ) const
inline

Definition at line 43 of file AssemblyValsCache.hpp.

References cache.

Referenced by get_or_compute(), and polyfem::assembler::RhsAssembler::RhsAssembler().

Here is the caller graph for this function:

◆ is_mass()

bool polyfem::assembler::AssemblyValsCache::is_mass ( ) const
inline

Definition at line 51 of file AssemblyValsCache.hpp.

References is_mass_.

Referenced by init(), init_empty(), and polyfem::assembler::RhsAssembler::RhsAssembler().

Here is the caller graph for this function:

◆ update()

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.

Member Data Documentation

◆ cache

std::vector<ElementAssemblyValues> polyfem::assembler::AssemblyValsCache::cache
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().

◆ is_mass_

bool polyfem::assembler::AssemblyValsCache::is_mass_
private

Definition at line 55 of file AssemblyValsCache.hpp.

Referenced by compute(), init(), init_empty(), is_mass(), and update().


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