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);
111 template <
class... Args>
114 const unsigned int new_maxlevel,
159 template <
typename ActionFunctionObjectType>
161 apply(ActionFunctionObjectType action);
185template <
class Object>
186template <
class... Args>
188 const unsigned int max,
196template <
class Object>
198 const unsigned int max)
205template <
class Object>
208 Assert((i >= minlevel) && (i < minlevel + objects.size()),
210 return *objects[i - minlevel];
214template <
class Object>
217 Assert((i >= minlevel) && (i < minlevel + objects.size()),
219 return *objects[i - minlevel];
223template <
class Object>
224template <
class... Args>
227 const unsigned int new_maxlevel,
237 minlevel = new_minlevel;
238 for (
unsigned int i = 0; i < new_maxlevel - new_minlevel + 1; ++i)
239 objects.push_back(std::make_shared<Object>(std::forward<Args>(args)...));
243template <
class Object>
247 typename std::vector<std::shared_ptr<Object>>::iterator v;
248 for (v = objects.begin(); v != objects.end(); ++v)
254template <
class Object>
258 typename std::vector<std::shared_ptr<Object>>::iterator v;
259 for (v = objects.begin(); v != objects.end(); ++v)
264template <
class Object>
272template <
class Object>
276 return minlevel + objects.size() - 1;
279template <
class Object>
280template <
typename ActionFunctionObjectType>
284 for (
unsigned int lvl = min_level(); lvl <= max_level(); ++lvl)
286 action(lvl, (*
this)[lvl]);
291template <
class Object>
295 std::size_t result =
sizeof(*this);
296 using Iter =
typename std::vector<std::shared_ptr<Object>>::const_iterator;
297 const Iter
end = objects.end();
298 for (Iter o = objects.begin(); o !=
end; ++o)
299 result += (*o)->memory_consumption();
std::vector< std::shared_ptr< Object > > objects
Object & operator[](const unsigned int level)
MGLevelObject< Object > & operator=(const double d)
void resize(const unsigned int new_minlevel, const unsigned int new_maxlevel, Args &&... args)
MGLevelObject(const unsigned int minlevel=0, const unsigned int maxlevel=0)
const Object & operator[](const unsigned int level) const
std::size_t memory_consumption() const
unsigned int max_level() const
unsigned int min_level() const
void apply(ActionFunctionObjectType action)
MGLevelObject(const unsigned int minlevel, const unsigned int maxlevel, Args &&... args)
VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &x, const ::VectorizedArray< Number, width > &y)
VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &x, const ::VectorizedArray< Number, width > &y)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
VectorType::value_type * end(VectorType &V)