PolyFEM
Loading...
Searching...
No Matches
LocalRelaxationData.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <polyfem/State.hpp>
7
8namespace polyfem::mesh
9{
10 // Things needed for the local relaxation solve
11 template <typename M>
13 {
14 public:
16 const State &state,
18 const double current_time,
19 const bool contact_enabled);
20
21 Eigen::MatrixXd sol() const
22 {
23 return utils::flatten(local_mesh.displacements());
24 }
25
26 bool is_volume() const { return mesh->is_volume(); }
27 int dim() const { return mesh->dimension(); }
28 int n_bases() const { return m_n_bases; }
29 int ndof() const { return dim() * n_bases(); }
30 int n_free_dof() const { return ndof() - boundary_nodes.size(); }
31
33
35
36 private:
37 void init_mesh(const State &state);
38 void init_bases(const State &state);
39 void init_boundary_conditions(const State &state);
40 void init_assembler(const State &state);
41 void init_mass_matrix(const State &state);
42 void init_solve_data(
43 const State &state,
44 const double current_time,
45 const bool contact_enabled);
46
47 // Mesh data
48 std::unique_ptr<Mesh> mesh;
49
50 // Basis data
52 std::vector<polyfem::basis::ElementBases> bases;
53
55 std::shared_ptr<assembler::Assembler> assembler;
57
58 std::shared_ptr<assembler::Mass> mass_matrix_assembler;
60 Eigen::SparseMatrix<double> mass;
61
63 std::shared_ptr<assembler::Problem> problem;
64
66 std::vector<int> boundary_nodes;
68 std::vector<mesh::LocalBoundary> local_boundary;
70 std::vector<mesh::LocalBoundary> local_neumann_boundary;
72 std::vector<int> dirichlet_nodes;
73 std::vector<RowVectorNd> dirichlet_nodes_position;
75 std::vector<int> neumann_nodes;
76 std::vector<RowVectorNd> neumann_nodes_position;
77
78 Eigen::MatrixXd rhs;
79
80 ipc::CollisionMesh collision_mesh;
81 };
82} // namespace polyfem::mesh
main class that contains the polyfem solver and all its state
Definition State.hpp:79
Caches basis evaluation and geometric mapping at every element.
std::vector< mesh::LocalBoundary > local_neumann_boundary
mapping from elements to nodes for neumann boundary conditions
std::vector< int > neumann_nodes
per node neumann
std::shared_ptr< assembler::Mass > mass_matrix_assembler
std::vector< int > dirichlet_nodes
per node dirichlet
std::vector< RowVectorNd > neumann_nodes_position
void init_solve_data(const State &state, const double current_time, const bool contact_enabled)
assembler::AssemblyValsCache assembly_vals_cache
std::vector< mesh::LocalBoundary > local_boundary
mapping from elements to nodes for dirichlet boundary conditions
std::shared_ptr< assembler::Assembler > assembler
Assembler data.
std::vector< int > boundary_nodes
list of boundary nodes
assembler::AssemblyValsCache mass_assembly_vals_cache
std::vector< RowVectorNd > dirichlet_nodes_position
std::vector< polyfem::basis::ElementBases > bases
Eigen::SparseMatrix< double > mass
std::shared_ptr< assembler::Problem > problem
current problem, it contains rhs and bc
void init_boundary_conditions(const State &state)
class to store time stepping data
Definition SolveData.hpp:51
Eigen::VectorXd flatten(const Eigen::MatrixXd &X)
Flatten rowwises.