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_;
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.