PolyFEM
|
#include <RhsAssembler.hpp>
Public Member Functions | |
RhsAssembler (const Assembler &assembler, const mesh::Mesh &mesh, const mesh::Obstacle &obstacle, const std::vector< int > &dirichlet_nodes, const std::vector< int > &neumann_nodes, const std::vector< RowVectorNd > &dirichlet_nodes_position, const std::vector< RowVectorNd > &neumann_nodes_position, const int n_basis, const int size, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const AssemblyValsCache &ass_vals_cache, const Problem &problem, const std::string bc_method, const json &solver_params) | |
void | assemble (const Density &density, Eigen::MatrixXd &rhs, const double t=1) const |
void | initial_solution (Eigen::MatrixXd &sol) const |
void | initial_velocity (Eigen::MatrixXd &sol) const |
void | initial_acceleration (Eigen::MatrixXd &sol) const |
void | set_bc (const std::vector< mesh::LocalBoundary > &local_boundary, const std::vector< int > &bounday_nodes, const int resolution, const std::vector< mesh::LocalBoundary > &local_neumann_boundary, Eigen::MatrixXd &rhs, const Eigen::MatrixXd &displacement=Eigen::MatrixXd(), const double t=1) const |
double | compute_energy (const Eigen::MatrixXd &displacement, const Eigen::MatrixXd &displacement_prev, const std::vector< mesh::LocalBoundary > &local_neumann_boundary, const Density &density, const int resolution, const double t) const |
void | compute_energy_grad (const std::vector< mesh::LocalBoundary > &local_boundary, const std::vector< int > &bounday_nodes, const Density &density, const int resolution, const std::vector< mesh::LocalBoundary > &local_neumann_boundary, const Eigen::MatrixXd &final_rhs, const double t, Eigen::MatrixXd &rhs) const |
void | compute_energy_hess (const std::vector< int > &bounday_nodes, const int resolution, const std::vector< mesh::LocalBoundary > &local_neumann_boundary, const Eigen::MatrixXd &displacement, const double t, const bool project_to_psd, StiffnessMatrix &hess) const |
const Problem & | problem () const |
const mesh::Mesh & | mesh () const |
const std::vector< basis::ElementBases > & | bases () const |
const std::vector< basis::ElementBases > & | gbases () const |
const AssemblyValsCache & | ass_vals_cache () const |
const Assembler & | assembler () const |
Private Member Functions | |
void | lsq_bc (const std::function< void(const Eigen::MatrixXi &, const Eigen::MatrixXd &, const Eigen::MatrixXd &, Eigen::MatrixXd &)> &df, const std::vector< mesh::LocalBoundary > &local_boundary, const std::vector< int > &bounday_nodes, const int resolution, Eigen::MatrixXd &rhs) const |
void | sample_bc (const std::function< void(const Eigen::MatrixXi &, const Eigen::MatrixXd &, const Eigen::MatrixXd &, Eigen::MatrixXd &)> &df, const std::vector< mesh::LocalBoundary > &local_boundary, const std::vector< int > &bounday_nodes, Eigen::MatrixXd &rhs) const |
void | set_bc (const std::function< void(const Eigen::MatrixXi &, const Eigen::MatrixXd &, const Eigen::MatrixXd &, Eigen::MatrixXd &)> &df, const std::function< void(const Eigen::MatrixXi &, const Eigen::MatrixXd &, const Eigen::MatrixXd &, const Eigen::MatrixXd &, Eigen::MatrixXd &)> &nf, const std::vector< mesh::LocalBoundary > &local_boundary, const std::vector< int > &bounday_nodes, const int resolution, const std::vector< mesh::LocalBoundary > &local_neumann_boundary, const Eigen::MatrixXd &displacement, const double t, Eigen::MatrixXd &rhs) const |
void | time_bc (const std::function< void(const mesh::Mesh &, const Eigen::MatrixXi &, const Eigen::MatrixXd &, Eigen::MatrixXd &)> &fun, Eigen::MatrixXd &sol) const |
Private Attributes | |
const Assembler & | assembler_ |
const mesh::Mesh & | mesh_ |
const mesh::Obstacle & | obstacle_ |
const int | n_basis_ |
const int | size_ |
dimension of problem | |
const std::vector< basis::ElementBases > & | bases_ |
basis functions associated with solution | |
const std::vector< basis::ElementBases > & | gbases_ |
basis functions associated with geometric mapping | |
const AssemblyValsCache & | ass_vals_cache_ |
const Problem & | problem_ |
const std::string | bc_method_ |
const json | solver_params_ |
const std::vector< int > & | dirichlet_nodes_ |
const std::vector< RowVectorNd > & | dirichlet_nodes_position_ |
const std::vector< int > & | neumann_nodes_ |
const std::vector< RowVectorNd > & | neumann_nodes_position_ |
Definition at line 15 of file RhsAssembler.hpp.
polyfem::assembler::RhsAssembler::RhsAssembler | ( | const Assembler & | assembler, |
const mesh::Mesh & | mesh, | ||
const mesh::Obstacle & | obstacle, | ||
const std::vector< int > & | dirichlet_nodes, | ||
const std::vector< int > & | neumann_nodes, | ||
const std::vector< RowVectorNd > & | dirichlet_nodes_position, | ||
const std::vector< RowVectorNd > & | neumann_nodes_position, | ||
const int | n_basis, | ||
const int | size, | ||
const std::vector< basis::ElementBases > & | bases, | ||
const std::vector< basis::ElementBases > & | gbases, | ||
const AssemblyValsCache & | ass_vals_cache, | ||
const Problem & | problem, | ||
const std::string | bc_method, | ||
const json & | solver_params | ||
) |
Definition at line 34 of file RhsAssembler.cpp.
References ass_vals_cache_, and polyfem::assembler::AssemblyValsCache::is_mass().
|
inline |
Definition at line 87 of file RhsAssembler.hpp.
References ass_vals_cache_.
Referenced by polyfem::solver::BodyForm::force_shape_derivative().
void polyfem::assembler::RhsAssembler::assemble | ( | const Density & | density, |
Eigen::MatrixXd & | rhs, | ||
const double | t = 1 |
||
) | const |
Definition at line 61 of file RhsAssembler.cpp.
References ass_vals_cache_, assembler_, bases_, polyfem::assembler::AssemblyValsCache::compute(), gbases_, polyfem::assembler::AssemblyValues::global, polyfem::assembler::Problem::is_rhs_zero(), polyfem::mesh::Mesh::is_volume(), mesh_, n_basis_, problem_, quadrature, polyfem::assembler::Problem::rhs(), size_, polyfem::assembler::AssemblyValues::val, and vals.
Referenced by compute_energy_grad().
|
inline |
Definition at line 88 of file RhsAssembler.hpp.
References assembler_.
Referenced by polyfem::solver::BodyForm::force_shape_derivative().
|
inline |
Definition at line 85 of file RhsAssembler.hpp.
References bases_.
Referenced by polyfem::solver::BodyForm::force_shape_derivative().
double polyfem::assembler::RhsAssembler::compute_energy | ( | const Eigen::MatrixXd & | displacement, |
const Eigen::MatrixXd & | displacement_prev, | ||
const std::vector< mesh::LocalBoundary > & | local_neumann_boundary, | ||
const Density & | density, | ||
const int | resolution, | ||
const double | t | ||
) | const |
Definition at line 649 of file RhsAssembler.cpp.
References ass_vals_cache_, assembler_, bases_, polyfem::utils::BoundarySampler::boundary_quadrature(), polyfem::assembler::AssemblyValsCache::compute(), polyfem::utils::create_thread_storage(), da, gbases_, polyfem::utils::get_local_thread_storage(), polyfem::assembler::Problem::is_rhs_zero(), polyfem::mesh::Mesh::is_volume(), polyfem::utils::maybe_parallel_for(), mesh_, polyfem::assembler::Problem::neumann_bc(), problem_, quadrature, polyfem::assembler::Problem::rhs(), size_, and vals.
Referenced by polyfem::solver::BodyForm::value_unweighted().
void polyfem::assembler::RhsAssembler::compute_energy_grad | ( | const std::vector< mesh::LocalBoundary > & | local_boundary, |
const std::vector< int > & | bounday_nodes, | ||
const Density & | density, | ||
const int | resolution, | ||
const std::vector< mesh::LocalBoundary > & | local_neumann_boundary, | ||
const Eigen::MatrixXd & | final_rhs, | ||
const double | t, | ||
Eigen::MatrixXd & | rhs | ||
) | const |
Definition at line 625 of file RhsAssembler.cpp.
References assemble(), polyfem::assembler::Problem::is_constant_in_time(), and problem_.
Referenced by polyfem::solver::BodyForm::update_current_rhs().
void polyfem::assembler::RhsAssembler::compute_energy_hess | ( | const std::vector< int > & | bounday_nodes, |
const int | resolution, | ||
const std::vector< mesh::LocalBoundary > & | local_neumann_boundary, | ||
const Eigen::MatrixXd & | displacement, | ||
const double | t, | ||
const bool | project_to_psd, | ||
StiffnessMatrix & | hess | ||
) | const |
Definition at line 804 of file RhsAssembler.cpp.
References bases_, polyfem::utils::BoundarySampler::boundary_quadrature(), entries, gbases_, polyfem::mesh::Mesh::get_boundary_id(), polyfem::assembler::AssemblyValues::global, polyfem::assembler::Problem::is_boundary_pressure(), polyfem::mesh::Mesh::is_volume(), polyfem::basis::ElementBases::local_nodes_for_primitive(), mesh_, n_basis_, polyfem::assembler::Problem::neumann_bc(), problem_, size_, polyfem::assembler::AssemblyValues::val, vals, and vec.
Referenced by polyfem::solver::BodyForm::hessian_wrt_u_prev().
|
inline |
Definition at line 86 of file RhsAssembler.hpp.
References gbases_.
Referenced by polyfem::solver::BodyForm::force_shape_derivative().
void polyfem::assembler::RhsAssembler::initial_acceleration | ( | Eigen::MatrixXd & | sol | ) | const |
Definition at line 130 of file RhsAssembler.cpp.
References polyfem::assembler::Problem::initial_acceleration(), mesh(), problem_, time_bc(), and val.
void polyfem::assembler::RhsAssembler::initial_solution | ( | Eigen::MatrixXd & | sol | ) | const |
Definition at line 114 of file RhsAssembler.cpp.
References polyfem::assembler::Problem::initial_solution(), mesh(), problem_, time_bc(), and val.
void polyfem::assembler::RhsAssembler::initial_velocity | ( | Eigen::MatrixXd & | sol | ) | const |
Definition at line 122 of file RhsAssembler.cpp.
References polyfem::assembler::Problem::initial_velocity(), mesh(), problem_, time_bc(), and val.
|
private |
Definition at line 235 of file RhsAssembler.cpp.
References polyfem::assembler::Problem::all_dimensions_dirichlet(), polyfem::basis::ElementBases::bases, bases_, polyfem::mesh::Mesh::dimension(), entries, polyfem::basis::ElementBases::eval_geom_mapping(), polyfem::basis::ElementBases::evaluate_bases(), gbases_, polyfem::mesh::Mesh::get_boundary_id(), polyfem::basis::Basis::global(), polyfem::assembler::Problem::is_dimension_dirichet(), polyfem::assembler::Problem::is_scalar(), polyfem::logger(), mesh_, n_basis_, problem_, polyfem::utils::BoundarySampler::sample_boundary(), size_, and solver_params_.
|
inline |
Definition at line 84 of file RhsAssembler.hpp.
References mesh_.
Referenced by polyfem::solver::BodyForm::force_shape_derivative(), initial_acceleration(), initial_solution(), and initial_velocity().
|
inline |
Definition at line 83 of file RhsAssembler.hpp.
References problem_.
Referenced by polyfem::solver::BodyForm::force_shape_derivative().
|
private |
Definition at line 423 of file RhsAssembler.cpp.
References polyfem::assembler::Problem::all_dimensions_dirichlet(), polyfem::basis::ElementBases::bases, bases_, polyfem::mesh::Mesh::dimension(), polyfem::mesh::Mesh::get_boundary_id(), polyfem::assembler::Problem::is_dimension_dirichet(), polyfem::assembler::Problem::is_scalar(), polyfem::basis::ElementBases::local_nodes_for_primitive(), mesh_, n_basis_, problem_, and size_.
|
private |
void polyfem::assembler::RhsAssembler::set_bc | ( | const std::vector< mesh::LocalBoundary > & | local_boundary, |
const std::vector< int > & | bounday_nodes, | ||
const int | resolution, | ||
const std::vector< mesh::LocalBoundary > & | local_neumann_boundary, | ||
Eigen::MatrixXd & | rhs, | ||
const Eigen::MatrixXd & | displacement = Eigen::MatrixXd() , |
||
const double | t = 1 |
||
) | const |
Referenced by polyfem::solver::BodyForm::update_current_rhs(), and polyfem::solver::BCLagrangianForm::update_target().
|
private |
Definition at line 138 of file RhsAssembler.cpp.
References polyfem::assembler::Mass::add_multimaterial(), ass_vals_cache_, polyfem::assembler::Mass::assemble(), assembler_, polyfem::basis::ElementBases::bases, bases_, bc_method_, polyfem::assembler::AssemblyValsCache::compute(), gbases_, polyfem::assembler::AssemblyValues::global, polyfem::mesh::Mesh::is_volume(), polyfem::logger(), mesh_, n_basis_, polyfem::mesh::Obstacle::n_vertices(), polyfem::mesh::Obstacle::ndof(), obstacle_, quadrature, polyfem::assembler::Assembler::set_size(), polyfem::assembler::Assembler::size(), size_, solver_params_, polyfem::assembler::AssemblyValues::val, and vals.
Referenced by initial_acceleration(), initial_solution(), and initial_velocity().
|
private |
Definition at line 120 of file RhsAssembler.hpp.
Referenced by ass_vals_cache(), assemble(), compute_energy(), RhsAssembler(), and time_bc().
|
private |
Definition at line 113 of file RhsAssembler.hpp.
Referenced by assemble(), assembler(), compute_energy(), and time_bc().
|
private |
basis functions associated with solution
Definition at line 118 of file RhsAssembler.hpp.
Referenced by assemble(), bases(), compute_energy(), compute_energy_hess(), lsq_bc(), sample_bc(), and time_bc().
|
private |
Definition at line 122 of file RhsAssembler.hpp.
Referenced by time_bc().
|
private |
Definition at line 124 of file RhsAssembler.hpp.
|
private |
Definition at line 125 of file RhsAssembler.hpp.
|
private |
basis functions associated with geometric mapping
Definition at line 119 of file RhsAssembler.hpp.
Referenced by assemble(), compute_energy(), compute_energy_hess(), gbases(), lsq_bc(), and time_bc().
|
private |
Definition at line 114 of file RhsAssembler.hpp.
Referenced by assemble(), compute_energy(), compute_energy_hess(), lsq_bc(), mesh(), sample_bc(), and time_bc().
|
private |
Definition at line 116 of file RhsAssembler.hpp.
Referenced by assemble(), compute_energy_hess(), lsq_bc(), sample_bc(), and time_bc().
|
private |
Definition at line 126 of file RhsAssembler.hpp.
|
private |
Definition at line 127 of file RhsAssembler.hpp.
|
private |
Definition at line 115 of file RhsAssembler.hpp.
Referenced by time_bc().
|
private |
Definition at line 121 of file RhsAssembler.hpp.
Referenced by assemble(), compute_energy(), compute_energy_grad(), compute_energy_hess(), initial_acceleration(), initial_solution(), initial_velocity(), lsq_bc(), problem(), and sample_bc().
|
private |
dimension of problem
Definition at line 117 of file RhsAssembler.hpp.
Referenced by assemble(), compute_energy(), compute_energy_hess(), lsq_bc(), sample_bc(), and time_bc().
|
private |
Definition at line 123 of file RhsAssembler.hpp.