libMesh
mesh_modification.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_MESH_MODIFICATION_H
21 #define LIBMESH_MESH_MODIFICATION_H
22 
23 // Local Includes
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/id_types.h" // for boundary_id_type, subdomain_id_type
26 #include "libmesh/tensor_value.h"
27 
28 namespace libMesh
29 {
30 
31 // forward declarations
32 template <typename Output> class FunctionBase;
33 class MeshBase;
34 
35 
36 // ------------------------------------------------------------
37 // MeshTools::Modification namespace
38 namespace MeshTools
39 {
46 namespace Modification
47 {
55 void distort (MeshBase & mesh,
56  const Real factor, const bool perturb_boundary=false);
57 
71 
80 
94 void redistribute (MeshBase & mesh,
95  const FunctionBase<Real> & mapfunc);
96 
97 
103 void translate (MeshBase & mesh,
104  const Real xt=0., const Real yt=0., const Real zt=0.);
105 
106 // /**
107 // * Rotates the mesh in the xy plane. The rotation is
108 // * counter-clock-wise (mathematical definition).
109 // * The angle is in degrees (360 make a full circle)
110 // */
111 // void rotate2D (MeshBase & mesh,
112 // const Real alpha=0.);
113 
122 rotate (MeshBase & mesh,
123  const Real phi, const Real theta=0., const Real psi=0.);
124 
131 void scale (MeshBase & mesh,
132  const Real xs, const Real ys=0., const Real zs=0.);
133 
142 void all_tri (MeshBase & mesh);
143 
156 void smooth(MeshBase &, unsigned int, Real);
157 
158 #ifdef LIBMESH_ENABLE_AMR
159 
169 void flatten(MeshBase & mesh);
170 #endif // #ifdef LIBMESH_ENABLE_AMR
171 
177  const boundary_id_type old_id,
178  const boundary_id_type new_id);
179 
185  const subdomain_id_type old_id,
186  const subdomain_id_type new_id);
187 
188 } // end namespace Meshtools::Modification
189 } // end namespace MeshTools
190 
191 } // namespace libMesh
192 
193 
194 #endif // LIBMESH_MESH_MODIFICATION_H
void scale(MeshBase &mesh, const Real xs, const Real ys=0., const Real zs=0.)
Scales the mesh.
void distort(MeshBase &mesh, const Real factor, const bool perturb_boundary=false)
Randomly perturb the nodal locations.
MeshBase & mesh
The libMesh namespace provides an interface to certain functionality in the library.
This is the MeshBase class.
Definition: mesh_base.h:75
void permute_elements(MeshBase &mesh)
Randomly permute the nodal ordering of each element (without twisting the element mapping)...
void change_subdomain_id(MeshBase &mesh, const subdomain_id_type old_id, const subdomain_id_type new_id)
Finds any subdomain ids that are currently old_id, changes them to new_id.
void all_tri(MeshBase &mesh)
Subdivides any non-simplex elements in a Mesh to produce simplex (triangular in 2D, tetrahedral in 3D) elements.
void smooth(MeshBase &, unsigned int, Real)
Smooth the mesh with a simple Laplace smoothing algorithm.
int8_t boundary_id_type
Definition: id_types.h:51
void change_boundary_id(MeshBase &mesh, const boundary_id_type old_id, const boundary_id_type new_id)
Finds any boundary ids that are currently old_id, changes them to new_id.
void orient_elements(MeshBase &mesh)
Redo the nodal ordering of each element as necessary to give the element Jacobian a positive orientat...
void translate(MeshBase &mesh, const Real xt=0., const Real yt=0., const Real zt=0.)
Translates the mesh.
RealTensorValue rotate(MeshBase &mesh, const Real phi, const Real theta=0., const Real psi=0.)
Rotates the mesh in the xy plane.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void redistribute(MeshBase &mesh, const FunctionBase< Real > &mapfunc)
Deterministically perturb the nodal locations.
void flatten(MeshBase &mesh)
Removes all the refinement tree structure of Mesh, leaving only the highest-level (most-refined) elem...
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.