16 #ifndef dealii_mg_level_object_h 17 #define dealii_mg_level_object_h 19 #include <deal.II/base/subscriptor.h> 24 DEAL_II_NAMESPACE_OPEN
47 template <
class Object>
71 const unsigned int maxlevel = 0);
84 const Object &
operator[](
const unsigned int level)
const;
98 resize(
const unsigned int new_minlevel,
const unsigned int new_maxlevel);
156 template <
typename ActionFunctionObjectType>
158 apply(ActionFunctionObjectType action);
182 template <
class Object>
184 const unsigned int max)
191 template <
class Object>
194 Assert((i >= minlevel) && (i < minlevel + objects.size()),
196 return *objects[i - minlevel];
200 template <
class Object>
203 Assert((i >= minlevel) && (i < minlevel + objects.size()),
205 return *objects[i - minlevel];
209 template <
class Object>
212 const unsigned int new_maxlevel)
221 minlevel = new_minlevel;
222 for (
unsigned int i = 0; i < new_maxlevel - new_minlevel + 1; ++i)
223 objects.push_back(std::make_shared<Object>());
227 template <
class Object>
231 typename std::vector<std::shared_ptr<Object>>::iterator v;
232 for (v = objects.begin(); v != objects.end(); ++v)
238 template <
class Object>
247 template <
class Object>
251 typename std::vector<std::shared_ptr<Object>>::iterator v;
252 for (v = objects.begin(); v != objects.end(); ++v)
257 template <
class Object>
265 template <
class Object>
269 return minlevel + objects.size() - 1;
272 template <
class Object>
273 template <
typename ActionFunctionObjectType>
277 for (
unsigned int lvl = min_level(); lvl <= max_level(); ++lvl)
279 action(lvl, (*
this)[lvl]);
284 template <
class Object>
288 std::size_t result =
sizeof(*this);
289 using Iter =
typename std::vector<std::shared_ptr<Object>>::const_iterator;
290 const Iter end = objects.end();
291 for (Iter o = objects.begin(); o != end; ++o)
292 result += (*o)->memory_consumption();
297 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()