38 #ifndef GETFEM_DEFORMABLE_MESH_H__
39 #define GETFEM_DEFORMABLE_MESH_H__
56 template<
class VECTOR = model_real_plain_vector>
61 bool deform_on_construct =
true,
bool to_be_restored =
true)
64 deform_on_construct_(deform_on_construct),
66 to_be_restored_(to_be_restored){
67 mf.extend_vector(dU, dU_);
68 if (deform_on_construct_) deform();
72 if (is_deformed_)
return;
79 if (!is_deformed_)
return;
85 if (to_be_restored_ && deform_on_construct_){
91 void deforming_mesh_(VECTOR &dU){
93 auto &ppts = m_.points();
94 auto init_nb_points = ppts.card();
98 std::vector<bool> deform_pt_flag(ppts.size(),
true);
102 getfem::mesh::ind_set pt_index = m_.ind_points_of_convex(cv);
106 GMM_ASSERT2(dof.size() % num_points == 0,
107 "mesh_fem should be isoparametric to the mesh, "
108 "with nb_points() of convex == size of ind_basic_dof_of_element / qdim()");
110 size_type ddim = dof.size() / num_points;
111 GMM_ASSERT2(ddim <= 3,
"dimension of dof is greater than 3");
113 for (
size_type pt = 0; pt < num_points; ++pt)
116 if (deform_pt_flag[pt_index[pt]])
117 for (
size_type comp = 0; comp < ddim; ++comp)
119 ppts[pt_index[pt]][comp] += dU[dof[pt*ddim + comp]];
122 deform_pt_flag[pt_index[pt]] =
false;
126 GMM_ASSERT1(ppts.card() == init_nb_points,
127 "Error, after deforming the mesh, number of nodes are different.");
133 GMM_ASSERT1(pts.size() == initial_nodes_.size(),
"Internal error, incorrect number of points.");
134 for (
size_type i = 0; i < pts.size(); ++i) gmm::copy(initial_nodes_[i], pts[i]);
140 bool deform_on_construct_;
142 bool to_be_restored_;
Store a set of points, identifying points that are nearer than a certain very small distance.
Describe a finite element method linked to a mesh.
virtual ind_dof_ct ind_basic_dof_of_element(size_type cv) const
Give an array of the dof numbers a of convex.
const mesh & linked_mesh() const
Return a reference to the underlying mesh.
virtual size_type nb_basic_dof() const
Return the total number of basic degrees of freedom (before the optional reduction).
const dal::bit_vector & convex_index() const
Get the set of convexes where a finite element has been assigned.
Describe a mesh (collection of convexes (elements) and points).
Define a getfem::getfem_mesh object.
Define the getfem::mesh_fem class.
Model representation in Getfem.
size_t size_type
used as the common size type in the library
GEneric Tool for Finite Element Methods.