ug4
grid_observer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-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__LIBGRID__GRID_OBSERVERS__
34 #define __H__LIBGRID__GRID_OBSERVERS__
35 
36 #include "common/types.h"
37 
38 namespace ug
39 {
41 // predeclarations
42 class Grid;
43 class Vertex;
44 class Edge;
45 class Face;
46 class Volume;
47 
48 
50 // Observer types
52 {
53  OT_NONE = 0,
61 };
62 
64 // GridObserver
80 {
81  public:
82  virtual ~GridObserver() {}
83 
84  // grid callbacks
85  virtual void grid_to_be_destroyed(Grid* grid) {}
86  virtual void elements_to_be_cleared(Grid* grid) {}
87 
88  // creation callbacks
106  virtual void vertex_created(Grid* grid, Vertex* vrt,
108  GridObject* pParent = NULL,
109  bool replacesParent = false) {}
110 
111  virtual void edge_created(Grid* grid, Edge* e,
112  GridObject* pParent = NULL,
113  bool replacesParent = false) {}
114 
115  virtual void face_created(Grid* grid, Face* f,
116  GridObject* pParent = NULL,
117  bool replacesParent = false) {}
118 
119  virtual void volume_created(Grid* grid, Volume* vol,
120  GridObject* pParent = NULL,
121  bool replacesParent = false) {}
123 
124 
125  // erase callbacks
127 
137  virtual void vertex_to_be_erased(Grid* grid, Vertex* vrt,
138  Vertex* replacedBy = NULL) {}
139 
140  virtual void edge_to_be_erased(Grid* grid, Edge* e,
141  Edge* replacedBy = NULL) {}
142 
143  virtual void face_to_be_erased(Grid* grid, Face* f,
144  Face* replacedBy = NULL) {}
145 
146  virtual void volume_to_be_erased(Grid* grid, Volume* vol,
147  Volume* replacedBy = NULL) {}
148 
151  // merge callbacks
153 
165  virtual void vertices_to_be_merged(Grid* grid, Vertex* target,
166  Vertex* elem1, Vertex* elem2) {}
167 
168  virtual void edges_to_be_merged(Grid* grid, Edge* target,
169  Edge* elem1, Edge* elem2) {}
170 
171  virtual void faces_to_be_merged(Grid* grid, Face* target,
172  Face* elem1, Face* elem2) {}
173 
174  virtual void volumes_to_be_merged(Grid* grid, Volume* target,
175  Volume* elem1, Volume* elem2) {}
176 
178 };
179 
180 }// end of namespace
181 
182 #endif
Base-class for edges.
Definition: grid_base_objects.h:397
Faces are 2-dimensional objects.
Definition: grid_base_objects.h:510
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
virtual void vertex_to_be_erased(Grid *grid, Vertex *vrt, Vertex *replacedBy=NULL)
Notified whenever an element of the given type is erased from the given grid.
Definition: grid_observer.h:137
virtual void elements_to_be_cleared(Grid *grid)
Definition: grid_observer.h:86
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: grid_observer.h:168
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: grid_observer.h:174
virtual void grid_to_be_destroyed(Grid *grid)
Definition: grid_observer.h:85
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: grid_observer.h:119
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: grid_observer.h:111
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: grid_observer.h:115
virtual ~GridObserver()
Definition: grid_observer.h:82
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: grid_observer.h:171
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: grid_observer.h:165
virtual void edge_to_be_erased(Grid *grid, Edge *e, Edge *replacedBy=NULL)
Notified whenever an element of the given type is erased from the given grid.
Definition: grid_observer.h:140
virtual void face_to_be_erased(Grid *grid, Face *f, Face *replacedBy=NULL)
Notified whenever an element of the given type is erased from the given grid.
Definition: grid_observer.h:143
virtual void volume_to_be_erased(Grid *grid, Volume *vol, Volume *replacedBy=NULL)
Notified whenever an element of the given type is erased from the given grid.
Definition: grid_observer.h:146
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
Volumes are 3-dimensional objects.
Definition: grid_base_objects.h:754
#define UG_API
Definition: ug_config.h:65
size_t target(SM_edge< typename T::value_type > const &e, ug::BidirectionalMatrix< T > const &m)
Definition: bidirectional_boost.h:100
the ug namespace
ObserverType
Definition: grid_observer.h:52
@ OT_VERTEX_OBSERVER
Definition: grid_observer.h:55
@ OT_VOLUME_OBSERVER
Definition: grid_observer.h:58
@ OT_FULL_OBSERVER
Definition: grid_observer.h:59
@ OT_FACE_OBSERVER
Definition: grid_observer.h:57
@ OT_EDGE_OBSERVER
Definition: grid_observer.h:56
@ OT_GRID_OBSERVER
Definition: grid_observer.h:54
@ OT_NONE
Definition: grid_observer.h:53