PolyFEM
Loading...
Searching...
No Matches
polyfem::varform::VarForm Class Referenceabstract

#include <VarForm.hpp>

Inheritance diagram for polyfem::varform::VarForm:
[legend]
Collaboration diagram for polyfem::varform::VarForm:
[legend]

Public Member Functions

virtual ~VarForm ()=default
 
virtual std::string name () const =0
 Get the name of the variational formulation.
 
void set_args (const json &args)
 Reset the internal state of the variational formulation, e.g.
 
virtual void init (const std::string &formulation, const Units &units, const json &args, const std::string &out_path)
 Initialize the variational formulation with the given parameters.
 
void set_mesh (std::unique_ptr< mesh::Mesh > mesh, const double loading_mesh_time=0)
 Set the mesh for the variational formulation.
 
void solve (Eigen::MatrixXd &sol)
 Solve the variational formulation and store the solution in the given matrix.
 
void set_time_callback (const std::function< void(int, int, double, double)> &callback)
 
int problem_dimension () const
 Get the problem dimension of the variational formulation, for output purposes.
 
virtual bool is_contact_enabled () const
 Check if contact is enabled for the variational formulation, for output purposes.
 
virtual io::OutputSpace output_space () const =0
 Get the output space of the variational formulation, for output purposes.
 
virtual std::vector< io::OutputFieldoutput_fields (const io::OutputSample &sample, const Eigen::MatrixXd &solution, const io::OutputFieldOptions &options) const =0
 Get the output fields of the variational formulation, for output purposes.
 
const io::OutRuntimeDataoutput_timings () const
 Get the runtime timings of the variational formulation, for output purposes.
 
virtual io::OutStatsData compute_errors (const Eigen::MatrixXd &solution)=0
 Get the error statistics of the variational formulation, for output purposes.
 
virtual void save_json (const Eigen::MatrixXd &solution, std::ostream &out) const =0
 Save the solution to a JSON file, for output purposes.
 
void save_json (const Eigen::MatrixXd &solution) const
 Save the solution to a JSON file, for output purposes.
 
virtual void export_data (const Eigen::MatrixXd &solution) const =0
 

Protected Member Functions

std::string resolve_output_path (const std::string &path) const
 
std::string resolve_input_path (const std::string &path, const bool only_if_exists=false) const
 
void set_materials (assembler::Assembler &assembler, const int size) const
 
virtual void reset ()=0
 
virtual void load_mesh (const mesh::Mesh &mesh, const json &args)=0
 
virtual void build_basis (mesh::Mesh &mesh, const bool iso_parametric, const json &args)=0
 
void assign_discr_orders (const json &discr_order, const mesh::Mesh &mesh, Eigen::VectorXi &disc_orders)
 
virtual void assemble_rhs (const mesh::Mesh &mesh)=0
 
virtual void assemble_mass_mat (const mesh::Mesh &mesh, const json &args)=0
 
virtual void solve_problem (Eigen::MatrixXd &sol)=0
 
void prepare ()
 
QuadratureOrders n_boundary_samples (const int discr_order, const int gdiscr_order) const
 
void build_fe_space (mesh::Mesh &mesh, const bool iso_parametric, const Eigen::VectorXi &disc_orders, const std::string &basis_type, const std::string &poly_basis_type, const assembler::Assembler &space_assembler, const int value_dim, const int quadrature_order, const int mass_quadrature_order, const bool use_corner_quadrature, const int n_harmonic_samples, const int integral_constraints, FESpace &space, VarFormBoundaryState &boundary, std::shared_ptr< GeometryMapping > geometry=nullptr)
 
virtual void build_rhs_assembler ()=0
 
std::shared_ptr< time_integrator::BDFmake_bdf_time_integrator () const
 
void save_step_state (const double t0, const double dt, const int t, const time_integrator::ImplicitTimeIntegrator *time_integrator, const bool rest_mesh_written=false) const
 
void ensure_output_sampler () const
 
void save_restart_json (const double t0, const double dt, const int t, const bool rest_mesh_written) const
 
void save_timestep (const double time, const int t, const double t0, const double dt, const Eigen::MatrixXd &solution) const
 
void save_subsolve (const int i, const int t, const Eigen::MatrixXd &solution) const
 
int output_file_index (const int t) const
 
void notify_time_step (const int t, const int time_steps, const double t0, const double dt) const
 
io::OutGeometryData::ExportOptions export_options (const io::OutputSpace &space) const
 
io::OutputFieldFunction output_field_function (const Eigen::MatrixXd &solution, const io::OutGeometryData::ExportOptions &opts) const
 

Static Protected Member Functions

static bool read_initial_x_from_file (const std::string &state_path, const std::string &x_name, const bool reorder, const Eigen::VectorXi &in_node_to_node, const int dim, Eigen::MatrixXd &x)
 
static void rebuild_node_positions (const std::vector< basis::ElementBases > &bases, const std::vector< int > &node_ids, std::vector< RowVectorNd > &positions)
 

Protected Attributes

std::shared_ptr< assembler::Problemproblem
 current problem, it contains rhs and bc
 
Units units
 
json args
 
io::OutStatsData stats
 
io::OutRuntimeData timings
 runtime statistics
 
std::string root_path
 
std::string output_path
 
std::unique_ptr< mesh::Meshmesh_
 
std::function< void(int, int, double, double)> time_callback
 
io::OutGeometryData output_geometry_
 
bool output_sampler_initialized_ = false
 
bool prepared_ = false
 

Private Member Functions

void build_polygonal_basis (const mesh::Mesh &mesh, const std::string &poly_basis_type, const assembler::Assembler &space_assembler, bool iso_parametric, const int quadrature_order, const int mass_quadrature_order, const int n_harmonic_samples, const int integral_constraints, FESpace &space, VarFormBoundaryState &boundary)
 
void build_node_mapping (const mesh::Mesh &mesh, const std::string &basis_type, const FESpace &space, Eigen::VectorXi &space_in_node_to_node, Eigen::VectorXi &space_in_primitive_to_primitive) const
 

Friends

class polyfem::test::VarFormTestAccess
 

Detailed Description

Definition at line 43 of file VarForm.hpp.

Constructor & Destructor Documentation

◆ ~VarForm()

virtual polyfem::varform::VarForm::~VarForm ( )
virtualdefault

Member Function Documentation

◆ assemble_mass_mat()

virtual void polyfem::varform::VarForm::assemble_mass_mat ( const mesh::Mesh mesh,
const json args 
)
protectedpure virtual

Implemented in polyfem::varform::BilaplacianVarForm, polyfem::varform::ElasticVarForm, polyfem::varform::FluidVarForm, polyfem::varform::IncompressibleElasticVarForm, and polyfem::varform::ScalarVarForm.

Referenced by prepare().

Here is the caller graph for this function:

◆ assemble_rhs()

virtual void polyfem::varform::VarForm::assemble_rhs ( const mesh::Mesh mesh)
protectedpure virtual

Implemented in polyfem::varform::BilaplacianVarForm, polyfem::varform::ElasticVarForm, polyfem::varform::FluidVarForm, polyfem::varform::IncompressibleElasticVarForm, and polyfem::varform::ScalarVarForm.

Referenced by prepare().

Here is the caller graph for this function:

◆ assign_discr_orders()

void polyfem::varform::VarForm::assign_discr_orders ( const json discr_order,
const mesh::Mesh mesh,
Eigen::VectorXi &  disc_orders 
)
protected

Definition at line 745 of file VarForm.cpp.

References polyfem::mesh::Mesh::get_body_id(), polyfem::logger(), polyfem::mesh::Mesh::n_elements(), polyfem::io::read_matrix(), polyfem::utils::resolve_path(), and root_path.

Referenced by polyfem::varform::BilaplacianVarForm::build_basis(), polyfem::varform::ElasticVarForm::build_basis(), polyfem::varform::FluidVarForm::build_basis(), and polyfem::varform::ScalarVarForm::build_basis().

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

◆ build_basis()

virtual void polyfem::varform::VarForm::build_basis ( mesh::Mesh mesh,
const bool  iso_parametric,
const json args 
)
protectedpure virtual

Implemented in polyfem::varform::BilaplacianVarForm, polyfem::varform::ElasticVarForm, polyfem::varform::FluidVarForm, polyfem::varform::IncompressibleElasticVarForm, polyfem::varform::NonlinearElasticVarForm, and polyfem::varform::ScalarVarForm.

Referenced by prepare().

Here is the caller graph for this function:

◆ build_fe_space()

void polyfem::varform::VarForm::build_fe_space ( mesh::Mesh mesh,
const bool  iso_parametric,
const Eigen::VectorXi &  disc_orders,
const std::string &  basis_type,
const std::string &  poly_basis_type,
const assembler::Assembler space_assembler,
const int  value_dim,
const int  quadrature_order,
const int  mass_quadrature_order,
const bool  use_corner_quadrature,
const int  n_harmonic_samples,
const int  integral_constraints,
FESpace space,
VarFormBoundaryState boundary,
std::shared_ptr< GeometryMapping geometry = nullptr 
)
protected

Definition at line 323 of file VarForm.cpp.

References polyfem::varform::FESpace::bases, polyfem::basis::LagrangeBasis2d::build_bases(), polyfem::basis::SplineBasis2d::build_bases(), polyfem::basis::LagrangeBasis3d::build_bases(), polyfem::basis::SplineBasis3d::build_bases(), build_node_mapping(), build_polygonal_basis(), polyfem::io::OutRuntimeData::building_basis_time, polyfem::varform::FESpace::disc_orders, polyfem::varform::FESpace::disc_ordersq, polyfem::varform::FESpace::geometry, polyfem::mesh::Mesh::has_poly(), polyfem::varform::FESpace::is_iso_parametric(), polyfem::mesh::Mesh::is_volume(), polyfem::varform::VarFormBoundaryState::local_boundary, polyfem::logger(), polyfem::varform::FESpace::mesh_nodes, polyfem::varform::FESpace::n_bases, polyfem::assembler::Assembler::name(), polyfem::mesh::Mesh::orders(), polyfem::varform::FESpace::poly_edge_to_data, polyfem::varform::FESpace::reset(), polyfem::varform::VarFormBoundaryState::reset(), polyfem::varform::FESpace::space_in_node_to_node, polyfem::varform::FESpace::space_in_primitive_to_primitive, timings, polyfem::varform::VarFormBoundaryState::total_local_boundary, and polyfem::varform::FESpace::value_dim.

Referenced by polyfem::varform::BilaplacianVarForm::build_basis(), polyfem::varform::ElasticVarForm::build_basis(), polyfem::varform::FluidVarForm::build_basis(), polyfem::varform::IncompressibleElasticVarForm::build_basis(), and polyfem::varform::ScalarVarForm::build_basis().

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

◆ build_node_mapping()

void polyfem::varform::VarForm::build_node_mapping ( const mesh::Mesh mesh,
const std::string &  basis_type,
const FESpace space,
Eigen::VectorXi &  space_in_node_to_node,
Eigen::VectorXi &  space_in_primitive_to_primitive 
) const
private

Definition at line 648 of file VarForm.cpp.

References polyfem::varform::FESpace::disc_orders, polyfem::mesh::Mesh::has_poly(), polyfem::mesh::Mesh::in_ordered_edges(), polyfem::mesh::Mesh::in_ordered_faces(), polyfem::mesh::Mesh::in_ordered_vertices(), polyfem::mesh::Mesh::is_conforming(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), polyfem::varform::FESpace::mesh_nodes, polyfem::mesh::Mesh::n_cells(), polyfem::mesh::Mesh::n_edges(), polyfem::mesh::Mesh::n_faces(), and polyfem::mesh::Mesh::n_vertices().

Referenced by build_fe_space().

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

◆ build_polygonal_basis()

void polyfem::varform::VarForm::build_polygonal_basis ( const mesh::Mesh mesh,
const std::string &  poly_basis_type,
const assembler::Assembler space_assembler,
bool  iso_parametric,
const int  quadrature_order,
const int  mass_quadrature_order,
const int  n_harmonic_samples,
const int  integral_constraints,
varform::FESpace space,
varform::VarFormBoundaryState boundary 
)
private

◆ build_rhs_assembler()

◆ compute_errors()

virtual io::OutStatsData polyfem::varform::VarForm::compute_errors ( const Eigen::MatrixXd &  solution)
pure virtual

Get the error statistics of the variational formulation, for output purposes.

Returns
Error statistics

Implemented in polyfem::varform::BilaplacianVarForm, polyfem::varform::ElasticVarForm, polyfem::varform::FluidVarForm, polyfem::varform::IncompressibleElasticVarForm, and polyfem::varform::ScalarVarForm.

◆ ensure_output_sampler()

void polyfem::varform::VarForm::ensure_output_sampler ( ) const
protected

Definition at line 832 of file VarForm.cpp.

References args, polyfem::io::OutGeometryData::build_grid(), polyfem::io::OutGeometryData::init_sampler(), polyfem::io::OutputSpace::mesh, output_geometry_, output_sampler_initialized_, and output_space().

Referenced by polyfem::varform::BilaplacianVarForm::export_data(), polyfem::varform::FluidVarForm::export_data(), polyfem::varform::ScalarVarForm::export_data(), save_subsolve(), and save_timestep().

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

◆ export_data()

virtual void polyfem::varform::VarForm::export_data ( const Eigen::MatrixXd &  solution) const
pure virtual

◆ export_options()

io::OutGeometryData::ExportOptions polyfem::varform::VarForm::export_options ( const io::OutputSpace space) const
protected

Definition at line 846 of file VarForm.cpp.

References args, polyfem::mesh::Mesh::has_prism(), polyfem::mesh::Mesh::is_linear(), polyfem::io::OutputSpace::mesh, and problem_dimension().

Referenced by polyfem::varform::BilaplacianVarForm::export_data(), polyfem::varform::FluidVarForm::export_data(), polyfem::varform::ScalarVarForm::export_data(), save_subsolve(), and save_timestep().

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

◆ init()

void polyfem::varform::VarForm::init ( const std::string &  formulation,
const Units units,
const json args,
const std::string &  out_path 
)
virtual

Initialize the variational formulation with the given parameters.

Parameters
formulationname of the variational formulation
unitsunit system to use for the formulation
argsjson input arguments, used to initialize the formulation
out_pathoutput path for the formulation, used to save intermediate data

Reimplemented in polyfem::varform::BilaplacianVarForm, polyfem::varform::ElasticVarForm, polyfem::varform::FluidVarForm, polyfem::varform::IncompressibleElasticVarForm, polyfem::varform::NonlinearElasticVarForm, and polyfem::varform::ScalarVarForm.

Definition at line 280 of file VarForm.cpp.

References args, polyfem::utils::is_param_valid(), output_path, output_sampler_initialized_, reset(), root_path, and units.

Referenced by polyfem::varform::BilaplacianVarForm::init(), polyfem::varform::ElasticVarForm::init(), polyfem::varform::FluidVarForm::init(), and polyfem::varform::ScalarVarForm::init().

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

◆ is_contact_enabled()

virtual bool polyfem::varform::VarForm::is_contact_enabled ( ) const
inlinevirtual

Check if contact is enabled for the variational formulation, for output purposes.

Returns
True if contact is enabled, false otherwise

Reimplemented in polyfem::varform::NonlinearElasticVarForm.

Definition at line 84 of file VarForm.hpp.

◆ load_mesh()

virtual void polyfem::varform::VarForm::load_mesh ( const mesh::Mesh mesh,
const json args 
)
protectedpure virtual

Implemented in polyfem::varform::BilaplacianVarForm, polyfem::varform::ElasticVarForm, polyfem::varform::FluidVarForm, polyfem::varform::IncompressibleElasticVarForm, polyfem::varform::NonlinearElasticVarForm, and polyfem::varform::ScalarVarForm.

Referenced by set_mesh().

Here is the caller graph for this function:

◆ make_bdf_time_integrator()

std::shared_ptr< time_integrator::BDF > polyfem::varform::VarForm::make_bdf_time_integrator ( ) const
protected

Definition at line 874 of file VarForm.cpp.

References args, polyfem::log_and_throw_error(), and polyfem::utils::StringUtils::startswith().

Referenced by polyfem::varform::BilaplacianVarForm::solve_transient_linear(), and polyfem::varform::IncompressibleElasticVarForm::solve_transient_linear().

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

◆ n_boundary_samples()

QuadratureOrders polyfem::varform::VarForm::n_boundary_samples ( const int  discr_order,
const int  gdiscr_order 
) const
protected

Definition at line 259 of file VarForm.cpp.

References args, mesh_, and polyfem::assembler::AssemblerUtils::quadrature_order().

Referenced by polyfem::varform::BilaplacianVarForm::assemble_rhs(), polyfem::varform::ElasticVarForm::elastic_boundary_samples(), polyfem::varform::BilaplacianVarForm::solve_static_linear(), and polyfem::varform::BilaplacianVarForm::solve_transient_linear().

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

◆ name()

virtual std::string polyfem::varform::VarForm::name ( ) const
pure virtual

◆ notify_time_step()

void polyfem::varform::VarForm::notify_time_step ( const int  t,
const int  time_steps,
const double  t0,
const double  dt 
) const
protected

Definition at line 951 of file VarForm.cpp.

References time_callback.

Referenced by polyfem::varform::BilaplacianVarForm::solve_transient_linear(), polyfem::varform::IncompressibleElasticVarForm::solve_transient_linear(), and polyfem::varform::LinearElasticVarForm::solve_transient_linear().

Here is the caller graph for this function:

◆ output_field_function()

io::OutputFieldFunction polyfem::varform::VarForm::output_field_function ( const Eigen::MatrixXd &  solution,
const io::OutGeometryData::ExportOptions opts 
) const
protected

Definition at line 855 of file VarForm.cpp.

References polyfem::io::OutGeometryData::ExportOptions::fields, and output_fields().

Referenced by polyfem::varform::BilaplacianVarForm::export_data(), polyfem::varform::FluidVarForm::export_data(), polyfem::varform::ScalarVarForm::export_data(), save_subsolve(), and save_timestep().

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

◆ output_fields()

virtual std::vector< io::OutputField > polyfem::varform::VarForm::output_fields ( const io::OutputSample sample,
const Eigen::MatrixXd &  solution,
const io::OutputFieldOptions options 
) const
pure virtual

Get the output fields of the variational formulation, for output purposes.

Parameters
sampleOutput sample
solutionSolution matrix
optionsOutput field options
Returns
Output fields

Implemented in polyfem::varform::BilaplacianVarForm, polyfem::varform::FluidVarForm, polyfem::varform::IncompressibleElasticVarForm, polyfem::varform::LinearElasticVarForm, polyfem::varform::NonlinearElasticVarForm, and polyfem::varform::ScalarVarForm.

Referenced by output_field_function().

Here is the caller graph for this function:

◆ output_file_index()

int polyfem::varform::VarForm::output_file_index ( const int  t) const
protected

Definition at line 1052 of file VarForm.cpp.

References args.

Referenced by save_restart_json(), save_step_state(), and save_timestep().

Here is the caller graph for this function:

◆ output_space()

virtual io::OutputSpace polyfem::varform::VarForm::output_space ( ) const
pure virtual

Get the output space of the variational formulation, for output purposes.

Returns
Output space

Implemented in polyfem::varform::BilaplacianVarForm, polyfem::varform::ElasticVarForm, polyfem::varform::FluidVarForm, polyfem::varform::NonlinearElasticVarForm, and polyfem::varform::ScalarVarForm.

Referenced by ensure_output_sampler(), save_subsolve(), and save_timestep().

Here is the caller graph for this function:

◆ output_timings()

const io::OutRuntimeData & polyfem::varform::VarForm::output_timings ( ) const
inline

Get the runtime timings of the variational formulation, for output purposes.

Returns
Runtime timings

Definition at line 101 of file VarForm.hpp.

References timings.

◆ prepare()

void polyfem::varform::VarForm::prepare ( )
protected

Definition at line 308 of file VarForm.cpp.

References args, assemble_mass_mat(), assemble_rhs(), build_basis(), polyfem::io::OutStatsData::compute_mesh_stats(), polyfem::log_and_throw_error(), mesh_, prepared_, and stats.

Referenced by solve().

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

◆ problem_dimension()

int polyfem::varform::VarForm::problem_dimension ( ) const

Get the problem dimension of the variational formulation, for output purposes.

Returns
Problem dimension

Definition at line 865 of file VarForm.cpp.

References mesh_, and problem.

Referenced by export_options().

Here is the caller graph for this function:

◆ read_initial_x_from_file()

bool polyfem::varform::VarForm::read_initial_x_from_file ( const std::string &  state_path,
const std::string &  x_name,
const bool  reorder,
const Eigen::VectorXi &  in_node_to_node,
const int  dim,
Eigen::MatrixXd &  x 
)
staticprotected

Definition at line 39 of file VarForm.cpp.

References polyfem::logger(), polyfem::io::read_matrix(), polyfem::utils::reorder_matrix(), and x.

Referenced by polyfem::varform::ElasticVarForm::initial_acceleration(), polyfem::varform::ElasticVarForm::initial_elastic_solution(), polyfem::varform::ElasticVarForm::initial_velocity(), polyfem::varform::BilaplacianVarForm::prepare_initial_solution(), polyfem::varform::FluidVarForm::prepare_initial_solution(), and polyfem::varform::ScalarVarForm::prepare_initial_solution().

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

◆ rebuild_node_positions()

void polyfem::varform::VarForm::rebuild_node_positions ( const std::vector< basis::ElementBases > &  bases,
const std::vector< int > &  node_ids,
std::vector< RowVectorNd > &  positions 
)
staticprotected

Definition at line 1071 of file VarForm.cpp.

Referenced by polyfem::varform::BilaplacianVarForm::build_basis(), polyfem::varform::ElasticVarForm::build_basis(), polyfem::varform::FluidVarForm::build_basis(), polyfem::varform::IncompressibleElasticVarForm::build_basis(), and polyfem::varform::ScalarVarForm::build_basis().

Here is the caller graph for this function:

◆ reset()

void polyfem::varform::VarForm::reset ( )
protectedpure virtual

Implemented in polyfem::varform::BilaplacianVarForm, polyfem::varform::ElasticVarForm, polyfem::varform::FluidVarForm, polyfem::varform::IncompressibleElasticVarForm, polyfem::varform::LinearElasticVarForm, polyfem::varform::NonlinearElasticVarForm, and polyfem::varform::ScalarVarForm.

Definition at line 268 of file VarForm.cpp.

References mesh_, output_sampler_initialized_, prepared_, problem, polyfem::io::OutStatsData::reset(), stats, time_callback, and timings.

Referenced by init(), polyfem::varform::BilaplacianVarForm::reset(), polyfem::varform::ElasticVarForm::reset(), polyfem::varform::FluidVarForm::reset(), and polyfem::varform::ScalarVarForm::reset().

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

◆ resolve_input_path()

std::string polyfem::varform::VarForm::resolve_input_path ( const std::string &  path,
const bool  only_if_exists = false 
) const
protected

Definition at line 1057 of file VarForm.cpp.

References polyfem::utils::resolve_path(), and root_path.

Referenced by polyfem::varform::ElasticVarForm::initial_acceleration(), polyfem::varform::ElasticVarForm::initial_elastic_solution(), polyfem::varform::ElasticVarForm::initial_velocity(), polyfem::varform::BilaplacianVarForm::prepare_initial_solution(), polyfem::varform::FluidVarForm::prepare_initial_solution(), and polyfem::varform::ScalarVarForm::prepare_initial_solution().

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

◆ resolve_output_path()

std::string polyfem::varform::VarForm::resolve_output_path ( const std::string &  path) const
protected

Definition at line 1062 of file VarForm.cpp.

References output_path.

Referenced by polyfem::varform::BilaplacianVarForm::export_data(), polyfem::varform::FluidVarForm::export_data(), polyfem::varform::ScalarVarForm::export_data(), save_json(), save_restart_json(), save_step_state(), save_subsolve(), and save_timestep().

Here is the caller graph for this function:

◆ save_json() [1/2]

void polyfem::varform::VarForm::save_json ( const Eigen::MatrixXd &  solution) const

Save the solution to a JSON file, for output purposes.

Parameters
solution

Definition at line 802 of file VarForm.cpp.

References args, polyfem::logger(), resolve_output_path(), and save_json().

Here is the call graph for this function:

◆ save_json() [2/2]

virtual void polyfem::varform::VarForm::save_json ( const Eigen::MatrixXd &  solution,
std::ostream &  out 
) const
pure virtual

Save the solution to a JSON file, for output purposes.

Parameters
solutionSolution matrix to save
outOutput stream to save the solution

Implemented in polyfem::varform::BilaplacianVarForm, polyfem::varform::ElasticVarForm, polyfem::varform::FluidVarForm, polyfem::varform::IncompressibleElasticVarForm, and polyfem::varform::ScalarVarForm.

Referenced by save_json().

Here is the caller graph for this function:

◆ save_restart_json()

void polyfem::varform::VarForm::save_restart_json ( const double  t0,
const double  dt,
const int  t,
const bool  rest_mesh_written 
) const
protected

Definition at line 957 of file VarForm.cpp.

References args, polyfem::logger(), polyfem::io::OutStatsData::min_edge_length, name(), output_file_index(), resolve_output_path(), root_path, and stats.

Referenced by save_step_state().

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

◆ save_step_state()

void polyfem::varform::VarForm::save_step_state ( const double  t0,
const double  dt,
const int  t,
const time_integrator::ImplicitTimeIntegrator time_integrator,
const bool  rest_mesh_written = false 
) const
protected

Definition at line 892 of file VarForm.cpp.

References args, output_file_index(), resolve_output_path(), save_restart_json(), and polyfem::time_integrator::ImplicitTimeIntegrator::save_state().

Referenced by polyfem::varform::BilaplacianVarForm::solve_transient_linear().

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

◆ save_subsolve()

void polyfem::varform::VarForm::save_subsolve ( const int  i,
const int  t,
const Eigen::MatrixXd &  solution 
) const
protected

Definition at line 932 of file VarForm.cpp.

References args, ensure_output_sampler(), export_options(), polyfem::io::OutputSpace::mesh, output_field_function(), output_geometry_, output_space(), resolve_output_path(), and polyfem::io::OutGeometryData::save_vtu().

Here is the call graph for this function:

◆ save_timestep()

void polyfem::varform::VarForm::save_timestep ( const double  time,
const int  t,
const double  t0,
const double  dt,
const Eigen::MatrixXd &  solution 
) const
protected

Definition at line 907 of file VarForm.cpp.

References args, ensure_output_sampler(), export_options(), polyfem::logger(), polyfem::io::OutputSpace::mesh, output_field_function(), output_file_index(), output_geometry_, output_space(), resolve_output_path(), polyfem::io::OutGeometryData::save_pvd(), and polyfem::io::OutGeometryData::save_vtu().

Referenced by polyfem::varform::BilaplacianVarForm::solve_transient_linear(), polyfem::varform::IncompressibleElasticVarForm::solve_transient_linear(), and polyfem::varform::LinearElasticVarForm::solve_transient_linear().

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

◆ set_args()

void polyfem::varform::VarForm::set_args ( const json args)
inline

Reset the internal state of the variational formulation, e.g.

when loading a new mesh

Parameters
argsjson input arguments, used to determine which data to reset

Definition at line 56 of file VarForm.hpp.

References args, output_sampler_initialized_, and prepared_.

◆ set_materials()

void polyfem::varform::VarForm::set_materials ( assembler::Assembler assembler,
const int  size 
) const
protected

Definition at line 817 of file VarForm.cpp.

References args, polyfem::utils::is_param_valid(), mesh_, root_path, polyfem::assembler::Assembler::set_materials(), polyfem::assembler::Assembler::set_size(), and units.

Referenced by polyfem::varform::BilaplacianVarForm::load_mesh(), polyfem::varform::ElasticVarForm::load_mesh(), polyfem::varform::FluidVarForm::load_mesh(), polyfem::varform::IncompressibleElasticVarForm::load_mesh(), and polyfem::varform::ScalarVarForm::load_mesh().

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

◆ set_mesh()

void polyfem::varform::VarForm::set_mesh ( std::unique_ptr< mesh::Mesh mesh,
const double  loading_mesh_time = 0 
)

Set the mesh for the variational formulation.

Parameters
meshunique pointer to the mesh to use for the formulation

Definition at line 296 of file VarForm.cpp.

References args, load_mesh(), polyfem::io::OutRuntimeData::loading_mesh_time, mesh_, output_sampler_initialized_, prepared_, and timings.

Here is the call graph for this function:

◆ set_time_callback()

void polyfem::varform::VarForm::set_time_callback ( const std::function< void(int, int, double, double)> &  callback)
inline

Definition at line 77 of file VarForm.hpp.

References time_callback.

◆ solve()

void polyfem::varform::VarForm::solve ( Eigen::MatrixXd &  sol)

Solve the variational formulation and store the solution in the given matrix.

Parameters
solmatrix to store the solution

Definition at line 642 of file VarForm.cpp.

References prepare(), and solve_problem().

Here is the call graph for this function:

◆ solve_problem()

virtual void polyfem::varform::VarForm::solve_problem ( Eigen::MatrixXd &  sol)
protectedpure virtual

Friends And Related Symbol Documentation

◆ polyfem::test::VarFormTestAccess

friend class polyfem::test::VarFormTestAccess
friend

Definition at line 45 of file VarForm.hpp.

Member Data Documentation

◆ args

json polyfem::varform::VarForm::args
protected

Definition at line 193 of file VarForm.hpp.

Referenced by polyfem::varform::BilaplacianVarForm::assemble_mass_mat(), polyfem::varform::ElasticVarForm::assemble_mass_mat(), polyfem::varform::FluidVarForm::assemble_mass_mat(), polyfem::varform::IncompressibleElasticVarForm::assemble_mass_mat(), polyfem::varform::ScalarVarForm::assemble_mass_mat(), polyfem::varform::BilaplacianVarForm::build_basis(), polyfem::varform::ElasticVarForm::build_basis(), polyfem::varform::FluidVarForm::build_basis(), polyfem::varform::IncompressibleElasticVarForm::build_basis(), polyfem::varform::ScalarVarForm::build_basis(), polyfem::varform::ElasticVarForm::build_rhs_assembler(), polyfem::varform::FluidVarForm::build_rhs_assembler(), polyfem::varform::IncompressibleElasticVarForm::build_rhs_assembler(), polyfem::varform::ScalarVarForm::build_rhs_assembler(), polyfem::varform::BilaplacianVarForm::build_rhs_assembler(), polyfem::varform::BilaplacianVarForm::build_stiffness_mat(), polyfem::varform::FluidVarForm::build_stiffness_mat(), polyfem::varform::IncompressibleElasticVarForm::build_stiffness_mat(), polyfem::varform::LinearElasticVarForm::build_stiffness_mat(), polyfem::varform::BilaplacianVarForm::compute_errors(), polyfem::varform::FluidVarForm::compute_errors(), polyfem::varform::IncompressibleElasticVarForm::compute_errors(), polyfem::varform::ScalarVarForm::compute_errors(), polyfem::varform::ElasticVarForm::elastic_output_fields(), ensure_output_sampler(), polyfem::varform::BilaplacianVarForm::export_data(), polyfem::varform::FluidVarForm::export_data(), polyfem::varform::ScalarVarForm::export_data(), export_options(), init(), polyfem::varform::BilaplacianVarForm::init(), polyfem::varform::ElasticVarForm::init(), polyfem::varform::FluidVarForm::init(), polyfem::varform::IncompressibleElasticVarForm::init(), polyfem::varform::NonlinearElasticVarForm::init(), polyfem::varform::ScalarVarForm::init(), polyfem::varform::LinearElasticVarForm::init_linear_solve(), polyfem::varform::ElasticVarForm::initial_acceleration(), polyfem::varform::ElasticVarForm::initial_elastic_solution(), polyfem::varform::ElasticVarForm::initial_velocity(), polyfem::varform::NonlinearElasticVarForm::is_contact_enabled(), polyfem::varform::ElasticVarForm::load_mesh(), polyfem::varform::IncompressibleElasticVarForm::load_mesh(), polyfem::varform::NonlinearElasticVarForm::load_mesh(), make_bdf_time_integrator(), n_boundary_samples(), polyfem::varform::BilaplacianVarForm::output_fields(), polyfem::varform::NonlinearElasticVarForm::output_fields(), polyfem::varform::ScalarVarForm::output_fields(), output_file_index(), prepare(), polyfem::varform::BilaplacianVarForm::prepare_initial_solution(), polyfem::varform::FluidVarForm::prepare_initial_solution(), polyfem::varform::ScalarVarForm::prepare_initial_solution(), save_json(), polyfem::varform::BilaplacianVarForm::save_json(), polyfem::varform::FluidVarForm::save_json(), polyfem::varform::IncompressibleElasticVarForm::save_json(), polyfem::varform::ScalarVarForm::save_json(), save_restart_json(), save_step_state(), save_subsolve(), save_timestep(), set_args(), set_materials(), set_mesh(), polyfem::varform::BilaplacianVarForm::solve_linear_system(), polyfem::varform::FluidVarForm::solve_linear_system(), polyfem::varform::IncompressibleElasticVarForm::solve_linear_system(), polyfem::varform::LinearElasticVarForm::solve_linear_system(), polyfem::varform::BilaplacianVarForm::solve_static_linear(), polyfem::varform::IncompressibleElasticVarForm::solve_static_linear(), polyfem::varform::LinearElasticVarForm::solve_static_linear(), polyfem::varform::BilaplacianVarForm::solve_transient_linear(), polyfem::varform::IncompressibleElasticVarForm::solve_transient_linear(), and polyfem::varform::LinearElasticVarForm::solve_transient_linear().

◆ mesh_

std::unique_ptr<mesh::Mesh> polyfem::varform::VarForm::mesh_
protected

Definition at line 203 of file VarForm.hpp.

Referenced by polyfem::varform::BilaplacianVarForm::assemble_rhs(), polyfem::varform::ElasticVarForm::build_rhs_assembler(), polyfem::varform::FluidVarForm::build_rhs_assembler(), polyfem::varform::IncompressibleElasticVarForm::build_rhs_assembler(), polyfem::varform::ScalarVarForm::build_rhs_assembler(), polyfem::varform::BilaplacianVarForm::build_rhs_assembler(), polyfem::varform::BilaplacianVarForm::build_stiffness_mat(), polyfem::varform::FluidVarForm::build_stiffness_mat(), polyfem::varform::IncompressibleElasticVarForm::build_stiffness_mat(), polyfem::varform::LinearElasticVarForm::build_stiffness_mat(), polyfem::varform::BilaplacianVarForm::compute_errors(), polyfem::varform::FluidVarForm::compute_errors(), polyfem::varform::IncompressibleElasticVarForm::compute_errors(), polyfem::varform::ScalarVarForm::compute_errors(), polyfem::varform::ElasticVarForm::elastic_boundary_samples(), polyfem::varform::ElasticVarForm::elastic_output_fields(), polyfem::varform::ElasticVarForm::elastic_primitive_to_node(), polyfem::varform::BilaplacianVarForm::export_data(), polyfem::varform::FluidVarForm::export_data(), polyfem::varform::ScalarVarForm::export_data(), polyfem::varform::LinearElasticVarForm::init_linear_solve(), polyfem::varform::ElasticVarForm::initial_acceleration(), polyfem::varform::ElasticVarForm::initial_elastic_solution(), polyfem::varform::ElasticVarForm::initial_velocity(), n_boundary_samples(), polyfem::varform::BilaplacianVarForm::output_fields(), polyfem::varform::FluidVarForm::output_fields(), polyfem::varform::IncompressibleElasticVarForm::output_fields(), polyfem::varform::NonlinearElasticVarForm::output_fields(), polyfem::varform::ScalarVarForm::output_fields(), polyfem::varform::BilaplacianVarForm::output_space(), polyfem::varform::FluidVarForm::output_space(), polyfem::varform::ScalarVarForm::output_space(), prepare(), polyfem::varform::FluidVarForm::prepare_initial_solution(), polyfem::varform::FluidVarForm::primary_ndof(), polyfem::varform::IncompressibleElasticVarForm::primary_ndof(), problem_dimension(), reset(), polyfem::varform::BilaplacianVarForm::save_json(), polyfem::varform::FluidVarForm::save_json(), polyfem::varform::IncompressibleElasticVarForm::save_json(), polyfem::varform::ScalarVarForm::save_json(), set_materials(), set_mesh(), polyfem::varform::LinearElasticVarForm::solve_linear_system(), polyfem::varform::BilaplacianVarForm::solve_static_linear(), and polyfem::varform::BilaplacianVarForm::solve_transient_linear().

◆ output_geometry_

◆ output_path

std::string polyfem::varform::VarForm::output_path
protected

Definition at line 201 of file VarForm.hpp.

Referenced by init(), and resolve_output_path().

◆ output_sampler_initialized_

bool polyfem::varform::VarForm::output_sampler_initialized_ = false
mutableprotected

Definition at line 208 of file VarForm.hpp.

Referenced by ensure_output_sampler(), init(), reset(), set_args(), and set_mesh().

◆ prepared_

bool polyfem::varform::VarForm::prepared_ = false
protected

Definition at line 209 of file VarForm.hpp.

Referenced by prepare(), reset(), set_args(), and set_mesh().

◆ problem

std::shared_ptr<assembler::Problem> polyfem::varform::VarForm::problem
protected

current problem, it contains rhs and bc

Definition at line 191 of file VarForm.hpp.

Referenced by polyfem::varform::BilaplacianVarForm::assemble_mass_mat(), polyfem::varform::ElasticVarForm::assemble_mass_mat(), polyfem::varform::FluidVarForm::assemble_mass_mat(), polyfem::varform::IncompressibleElasticVarForm::assemble_mass_mat(), polyfem::varform::ScalarVarForm::assemble_mass_mat(), polyfem::varform::BilaplacianVarForm::assemble_rhs(), polyfem::varform::ElasticVarForm::assemble_rhs(), polyfem::varform::FluidVarForm::assemble_rhs(), polyfem::varform::ScalarVarForm::assemble_rhs(), polyfem::varform::BilaplacianVarForm::build_basis(), polyfem::varform::ElasticVarForm::build_basis(), polyfem::varform::FluidVarForm::build_basis(), polyfem::varform::IncompressibleElasticVarForm::build_basis(), polyfem::varform::ScalarVarForm::build_basis(), polyfem::varform::ElasticVarForm::build_rhs_assembler(), polyfem::varform::FluidVarForm::build_rhs_assembler(), polyfem::varform::IncompressibleElasticVarForm::build_rhs_assembler(), polyfem::varform::ScalarVarForm::build_rhs_assembler(), polyfem::varform::BilaplacianVarForm::build_rhs_assembler(), polyfem::varform::BilaplacianVarForm::compute_errors(), polyfem::varform::FluidVarForm::compute_errors(), polyfem::varform::IncompressibleElasticVarForm::compute_errors(), polyfem::varform::ScalarVarForm::compute_errors(), polyfem::varform::ElasticVarForm::elastic_output_fields(), polyfem::varform::BilaplacianVarForm::export_data(), polyfem::varform::FluidVarForm::export_data(), polyfem::varform::ScalarVarForm::export_data(), polyfem::varform::BilaplacianVarForm::init(), polyfem::varform::ElasticVarForm::init(), polyfem::varform::FluidVarForm::init(), polyfem::varform::ScalarVarForm::init(), polyfem::varform::LinearElasticVarForm::init_linear_solve(), polyfem::varform::ElasticVarForm::initial_elastic_solution(), polyfem::varform::BilaplacianVarForm::load_mesh(), polyfem::varform::ElasticVarForm::load_mesh(), polyfem::varform::FluidVarForm::load_mesh(), polyfem::varform::ScalarVarForm::load_mesh(), polyfem::varform::BilaplacianVarForm::output_fields(), polyfem::varform::FluidVarForm::output_fields(), polyfem::varform::NonlinearElasticVarForm::output_fields(), polyfem::varform::ScalarVarForm::output_fields(), polyfem::varform::BilaplacianVarForm::prepare_initial_solution(), polyfem::varform::FluidVarForm::prepare_initial_solution(), polyfem::varform::ScalarVarForm::prepare_initial_solution(), problem_dimension(), reset(), polyfem::varform::BilaplacianVarForm::save_json(), polyfem::varform::FluidVarForm::save_json(), polyfem::varform::IncompressibleElasticVarForm::save_json(), polyfem::varform::ScalarVarForm::save_json(), polyfem::varform::LinearElasticVarForm::solve_linear_system(), polyfem::varform::BilaplacianVarForm::solve_problem(), polyfem::varform::IncompressibleElasticVarForm::solve_problem(), polyfem::varform::LinearElasticVarForm::solve_problem(), and polyfem::varform::LinearElasticVarForm::solve_transient_linear().

◆ root_path

◆ stats

io::OutStatsData polyfem::varform::VarForm::stats
protected

Definition at line 195 of file VarForm.hpp.

Referenced by polyfem::varform::BilaplacianVarForm::assemble_mass_mat(), polyfem::varform::ElasticVarForm::assemble_mass_mat(), polyfem::varform::FluidVarForm::assemble_mass_mat(), polyfem::varform::IncompressibleElasticVarForm::assemble_mass_mat(), polyfem::varform::ScalarVarForm::assemble_mass_mat(), polyfem::varform::BilaplacianVarForm::build_basis(), polyfem::varform::ElasticVarForm::build_basis(), polyfem::varform::FluidVarForm::build_basis(), polyfem::varform::ScalarVarForm::build_basis(), polyfem::varform::BilaplacianVarForm::build_stiffness_mat(), polyfem::varform::FluidVarForm::build_stiffness_mat(), polyfem::varform::IncompressibleElasticVarForm::build_stiffness_mat(), polyfem::varform::LinearElasticVarForm::build_stiffness_mat(), polyfem::varform::BilaplacianVarForm::compute_errors(), polyfem::varform::FluidVarForm::compute_errors(), polyfem::varform::IncompressibleElasticVarForm::compute_errors(), polyfem::varform::ScalarVarForm::compute_errors(), prepare(), reset(), polyfem::varform::BilaplacianVarForm::save_json(), polyfem::varform::FluidVarForm::save_json(), polyfem::varform::IncompressibleElasticVarForm::save_json(), polyfem::varform::ScalarVarForm::save_json(), save_restart_json(), polyfem::varform::BilaplacianVarForm::solve_linear_system(), polyfem::varform::FluidVarForm::solve_linear_system(), polyfem::varform::IncompressibleElasticVarForm::solve_linear_system(), polyfem::varform::LinearElasticVarForm::solve_linear_system(), polyfem::varform::BilaplacianVarForm::solve_problem(), polyfem::varform::IncompressibleElasticVarForm::solve_problem(), and polyfem::varform::LinearElasticVarForm::solve_problem().

◆ time_callback

std::function<void(int, int, double, double)> polyfem::varform::VarForm::time_callback
protected

Definition at line 205 of file VarForm.hpp.

Referenced by notify_time_step(), reset(), and set_time_callback().

◆ timings

◆ units


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