16 #ifndef dealii__mg_level_object_h 17 #define dealii__mg_level_object_h 19 #include <deal.II/base/subscriptor.h> 22 #include <deal.II/base/std_cxx11/shared_ptr.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;
97 void resize (
const unsigned int new_minlevel,
98 const unsigned int new_maxlevel);
118 void clear() DEAL_II_DEPRECATED;
154 std::vector<std_cxx11::shared_ptr<Object> >
objects;
161 template<
class Object>
163 const unsigned int max)
171 template<
class Object>
175 Assert((i>=minlevel) && (i<minlevel+objects.size()),
177 return *objects[i-minlevel];
181 template<
class Object>
185 Assert((i>=minlevel) && (i<minlevel+objects.size()),
187 return *objects[i-minlevel];
191 template<
class Object>
194 const unsigned int new_maxlevel)
203 minlevel = new_minlevel;
204 for (
unsigned int i=0; i<new_maxlevel-new_minlevel+1; ++i)
205 objects.push_back(std_cxx11::shared_ptr<Object> (
new Object));
209 template<
class Object>
213 typename std::vector<std_cxx11::shared_ptr<Object> >::iterator v;
214 for (v = objects.begin(); v != objects.end(); ++v)
220 template<
class Object>
229 template<
class Object>
233 typename std::vector<std_cxx11::shared_ptr<Object> >::iterator v;
234 for (v = objects.begin(); v != objects.end(); ++v)
239 template<
class Object>
247 template<
class Object>
251 return minlevel + objects.size() - 1;
255 template<
class Object>
259 std::size_t result =
sizeof(*this);
260 typedef typename std::vector<std_cxx11::shared_ptr<Object> >::const_iterator Iter;
261 const Iter end = objects.end();
262 for (Iter o=objects.begin(); o!=end; ++o)
263 result += (*o)->memory_consumption();
268 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)
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
std::size_t memory_consumption() const
unsigned int min_level() const
std::vector< std_cxx11::shared_ptr< Object > > objects
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()