libMesh
mesh_modification.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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 
27 namespace libMesh
28 {
29 
30 // forward declarations
31 template <typename Output> class FunctionBase;
32 class MeshBase;
33 
34 
35 // ------------------------------------------------------------
36 // MeshTools::Modification namespace
37 namespace MeshTools
38 {
45 namespace Modification
46 {
54 void distort (MeshBase & mesh,
55  const Real factor, const bool perturb_boundary=false);
56 
70 void redistribute (MeshBase & mesh,
71  const FunctionBase<Real> & mapfunc);
72 
73 
79 void translate (MeshBase & mesh,
80  const Real xt=0., const Real yt=0., const Real zt=0.);
81 
82 // /**
83 // * Rotates the mesh in the xy plane. The rotation is
84 // * counter-clock-wise (mathematical definition).
85 // * The angle is in degrees (360 make a full circle)
86 // */
87 // void rotate2D (MeshBase & mesh,
88 // const Real alpha=0.);
89 
96 void rotate (MeshBase & mesh,
97  const Real phi, const Real theta=0., const Real psi=0.);
98 
105 void scale (MeshBase & mesh,
106  const Real xs, const Real ys=0., const Real zs=0.);
107 
116 void all_tri (MeshBase & mesh);
117 
130 void smooth(MeshBase &, unsigned int, Real);
131 
132 #ifdef LIBMESH_ENABLE_AMR
133 
143 void flatten(MeshBase & mesh);
144 #endif // #ifdef LIBMESH_ENABLE_AMR
145 
150 void change_boundary_id (MeshBase & mesh,
151  const boundary_id_type old_id,
152  const boundary_id_type new_id);
153 
158 void change_subdomain_id (MeshBase & mesh,
159  const subdomain_id_type old_id,
160  const subdomain_id_type new_id);
161 
162 } // end namespace Meshtools::Modification
163 } // end namespace MeshTools
164 
165 } // namespace libMesh
166 
167 
168 #endif // LIBMESH_MESH_MODIFICATION_H
void rotate(MeshBase &mesh, const Real phi, const Real theta=0., const Real psi=0.)
Rotates the mesh in the xy plane.
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:68
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)
Converts the 2D quadrilateral elements of a Mesh into triangular 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 translate(MeshBase &mesh, const Real xt=0., const Real yt=0., const Real zt=0.)
Translates the mesh.
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...