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
62 std::shared_ptr<assembler::PressureAssembler> pressure_assembler;
63
65 std::shared_ptr<assembler::Problem> problem;
66
68 std::vector<int> boundary_nodes;
70 std::vector<mesh::LocalBoundary> local_boundary;
72 std::vector<mesh::LocalBoundary> local_neumann_boundary;
74 std::vector<mesh::LocalBoundary> local_pressure_boundary;
76 std::vector<int> dirichlet_nodes;
77 std::vector<RowVectorNd> dirichlet_nodes_position;
79 std::vector<int> neumann_nodes;
80 std::vector<RowVectorNd> neumann_nodes_position;
81 // per node pressure
82 std::unordered_map<int, std::vector<LocalBoundary>> local_pressure_cavity;
83 std::vector<int> pressure_boundary_nodes;
84
85 Eigen::MatrixXd rhs;
86
87 ipc::CollisionMesh collision_mesh;
88 };
89} // 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::unordered_map< int, std::vector< LocalBoundary > > local_pressure_cavity
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)
std::shared_ptr< assembler::PressureAssembler > pressure_assembler
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< mesh::LocalBoundary > local_pressure_boundary
mapping from elements to nodes for pressure boundary conditions
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:57
Eigen::VectorXd flatten(const Eigen::MatrixXd &X)
Flatten rowwises.