16#ifndef dealii_mg_level_object_h
17#define dealii_mg_level_object_h
48template <
class Object>
73 template <
class... Args>
75 const unsigned int maxlevel,
83 const unsigned int maxlevel = 0);
119 template <
class... Args>
122 const unsigned int new_maxlevel,
173 template <
typename ActionFunctionObjectType>
175 apply(ActionFunctionObjectType action);
199template <
class Object>
200template <
class... Args>
202 const unsigned int max,
206 resize(min, max, std::forward<Args>(args)...);
210template <
class Object>
212 const unsigned int max)
219template <
class Object>
223 Assert((i >= minlevel) && (i < minlevel + objects.size()),
225 return *objects[i - minlevel];
229template <
class Object>
233 Assert((i >= minlevel) && (i < minlevel + objects.size()),
235 return *objects[i - minlevel];
239template <
class Object>
243 return this->operator[](this->max_level());
247template <
class Object>
248template <
class... Args>
251 const unsigned int new_maxlevel,
261 minlevel = new_minlevel;
262 for (
unsigned int i = 0; i < new_maxlevel - new_minlevel + 1; ++i)
263 objects.push_back(std::make_shared<Object>(std::forward<Args>(args)...));
267template <
class Object>
271 typename std::vector<std::shared_ptr<Object>>::iterator v;
272 for (v = objects.begin(); v != objects.end(); ++v)
278template <
class Object>
282 typename std::vector<std::shared_ptr<Object>>::iterator v;
283 for (v = objects.begin(); v != objects.end(); ++v)
288template <
class Object>
296template <
class Object>
300 return minlevel + objects.size() - 1;
304template <
class Object>
308 return objects.size();
311template <
class Object>
312template <
typename ActionFunctionObjectType>
316 for (
unsigned int lvl = min_level(); lvl <= max_level(); ++lvl)
318 action(lvl, (*
this)[lvl]);
323template <
class Object>
327 std::size_t result =
sizeof(*this);
328 using Iter =
typename std::vector<std::shared_ptr<Object>>::const_iterator;
329 const Iter end = objects.end();
330 for (Iter o = objects.begin(); o != end; ++o)
331 result += (*o)->memory_consumption();
std::vector< std::shared_ptr< Object > > objects
Object & operator[](const unsigned int level)
MGLevelObject< Object > & operator=(const double d)
MGLevelObject(const unsigned int minlevel, const unsigned int maxlevel, Args &&...args)
MGLevelObject(const unsigned int minlevel=0, const unsigned int maxlevel=0)
const Object & operator[](const unsigned int level) const
void resize(const unsigned int new_minlevel, const unsigned int new_maxlevel, Args &&...args)
std::size_t memory_consumption() const
unsigned int max_level() const
unsigned int min_level() const
const Object & back() const
unsigned int n_levels() const
void apply(ActionFunctionObjectType action)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)