51 : m_spSH (spSH), m_bClosed (false)
55 UG_THROW (
"DegeneratedLayerManager: Invalid subset handler specified!");
81 m_aaVertMarks.invalidate ();
82 pMG->template detach_from<Vertex> (m_aVertexMarks);
96 UG_LOG (
"DegeneratedLayerManager: Adding subsets to a closed manager.");
102 std::vector<std::string> vssNames;
106 m_layerSsGrp.add (vssNames);
115 const char * ss_names
122 std::vector<std::string> vssNames;
126 m_layerSsGrp.remove (vssNames);
135 size_t init_n_subsets = m_layerSsGrp.size ();
139 while (i < m_layerSsGrp.size ())
142 UG_LOG (
"DegeneratedLayerManager: Low-dimensional subset '"
143 << m_spSH->get_subset_name (m_layerSsGrp [i])
144 <<
"' specified as a degenerated layer. Removed from the list.\n");
145 m_layerSsGrp.remove (m_layerSsGrp [i]);
151 if (init_n_subsets != 0 && m_layerSsGrp.size () == 0)
152 UG_THROW (
"DegeneratedLayerManager: All the specified subsets have illegal dimensionality!\n");
172 UG_THROW (
"DegeneratedLayerManager: The manager must be closed before use.");
173 for (
size_t i = 0; i < m_layerSsGrp.size (); i++)
174 refiner->mark_as_fracture (m_layerSsGrp[i], as_low_dim);
191 for (
size_t i = 0; i < m_layerSsGrp.size (); i++)
193 int si = m_layerSsGrp [i];
194 for (
size_t lev = 0; lev < pMG->
num_levels (); lev++)
196 t_elem_iter list_end = m_spSH->template end<element_type> (si, lev);
197 for (t_elem_iter iElem = m_spSH->template begin<element_type> (si, lev);
198 iElem != list_end; ++iElem)
201 for (
size_t i = 0; i < elem->num_vertices (); i++)
203 Vertex * vert = elem->vertex(i);
204 m_aaVertMarks [vert] = (! vert->
is_constrained ())? D_LAYER_INNER : D_LAYER_OUTER;
213 for (
int si = 0; si < m_spSH->num_subsets (); si++)
215 for (
size_t lev = 0; lev < pMG->
num_levels (); lev++)
217 t_elem_iter list_end = m_spSH->template end<element_type> (si, lev);
218 for (t_elem_iter iElem = m_spSH->template begin<element_type> (si, lev);
219 iElem != list_end; ++iElem)
222 for (
size_t i = 0; i < elem->num_vertices (); i++)
223 m_aaVertMarks [elem->vertex(i)] = D_LAYER_OUTER;
229 AttachmentAllReduce<Vertex> (*pMG, m_aVertexMarks,
PCL_RO_MIN);
268 size_t & num_side_co,
270 size_t & inner_side_idx,
271 size_t inner_side_corners [],
273 size_t & outer_side_idx,
274 size_t outer_side_corners [],
278 size_t n_inner, n_outer;
279 size_t n_co = elem->num_vertices ();
285 inner_side = NULL; n_inner = 0;
286 outer_side = NULL; n_outer = 0;
287 for (
size_t i = 0; i < elem->num_sides (); i++)
290 bool has_inner =
false, has_outer =
false;
291 size_t side_n_co = side->num_vertices ();
292 for (
size_t co = 0; co < side_n_co; co++)
294 int mark = vert_mark (side->vertex (co));
295 if (mark == D_LAYER_OUTER)
297 else if (mark == D_LAYER_INNER)
300 UG_THROW (
"DegeneratedLayerManager: Some vertices are not marked!");
303 if (has_inner && has_outer)
continue;
307 if (inner_side != NULL)
308 UG_THROW (
"DegeneratedLayerManager: Two inner sides of a degenerated layer element found!");
315 if (outer_side != NULL)
316 UG_THROW (
"DegeneratedLayerManager: Two outer sides of a degenerated layer element found!");
322 if (n_inner != n_outer || 2 * n_inner != n_co)
323 UG_THROW (
"DegeneratedLayerManager: Unrecognized degenerated layer element!");
324 num_side_co = n_inner;
327 Vertex * inner_vert_ptr [maxLayerSideCorners], * outer_vert_ptr [maxLayerSideCorners];
328 size_t inner_corners [maxLayerSideCorners], outer_corners [maxLayerSideCorners];
329 size_t inner_i = 0, outer_i = 0;
330 for (
size_t co = 0; co < n_co; co++)
332 Vertex * vrt = elem->vertex (co);
333 if (vert_mark (vrt) == D_LAYER_INNER)
335 inner_vert_ptr [inner_i] = vrt;
336 inner_corners [inner_i] = co;
341 outer_vert_ptr [outer_i] = vrt;
342 outer_corners [outer_i] = co;
346 if (inner_i != n_inner || outer_i != n_outer)
347 UG_THROW (
"DegeneratedLayerManager: Failed to get the vertex-side correspondence!");
350 for (
size_t i = 0; i < n_inner; i++)
355 while (inner_side->vertex (co) != inner_vert_ptr [i])
357 UG_THROW (
"DegeneratedLayerManager: Failed! Missing inner vertex?");
358 inner_side_corners [co] = inner_corners [i];
361 while (outer_side->vertex (co) != outer_vert_ptr [i])
363 UG_THROW (
"DegeneratedLayerManager: Failed! Missing outer vertex?");
364 outer_side_corners [co] = outer_corners [i];
371 for (
size_t i = 0; i < edge_list.
size (); i++)
373 Edge * e = edge_list [i];
374 Vertex * v_1 = e->
vertex (0);
int mark_1 = vert_mark (v_1);
375 Vertex * v_2 = e->
vertex (1);
int mark_2 = vert_mark (v_2);
379 if (mark_1 == mark_2)
382 if (mark_1 == D_LAYER_OUTER)
384 t = v_1; v_1 = v_2; v_2 = t;
388 while (inner_vert_ptr[co_1] != v_1)
389 if (++co_1 == n_inner)
390 UG_THROW (
"DegeneratedLayerManager: Cannot find an inner node by vertex!");
393 while (outer_vert_ptr[co_2] != v_2)
394 if (++co_2 == n_outer)
395 UG_THROW (
"DegeneratedLayerManager: Cannot find an outer node by vertex!");
397 ass_co [inner_corners [co_1]] = outer_corners [co_2];
398 ass_co [outer_corners [co_2]] = inner_corners [co_1];
421 if (middle_si < 0) middle_si = m_spSH->num_subsets ();
425 for (
size_t lev = 0; lev < pMG->
num_levels (); lev++)
427 t_elem_iter list_end = m_spSH->template end<element_type> (layer_si, lev);
428 for (t_elem_iter iElem = m_spSH->template begin<element_type> (layer_si, lev);
429 iElem != list_end; ++iElem)
434 size_t inner_side_idx, outer_side_idx;
435 size_t inner_side_corners [maxLayerSideCorners], outer_side_corners [maxLayerSideCorners];
438 get_layer_sides (elem, num_side_co,
439 inner_side, inner_side_idx, inner_side_corners,
440 outer_side, outer_side_idx, outer_side_corners);
443 m_spSH->assign_subset (inner_side, middle_si);
460 const char* middle_ss_name
466 for (
int si = 0; si < m_spSH->num_subsets (); si++)
467 if (strcmp (middle_ss_name, m_spSH->get_subset_name (si)) == 0)
475 middle_si = assign_middle_subset (layer_si, middle_si);
479 m_spSH->set_subset_name (middle_ss_name, middle_si);
492 const char* layer_ss_name,
493 const char* middle_ss_name
497 for (
int si = 0; si < m_spSH->num_subsets (); si++)
498 if (strcmp (layer_ss_name, m_spSH->get_subset_name (si)) == 0)
499 return assign_middle_subset (si, middle_ss_name);
500 UG_THROW (
"DegeneratedLayerManager: Subset '" << layer_ss_name <<
"' not found");
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
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
@ D_LAYER_UNKNOWN
Definition: deg_layer_mngr.h:119
void grid_adaption_callback(const GridMessage_Adaption &msg)
Called when a grid adaption has been performed.
Definition: deg_layer_mngr_impl.h:238
void add(const char *ss_names)
Adds a fracture subdomain.
Definition: deg_layer_mngr_impl.h:91
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
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
Base-class for edges.
Definition: grid_base_objects.h:397
virtual Vertex * vertex(size_t index) const
Definition: grid_base_objects.h:366
SPMessageHub message_hub()
gives access to the grid's message-hub
Definition: grid.h:945
Vertex::side * get_side(Vertex *obj, size_t side)
This method returns the i-th side of an Edge, Face or Volume.
Definition: grid.cpp:1170
void associated_elements(traits< Vertex >::secure_container &elemsOut, TElem *e)
Puts all elements of type TAss which are contained in 'e' or which contain 'e' into elemsOut.
Definition: grid_impl.hpp:466
A message sent along with "GridRefinement" messages.
Definition: lib_grid_messages.h:91
bool adaption_ends() const
tells whether grid adaption has just been started or has been finished.
Definition: lib_grid_messages.cpp:44
Definition: lib_grid_messages.h:195
Definition: lib_grid_messages.h:166
GridMessageDistributionType msg() const
Definition: lib_grid_messages.h:174
virtual bool is_constrained() const
returns true if the object is constrained by other objects.
Definition: grid_base_objects.h:188
void post_message(const TMsg &msg)
Posts a message to all callbacks which are registered for the given message tpye.
Definition: message_hub_impl.hpp:67
Definition: multi_grid.h:72
size_t num_levels() const
number of levels
Definition: multi_grid.h:145
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
void set_subset_handler(ConstSmartPtr< ISubsetHandler > sh)
set an underlying subset handler
Definition: subset_group.h:69
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
Definition: grid_base_object_traits.h:68
#define PCL_RO_MIN
Definition: pcl_methods.h:62
#define UG_THROW(msg)
Definition: error.h:57
#define UG_LOG(msg)
Definition: log.h:367
@ GMCT_CREATION_STOPS
Definition: lib_grid_messages.h:191
@ GMCT_CREATION_STARTS
Definition: lib_grid_messages.h:190
void TokenizeString(const string &str, vector< string > &vToken, const char delimiter)
Definition: string_util.cpp:56
@ GMDT_DISTRIBUTION_STOPS
Definition: lib_grid_messages.h:162
int DimensionOfSubset(const ISubsetHandler &sh, int si)
returns the current dimension of the subset
Definition: subset_dim_util.cpp:89