ug4
topology_callbacks.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015: G-CSC, Goethe University Frankfurt
3  * Author: Sebastian Reiter
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__UG_topology_callbacks
34 #define __H__UG_topology_callbacks
35 
38 
39 namespace ug{
40 
46 {
47  public:
49  m_grid(g) {}
50 
51  bool operator() (Vertex* v) const {return callback(v);}
52  bool operator() (Edge* e) const {return callback(e);}
53  bool operator() (Face* f) const {return callback(f);}
54  bool operator() (Volume*) const {return false;}
55 
56  private:
57  template <class TElem>
58  bool callback(TElem* e) const {return LiesOnBoundary(m_grid, e);}
59 
60  private:
62 };
63 
66 {
67  public:
69  m_grid(g) {}
70 
71  bool operator() (Vertex* v) const {return callback(v);}
72  bool operator() (Edge* e) const {return callback(e);}
73  bool operator() (Face* f) const {return callback(f);}
74  bool operator() (Volume*) const {return true;}
75  private:
76  template <class TElem>
77  bool callback(TElem* e) const {return !LiesOnBoundary(m_grid, e);}
78 
79  private:
81 };
82 
83 
85 {
86  public:
88  m_grid(g) {}
89 
90  bool operator() (Vertex* v) const {return false;}
91  bool operator() (Edge* e) const {return false;}
92  bool operator() (Face* f) const {return callback(f);}
93  bool operator() (Volume*) const {return true;}
94 
95  private:
96  template <class TElem>
97  bool callback(TElem* e) const
98  {
99  //todo: mutex?
100  //todo: m_grid.num_associated_elements<Volume>(e)...
101  const_cast<Grid&>(m_grid).associated_elements(
102  const_cast<IsBoundaryOrManifodFace*>(this)->m_tmpVols, e);
103  return m_tmpVols.size() < 2;
104  }
105 
106  private:
108  Grid::volume_traits::secure_container m_tmpVols;// optimization for single-thread
109 };
110 
112 {
113  public:
115  m_callback(g) {}
116 
117  bool operator() (Vertex* v) const {return !m_callback(v);}
118  bool operator() (Edge* e) const {return !m_callback(e);}
119  bool operator() (Face* f) const {return !m_callback(f);}
120  bool operator() (Volume* v) const {return !m_callback(v);}
121 
122  private:
124 }; //lib_grid_element_callbacks
126 
127 }// end of namespace
128 
129 #endif //__H__UG_topology_callbacks
Base-class for edges.
Definition: grid_base_objects.h:397
Definition: element_callback_interface.h:40
Faces are 2-dimensional objects.
Definition: grid_base_objects.h:510
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
Definition: topology_callbacks.h:85
IsBoundaryOrManifodFace(Grid &g)
Definition: topology_callbacks.h:87
Grid::volume_traits::secure_container m_tmpVols
Definition: topology_callbacks.h:108
bool operator()(Vertex *v) const
Definition: topology_callbacks.h:90
Grid & m_grid
Definition: topology_callbacks.h:107
bool callback(TElem *e) const
Definition: topology_callbacks.h:97
Definition: topology_callbacks.h:112
IsBoundaryOrManifodFace m_callback
Definition: topology_callbacks.h:123
IsNotBoundaryOrManifodFace(Grid &g)
Definition: topology_callbacks.h:114
bool operator()(Vertex *v) const
Definition: topology_callbacks.h:117
Element callback that returns true, if an element does not lie on the grids boundary.
Definition: topology_callbacks.h:66
IsNotOnBoundary(Grid &g)
Definition: topology_callbacks.h:68
bool callback(TElem *e) const
Definition: topology_callbacks.h:77
Grid & m_grid
Definition: topology_callbacks.h:80
bool operator()(Vertex *v) const
Definition: topology_callbacks.h:71
Element callback that returns true, if an element lies on the grids boundary.
Definition: topology_callbacks.h:46
IsOnBoundary(Grid &g)
Definition: topology_callbacks.h:48
bool operator()(Vertex *v) const
Definition: topology_callbacks.h:51
Grid & m_grid
Definition: topology_callbacks.h:61
bool callback(TElem *e) const
Definition: topology_callbacks.h:58
Container which holds an array of pointers.
Definition: pointer_const_array.h:84
size_t size() const
returns the size of the associated array.
Definition: pointer_const_array_impl.hpp:106
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
Volumes are 3-dimensional objects.
Definition: grid_base_objects.h:754
bool LiesOnBoundary(Grid &grid, Edge *e)
returns true, if the edge lies on a 2d or 3d boundary
Definition: edge_util.cpp:169
the ug namespace