libMesh
patch.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_PATCH_H
21 #define LIBMESH_PATCH_H
22 
23 // Local includes
24 #include "libmesh/id_types.h"
25 
26 // C++ includes
27 #include <vector>
28 #include <string>
29 #include <set>
30 
31 namespace libMesh
32 {
33 
34 // Forward Declarations
35 class Elem;
36 
47 class Patch : public std::set<const Elem *>
48 {
49 public:
50 
54  Patch(const processor_id_type my_procid = static_cast<processor_id_type>(-1)) :
55  _my_procid(my_procid)
56  {}
57 
61  ~Patch() {}
62 
67  void add_face_neighbors();
68 
74 
81 
86  void add_point_neighbors();
87 
93 
100 
104  typedef void (Patch::*PMF)();
105 
113  void build_around_element(const Elem * elem,
114  const unsigned int target_patch_size = 10,
115  PMF patchtype = &Patch::add_local_face_neighbors);
116 
117 protected:
118 
123  void find_face_neighbors(std::set<const Elem *> & neighbor_set);
124 
129  void find_point_neighbors(std::set<const Elem *> & neighbor_set);
130 
132 };
133 
134 } // namespace libMesh
135 
136 
137 #endif // LIBMESH_PATCH_H
This class implements useful utility functions for a patch of elements.
Definition: patch.h:47
void add_local_point_neighbors()
This function finds all elements on the current processor which touch the current patch at any point...
Definition: patch.C:155
This is the base class from which all geometric element types are derived.
Definition: elem.h:89
uint8_t processor_id_type
Definition: id_types.h:99
Patch(const processor_id_type my_procid=static_cast< processor_id_type >(-1))
Constructor.
Definition: patch.h:54
The libMesh namespace provides an interface to certain functionality in the library.
void build_around_element(const Elem *elem, const unsigned int target_patch_size=10, PMF patchtype=&Patch::add_local_face_neighbors)
Erases any elements in the current patch, then builds a new patch containing element elem by repeated...
Definition: patch.C:194
void add_point_neighbors()
This function finds all elements which touch the current patch at any point, and adds them to the pat...
Definition: patch.C:144
void add_semilocal_point_neighbors()
This function finds all elements which touch the current patch at any point and which touch one of ou...
Definition: patch.C:175
void find_face_neighbors(std::set< const Elem * > &neighbor_set)
This function finds all elements which touch the current patch at a face.
Definition: patch.C:37
void add_local_face_neighbors()
This function finds all elements on the current processor which touch the current patch at a face...
Definition: patch.C:85
~Patch()
Destructor.
Definition: patch.h:61
void(Patch::* PMF)()
Pointer to Member Function typedef.
Definition: patch.h:104
void add_face_neighbors()
This function finds all elements which touch the current patch at a face, and adds them to the patch...
Definition: patch.C:74
void add_semilocal_face_neighbors()
This function finds all elements which touch the current patch at a face and which touch one of our p...
Definition: patch.C:105
const processor_id_type _my_procid
Definition: patch.h:131
void find_point_neighbors(std::set< const Elem * > &neighbor_set)
This function finds all elements which touch the current patch at any point.
Definition: patch.C:124