PolyFEM
Loading...
Searching...
No Matches
LocalRelaxationData.hpp
Go to the documentation of this file.
1#pragma once
2
8
9namespace polyfem::mesh
10{
12
13 // Things needed for the local relaxation solve
14 template <typename M>
16 {
17 // Assemblers and forms retain references to this reader.
19
20 public:
22 const State &state,
24 const double current_time,
25 const bool contact_enabled);
26
27 Eigen::MatrixXd sol() const
28 {
29 return utils::flatten(local_mesh.displacements());
30 }
31
32 bool is_volume() const { return mesh->is_volume(); }
33 int dim() const { return mesh->dimension(); }
34 int n_bases() const { return m_n_bases; }
35 int ndof() const { return dim() * n_bases(); }
36 int n_free_dof() const { return ndof() - boundary_nodes.size(); }
37
39
41
42 private:
43 void init_mesh(const State &state);
44 void init_bases(const State &state);
45 void init_boundary_conditions(const State &state);
46 void init_assembler(const State &state);
47 void init_mass_matrix(const State &state);
48 void init_solve_data(
49 const State &state,
50 const double current_time,
51 const bool contact_enabled);
52
53 // Mesh data
54 std::unique_ptr<Mesh> mesh;
55
56 // Basis data
58 std::vector<polyfem::basis::ElementBases> bases;
59
61 std::shared_ptr<assembler::Assembler> assembler;
63
64 std::shared_ptr<assembler::Mass> mass_matrix_assembler;
66 Eigen::SparseMatrix<double> mass;
67
68 std::shared_ptr<assembler::PressureAssembler> pressure_assembler;
69
71 std::shared_ptr<assembler::Problem> problem;
72
74 std::vector<int> boundary_nodes;
76 std::vector<mesh::LocalBoundary> local_boundary;
78 std::vector<mesh::LocalBoundary> local_neumann_boundary;
80 std::vector<mesh::LocalBoundary> local_pressure_boundary;
82 std::vector<int> dirichlet_nodes;
83 std::vector<RowVectorNd> dirichlet_nodes_position;
85 std::vector<int> neumann_nodes;
86 std::vector<RowVectorNd> neumann_nodes_position;
87 // per node pressure
88 std::unordered_map<int, std::vector<LocalBoundary>> local_pressure_cavity;
89 std::vector<int> pressure_boundary_nodes;
90
91 Eigen::MatrixXd rhs;
92
93 ipc::CollisionMesh collision_mesh;
94 };
95} // namespace polyfem::mesh
Caches basis evaluation and geometric mapping at every element.
main class that contains the polyfem solver and all its state
Definition State.hpp:114
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:56
polyfem::legacy::State State
Definition Remesher.hpp:19
Eigen::VectorXd flatten(const Eigen::MatrixXd &X)
Flatten rowwises.