33 #ifndef __H__LIBGRID__GRID_DEBUG__
34 #define __H__LIBGRID__GRID_DEBUG__
84 UG_THROW (
"Reinitialization of the grid debugging info provider is not allowed!");
96 return the_object->m_pSH->get_subset_index (elem) == si;
103 std::vector<int> si_ar
108 int si =
the_object->m_pSH->get_subset_index (elem);
109 for (
size_t i = 0; i < si_ar.size (); i++)
if (si == si_ar[i])
return true;
114 template <
typename TAssElem>
125 the_object->m_pGrid->associated_elements (ass_elem_list, elem);
126 for (
size_t i = 0; i < ass_elem_list.
size (); i++)
127 if (
the_object->m_pSH->get_subset_index (ass_elem_list [i]) == si)
133 template <
typename TAssElem>
137 std::vector<int> si_ar,
143 if (si_ar.size () == 0)
146 typedef unsigned long flags_t;
148 flags_t flags = 0, all_flags = 1;
151 if (si_ar.size () > sizeof (flags_t))
152 UG_THROW (
"Grid debugging info provider: too many subsets for the in_all flag");
153 all_flags = (all_flags << si_ar.size ()) - 1;
158 the_object->m_pGrid->associated_elements (ass_elem_list, elem);
159 for (
size_t i = 0; i < ass_elem_list.
size (); i++)
161 si =
the_object->m_pSH->get_subset_index (ass_elem_list [i]);
162 for (
size_t j = 0; j < si_ar.size (); j++)
165 if (! in_all)
return true;
166 flags |= ((flags_t) 1) << j;
169 return flags == all_flags;
187 static std::unique_ptr<grid_global_debug_info_provider>
the_object;
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: subset_handler_interface.h:223
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
Debugging tool for function that do have no direct access to the grid.
Definition: grid_debug.h:63
grid_global_debug_info_provider this_type
Definition: grid_debug.h:64
static bool elem_in_subset(GridObject *elem, int si)
checks if an element is in a subset
Definition: grid_debug.h:89
Grid grid_type
Definition: grid_debug.h:65
grid_global_debug_info_provider(grid_type &rGrid, ISubsetHandler &rSH)
(protected) constructor
Definition: grid_debug.h:176
static bool ass_elem_in_subset(GridObject *elem, int si)
checks if one of the associated elements is in a given subset
Definition: grid_debug.h:116
grid_type * m_pGrid
current grid
Definition: grid_debug.h:189
static std::unique_ptr< grid_global_debug_info_provider > the_object
Pointer to the single (if any) object of the grid debug info provider.
Definition: grid_debug.h:182
static void create(grid_type &rGrid, ISubsetHandler &rSH)
creates the object (if it did not exist)
Definition: grid_debug.h:76
ISubsetHandler * m_pSH
current SubsetHandler to use
Definition: grid_debug.h:190
static bool ass_elem_in_subsets(GridObject *elem, std::vector< int > si_ar, bool in_all=false)
checks if one of the associated elements is in (all or some of the) given subsets
Definition: grid_debug.h:135
static bool elem_in_subsets(GridObject *elem, std::vector< int > si_ar)
checks if an element is in subsets from a list
Definition: grid_debug.h:101
#define UG_THROW(msg)
Definition: error.h:57