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

#include <RhsAssembler.hpp>

Collaboration diagram for polyfem::assembler::RhsAssembler:
[legend]

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 Problemproblem () const
 
const mesh::Meshmesh () const
 
const std::vector< basis::ElementBases > & bases () const
 
const std::vector< basis::ElementBases > & gbases () const
 
const AssemblyValsCacheass_vals_cache () const
 
const Assemblerassembler () 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 Assemblerassembler_
 
const mesh::Meshmesh_
 
const mesh::Obstacleobstacle_
 
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 AssemblyValsCacheass_vals_cache_
 
const Problemproblem_
 
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_
 

Detailed Description

Definition at line 15 of file RhsAssembler.hpp.

Constructor & Destructor Documentation

◆ RhsAssembler()

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_, polyfem::assembler::AssemblyValsCache::is_initialized(), and polyfem::assembler::AssemblyValsCache::is_mass().

Here is the call graph for this function:

Member Function Documentation

◆ ass_vals_cache()

const AssemblyValsCache & polyfem::assembler::RhsAssembler::ass_vals_cache ( ) const
inline

Definition at line 87 of file RhsAssembler.hpp.

References ass_vals_cache_.

Referenced by polyfem::solver::BodyForm::force_shape_derivative().

Here is the caller graph for this function:

◆ assemble()

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

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

◆ assembler()

const Assembler & polyfem::assembler::RhsAssembler::assembler ( ) const
inline

Definition at line 88 of file RhsAssembler.hpp.

References assembler_.

Referenced by polyfem::solver::BodyForm::force_shape_derivative().

Here is the caller graph for this function:

◆ bases()

const std::vector< basis::ElementBases > & polyfem::assembler::RhsAssembler::bases ( ) const
inline

Definition at line 85 of file RhsAssembler.hpp.

References bases_.

Referenced by polyfem::solver::BodyForm::force_shape_derivative().

Here is the caller graph for this function:

◆ compute_energy()

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

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

◆ compute_energy_grad()

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

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

◆ compute_energy_hess()

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

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

◆ gbases()

const std::vector< basis::ElementBases > & polyfem::assembler::RhsAssembler::gbases ( ) const
inline

Definition at line 86 of file RhsAssembler.hpp.

References gbases_.

Referenced by polyfem::solver::BodyForm::force_shape_derivative().

Here is the caller graph for this function:

◆ initial_acceleration()

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.

Here is the call graph for this function:

◆ initial_solution()

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.

Here is the call graph for this function:

◆ initial_velocity()

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.

Here is the call graph for this function:

◆ lsq_bc()

void polyfem::assembler::RhsAssembler::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
private

◆ mesh()

const mesh::Mesh & polyfem::assembler::RhsAssembler::mesh ( ) const
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().

Here is the caller graph for this function:

◆ problem()

const Problem & polyfem::assembler::RhsAssembler::problem ( ) const
inline

Definition at line 83 of file RhsAssembler.hpp.

References problem_.

Referenced by polyfem::solver::BodyForm::force_shape_derivative().

Here is the caller graph for this function:

◆ sample_bc()

void polyfem::assembler::RhsAssembler::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
private

◆ set_bc() [1/2]

void polyfem::assembler::RhsAssembler::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
private

◆ set_bc() [2/2]

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

Here is the caller graph for this function:

◆ time_bc()

void polyfem::assembler::RhsAssembler::time_bc ( const std::function< void(const mesh::Mesh &, const Eigen::MatrixXi &, const Eigen::MatrixXd &, Eigen::MatrixXd &)> &  fun,
Eigen::MatrixXd &  sol 
) const
private

Member Data Documentation

◆ ass_vals_cache_

const AssemblyValsCache& polyfem::assembler::RhsAssembler::ass_vals_cache_
private

Definition at line 120 of file RhsAssembler.hpp.

Referenced by ass_vals_cache(), assemble(), compute_energy(), RhsAssembler(), and time_bc().

◆ assembler_

const Assembler& polyfem::assembler::RhsAssembler::assembler_
private

Definition at line 113 of file RhsAssembler.hpp.

Referenced by assemble(), assembler(), compute_energy(), and time_bc().

◆ bases_

const std::vector<basis::ElementBases>& polyfem::assembler::RhsAssembler::bases_
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().

◆ bc_method_

const std::string polyfem::assembler::RhsAssembler::bc_method_
private

Definition at line 122 of file RhsAssembler.hpp.

Referenced by time_bc().

◆ dirichlet_nodes_

const std::vector<int>& polyfem::assembler::RhsAssembler::dirichlet_nodes_
private

Definition at line 124 of file RhsAssembler.hpp.

◆ dirichlet_nodes_position_

const std::vector<RowVectorNd>& polyfem::assembler::RhsAssembler::dirichlet_nodes_position_
private

Definition at line 125 of file RhsAssembler.hpp.

◆ gbases_

const std::vector<basis::ElementBases>& polyfem::assembler::RhsAssembler::gbases_
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().

◆ mesh_

const mesh::Mesh& polyfem::assembler::RhsAssembler::mesh_
private

◆ n_basis_

const int polyfem::assembler::RhsAssembler::n_basis_
private

Definition at line 116 of file RhsAssembler.hpp.

Referenced by assemble(), compute_energy_hess(), lsq_bc(), sample_bc(), and time_bc().

◆ neumann_nodes_

const std::vector<int>& polyfem::assembler::RhsAssembler::neumann_nodes_
private

Definition at line 126 of file RhsAssembler.hpp.

◆ neumann_nodes_position_

const std::vector<RowVectorNd>& polyfem::assembler::RhsAssembler::neumann_nodes_position_
private

Definition at line 127 of file RhsAssembler.hpp.

◆ obstacle_

const mesh::Obstacle& polyfem::assembler::RhsAssembler::obstacle_
private

Definition at line 115 of file RhsAssembler.hpp.

Referenced by time_bc().

◆ problem_

const Problem& polyfem::assembler::RhsAssembler::problem_
private

◆ size_

const int polyfem::assembler::RhsAssembler::size_
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().

◆ solver_params_

const json polyfem::assembler::RhsAssembler::solver_params_
private

Definition at line 123 of file RhsAssembler.hpp.

Referenced by lsq_bc(), and time_bc().


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