PolyFEM
Loading...
Searching...
No Matches
polyfem::DiffCache Class Reference

Storage for additional data required by differntial code. More...

#include <DiffCache.hpp>

Collaboration diagram for polyfem::DiffCache:
[legend]

Public Member Functions

void cache_adjoints (const Eigen::MatrixXd &adjoint_mat)
 
void cache_transient (int step, State &state, const Eigen::MatrixXd &sol, const Eigen::MatrixXd *disp_grad, const Eigen::MatrixXd *pressure)
 Cache time-dependent adjoint optimization data.
 
const Eigen::MatrixXd & adjoint_mat () const
 
const StiffnessMatrixbasis_nodes_to_gbasis_nodes () const
 
int size () const
 
int bdf_order (int step) const
 
Eigen::MatrixXd disp_grad (int step=0) const
 
Eigen::VectorXd u (int step) const
 
Eigen::VectorXd v (int step) const
 
Eigen::VectorXd acc (int step) const
 
const StiffnessMatrixgradu_h (int step) const
 
const ipc::NormalCollisions & collision_set (int step) const
 
const ipc::SmoothCollisions & smooth_collision_set (int step) const
 
const ipc::TangentialCollisions & friction_collision_set (int step) const
 
const ipc::NormalCollisions & normal_adhesion_collision_set (int step) const
 
const ipc::TangentialCollisions & tangential_adhesion_collision_set (int step) const
 

Public Attributes

InitialConditionOverride initial_condition_override
 Initial-condition override storage for initial condition optimization.
 

Private Member Functions

void init (const int dimension, const int ndof, const int n_time_steps=0)
 
void cache_quantities_static (const Eigen::MatrixXd &u, const StiffnessMatrix &gradu_h, const ipc::NormalCollisions &collision_set, const ipc::SmoothCollisions &smooth_collision_set, const ipc::TangentialCollisions &friction_constraint_set, const ipc::NormalCollisions &normal_adhesion_set, const ipc::TangentialCollisions &tangential_adhesion_set, const Eigen::MatrixXd &disp_grad)
 
void cache_quantities_transient (const int cur_step, const int cur_bdf_order, const Eigen::MatrixXd &u, const Eigen::MatrixXd &v, const Eigen::MatrixXd &acc, const StiffnessMatrix &gradu_h, const ipc::NormalCollisions &collision_set, const ipc::SmoothCollisions &smooth_collision_set, const ipc::TangentialCollisions &friction_collision_set)
 
void cache_quantities_quasistatic (const int cur_step, const Eigen::MatrixXd &u, const StiffnessMatrix &gradu_h, const ipc::NormalCollisions &collision_set, const ipc::SmoothCollisions &smooth_collision_set, const ipc::NormalCollisions &normal_adhesion_set, const Eigen::MatrixXd &disp_grad)
 

Private Attributes

int n_time_steps_ = 0
 
int cur_size_ = 0
 
StiffnessMatrix basis_nodes_to_gbasis_nodes_
 
std::vector< Eigen::MatrixXd > disp_grad_
 
Eigen::MatrixXd u_
 
Eigen::MatrixXd v_
 
Eigen::MatrixXd acc_
 
Eigen::VectorXi bdf_order_
 
std::vector< StiffnessMatrixgradu_h_
 
std::vector< ipc::NormalCollisions > collision_set_
 
std::vector< ipc::SmoothCollisions > smooth_collision_set_
 
std::vector< ipc::TangentialCollisions > friction_collision_set_
 
std::vector< ipc::NormalCollisions > normal_adhesion_collision_set_
 
std::vector< ipc::TangentialCollisions > tangential_adhesion_collision_set_
 
Eigen::MatrixXd adjoint_mat_
 

Detailed Description

Storage for additional data required by differntial code.

Definition at line 20 of file DiffCache.hpp.

Member Function Documentation

◆ acc()

Eigen::VectorXd polyfem::DiffCache::acc ( int  step) const
inline

Definition at line 78 of file DiffCache.hpp.

References acc_, and size().

Referenced by cache_quantities_transient(), and cache_transient().

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

◆ adjoint_mat()

const Eigen::MatrixXd & polyfem::DiffCache::adjoint_mat ( ) const
inline

Definition at line 43 of file DiffCache.hpp.

References adjoint_mat_.

Referenced by cache_adjoints(), and polyfem::get_adjoint_mat().

Here is the caller graph for this function:

◆ basis_nodes_to_gbasis_nodes()

const StiffnessMatrix & polyfem::DiffCache::basis_nodes_to_gbasis_nodes ( ) const

◆ bdf_order()

int polyfem::DiffCache::bdf_order ( int  step) const
inline

Definition at line 48 of file DiffCache.hpp.

References bdf_order_, and size().

Here is the call graph for this function:

◆ cache_adjoints()

void polyfem::DiffCache::cache_adjoints ( const Eigen::MatrixXd &  adjoint_mat)

Definition at line 273 of file DiffCache.cpp.

References adjoint_mat(), and adjoint_mat_.

Referenced by polyfem::solve_adjoint_cached().

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

◆ cache_quantities_quasistatic()

void polyfem::DiffCache::cache_quantities_quasistatic ( const int  cur_step,
const Eigen::MatrixXd &  u,
const StiffnessMatrix gradu_h,
const ipc::NormalCollisions &  collision_set,
const ipc::SmoothCollisions &  smooth_collision_set,
const ipc::NormalCollisions &  normal_adhesion_set,
const Eigen::MatrixXd &  disp_grad 
)
private

Definition at line 254 of file DiffCache.cpp.

References collision_set(), collision_set_, cur_size_, disp_grad(), disp_grad_, gradu_h(), gradu_h_, normal_adhesion_collision_set_, smooth_collision_set(), smooth_collision_set_, u(), and u_.

Referenced by cache_transient().

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

◆ cache_quantities_static()

void polyfem::DiffCache::cache_quantities_static ( const Eigen::MatrixXd &  u,
const StiffnessMatrix gradu_h,
const ipc::NormalCollisions &  collision_set,
const ipc::SmoothCollisions &  smooth_collision_set,
const ipc::TangentialCollisions &  friction_constraint_set,
const ipc::NormalCollisions &  normal_adhesion_set,
const ipc::TangentialCollisions &  tangential_adhesion_set,
const Eigen::MatrixXd &  disp_grad 
)
private

Definition at line 203 of file DiffCache.cpp.

References collision_set(), collision_set_, cur_size_, disp_grad(), disp_grad_, friction_collision_set_, gradu_h(), gradu_h_, normal_adhesion_collision_set_, smooth_collision_set(), smooth_collision_set_, tangential_adhesion_collision_set_, u(), and u_.

Referenced by cache_transient().

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

◆ cache_quantities_transient()

void polyfem::DiffCache::cache_quantities_transient ( const int  cur_step,
const int  cur_bdf_order,
const Eigen::MatrixXd &  u,
const Eigen::MatrixXd &  v,
const Eigen::MatrixXd &  acc,
const StiffnessMatrix gradu_h,
const ipc::NormalCollisions &  collision_set,
const ipc::SmoothCollisions &  smooth_collision_set,
const ipc::TangentialCollisions &  friction_collision_set 
)
private

Definition at line 226 of file DiffCache.cpp.

References acc(), acc_, bdf_order_, collision_set(), collision_set_, cur_size_, friction_collision_set(), friction_collision_set_, gradu_h(), gradu_h_, smooth_collision_set(), smooth_collision_set_, u(), u_, v(), and v_.

Referenced by cache_transient().

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

◆ cache_transient()

void polyfem::DiffCache::cache_transient ( int  step,
State state,
const Eigen::MatrixXd &  sol,
const Eigen::MatrixXd *  disp_grad,
const Eigen::MatrixXd *  pressure 
)

Cache time-dependent adjoint optimization data.

Parameters
[in]stepCurrent time step.
[in]stateCurrent forward simulation state. Will mutate it to get latest value.
[in]solCurrent solution.
[in]disp_gradPointer to displacement gradient matrix. Assumes zero if nullptr.
[in]pressurePointer to pressure matrix. PASS nullptr ONLY.
Warning
We DO NOT support navier stoke problem yet!! Passing non-null pressure triggers exception.

Definition at line 283 of file DiffCache.cpp.

References acc(), basis_nodes_to_gbasis_nodes_, cache_quantities_quasistatic(), cache_quantities_static(), cache_quantities_transient(), disp_grad(), gradu_h(), init(), polyfem::log_and_throw_adjoint_error(), polyfem::log_and_throw_error(), polyfem::time_integrator::ImplicitTimeIntegrator::v_prev(), and polyfem::time_integrator::BDF::weighted_sum_v_prevs().

Here is the call graph for this function:

◆ collision_set()

const ipc::NormalCollisions & polyfem::DiffCache::collision_set ( int  step) const
inline

Definition at line 95 of file DiffCache.hpp.

References collision_set_, and size().

Referenced by cache_quantities_quasistatic(), cache_quantities_static(), cache_quantities_transient(), polyfem::solver::AdjointTools::dJ_shape_homogenization_adjoint_term(), polyfem::solver::AdjointTools::dJ_shape_static_adjoint_term(), and polyfem::solver::AdjointTools::dJ_shape_transient_adjoint_term().

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

◆ disp_grad()

Eigen::MatrixXd polyfem::DiffCache::disp_grad ( int  step = 0) const
inline

Definition at line 56 of file DiffCache.hpp.

References disp_grad_, and size().

Referenced by cache_quantities_quasistatic(), cache_quantities_static(), cache_transient(), and polyfem::solver::AdjointTools::dJ_periodic_shape_adjoint_term().

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

◆ friction_collision_set()

const ipc::TangentialCollisions & polyfem::DiffCache::friction_collision_set ( int  step) const
inline

Definition at line 109 of file DiffCache.hpp.

References friction_collision_set_, and size().

Referenced by cache_quantities_transient(), polyfem::solver::AdjointTools::dJ_friction_transient_adjoint_term(), and polyfem::solver::AdjointTools::dJ_shape_transient_adjoint_term().

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

◆ gradu_h()

const StiffnessMatrix & polyfem::DiffCache::gradu_h ( int  step) const
inline

Definition at line 86 of file DiffCache.hpp.

References gradu_h_, and size().

Referenced by cache_quantities_quasistatic(), cache_quantities_static(), cache_quantities_transient(), cache_transient(), and polyfem::solver::AdjointTools::dJ_dirichlet_static_adjoint_term().

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

◆ init()

void polyfem::DiffCache::init ( const int  dimension,
const int  ndof,
const int  n_time_steps = 0 
)
private

Definition at line 181 of file DiffCache.cpp.

References acc_, bdf_order_, collision_set_, cur_size_, disp_grad_, friction_collision_set_, gradu_h_, n_time_steps_, normal_adhesion_collision_set_, smooth_collision_set_, tangential_adhesion_collision_set_, u_, and v_.

Referenced by cache_transient().

Here is the caller graph for this function:

◆ normal_adhesion_collision_set()

const ipc::NormalCollisions & polyfem::DiffCache::normal_adhesion_collision_set ( int  step) const
inline

Definition at line 116 of file DiffCache.hpp.

References normal_adhesion_collision_set_, and size().

Referenced by polyfem::solver::AdjointTools::dJ_shape_homogenization_adjoint_term(), polyfem::solver::AdjointTools::dJ_shape_static_adjoint_term(), and polyfem::solver::AdjointTools::dJ_shape_transient_adjoint_term().

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

◆ size()

int polyfem::DiffCache::size ( ) const
inline

◆ smooth_collision_set()

const ipc::SmoothCollisions & polyfem::DiffCache::smooth_collision_set ( int  step) const
inline

Definition at line 102 of file DiffCache.hpp.

References size(), and smooth_collision_set_.

Referenced by cache_quantities_quasistatic(), cache_quantities_static(), cache_quantities_transient(), polyfem::solver::AdjointTools::dJ_shape_homogenization_adjoint_term(), polyfem::solver::AdjointTools::dJ_shape_static_adjoint_term(), and polyfem::solver::AdjointTools::dJ_shape_transient_adjoint_term().

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

◆ tangential_adhesion_collision_set()

const ipc::TangentialCollisions & polyfem::DiffCache::tangential_adhesion_collision_set ( int  step) const
inline

Definition at line 123 of file DiffCache.hpp.

References size(), and tangential_adhesion_collision_set_.

Referenced by polyfem::solver::AdjointTools::dJ_shape_transient_adjoint_term().

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

◆ u()

Eigen::VectorXd polyfem::DiffCache::u ( int  step) const
inline

◆ v()

Eigen::VectorXd polyfem::DiffCache::v ( int  step) const
inline

Definition at line 71 of file DiffCache.hpp.

References size(), and v_.

Referenced by cache_quantities_transient(), and polyfem::solver::AdjointTools::dJ_shape_transient_adjoint_term().

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

Member Data Documentation

◆ acc_

Eigen::MatrixXd polyfem::DiffCache::acc_
private

Definition at line 141 of file DiffCache.hpp.

Referenced by acc(), cache_quantities_transient(), and init().

◆ adjoint_mat_

Eigen::MatrixXd polyfem::DiffCache::adjoint_mat_
private

Definition at line 155 of file DiffCache.hpp.

Referenced by adjoint_mat(), and cache_adjoints().

◆ basis_nodes_to_gbasis_nodes_

StiffnessMatrix polyfem::DiffCache::basis_nodes_to_gbasis_nodes_
private

Definition at line 136 of file DiffCache.hpp.

Referenced by basis_nodes_to_gbasis_nodes(), and cache_transient().

◆ bdf_order_

Eigen::VectorXi polyfem::DiffCache::bdf_order_
private

Definition at line 143 of file DiffCache.hpp.

Referenced by bdf_order(), cache_quantities_transient(), and init().

◆ collision_set_

std::vector<ipc::NormalCollisions> polyfem::DiffCache::collision_set_
private

◆ cur_size_

int polyfem::DiffCache::cur_size_ = 0
private

◆ disp_grad_

std::vector<Eigen::MatrixXd> polyfem::DiffCache::disp_grad_
private

◆ friction_collision_set_

std::vector<ipc::TangentialCollisions> polyfem::DiffCache::friction_collision_set_
private

◆ gradu_h_

std::vector<StiffnessMatrix> polyfem::DiffCache::gradu_h_
private

◆ initial_condition_override

InitialConditionOverride polyfem::DiffCache::initial_condition_override

Initial-condition override storage for initial condition optimization.

Definition at line 24 of file DiffCache.hpp.

Referenced by polyfem::solver::AdjointTools::dJ_friction_transient_adjoint_term().

◆ n_time_steps_

int polyfem::DiffCache::n_time_steps_ = 0
private

Definition at line 132 of file DiffCache.hpp.

Referenced by init().

◆ normal_adhesion_collision_set_

std::vector<ipc::NormalCollisions> polyfem::DiffCache::normal_adhesion_collision_set_
private

◆ smooth_collision_set_

std::vector<ipc::SmoothCollisions> polyfem::DiffCache::smooth_collision_set_
private

◆ tangential_adhesion_collision_set_

std::vector<ipc::TangentialCollisions> polyfem::DiffCache::tangential_adhesion_collision_set_
private

Definition at line 153 of file DiffCache.hpp.

Referenced by cache_quantities_static(), init(), and tangential_adhesion_collision_set().

◆ u_

Eigen::MatrixXd polyfem::DiffCache::u_
private

◆ v_

Eigen::MatrixXd polyfem::DiffCache::v_
private

Definition at line 140 of file DiffCache.hpp.

Referenced by cache_quantities_transient(), init(), and v().


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