ug4
deg_layer_mngr.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015: G-CSC, Goethe University Frankfurt
3  * Author: Dmitry Logashenko
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 /*
34  * A manager for the degenerated layer subsets. It helps to distinguish between the sides
35  * of the degenerated elements and to find out the correspondence of the nodes
36  * in them.
37  */
38 #ifndef __H__UG__PLUGINS__D3F__DEGENERATED_LAYER_MANAGER__
39 #define __H__UG__PLUGINS__D3F__DEGENERATED_LAYER_MANAGER__
40 
41 #include <map>
42 #include <vector>
43 
44 // ug4 headers
45 #include "common/common.h"
47 #include "lib_grid/grid/grid.h"
53 #ifdef UG_PARALLEL
56 #endif
57 
58 namespace ug {
59 
61 
97 template <int dim>
99 {
100 public:
103 
106 
109 
112 
114  static const size_t maxLayerSideCorners = maxElemCorners / 2;
115 
118  {
121  D_LAYER_INNER = 1
122  };
123 
124 public:
127  (
129  );
130 
132  virtual ~DegeneratedLayerManager ();
133 
135  void add
136  (
137  const char * ss_names
138  );
139 
141  void remove
142  (
143  const char * ss_names
144  );
145 
147  void close ();
148 
150  void init_refiner
151  (
153  bool as_low_dim
154  );
155 
157  bool is_closed () {return m_bClosed;};
158 
160  bool contains
161  (
162  int si
163  )
164  {return m_layerSsGrp.contains (si);};
165 
167  const SubsetGroup & subset_grp () {return m_layerSsGrp;};
168 
170  size_t num_subsets () {return m_layerSsGrp.size ();};
171 
173  int subset (size_t i)
174  {
175  if (! is_closed ()) UG_THROW ("DegeneratedLayerManager: The manager is not closed.");
176  return m_layerSsGrp[i];
177  }
178 
180  int vert_mark (Vertex * vrt) {return m_aaVertMarks [vrt];};
181 
183  void get_layer_sides
184  (
185  element_type * elem,
186  size_t & num_fract_co,
187  side_type * & inner_side,
188  size_t & inner_side_idx,
189  size_t inner_side_corners [],
190  side_type * & outer_side,
191  size_t & outer_side_idx,
192  size_t outer_side_corners [],
193  size_t ass_co [] = NULL
194  );
195 
198  (
199  int layer_si,
200  int middle_si = -1
201  );
202 
205  (
206  int layer_si,
207  const char* middle_ss_name
208  );
209 
212  (
213  const char* layer_ss_name,
214  const char* middle_ss_name
215  );
216 
217 protected:
219  void mark_vertices ();
220 
223 
226 
227 private:
230 
233 
238 
240  bool m_bClosed;
241 
242  // Message hub callback id's for the notifications of the changes of the grid:
245 };
246 
247 } // end namespace ug
248 
249 #include "deg_layer_mngr_impl.h"
250 
251 #endif // __H__UG__PLUGINS__D3F__DEGENERATED_LAYER_MANAGER__
252 
253 /* End of File */
Definition: smart_pointer.h:108
Gegenerated layer subset manager.
Definition: deg_layer_mngr.h:99
MultiGrid::AttachmentAccessor< Vertex, mark_attachment_type > m_aaVertMarks
Attachment accessor.
Definition: deg_layer_mngr.h:237
void close()
Closes the manager, i.e. computes all the data, ...
Definition: deg_layer_mngr_impl.h:133
MessageHub::SPCallbackId m_spGridDistributionCallbackID
Definition: deg_layer_mngr.h:244
bool m_bClosed
'closed'-flag
Definition: deg_layer_mngr.h:240
void grid_distribution_callback(const GridMessage_Distribution &msg)
Called when a grid has been distributed between different processes.
Definition: deg_layer_mngr_impl.h:251
void remove(const char *ss_names)
Removes a fracture subdomain (e.g. for dimension-adaptive method)
Definition: deg_layer_mngr_impl.h:114
SubsetGroup m_layerSsGrp
Subset group of the fractures.
Definition: deg_layer_mngr.h:232
MessageHub::SPCallbackId m_spGridAdaptionCallbackID
Definition: deg_layer_mngr.h:243
virtual ~DegeneratedLayerManager()
Destructor.
Definition: deg_layer_mngr_impl.h:78
const SubsetGroup & subset_grp()
Returns the subset group of the fracture network.
Definition: deg_layer_mngr.h:167
static const size_t maxElemCorners
max. number of corners of the elements
Definition: deg_layer_mngr.h:111
static const size_t maxLayerSideCorners
max. number of corners of non-degenerated sides
Definition: deg_layer_mngr.h:114
t_grid_object_mark
Marks for the grid vertices.
Definition: deg_layer_mngr.h:118
@ D_LAYER_OUTER
Definition: deg_layer_mngr.h:120
@ D_LAYER_UNKNOWN
Definition: deg_layer_mngr.h:119
@ D_LAYER_INNER
Definition: deg_layer_mngr.h:121
int subset(size_t i)
Subset no. i in the manager (only if the manager is closed)
Definition: deg_layer_mngr.h:173
void grid_adaption_callback(const GridMessage_Adaption &msg)
Called when a grid adaption has been performed.
Definition: deg_layer_mngr_impl.h:238
bool is_closed()
Returns true if the manager is closed (and can be used) or false otherwise.
Definition: deg_layer_mngr.h:157
void add(const char *ss_names)
Adds a fracture subdomain.
Definition: deg_layer_mngr_impl.h:91
bool contains(int si)
Whether a subset is registered in the manager.
Definition: deg_layer_mngr.h:161
grid_dim_traits< dim >::grid_base_object element_type
base grid element object type
Definition: deg_layer_mngr.h:105
SmartPtr< MultiGridSubsetHandler > m_spSH
Subset handler to use.
Definition: deg_layer_mngr.h:229
Attachment< signed char > mark_attachment_type
type of the attachment for the marks
Definition: deg_layer_mngr.h:102
size_t num_subsets()
Number of subsets in the manager.
Definition: deg_layer_mngr.h:170
DegeneratedLayerManager(SmartPtr< MultiGridSubsetHandler > spSH)
Constructor.
Definition: deg_layer_mngr_impl.h:48
int assign_middle_subset(int layer_si, int middle_si=-1)
Assigns a different subset index to the inner sides of a layer.
Definition: deg_layer_mngr_impl.h:411
void init_refiner(SmartPtr< GlobalFracturedMediaRefiner > refiner, bool as_low_dim)
Initializes a refiner with the fracture subsets.
Definition: deg_layer_mngr_impl.h:166
grid_dim_traits< dim >::side_type side_type
grid element's side base object type
Definition: deg_layer_mngr.h:108
void mark_vertices()
Marks the inner fracture vertices.
Definition: deg_layer_mngr_impl.h:184
mark_attachment_type m_aVertexMarks
Attachment keeping the grid object marks for the vertices.
Definition: deg_layer_mngr.h:235
void get_layer_sides(element_type *elem, size_t &num_fract_co, side_type *&inner_side, size_t &inner_side_idx, size_t inner_side_corners[], side_type *&outer_side, size_t &outer_side_idx, size_t outer_side_corners[], size_t ass_co[]=NULL)
Gets the inner and the outer fracture sides of an element.
Definition: deg_layer_mngr_impl.h:266
int vert_mark(Vertex *vrt)
Returs the mark of a vertex.
Definition: deg_layer_mngr.h:180
the generic attachment-accessor for access to grids attachment pipes.
Definition: grid.h:182
A message sent along with "GridRefinement" messages.
Definition: lib_grid_messages.h:91
Definition: lib_grid_messages.h:166
Group of subsets.
Definition: subset_group.h:51
size_t size() const
number of subsets in this group
Definition: subset_group.h:122
bool contains(int si) const
returns true if subset is contained in this group
Definition: subset_group.cpp:272
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
#define UG_THROW(msg)
Definition: error.h:57
the ug namespace
Definition: grid_dim_traits.h:53