Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
bool_marker.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-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__bool_marker__
34#define __H__UG__bool_marker__
35
36#include "lib_grid/grid/grid.h"
38
39namespace ug
40{
41
46
64{
65 public:
66 BoolMarker();
67 BoolMarker(Grid& g);
68
69 virtual ~BoolMarker();
70
72
74 void assign_grid(Grid* g);
77
78 Grid* grid() {return m_pGrid;}
79
81
86 bool default_mark() {return m_defaultMark;}
87
89
103 bool is_marked(GridObject* e) const;
104 bool is_marked(Vertex* e) const {assert(m_pGrid); return m_aaMarkVRT[e];}
105 bool is_marked(Edge* e) const {assert(m_pGrid); return m_aaMarkEDGE[e];}
106 bool is_marked(Face* e) const {assert(m_pGrid); return m_aaMarkFACE[e];}
107 bool is_marked(Volume* e) const {assert(m_pGrid); return m_aaMarkVOL[e];}
108
109 void mark(Vertex* e, bool mark = true) {assert(m_pGrid); m_aaMarkVRT[e] = mark;}
110 void mark(Edge* e, bool mark = true) {assert(m_pGrid); m_aaMarkEDGE[e] = mark;}
111 void mark(Face* e, bool mark = true) {assert(m_pGrid); m_aaMarkFACE[e] = mark;}
112 void mark(Volume* e, bool mark = true) {assert(m_pGrid); m_aaMarkVOL[e] = mark;}
113
114 template <class TIter>
115 void mark(TIter begin, TIter end, bool mark = true)
116 {
117 for(TIter iter = begin; iter != end; ++iter) BoolMarker::mark(*iter, mark);
118 }
119
120 void unmark(Vertex* e) {mark(e, false);}
121 void unmark(Edge* e) {mark(e, false);}
122 void unmark(Face* e) {mark(e, false);}
123 void unmark(Volume* e) {mark(e, false);}
124
125 template <class TIter>
126 void unmark(TIter begin, TIter end) {mark(begin, end, false);}
127
129 void clear();
130
132 virtual void grid_to_be_destroyed(Grid* grid);
133
134 // element callbacks
135 virtual void vertex_created(Grid* grid, Vertex* vrt,
136 GridObject* pParent = NULL,
137 bool replacesParent = false);
138
139 virtual void edge_created(Grid* grid, Edge* e,
140 GridObject* pParent = NULL,
141 bool replacesParent = false);
142
143 virtual void face_created(Grid* grid, Face* f,
144 GridObject* pParent = NULL,
145 bool replacesParent = false);
146
147 virtual void volume_created(Grid* grid, Volume* vol,
148 GridObject* pParent = NULL,
149 bool replacesParent = false);
150
151 virtual void vertices_to_be_merged(Grid* grid, Vertex* target,
152 Vertex* elem1, Vertex* elem2);
153
154 virtual void edges_to_be_merged(Grid* grid, Edge* target,
155 Edge* elem1, Edge* elem2);
156
157 virtual void faces_to_be_merged(Grid* grid, Face* target,
158 Face* elem1, Face* elem2);
159
160 virtual void volumes_to_be_merged(Grid* grid, Volume* target,
161 Volume* elem1, Volume* elem2);
162
163 protected:
173};
174
177}// end of namespace
178
179#endif
Allows to mark elements.
Definition bool_marker.h:64
BoolMarker()
Definition bool_marker.cpp:37
bool m_defaultMark
Definition bool_marker.h:166
void enable_strict_inheritance(bool enable)
Definition bool_marker.h:98
bool strict_inheritance_enabled()
Definition bool_marker.h:99
void clear()
Sets all marks to false. O(n).
Definition bool_marker.cpp:105
ABool m_aBool
Definition bool_marker.h:165
virtual ~BoolMarker()
Definition bool_marker.cpp:54
bool is_marked(GridObject *e) const
Definition bool_marker.cpp:86
virtual void volume_created(Grid *grid, Volume *vol, GridObject *pParent=NULL, bool replacesParent=false)
Notified whenever a new element of the given type is created in the given grid.
Definition bool_marker.cpp:176
void assign_grid(Grid *g)
Assign the grid on which the marker shall operate.
Definition bool_marker.cpp:59
virtual void grid_to_be_destroyed(Grid *grid)
derived from GridObserver
Definition bool_marker.cpp:100
void mark(Face *e, bool mark=true)
Definition bool_marker.h:111
bool m_markInheritanceEnabled
Definition bool_marker.h:167
Grid::AttachmentAccessor< Vertex, ABool > m_aaMarkVRT
Definition bool_marker.h:169
bool default_mark()
returns the default mark.
Definition bool_marker.h:86
virtual void volumes_to_be_merged(Grid *grid, Volume *target, Volume *elem1, Volume *elem2)
Notified when two elements of the same type are going to be merged.
Definition bool_marker.cpp:217
void mark(TIter begin, TIter end, bool mark=true)
Definition bool_marker.h:115
bool is_marked(Vertex *e) const
Definition bool_marker.h:104
Grid * m_pGrid
Definition bool_marker.h:164
void unmark(Edge *e)
Definition bool_marker.h:121
bool is_marked(Edge *e) const
Definition bool_marker.h:105
void mark(Volume *e, bool mark=true)
Definition bool_marker.h:112
Grid::AttachmentAccessor< Face, ABool > m_aaMarkFACE
Definition bool_marker.h:171
void unmark(Vertex *e)
Definition bool_marker.h:120
bool is_marked(Volume *e) const
Definition bool_marker.h:107
void assign_grid(Grid &g)
Assign the grid on which the marker shall operate.
Definition bool_marker.h:76
void unmark(Face *e)
Definition bool_marker.h:122
void unmark(TIter begin, TIter end)
Definition bool_marker.h:126
void mark(Vertex *e, bool mark=true)
Definition bool_marker.h:109
void set_default_mark(bool mark)
set the mark which is applied when a new element is created
Definition bool_marker.h:84
bool m_strictInheritanceEnabled
Definition bool_marker.h:168
Grid * grid()
Definition bool_marker.h:78
virtual void vertices_to_be_merged(Grid *grid, Vertex *target, Vertex *elem1, Vertex *elem2)
Notified when two elements of the same type are going to be merged.
Definition bool_marker.cpp:196
bool is_marked(Face *e) const
Definition bool_marker.h:106
Grid::AttachmentAccessor< Volume, ABool > m_aaMarkVOL
Definition bool_marker.h:172
virtual void face_created(Grid *grid, Face *f, GridObject *pParent=NULL, bool replacesParent=false)
Notified whenever a new element of the given type is created in the given grid.
Definition bool_marker.cpp:156
bool mark_inheritance_enabeld()
if enabled, marks are passed from parents on to their children
Definition bool_marker.h:91
virtual void faces_to_be_merged(Grid *grid, Face *target, Face *elem1, Face *elem2)
Notified when two elements of the same type are going to be merged.
Definition bool_marker.cpp:210
void mark(Edge *e, bool mark=true)
Definition bool_marker.h:110
virtual void vertex_created(Grid *grid, Vertex *vrt, GridObject *pParent=NULL, bool replacesParent=false)
Notified whenever a new element of the given type is created in the given grid.
Definition bool_marker.cpp:116
Grid::AttachmentAccessor< Edge, ABool > m_aaMarkEDGE
Definition bool_marker.h:170
void enable_mark_inheritance(bool enable)
if enabled, marks are passed from parents on to their children
Definition bool_marker.h:90
virtual void edges_to_be_merged(Grid *grid, Edge *target, Edge *elem1, Edge *elem2)
Notified when two elements of the same type are going to be merged.
Definition bool_marker.cpp:203
virtual void edge_created(Grid *grid, Edge *e, GridObject *pParent=NULL, bool replacesParent=false)
Notified whenever a new element of the given type is created in the given grid.
Definition bool_marker.cpp:136
void unmark(Volume *e)
Definition bool_marker.h:123
Base-class for edges.
Definition grid_base_objects.h:397
Faces are 2-dimensional objects.
Definition grid_base_objects.h:510
the generic attachment-accessor for access to grids attachment pipes.
Definition grid.h:182
Manages the elements of a grid and their interconnection.
Definition grid.h:132
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition grid_base_objects.h:157
Definition grid_observer.h:80
Base-class for all vertex-types.
Definition grid_base_objects.h:231
Volumes are 3-dimensional objects.
Definition grid_base_objects.h:754
the ug namespace