39 #ifndef GETFEM_DEFORMABLE_MESH_H__
40 #define GETFEM_DEFORMABLE_MESH_H__
57 template<
class VECTOR = model_real_plain_vector>
62 bool deform_on_construct =
true,
bool to_be_restored =
true)
65 deform_on_construct_(deform_on_construct),
67 to_be_restored_(to_be_restored){
68 mf.extend_vector(dU, dU_);
69 if (deform_on_construct_) deform();
73 if (is_deformed_)
return;
80 if (!is_deformed_)
return;
86 if (to_be_restored_ && deform_on_construct_){
92 void deforming_mesh_(VECTOR &dU){
94 auto &ppts = m_.points();
95 auto init_nb_points = ppts.card();
99 std::vector<bool> deform_pt_flag(ppts.size(),
true);
103 getfem::mesh::ind_set pt_index = m_.ind_points_of_convex(cv);
107 GMM_ASSERT2(dof.size() % num_points == 0,
108 "mesh_fem should be isoparametric to the mesh, "
109 "with nb_points() of convex == size of ind_basic_dof_of_element / qdim()");
111 size_type ddim = dof.size() / num_points;
112 GMM_ASSERT2(ddim <= 3,
"dimension of dof is greater than 3");
114 for (
size_type pt = 0; pt < num_points; ++pt)
117 if (deform_pt_flag[pt_index[pt]])
118 for (
size_type comp = 0; comp < ddim; ++comp)
120 ppts[pt_index[pt]][comp] += dU[dof[pt*ddim + comp]];
123 deform_pt_flag[pt_index[pt]] =
false;
127 GMM_ASSERT1(ppts.card() == init_nb_points,
128 "Error, after deforming the mesh, number of nodes are different.");
134 GMM_ASSERT1(pts.size() == initial_nodes_.size(),
"Internal error, incorrect number of points.");
135 for (
size_type i = 0; i < pts.size(); ++i) gmm::copy(initial_nodes_[i], pts[i]);
141 bool deform_on_construct_;
143 bool to_be_restored_;
148 #endif //GETFEM_DEFORMABLE_MESH_H__