16 #ifndef dealii_mg_level_object_h 17 #define dealii_mg_level_object_h 19 #include <deal.II/base/subscriptor.h> 23 DEAL_II_NAMESPACE_OPEN
46 template <
class Object>
70 const unsigned int maxlevel = 0);
83 const Object &
operator[] (
const unsigned int level)
const;
96 void resize (
const unsigned int new_minlevel,
97 const unsigned int new_maxlevel);
150 template <
typename ActionFunctionObjectType>
151 void apply (ActionFunctionObjectType action);
167 std::vector<std::shared_ptr<Object> >
objects;
174 template <
class Object>
176 const unsigned int max)
184 template <
class Object>
188 Assert((i>=minlevel) && (i<minlevel+objects.size()),
190 return *objects[i-minlevel];
194 template <
class Object>
198 Assert((i>=minlevel) && (i<minlevel+objects.size()),
200 return *objects[i-minlevel];
204 template <
class Object>
207 const unsigned int new_maxlevel)
216 minlevel = new_minlevel;
217 for (
unsigned int i=0; i<new_maxlevel-new_minlevel+1; ++i)
218 objects.push_back(std::make_shared<Object> ());
222 template <
class Object>
226 typename std::vector<std::shared_ptr<Object> >::iterator v;
227 for (v = objects.begin(); v != objects.end(); ++v)
233 template <
class Object>
242 template <
class Object>
246 typename std::vector<std::shared_ptr<Object> >::iterator v;
247 for (v = objects.begin(); v != objects.end(); ++v)
252 template <
class Object>
260 template <
class Object>
264 return minlevel + objects.size() - 1;
267 template <
class Object>
268 template <
typename ActionFunctionObjectType>
272 for (
unsigned int lvl = min_level(); lvl <= max_level(); ++lvl)
274 action (lvl, (*
this)[lvl]);
279 template <
class Object>
283 std::size_t result =
sizeof(*this);
284 typedef typename std::vector<std::shared_ptr<Object> >::const_iterator Iter;
285 const Iter end = objects.end();
286 for (Iter o=objects.begin(); o!=end; ++o)
287 result += (*o)->memory_consumption();
292 DEAL_II_NAMESPACE_CLOSE
unsigned int max_level() const
Object & operator[](const unsigned int level)
MGLevelObject(const unsigned int minlevel=0, const unsigned int maxlevel=0)
std::vector< std::shared_ptr< Object > > objects
void apply(ActionFunctionObjectType action)
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
std::size_t memory_consumption() const
unsigned int min_level() const
VectorizedArray< Number > min(const ::VectorizedArray< Number > &x, const ::VectorizedArray< Number > &y)
#define Assert(cond, exc)
MGLevelObject< Object > & operator=(const double d)
void resize(const unsigned int new_minlevel, const unsigned int new_maxlevel)
VectorizedArray< Number > max(const ::VectorizedArray< Number > &x, const ::VectorizedArray< Number > &y)
static ::ExceptionBase & ExcInternalError()