PolyFEM
Loading...
Searching...
No Matches
LocalRelaxationData.hpp
Go to the documentation of this file.
1#pragma once
2
7
8namespace polyfem::mesh
9{
11
12 // Things needed for the local relaxation solve
13 template <typename M>
15 {
16 public:
18 const State &state,
20 const double current_time,
21 const bool contact_enabled);
22
23 Eigen::MatrixXd sol() const
24 {
25 return utils::flatten(local_mesh.displacements());
26 }
27
28 bool is_volume() const { return mesh->is_volume(); }
29 int dim() const { return mesh->dimension(); }
30 int n_bases() const { return m_n_bases; }
31 int ndof() const { return dim() * n_bases(); }
32 int n_free_dof() const { return ndof() - boundary_nodes.size(); }
33
35
37
38 private:
39 void init_mesh(const State &state);
40 void init_bases(const State &state);
41 void init_boundary_conditions(const State &state);
42 void init_assembler(const State &state);
43 void init_mass_matrix(const State &state);
44 void init_solve_data(
45 const State &state,
46 const double current_time,
47 const bool contact_enabled);
48
49 // Mesh data
50 std::unique_ptr<Mesh> mesh;
51
52 // Basis data
54 std::vector<polyfem::basis::ElementBases> bases;
55
57 std::shared_ptr<assembler::Assembler> assembler;
59
60 std::shared_ptr<assembler::Mass> mass_matrix_assembler;
62 Eigen::SparseMatrix<double> mass;
63
64 std::shared_ptr<assembler::PressureAssembler> pressure_assembler;
65
67 std::shared_ptr<assembler::Problem> problem;
68
70 std::vector<int> boundary_nodes;
72 std::vector<mesh::LocalBoundary> local_boundary;
74 std::vector<mesh::LocalBoundary> local_neumann_boundary;
76 std::vector<mesh::LocalBoundary> local_pressure_boundary;
78 std::vector<int> dirichlet_nodes;
79 std::vector<RowVectorNd> dirichlet_nodes_position;
81 std::vector<int> neumann_nodes;
82 std::vector<RowVectorNd> neumann_nodes_position;
83 // per node pressure
84 std::unordered_map<int, std::vector<LocalBoundary>> local_pressure_cavity;
85 std::vector<int> pressure_boundary_nodes;
86
87 Eigen::MatrixXd rhs;
88
89 ipc::CollisionMesh collision_mesh;
90 };
91} // 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:59
polyfem::legacy::State State
Definition Remesher.hpp:19
Eigen::VectorXd flatten(const Eigen::MatrixXd &X)
Flatten rowwises.