mesh_tools.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 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_TOOLS_H
21 #define LIBMESH_MESH_TOOLS_H
22 
23 
24 
25 // Local Includes -----------------------------------
26 #include "libmesh/libmesh.h"
27 #include "libmesh/enum_elem_type.h"
28 #include "libmesh/id_types.h"
29 #include "libmesh/mesh_base.h"
30 #include "libmesh/point.h" // some compilers want the full definition - I think so they can do
31  // return-value-optimization for BoundingBox'es - BSK
32 
33 // C++ Includes -----------------------------------
34 #include <vector>
35 #include <set>
36 #include <limits>
37 
38 namespace libMesh
39 {
40 
41 // forward declarations
42 class SerialMesh;
43 class ParallelMesh;
44 class Sphere;
45 class Elem;
46 template <typename T> class LocationMap;
47 
59 // ------------------------------------------------------------
60 // MeshTools namespace
61 namespace MeshTools
62 {
67  class BoundingBox : public std::pair<Point, Point>
68  {
69  public:
70 
71  BoundingBox (const Point &new_min, const Point &new_max) :
72  std::pair<Point, Point>(new_min, new_max)
73  {}
74 
75  BoundingBox (const std::pair<Point, Point> &bbox) :
76  std::pair<Point, Point> (bbox)
77  {}
78 
83  {
84  this->invalidate();
85  }
86 
87  void invalidate ()
88  {
89  for (unsigned int i=0; i<LIBMESH_DIM; i++)
90  {
91  this->first(i) = std::numeric_limits<Real>::max();
92  this->second(i) = -std::numeric_limits<Real>::max();
93  }
94  }
95 
96  const Point & min() const
97  { return this->first; }
98 
99  Point & min()
100  { return this->first; }
101 
102  const Point & max() const
103  { return this->second; }
104 
105  Point & max()
106  { return this->second; }
107 
109  { return *this; }
110 
111  bool intersect (const BoundingBox &) const;
112 
113  bool contains_point (const Point &) const;
114 
115  private:
116  };
117 
125 
132  dof_id_type weight (const MeshBase &mesh, const processor_id_type pid);
133 
134  inline
136  { return MeshTools::weight (mesh, mesh.processor_id()); }
137 
145  std::vector<std::vector<dof_id_type> > &nodes_to_elem_map);
146 
151  std::vector<std::vector<const Elem*> >& nodes_to_elem_map);
152 
153 
154 // /**
155 // * Calling this function on a 2D mesh will convert all the elements
156 // * to triangles. \p QUAD4s will be converted to \p TRI3s, \p QUAD8s
157 // * and \p QUAD9s will be converted to \p TRI6s.
158 // */
159 // void all_tri (MeshBase &mesh);
160 
165  void find_boundary_nodes (const MeshBase &mesh,
166  std::vector<bool> &on_boundary);
167 
173  BoundingBox
174  bounding_box (const MeshBase &mesh);
175 
179  Sphere
180  bounding_sphere (const MeshBase &mesh);
181 
186  BoundingBox
188  const processor_id_type pid);
189 
193  Sphere
195  const processor_id_type pid);
196 
201  BoundingBox
203  const subdomain_id_type sid);
204 
208  Sphere
210  const subdomain_id_type sid);
211 
212 
217  void elem_types (const MeshBase &mesh,
218  std::vector<ElemType> &et);
219 
225  const ElemType type);
226 
232  const ElemType type);
233 
243  const ElemType type,
244  const unsigned int level);
245 
251  unsigned int n_levels(const MeshBase &mesh);
252 
258  unsigned int n_local_levels(const MeshBase &mesh);
259 
265  unsigned int n_active_levels(const MeshBase &mesh);
266 
272  unsigned int n_active_local_levels(const MeshBase &mesh);
273 
279  unsigned int n_active_local_levels(const MeshBase &mesh);
280 
286  unsigned int n_p_levels (const MeshBase &mesh);
287 
295  std::set<dof_id_type> &not_subactive_node_ids);
296 
303 
304 
311 
312 
316  unsigned int max_level (const MeshBase &mesh);
317 
318 
323  void find_nodal_neighbors(const MeshBase &mesh, const Node &n,
324  std::vector<std::vector<const Elem*> > &nodes_to_elem_map,
325  std::vector<const Node*> &neighbors);
326 
333  void find_hanging_nodes_and_parents(const MeshBase &mesh, std::map<dof_id_type, std::vector<dof_id_type> > &hanging_nodes);
334 
346 
347 
348 #ifdef DEBUG
349 
354  const Elem *bad_elem);
355 
361 
368 
374 
380 
386 
392 
404 
410 
419  template <typename DofObjectSubclass>
421 
427 
433 
439 #endif
440 
441  // There is no reason for users to call functions in the MeshTools::Private namespace.
442  namespace Private {
455  } // end namespace Private
456 
457 } // end namespace MeshTools
458 
459 } // namespace libMesh
460 
461 
462 #endif // LIBMESH_MESH_TOOLS_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:06 UTC

Hosted By:
SourceForge.net Logo