PolyFEM
Loading...
Searching...
No Matches
polyfem::solver::VariableToSimulationGroup Class Reference

A collection of VariableToSimulation. More...

#include <VariableToSimulation.hpp>

Public Types

using ValueType = std::shared_ptr< VariableToSimulation >
 
typedef std::vector< ValueType >::const_iterator const_iterator
 

Public Member Functions

 VariableToSimulationGroup ()=default
 
virtual ~VariableToSimulationGroup ()=default
 
void init (const json &args, const std::vector< std::shared_ptr< State > > &states, const std::vector< int > &variable_sizes)
 
void update (const Eigen::VectorXd &x)
 Update parameters in simulators.
 
void compute_state_variable (const ParameterType type, const State *state_ptr, const Eigen::VectorXd &x, Eigen::VectorXd &state_variable) const
 Evaluate the variable to simulations and overwrite the state_variable based on x.
 
Eigen::VectorXd compute_adjoint_term (const Eigen::VectorXd &x) const
 Computes the sum of adjoint terms for all VariableToSimulation.
 
virtual Eigen::VectorXd apply_parametrization_jacobian (const ParameterType type, const State *state_ptr, const Eigen::VectorXd &x, const std::function< Eigen::VectorXd()> &grad) const
 Maps the partial gradient wrt.
 
ValueTypeoperator[] (size_t i)
 
const ValueTypeoperator[] (size_t i) const
 
const_iterator begin () const
 
const_iterator end () const
 
void push_back (const ValueType &v2s)
 
void clear ()
 

Private Attributes

std::vector< ValueTypeL
 

Detailed Description

A collection of VariableToSimulation.

Definition at line 50 of file VariableToSimulation.hpp.

Member Typedef Documentation

◆ const_iterator

Definition at line 86 of file VariableToSimulation.hpp.

◆ ValueType

Constructor & Destructor Documentation

◆ VariableToSimulationGroup()

polyfem::solver::VariableToSimulationGroup::VariableToSimulationGroup ( )
default

◆ ~VariableToSimulationGroup()

virtual polyfem::solver::VariableToSimulationGroup::~VariableToSimulationGroup ( )
virtualdefault

Member Function Documentation

◆ apply_parametrization_jacobian()

Eigen::VectorXd polyfem::solver::VariableToSimulationGroup::apply_parametrization_jacobian ( const ParameterType  type,
const State state_ptr,
const Eigen::VectorXd &  x,
const std::function< Eigen::VectorXd()> &  grad 
) const
virtual

Maps the partial gradient wrt.

the state variable to the partial gradient wrt. the optimization variable

Parameters
typeType of state variable
state_ptrThe state that stores the state variable
xOptimization variable
gradPartial gradient wrt. the state variable, lambda function to allow lazy evaluation of the gradient
Returns
Partial gradient wrt. the optimization variable

Definition at line 127 of file VariableToSimulation.cpp.

References L, and x.

Referenced by polyfem::solver::AMIPSForm::compute_partial_gradient(), polyfem::solver::CollisionBarrierForm::compute_partial_gradient(), polyfem::solver::DeformedCollisionBarrierForm::compute_partial_gradient(), polyfem::solver::BoundarySmoothingForm::compute_partial_gradient(), polyfem::solver::SpatialIntegralForm::compute_partial_gradient_step(), polyfem::solver::ElasticEnergyForm::compute_partial_gradient_step(), polyfem::solver::StressNormForm::compute_partial_gradient_step(), polyfem::solver::ComplianceForm::compute_partial_gradient_step(), polyfem::solver::StressForm::compute_partial_gradient_step(), polyfem::solver::ProxyContactForceForm::compute_partial_gradient_step(), and polyfem::solver::NodeTargetForm::compute_partial_gradient_step().

Here is the caller graph for this function:

◆ begin()

const_iterator polyfem::solver::VariableToSimulationGroup::begin ( ) const
inline

Definition at line 90 of file VariableToSimulation.hpp.

References L.

◆ clear()

void polyfem::solver::VariableToSimulationGroup::clear ( )
inline

Definition at line 93 of file VariableToSimulation.hpp.

References L.

◆ compute_adjoint_term()

Eigen::VectorXd polyfem::solver::VariableToSimulationGroup::compute_adjoint_term ( const Eigen::VectorXd &  x) const

Computes the sum of adjoint terms for all VariableToSimulation.

Parameters
xOptimization variable
Returns
Sum of adjoint terms

Definition at line 101 of file VariableToSimulation.cpp.

References L, and x.

Referenced by polyfem::solver::AdjointForm::first_derivative().

Here is the caller graph for this function:

◆ compute_state_variable()

void polyfem::solver::VariableToSimulationGroup::compute_state_variable ( const ParameterType  type,
const State state_ptr,
const Eigen::VectorXd &  x,
Eigen::VectorXd &  state_variable 
) const

Evaluate the variable to simulations and overwrite the state_variable based on x.

Parameters
xOptimization variable
state_variableThe state variable in state_ptr with type

Definition at line 109 of file VariableToSimulation.cpp.

References L, and x.

Referenced by polyfem::solver::AMIPSForm::get_updated_mesh_nodes(), polyfem::solver::CollisionBarrierForm::get_updated_mesh_nodes(), and polyfem::solver::DeformedCollisionBarrierForm::get_updated_mesh_nodes().

Here is the caller graph for this function:

◆ end()

const_iterator polyfem::solver::VariableToSimulationGroup::end ( ) const
inline

Definition at line 91 of file VariableToSimulation.hpp.

References L.

◆ init()

void polyfem::solver::VariableToSimulationGroup::init ( const json args,
const std::vector< std::shared_ptr< State > > &  states,
const std::vector< int > &  variable_sizes 
)

Definition at line 94 of file VariableToSimulation.cpp.

References polyfem::solver::AdjointOptUtils::create_variable_to_simulation(), and L.

Referenced by polyfem::OptState::init_variables().

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

◆ operator[]() [1/2]

ValueType & polyfem::solver::VariableToSimulationGroup::operator[] ( size_t  i)
inline

Definition at line 88 of file VariableToSimulation.hpp.

References L.

◆ operator[]() [2/2]

const ValueType & polyfem::solver::VariableToSimulationGroup::operator[] ( size_t  i) const
inline

Definition at line 89 of file VariableToSimulation.hpp.

References L.

◆ push_back()

void polyfem::solver::VariableToSimulationGroup::push_back ( const ValueType v2s)
inline

Definition at line 92 of file VariableToSimulation.hpp.

References L.

Referenced by polyfem::solver::AdjointOptUtils::create_simple_form().

Here is the caller graph for this function:

◆ update()

void polyfem::solver::VariableToSimulationGroup::update ( const Eigen::VectorXd &  x)
inline

Update parameters in simulators.

Parameters
xOptimization variable

Definition at line 62 of file VariableToSimulation.hpp.

References L, and x.

Referenced by polyfem::OptState::initial_guess().

Here is the caller graph for this function:

Member Data Documentation

◆ L

std::vector<ValueType> polyfem::solver::VariableToSimulationGroup::L
private

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