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

#include <NLHomoProblem.hpp>

Inheritance diagram for polyfem::solver::NLHomoProblem:
[legend]
Collaboration diagram for polyfem::solver::NLHomoProblem:
[legend]

Public Member Functions

 NLHomoProblem (const int full_size, const std::vector< int > &boundary_nodes, const std::vector< mesh::LocalBoundary > &local_boundary, const int n_boundary_samples, const assembler::RhsAssembler &rhs_assembler, const assembler::MacroStrainValue &macro_strain_constraint, const State &state, const double t, const std::vector< std::shared_ptr< Form > > &forms, const bool solve_symmetric_macro_strain)
 
virtual ~NLHomoProblem ()=default
 
double value (const TVector &x) override
 
void gradient (const TVector &x, TVector &gradv) override
 
void hessian (const TVector &x, THessian &hessian) override
 
void full_hessian_to_reduced_hessian (const THessian &full, THessian &reduced) const override
 
int macro_reduced_size () const
 
TVector full_to_reduced (const TVector &full, const Eigen::MatrixXd &disp_grad) const
 
TVector full_to_reduced (const TVector &full) const override
 
TVector full_to_reduced_grad (const TVector &full) const override
 
TVector reduced_to_full (const TVector &reduced) const override
 
TVector reduced_to_full_shape_derivative (const Eigen::MatrixXd &disp_grad, const TVector &adjoint_full) const
 
TVector reduced_to_extended (const TVector &reduced, bool homogeneous=false) const
 
TVector extended_to_reduced (const TVector &extended) const
 
TVector extended_to_reduced_grad (const TVector &extended) const
 
void extended_hessian_to_reduced_hessian (const THessian &extended, THessian &reduced) const
 
Eigen::MatrixXd reduced_to_disp_grad (const TVector &reduced, bool homogeneous=false) const
 
void set_fixed_entry (const Eigen::VectorXi &fixed_entry)
 
void init (const TVector &x0) override
 
bool is_step_valid (const TVector &x0, const TVector &x1) override
 
bool is_step_collision_free (const TVector &x0, const TVector &x1) override
 
double max_step_size (const TVector &x0, const TVector &x1) override
 
void line_search_begin (const TVector &x0, const TVector &x1) override
 
void post_step (const polysolve::nonlinear::PostStepData &data) override
 
void solution_changed (const TVector &new_x) override
 
void init_lagging (const TVector &x) override
 
void update_lagging (const TVector &x, const int iter_num) override
 
void update_quantities (const double t, const TVector &x) override
 
void add_form (const std::shared_ptr< Form > &form)
 
bool has_symmetry_constraint () const
 
- Public Member Functions inherited from polyfem::solver::NLProblem
 NLProblem (const int full_size, const std::vector< int > &boundary_nodes, const std::vector< mesh::LocalBoundary > &local_boundary, const int n_boundary_samples, const assembler::RhsAssembler &rhs_assembler, const std::shared_ptr< utils::PeriodicBoundary > &periodic_bc, const double t, const std::vector< std::shared_ptr< Form > > &forms)
 
virtual ~NLProblem ()=default
 
void line_search_begin (const TVector &x0, const TVector &x1) override
 
void solution_changed (const TVector &new_x) override
 
void init_lagging (const TVector &x) override
 
void update_lagging (const TVector &x, const int iter_num) override
 
int full_size () const
 
int reduced_size () const
 
void use_full_size ()
 
void use_reduced_size ()
 
void set_apply_DBC (const TVector &x, const bool val)
 
- Public Member Functions inherited from polyfem::solver::FullNLProblem
 FullNLProblem (const std::vector< std::shared_ptr< Form > > &forms)
 
virtual ~FullNLProblem ()=default
 
virtual void line_search_end () override
 
virtual void set_project_to_psd (bool val) override
 
int max_lagging_iterations () const
 
bool uses_lagging () const
 
std::vector< std::shared_ptr< Form > > & forms ()
 
virtual bool stop (const TVector &x) override
 

Protected Member Functions

Eigen::MatrixXd boundary_values () const override
 
- Protected Member Functions inherited from polyfem::solver::NLProblem
 NLProblem (const int full_size, const std::vector< int > &boundary_nodes, const std::vector< std::shared_ptr< Form > > &forms)
 
int current_size () const
 

Private Member Functions

void init_projection ()
 
Eigen::MatrixXd constraint_grad () const
 
TVector macro_full_to_reduced (const TVector &full) const
 
Eigen::MatrixXd macro_full_to_reduced_grad (const Eigen::MatrixXd &full) const
 
TVector macro_reduced_to_full (const TVector &reduced, bool homogeneous=false) const
 

Private Attributes

const Statestate_
 
const bool only_symmetric
 
const assembler::MacroStrainValuemacro_strain_constraint_
 
Eigen::VectorXi fixed_mask_
 
Eigen::MatrixXd macro_mid_to_reduced_
 
Eigen::MatrixXd macro_full_to_mid_
 
Eigen::MatrixXd macro_mid_to_full_
 
std::vector< std::shared_ptr< Form > > homo_forms
 

Additional Inherited Members

- Protected Types inherited from polyfem::solver::NLProblem
enum class  CurrentSize { FULL_SIZE , REDUCED_SIZE }
 
- Protected Attributes inherited from polyfem::solver::NLProblem
const std::vector< int > full_boundary_nodes_
 
const std::vector< int > boundary_nodes_
 
const int full_size_
 Size of the full problem.
 
const int reduced_size_
 Size of the reduced problem.
 
std::shared_ptr< utils::PeriodicBoundaryperiodic_bc_
 
CurrentSize current_size_
 Current size of the problem (either full or reduced size)
 
double t_
 
- Protected Attributes inherited from polyfem::solver::FullNLProblem
std::vector< std::shared_ptr< Form > > forms_
 

Detailed Description

Definition at line 15 of file NLHomoProblem.hpp.

Constructor & Destructor Documentation

◆ NLHomoProblem()

polyfem::solver::NLHomoProblem::NLHomoProblem ( const int  full_size,
const std::vector< int > &  boundary_nodes,
const std::vector< mesh::LocalBoundary > &  local_boundary,
const int  n_boundary_samples,
const assembler::RhsAssembler rhs_assembler,
const assembler::MacroStrainValue macro_strain_constraint,
const State state,
const double  t,
const std::vector< std::shared_ptr< Form > > &  forms,
const bool  solve_symmetric_macro_strain 
)

Definition at line 11 of file NLHomoProblem.cpp.

References init_projection().

Here is the call graph for this function:

◆ ~NLHomoProblem()

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

Member Function Documentation

◆ add_form()

void polyfem::solver::NLHomoProblem::add_form ( const std::shared_ptr< Form > &  form)
inline

Definition at line 71 of file NLHomoProblem.hpp.

References homo_forms.

◆ boundary_values()

Eigen::MatrixXd polyfem::solver::NLHomoProblem::boundary_values ( ) const
overrideprotectedvirtual

Reimplemented from polyfem::solver::NLProblem.

Definition at line 407 of file NLHomoProblem.cpp.

References polyfem::solver::NLProblem::full_size().

Here is the call graph for this function:

◆ constraint_grad()

Eigen::MatrixXd polyfem::solver::NLHomoProblem::constraint_grad ( ) const
private

Definition at line 391 of file NLHomoProblem.cpp.

References polyfem::solver::NLProblem::full_size_, polyfem::io::Evaluator::get_bases_position(), macro_full_to_reduced_grad(), polyfem::State::mesh, polyfem::State::mesh_nodes, polyfem::State::n_bases, and state_.

Referenced by full_hessian_to_reduced_hessian(), and full_to_reduced_grad().

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

◆ extended_hessian_to_reduced_hessian()

void polyfem::solver::NLHomoProblem::extended_hessian_to_reduced_hessian ( const THessian &  extended,
THessian &  reduced 
) const

Definition at line 127 of file NLHomoProblem.cpp.

References entries, polyfem::solver::NLProblem::full_hessian_to_reduced_hessian(), polyfem::solver::NLProblem::full_size_, macro_full_to_reduced_grad(), macro_reduced_size(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), and state_.

Referenced by hessian().

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

◆ extended_to_reduced()

Eigen::VectorXd polyfem::solver::NLHomoProblem::extended_to_reduced ( const TVector &  extended) const

Definition at line 53 of file NLHomoProblem.cpp.

References polyfem::solver::NLProblem::full_to_reduced(), macro_full_to_reduced(), macro_reduced_size(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), and state_.

Here is the call graph for this function:

◆ extended_to_reduced_grad()

Eigen::VectorXd polyfem::solver::NLHomoProblem::extended_to_reduced_grad ( const TVector &  extended) const

Definition at line 81 of file NLHomoProblem.cpp.

References polyfem::solver::NLProblem::full_to_reduced_grad(), macro_full_to_reduced_grad(), macro_reduced_size(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), and state_.

Referenced by gradient().

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

◆ full_hessian_to_reduced_hessian()

void polyfem::solver::NLHomoProblem::full_hessian_to_reduced_hessian ( const THessian &  full,
THessian &  reduced 
) const
overridevirtual

Reimplemented from polyfem::solver::NLProblem.

Definition at line 215 of file NLHomoProblem.cpp.

References constraint_grad(), entries, polyfem::solver::NLProblem::full_hessian_to_reduced_hessian(), macro_reduced_size(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), and state_.

Here is the call graph for this function:

◆ full_to_reduced() [1/2]

NLHomoProblem::TVector polyfem::solver::NLHomoProblem::full_to_reduced ( const TVector &  full) const
overridevirtual

Reimplemented from polyfem::solver::NLProblem.

Definition at line 249 of file NLHomoProblem.cpp.

References polyfem::log_and_throw_error().

Here is the call graph for this function:

◆ full_to_reduced() [2/2]

NLHomoProblem::TVector polyfem::solver::NLHomoProblem::full_to_reduced ( const TVector &  full,
const Eigen::MatrixXd &  disp_grad 
) const

Definition at line 255 of file NLHomoProblem.cpp.

References polyfem::utils::flatten(), polyfem::solver::NLProblem::full_to_reduced(), polyfem::io::Evaluator::generate_linear_field(), macro_full_to_reduced(), macro_reduced_size(), polyfem::State::mesh, polyfem::State::mesh_nodes, polyfem::State::n_bases, polyfem::solver::NLProblem::reduced_size(), and state_.

Here is the call graph for this function:

◆ full_to_reduced_grad()

NLHomoProblem::TVector polyfem::solver::NLHomoProblem::full_to_reduced_grad ( const TVector &  full) const
overridevirtual

Reimplemented from polyfem::solver::NLProblem.

Definition at line 269 of file NLHomoProblem.cpp.

References constraint_grad(), polyfem::solver::NLProblem::full_to_reduced_grad(), macro_reduced_size(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), and state_.

Here is the call graph for this function:

◆ gradient()

void polyfem::solver::NLHomoProblem::gradient ( const TVector &  x,
TVector &  gradv 
)
overridevirtual

Reimplemented from polyfem::solver::NLProblem.

Definition at line 115 of file NLHomoProblem.cpp.

References extended_to_reduced_grad(), polyfem::solver::NLProblem::gradient(), homo_forms, reduced_to_extended(), and x.

Here is the call graph for this function:

◆ has_symmetry_constraint()

bool polyfem::solver::NLHomoProblem::has_symmetry_constraint ( ) const
inline

Definition at line 72 of file NLHomoProblem.hpp.

References only_symmetric.

◆ hessian()

void polyfem::solver::NLHomoProblem::hessian ( const TVector &  x,
THessian &  hessian 
)
overridevirtual

Reimplemented from polyfem::solver::NLProblem.

Definition at line 178 of file NLHomoProblem.cpp.

References extended_hessian_to_reduced_hessian(), hessian(), polyfem::solver::NLProblem::hessian(), homo_forms, reduced_to_extended(), and x.

Referenced by hessian().

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

◆ init()

void polyfem::solver::NLHomoProblem::init ( const TVector &  x0)
overridevirtual

Reimplemented from polyfem::solver::FullNLProblem.

Definition at line 316 of file NLHomoProblem.cpp.

References homo_forms, polyfem::solver::FullNLProblem::init(), reduced_to_extended(), and reduced_to_full().

Here is the call graph for this function:

◆ init_lagging()

void polyfem::solver::NLHomoProblem::init_lagging ( const TVector &  x)
overridevirtual

Reimplemented from polyfem::solver::FullNLProblem.

Definition at line 371 of file NLHomoProblem.cpp.

References homo_forms, polyfem::solver::NLProblem::init_lagging(), reduced_to_extended(), and x.

Here is the call graph for this function:

◆ init_projection()

void polyfem::solver::NLHomoProblem::init_projection ( )
private

Definition at line 25 of file NLHomoProblem.cpp.

References macro_full_to_mid_, macro_mid_to_full_, macro_mid_to_reduced_, polyfem::State::mesh, only_symmetric, and state_.

Referenced by NLHomoProblem().

Here is the caller graph for this function:

◆ is_step_collision_free()

bool polyfem::solver::NLHomoProblem::is_step_collision_free ( const TVector &  x0,
const TVector &  x1 
)
overridevirtual

Reimplemented from polyfem::solver::NLProblem.

Definition at line 332 of file NLHomoProblem.cpp.

References homo_forms, polyfem::solver::NLProblem::is_step_collision_free(), and reduced_to_extended().

Here is the call graph for this function:

◆ is_step_valid()

bool polyfem::solver::NLHomoProblem::is_step_valid ( const TVector &  x0,
const TVector &  x1 
)
overridevirtual

Reimplemented from polyfem::solver::NLProblem.

Definition at line 323 of file NLHomoProblem.cpp.

References homo_forms, polyfem::solver::NLProblem::is_step_valid(), and reduced_to_extended().

Here is the call graph for this function:

◆ line_search_begin()

void polyfem::solver::NLHomoProblem::line_search_begin ( const TVector &  x0,
const TVector &  x1 
)
overridevirtual

Reimplemented from polyfem::solver::FullNLProblem.

Definition at line 350 of file NLHomoProblem.cpp.

References homo_forms, polyfem::solver::NLProblem::line_search_begin(), and reduced_to_extended().

Here is the call graph for this function:

◆ macro_full_to_reduced()

NLHomoProblem::TVector polyfem::solver::NLHomoProblem::macro_full_to_reduced ( const TVector &  full) const
private

Definition at line 297 of file NLHomoProblem.cpp.

References macro_full_to_mid_, and macro_mid_to_reduced_.

Referenced by extended_to_reduced(), and full_to_reduced().

Here is the caller graph for this function:

◆ macro_full_to_reduced_grad()

Eigen::MatrixXd polyfem::solver::NLHomoProblem::macro_full_to_reduced_grad ( const Eigen::MatrixXd &  full) const
private

Definition at line 301 of file NLHomoProblem.cpp.

References macro_mid_to_full_, and macro_mid_to_reduced_.

Referenced by constraint_grad(), extended_hessian_to_reduced_hessian(), and extended_to_reduced_grad().

Here is the caller graph for this function:

◆ macro_reduced_size()

int polyfem::solver::NLHomoProblem::macro_reduced_size ( ) const

Definition at line 293 of file NLHomoProblem.cpp.

References macro_mid_to_reduced_.

Referenced by extended_hessian_to_reduced_hessian(), extended_to_reduced(), extended_to_reduced_grad(), full_hessian_to_reduced_hessian(), full_to_reduced(), full_to_reduced_grad(), reduced_to_disp_grad(), reduced_to_extended(), and reduced_to_full().

Here is the caller graph for this function:

◆ macro_reduced_to_full()

NLHomoProblem::TVector polyfem::solver::NLHomoProblem::macro_reduced_to_full ( const TVector &  reduced,
bool  homogeneous = false 
) const
private

Definition at line 305 of file NLHomoProblem.cpp.

References polyfem::assembler::MacroStrainValue::eval(), fixed_mask_, polyfem::utils::flatten(), macro_full_to_mid_, macro_mid_to_full_, macro_mid_to_reduced_, macro_strain_constraint_, and polyfem::solver::NLProblem::t_.

Referenced by reduced_to_disp_grad(), reduced_to_extended(), and reduced_to_full().

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

◆ max_step_size()

double polyfem::solver::NLHomoProblem::max_step_size ( const TVector &  x0,
const TVector &  x1 
)
overridevirtual

Reimplemented from polyfem::solver::NLProblem.

Definition at line 341 of file NLHomoProblem.cpp.

References homo_forms, polyfem::solver::NLProblem::max_step_size(), and reduced_to_extended().

Here is the call graph for this function:

◆ post_step()

void polyfem::solver::NLHomoProblem::post_step ( const polysolve::nonlinear::PostStepData &  data)
overridevirtual

Reimplemented from polyfem::solver::NLProblem.

Definition at line 356 of file NLHomoProblem.cpp.

References homo_forms, polyfem::solver::NLProblem::post_step(), and reduced_to_extended().

Here is the call graph for this function:

◆ reduced_to_disp_grad()

Eigen::MatrixXd polyfem::solver::NLHomoProblem::reduced_to_disp_grad ( const TVector &  reduced,
bool  homogeneous = false 
) const

Definition at line 170 of file NLHomoProblem.cpp.

References macro_reduced_size(), macro_reduced_to_full(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), state_, and polyfem::utils::unflatten().

Here is the call graph for this function:

◆ reduced_to_extended()

Eigen::VectorXd polyfem::solver::NLHomoProblem::reduced_to_extended ( const TVector &  reduced,
bool  homogeneous = false 
) const

Definition at line 66 of file NLHomoProblem.cpp.

References macro_reduced_size(), macro_reduced_to_full(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), polyfem::solver::NLProblem::reduced_to_full(), and state_.

Referenced by gradient(), hessian(), init(), init_lagging(), is_step_collision_free(), is_step_valid(), line_search_begin(), max_step_size(), post_step(), solution_changed(), update_lagging(), update_quantities(), and value().

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

◆ reduced_to_full()

NLHomoProblem::TVector polyfem::solver::NLHomoProblem::reduced_to_full ( const TVector &  reduced) const
overridevirtual

Reimplemented from polyfem::solver::NLProblem.

Definition at line 283 of file NLHomoProblem.cpp.

References polyfem::io::Evaluator::generate_linear_field(), macro_reduced_size(), macro_reduced_to_full(), polyfem::State::mesh, polyfem::State::mesh_nodes, polyfem::State::n_bases, polyfem::solver::NLProblem::reduced_size(), polyfem::solver::NLProblem::reduced_to_full(), state_, and polyfem::utils::unflatten().

Referenced by init().

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

◆ reduced_to_full_shape_derivative()

NLHomoProblem::TVector polyfem::solver::NLHomoProblem::reduced_to_full_shape_derivative ( const Eigen::MatrixXd &  disp_grad,
const TVector &  adjoint_full 
) const

Definition at line 94 of file NLHomoProblem.cpp.

References polyfem::State::basis_nodes_to_gbasis_nodes, polyfem::State::mesh, polyfem::State::n_bases, and state_.

Referenced by polyfem::solver::SpatialIntegralForm::compute_partial_gradient_step().

Here is the caller graph for this function:

◆ set_fixed_entry()

void polyfem::solver::NLHomoProblem::set_fixed_entry ( const Eigen::VectorXi &  fixed_entry)

◆ solution_changed()

void polyfem::solver::NLHomoProblem::solution_changed ( const TVector &  new_x)
overridevirtual

Reimplemented from polyfem::solver::FullNLProblem.

Definition at line 364 of file NLHomoProblem.cpp.

References homo_forms, reduced_to_extended(), and polyfem::solver::NLProblem::solution_changed().

Here is the call graph for this function:

◆ update_lagging()

void polyfem::solver::NLHomoProblem::update_lagging ( const TVector &  x,
const int  iter_num 
)
overridevirtual

Reimplemented from polyfem::solver::FullNLProblem.

Definition at line 377 of file NLHomoProblem.cpp.

References homo_forms, reduced_to_extended(), polyfem::solver::NLProblem::update_lagging(), and x.

Here is the call graph for this function:

◆ update_quantities()

void polyfem::solver::NLHomoProblem::update_quantities ( const double  t,
const TVector &  x 
)
overridevirtual

Reimplemented from polyfem::solver::NLProblem.

Definition at line 384 of file NLHomoProblem.cpp.

References homo_forms, reduced_to_extended(), polyfem::solver::NLProblem::update_quantities(), and x.

Here is the call graph for this function:

◆ value()

double polyfem::solver::NLHomoProblem::value ( const TVector &  x)
overridevirtual

Reimplemented from polyfem::solver::NLProblem.

Definition at line 106 of file NLHomoProblem.cpp.

References homo_forms, reduced_to_extended(), val, polyfem::solver::NLProblem::value(), and x.

Here is the call graph for this function:

Member Data Documentation

◆ fixed_mask_

Eigen::VectorXi polyfem::solver::NLHomoProblem::fixed_mask_
private

Definition at line 89 of file NLHomoProblem.hpp.

Referenced by macro_reduced_to_full(), and set_fixed_entry().

◆ homo_forms

std::vector<std::shared_ptr<Form> > polyfem::solver::NLHomoProblem::homo_forms
private

◆ macro_full_to_mid_

Eigen::MatrixXd polyfem::solver::NLHomoProblem::macro_full_to_mid_
private

◆ macro_mid_to_full_

Eigen::MatrixXd polyfem::solver::NLHomoProblem::macro_mid_to_full_
private

◆ macro_mid_to_reduced_

Eigen::MatrixXd polyfem::solver::NLHomoProblem::macro_mid_to_reduced_
private

◆ macro_strain_constraint_

const assembler::MacroStrainValue& polyfem::solver::NLHomoProblem::macro_strain_constraint_
private

Definition at line 87 of file NLHomoProblem.hpp.

Referenced by macro_reduced_to_full().

◆ only_symmetric

const bool polyfem::solver::NLHomoProblem::only_symmetric
private

Definition at line 86 of file NLHomoProblem.hpp.

Referenced by has_symmetry_constraint(), and init_projection().

◆ state_


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