*/
Patch ();
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception
*/
* all previous contents of this object.
*/
void parse_parameters (ParameterHandler &prm);
+
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ unsigned int memory_consumption () const;
};
/**
* all previous contents of this object.
*/
void parse_parameters (ParameterHandler &prm);
+
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ unsigned int memory_consumption () const;
};
/**
*/
struct PovrayFlags
{
- /**
- * Normal vector interpolation,
- * if set to true
- *
- * default = false
- */
- bool smooth;
-
- /**
- * Use bicubic patches (b-splines)
- * instead of triangles.
- *
- * default = false
- */
- bool bicubic_patch;
-
- /**
- * include external "data.inc"
- * with camera, light and
- * texture definition for the
- * scene.
- *
- * default = false
- */
- bool external_data;
-
- /**
- * Constructor.
- */
- PovrayFlags (const bool smooth = false,
- const bool bicubic_patch = false,
- const bool external_data = false);
+ /**
+ * Normal vector interpolation,
+ * if set to true
+ *
+ * default = false
+ */
+ bool smooth;
+
+ /**
+ * Use bicubic patches (b-splines)
+ * instead of triangles.
+ *
+ * default = false
+ */
+ bool bicubic_patch;
+ /**
+ * include external "data.inc"
+ * with camera, light and
+ * texture definition for the
+ * scene.
+ *
+ * default = false
+ */
+ bool external_data;
+
+ /**
+ * Constructor.
+ */
+ PovrayFlags (const bool smooth = false,
+ const bool bicubic_patch = false,
+ const bool external_data = false);
+
/**
* Declare all flags with name
* and type as offered by this
* all previous contents of this object.
*/
void parse_parameters (ParameterHandler &prm);
+
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ unsigned int memory_consumption () const;
};
* all previous contents of this object.
*/
void parse_parameters (ParameterHandler &prm);
+
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ unsigned int memory_consumption () const;
};
/**
* all previous contents of this object.
*/
void parse_parameters (ParameterHandler &prm);
+
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ unsigned int memory_consumption () const;
};
/**
const GmvFlags &flags,
ostream &out);
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ static unsigned int memory_consumption ();
/**
* Exception
*/
void parse_parameters (ParameterHandler &prm);
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception
*/
*/
virtual void vector_laplacian_list (const vector<Point<dim> > &points,
vector<Vector<double> > &values) const;
+
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ unsigned int memory_consumption () const;
};
virtual void vector_value_list (const vector<Point<dim> > &points,
vector<Vector<double> > &values) const;
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ unsigned int memory_consumption () const;
+
protected:
/**
* Store the constant function value.
virtual void vector_value_list (const vector<Point<dim> > &points,
vector<Vector<double> > &values) const;
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ unsigned int memory_consumption () const;
+
protected:
const unsigned int selected;
};
#include <base/exceptions.h>
#include <base/function.h>
-/**
- * Names of difference formulas.
- */
-enum DifferenceFormula
-{
- Euler,
- UpwindEuler,
- FourthOrder
-};
-
/**
* Derivative of a function object. The value access functions of
template <int dim>
class FunctionDerivative : public Function<dim>
{
-public:
- /**
- * Constructor. Provided are the
- * function to compute derivatives
- * of and the direction vector of
- * the differentiation.
- */
- FunctionDerivative (const Function<dim>& f,
- const Point<dim>& direction);
+ public:
+ /**
+ * Names of difference formulas.
+ */
+ enum DifferenceFormula
+ {
+ Euler,
+ UpwindEuler,
+ FourthOrder
+ };
- /**
- * Set step size of the difference
- * formula. This is set to the
- * default in the constructor.
- */
- void set_h (double h_new = 1.e-6);
-
- /**
- * Choose the difference formula.
- * This is set to the default in
- * the constructor.
- *
- * Formulas implemented right now
- * are first order backward Euler
- * (@p{UpwindEuler}), second order
- * symmetric Euler (@p{Euler}) and
- * a symmetric fourth order formula
- * (@p{FourthOrder}).
- */
- void set_formula (DifferenceFormula formula = Euler);
-
- /**
- * Function value at one point.
- */
- virtual double value (const Point<dim> &p,
- const unsigned int component = 0) const;
-
- /**
- * Function values at multiple points.
- */
- virtual void value_list (const vector<Point<dim> > &points,
- vector<double> &values,
- const unsigned int component = 0) const;
+ /**
+ * Constructor. Provided are the
+ * function to compute derivatives
+ * of and the direction vector of
+ * the differentiation.
+ */
+ FunctionDerivative (const Function<dim>& f,
+ const Point<dim>& direction);
+
+ /**
+ * Set step size of the difference
+ * formula. This is set to the
+ * default in the constructor.
+ */
+ void set_h (double h_new = 1.e-6);
+
+ /**
+ * Choose the difference formula.
+ * This is set to the default in
+ * the constructor.
+ *
+ * Formulas implemented right now
+ * are first order backward Euler
+ * (@p{UpwindEuler}), second order
+ * symmetric Euler (@p{Euler}) and
+ * a symmetric fourth order formula
+ * (@p{FourthOrder}).
+ */
+ void set_formula (DifferenceFormula formula = Euler);
+
+ /**
+ * Function value at one point.
+ */
+ virtual double value (const Point<dim> &p,
+ const unsigned int component = 0) const;
+
+ /**
+ * Function values at multiple points.
+ */
+ virtual void value_list (const vector<Point<dim> > &points,
+ vector<double> &values,
+ const unsigned int component = 0) const;
- DeclException0(ExcInvalidFormula);
-
-private:
- /**
- * Function for differentiation.
- */
- const Function<dim>& f;
- /**
- * Differentiation vector.
- */
- Point<dim> direction;
-
- /**
- * Step size of the difference formula.
- */
- double h;
- /**
- * Difference formula.
- */
- DifferenceFormula formula;
- /**
- * Helper object. Contains the
- * increment vector for the
- * formula.
- */
- Point<dim> incr;
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ unsigned int memory_consumption () const;
+
+ DeclException0(ExcInvalidFormula);
+
+ private:
+ /**
+ * Function for differentiation.
+ */
+ const Function<dim>& f;
+ /**
+ * Differentiation vector.
+ */
+ Point<dim> direction;
+
+ /**
+ * Step size of the difference formula.
+ */
+ double h;
+ /**
+ * Difference formula.
+ */
+ DifferenceFormula formula;
+ /**
+ * Helper object. Contains the
+ * increment vector for the
+ * formula.
+ */
+ Point<dim> incr;
};
#endif
vector<double> &values,
const unsigned int component = 0) const;
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ unsigned int memory_consumption () const;
+
protected:
/**
* Advection vector.
*/
const Point<dim> direction;
+
/**
* Steepness (maximal derivative)
* of the slope.
*
* The usual usage of this class is through the pregenerated object
* @p{deallog}. Typical steps are
- * <OL>
- * <LI> @p{deallog.attach(ostream)}: write logging information into a file.
- * <LI> @p{deallog.depth_console(n)}: restrict output on screen to outer loops.
- * <LI> Before entering a new phase of your program, e.g. a new loop,
- * @p{deallog.push("loopname")}.
- * <LI> @p{deallog << anything << endl;} to write logging information
- * (Usage of @p{endl} is mandatory!).
- * <LI> @p{deallog.pop()} when leaving that stage entered with @p{push}.
- * </OL>
+ * @begin{itemize}
+ * @item @p{deallog.attach(ostream)}: write logging information into a file.
+ * @item @p{deallog.depth_console(n)}: restrict output on screen to outer loops.
+ * @item Before entering a new phase of your program, e.g. a new loop,
+ * @p{deallog.push("loopname")}.
+ * @item @p{deallog << anything << endl;} to write logging information
+ * (Usage of @p{endl} is mandatory!).
+ * @item @p{deallog.pop()} when leaving that stage entered with @p{push}.
+ * @end{itemize}
*
* @author Guido Kanschat, Wolfgang Bangerth, 1999
*/
*/
LogStream & operator << (void (f)(LogStream &));
+
/**
- * Declare this function as a friend.
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
*/
- friend void endl (LogStream &);
+ unsigned int memory_consumption () const;
/**
* Exception
* the contents of the prefix stack.
*/
void print_line_head();
+
+ /**
+ * Declare this function as a friend.
+ */
+ friend void endl (LogStream &);
};
--- /dev/null
+//---------------------------- memory_consumption.h ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 1998, 1999, 2000 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- memory_consumption.h ---------------------------
+#ifndef __deal2__memory_consumption_h
+#define __deal2__memory_consumption_h
+
+
+#include <string>
+#include <vector>
+#include <utility>
+
+
+
+/**
+ * Basic types, vectors of basic types, strings, vectors of composed types
+ *
+ * @author Wolfgang Bangerth, 2000
+ */
+namespace MemoryConsumption
+{
+ /**
+ * Determine the amount of memory
+ * in bytes consumed by a @p{bool}
+ * variable.
+ */
+ inline
+ unsigned int memory_consumption (const bool)
+ {
+ return sizeof(bool);
+ };
+
+ /**
+ * Determine the amount of memory
+ * in bytes consumed by a @p{char}
+ * variable.
+ */
+ inline
+ unsigned int memory_consumption (const char)
+ {
+ return sizeof(char);
+ };
+
+ /**
+ * Determine the amount of memory
+ * in bytes consumed by a
+ * @p{short int} variable.
+ */
+ inline
+ unsigned int memory_consumption (const short int)
+ {
+ return sizeof(short int);
+ };
+
+
+ /**
+ * Determine the amount of memory
+ * in bytes consumed by a
+ * @p{short unsigned int} variable.
+ */
+ inline
+ unsigned int memory_consumption (const short unsigned int)
+ {
+ return sizeof(short unsigned int);
+ };
+
+
+
+ /**
+ * Determine the amount of memory
+ * in bytes consumed by a @p{int}
+ * variable.
+ */
+ inline
+ unsigned int memory_consumption (const int)
+ {
+ return sizeof(int);
+ };
+
+
+ /**
+ * Determine the amount of memory
+ * in bytes consumed by a @p{unsigned int}
+ * variable.
+ */
+ inline
+ unsigned int memory_consumption (const unsigned int)
+ {
+ return sizeof(unsigned int);
+ };
+
+
+ /**
+ * Determine the amount of memory
+ * in bytes consumed by a @p{float}
+ * variable.
+ */
+ inline
+ unsigned int memory_consumption (const float)
+ {
+ return sizeof(float);
+ };
+
+
+
+ /**
+ * Determine the amount of memory
+ * in bytes consumed by a @p{double}
+ * variable.
+ */
+ inline
+ unsigned int memory_consumption (const double)
+ {
+ return sizeof(double);
+ };
+
+ /**
+ * Determine an estimate of the
+ * amount of memory in bytes
+ * consumed by a @p{string}
+ * variable.
+ */
+ unsigned int memory_consumption (const string &s);
+
+ /**
+ * Determine an estimate of the
+ * amount of memory in bytes
+ * consumed by a @p{vector} of
+ * certain elements. It does so by
+ * looping over all elements of the
+ * vector and determining their
+ * sizes using the
+ * @p{memory_consumption}
+ * functions. If the elements are
+ * of constant size, there might be
+ * another global function
+ * @p{memory_consumption} for this
+ * data type or if there is a
+ * member function of that class of
+ * that names that returns a
+ * constant value and the compiler
+ * will unroll this loop so that
+ * the operation is fast. If the
+ * size of the data elements is
+ * variable, for example if they do
+ * memory allocation themselves,
+ * then the operation will
+ * necessarily be more expensive.
+ *
+ * Using the algorithm, in
+ * particular the loop over all
+ * elements, it is possible to also
+ * compute the memory consumption
+ * of vectors of vectors, vectors
+ * of strings, etc, where the
+ * individual elements may have
+ * vastly different sizes.
+ *
+ * Note that this algorithm also
+ * takes into account the size of
+ * elements that are allocated by
+ * this vector but not currently
+ * used.
+ *
+ * For the most commonly used
+ * vectors, there are special
+ * functions that compute the size
+ * without a loop. This also
+ * applies for the special case of
+ * vectors of bools.
+ */
+ template <typename T>
+ unsigned int memory_consumption (const vector<T> &v)
+ {
+ unsigned int mem = sizeof(vector<T>);
+ const unsigned int n = v.size();
+ for (unsigned int i=0; i<n; ++i)
+ mem += memory_consumption(v[i]);
+ mem += (v.capacity() - n)*sizeof(T);
+ return mem;
+ };
+
+
+
+ /**
+ * Estimate the amount of memory
+ * (in bytes) occupied by a
+ * C-style array. Since in this
+ * library we do not usually
+ * store simple data elements
+ * like @p{double}s in such
+ * arrays (but rather use STL
+ * @p{vector}s or deal.II
+ * @p{Vector} objects), we do not
+ * provide specializations like
+ * for the @p{vector} arrays, but
+ * always use the loop over all
+ * elements.
+ */
+ template <typename T, int N>
+ unsigned int memory_consumption (const T (&v)[N])
+ {
+ unsigned int mem = 0;
+ for (unsigned int i=0; i<N; ++i)
+ mem += memory_consumption(v[i]);
+ return mem;
+ };
+
+
+ /**
+ * Specialization of the
+ * determination of the memory
+ * consumption of a vector, here
+ * for a vector of @p{bool}s.
+ *
+ * This is a special case, as the
+ * bools are not stored
+ * one-by-one, but as a bit
+ * field.
+ */
+ inline
+ unsigned int memory_consumption (const vector<bool> &v)
+ {
+ return v.capacity() / 8 + sizeof(v);
+ };
+
+
+ /**
+ * Specialization of the
+ * determination of the memory
+ * consumption of a vector, here
+ * for a vector of @p{int}s.
+ */
+ inline
+ unsigned int memory_consumption (const vector<int> &v)
+ {
+ return (v.capacity() * sizeof(int) +
+ sizeof(v));
+ };
+
+
+ /**
+ * Specialization of the
+ * determination of the memory
+ * consumption of a vector, here
+ * for a vector of @p{double}s.
+ */
+ inline
+ unsigned int memory_consumption (const vector<double> &v)
+ {
+ return (v.capacity() * sizeof(double) +
+ sizeof(v));
+ };
+
+
+ /**
+ * Specialization of the
+ * determination of the memory
+ * consumption of a vector, here
+ * for a vector of @p{float}s.
+ */
+ inline
+ unsigned int memory_consumption (const vector<float> &v)
+ {
+ return (v.capacity() * sizeof(float) +
+ sizeof(v));
+ };
+
+
+ /**
+ * Specialization of the
+ * determination of the memory
+ * consumption of a vector, here
+ * for a vector of @p{char}s.
+ */
+ inline
+ unsigned int memory_consumption (const vector<char> &v)
+ {
+ return (v.capacity() * sizeof(char) +
+ sizeof(v));
+ };
+
+
+
+ /**
+ * Specialization of the
+ * determination of the memory
+ * consumption of a vector, here
+ * for a vector of @p{unsigned char}s.
+ */
+ inline
+ unsigned int memory_consumption (const vector<unsigned char> &v)
+ {
+ return (v.capacity() * sizeof(unsigned char) +
+ sizeof(v));
+ };
+
+
+
+
+ /**
+ * Specialization of the
+ * determination of the memory
+ * consumption of a vector, here
+ * for a vector of pointers.
+ */
+ template <typename T>
+ inline
+ unsigned int memory_consumption (const vector<T *> &v)
+ {
+ return (v.capacity() * sizeof(T *) +
+ sizeof(v));
+ };
+
+
+ /**
+ * Determine an estimate of the
+ * amount of memory in bytes
+ * consumed by a pair of values.
+ */
+ template <typename A, typename B>
+ inline
+ unsigned int memory_consumption (const pair<A,B> &p)
+ {
+ return (memory_consumption(p.first) +
+ memory_consumption(p.second));
+ };
+
+ /**
+ * Return the amount of memory
+ * used by a pointer. Make sure
+ * that you are really interested
+ * in this, and not the amount of
+ * memory required by the object
+ * pointed to.
+ */
+ template <typename T>
+ inline
+ unsigned int
+ memory_consumption (const T * const)
+ {
+ return sizeof(T*);
+ };
+
+
+
+ /**
+ * Return the amount of memory
+ * used by a pointer. Make sure
+ * that you are really interested
+ * in this, and not the amount of
+ * memory required by the object
+ * pointed to.
+ *
+ * This function is the same as
+ * above, but for non-const
+ * pointers
+ */
+ template <typename T>
+ inline
+ unsigned int
+ memory_consumption (T * const)
+ {
+ return sizeof(T*);
+ };
+
+
+
+ /**
+ * Return the amount of memory
+ * used by a void pointer. Make
+ * sure that you are really
+ * interested in this, and not
+ * the amount of memory required
+ * by the object pointed to.
+ *
+ * Note that we needed this
+ * function since @p{void} is no
+ * type and a @p{void*} is thus
+ * not caught by the general
+ * @p{T*} template function
+ * above.
+ */
+ inline
+ unsigned int
+ memory_consumption (void * const)
+ {
+ return sizeof(void*);
+ };
+
+
+ /**
+ * For all other types which are
+ * not explicitely listed: try if
+ * there is a member function
+ * called
+ * @p{memory_consumption}. If
+ * this is not the case, then the
+ * compiler will in any case
+ * complain that this last exit
+ * does not work.
+ */
+ template <typename T>
+ inline
+ unsigned int
+ memory_consumption (const T &t)
+ {
+ return t.memory_consumption();
+ };
+}
+
+
+
+#endif
+
*/
unsigned int n_default_threads;
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ static unsigned int memory_consumption ();
+
/**
* Exception
*/
* this function.
*/
virtual PatternBase * clone () const = 0;
+
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this object. To
+ * avoid unnecessary
+ * overhead, we do not force
+ * derivd classes to provide
+ * this function as a virtual
+ * overloaded one, but rather
+ * try to cast the present
+ * object to one of the known
+ * derived classes and if
+ * that fails then take the
+ * size of this base class
+ * instead and add 32 byte
+ * (this value is arbitrary,
+ * it should account for
+ * virtual function tables,
+ * and some possible data
+ * elements). Since there are
+ * usually not many thousands
+ * of objects of this type
+ * around, and since the
+ * @p{memory_consumption}
+ * mechanism is used to find
+ * out where memory in the
+ * range of many megabytes
+ * is, this seems like a
+ * reasonable approximation.
+ *
+ * On the other hand, if you
+ * know that your class
+ * deviates from this
+ * assumption significantly,
+ * you can still overload
+ * this function.
+ */
+ virtual unsigned int memory_consumption () const;
};
/**
*/
virtual PatternBase * clone () const;
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this object.
+ */
+ unsigned int memory_consumption () const;
+
private:
/**
* List of valid strings as
*/
virtual PatternBase * clone () const;
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception.
*/
* Return status of this object:
* @p{true}=clean or @p{false}=error occured.
*/
- bool ok() const;
+ bool ok () const;
/**
* clear status bit and contents.
*/
void log_parameters (LogStream& out);
- /**
- * Log parameters in
- * subsection. The subsection is
- * determined by the
- * @p{subsection_path} member *
- * variable.
- */
- void log_parameters_section (LogStream& out);
+ /**
+ * Log parameters in
+ * subsection. The subsection is
+ * determined by the
+ * @p{subsection_path} member *
+ * variable.
+ */
+ void log_parameters_section (LogStream& out);
+
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object.
+ */
+ unsigned int memory_consumption () const;
/**
* Exception
* entry content and regexp, and
* list of subsections.
*/
- struct Section {
+ struct Section
+ {
~Section ();
typedef map<string, pair<string,Patterns::PatternBase*> > EntryType;
EntryType entries;
map<string, Section*> subsections;
+
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object. Since sometimes
+ * the size of objects can
+ * not be determined exactly
+ * (for example: what is the
+ * memory consumption of an
+ * STL @p{map} type with a
+ * certain number of
+ * elements?), this is only
+ * an estimate. however often
+ * quite close to the true
+ * value.
+ */
+ unsigned int memory_consumption () const;
};
/**
- * Path of presently selected subsections;
- * empty list means top level
+ * Path of presently selected
+ * subsections; empty list means
+ * top level
*/
vector<string> subsection_path;
/**
- * List of default values organized as a
- * tree of subsections
+ * List of default values
+ * organized as a tree of
+ * subsections
*/
Section defaults;
/**
- * Analogue list of changed entries. The
- * tree of subsections is there even if there
- * are no changed entry values in a
- * subsection; therefore @p{enter_subsection}
- * has to create the tree in both @p{Defaults}
- * and @p{changed_entries}.
+ * Analogue list of changed
+ * entries. The tree of
+ * subsections is there even if
+ * there are no changed entry
+ * values in a subsection;
+ * therefore @p{enter_subsection}
+ * has to create the tree in both
+ * @p{Defaults} and
+ * @p{changed_entries}.
*/
Section changed_entries;
/**
* Scan one line of input.
- * @p{lineno} is the number of the line presently
- * scanned (for the logs if there are messages).
- * @return @p{false} if line contained stuff
- * that could not be understood, the uppermost
- * subsection was to be left by an @p{END} or
- * @p{end} statement, a value for a non-declared
- * entry was given or teh entry value did not
- * match the regular expression. @p{true}
- * otherwise
+ * @p{lineno} is the number of
+ * the line presently scanned
+ * (for the logs if there are
+ * messages). @return @p{false}
+ * if line contained stuff that
+ * could not be understood, the
+ * uppermost subsection was to be
+ * left by an @p{END} or @p{end}
+ * statement, a value for a
+ * non-declared entry was given
+ * or teh entry value did not
+ * match the regular
+ * expression. @p{true} otherwise
*/
bool scan_line (string line, const unsigned int lineno);
/**
- * Get a pointer to the @p{Section} structure
- * in the @p{Defaults} tree
- * for the subsection we are presently in.
+ * Get a pointer to the
+ * @p{Section} structure in the
+ * @p{Defaults} tree for the
+ * subsection we are presently
+ * in.
*/
Section* get_present_defaults_subsection ();
};
+
/**
* The class @p{MultipleParameterLoop} offers an easy possibility to test several
* parameter sets during one run of the program. For this it uses the
* This is the class the helper class or the
* problem class has to be derived of.
*/
- class UserClass {
+ class UserClass
+ {
public:
/**
* @p{create_new} must provide a clean
*/
void loop (UserClass &uc);
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object.
+ */
+ unsigned int memory_consumption () const;
+
private:
/**
- * Declare what a multiple entry is: a variant
- * entry (in curly braces @p{{}}) or an
- * array (in double curly braces @p{{{}}}).
+ * Declare what a multiple entry
+ * is: a variant * entry (in
+ * curly braces @p{{}}) or an
+ * array (in double curly braces
+ * @p{{{}}}).
*/
- enum MultipleEntryType {
+ enum MultipleEntryType
+ {
variant, array
};
* An object in the list of entries with
* multiple values.
*/
- class Entry {
+ class Entry
+ {
public:
/**
* Constructor
* entry or an array.
*/
MultipleEntryType type;
+
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object.
+ */
+ unsigned int memory_consumption () const;
};
/**
*/
const vector<double> & get_weights () const;
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object.
+ */
+ unsigned int memory_consumption () const;
+
protected:
/**
* List of quadrature points. To be filled
* variable which we are given.
*/
void swap (T *&tt);
+
+ /**
+ * Return an estimate of the
+ * amount of memory (in bytes)
+ * used by this class. Note in
+ * particular, that this only
+ * includes the amount of memory
+ * used by @it{this} object, not
+ * by the object pointed to.
+ */
+ unsigned int memory_consumption () const;
private:
/**
+template <typename T>
+inline
+unsigned int SmartPointer<T>::memory_consumption () const
+{
+ return sizeof(SmartPointer<T>);
+};
+
+
+
+
/**
* Global function to swap the contents of two smart pointers. As both
* objects to which the pointers point retain to be subscribed to, we
*/
void clear ();
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object.
+ */
+ static unsigned int memory_consumption ();
+
// /**
// * Exception
// */
/*--------------------------- Inline functions -----------------------------*/
-// in the following, declarations of operators look rather weird because they are
-// split over several lines. this is necessary, however, because otherwise doc++
-// gets really confused about this all... :-(
+
template <int rank_, int dim>
};
+
+template <int rank_, int dim>
+inline
+unsigned int
+Tensor<rank_,dim>::memory_consumption ()
+{
+ return sizeof(Tensor<rank_,dim>);
+};
+
+
/* ----------------- Non-member functions operating on tensors. ------------ */
*/
void unroll (Vector<double> &result) const;
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this
+ * object.
+ */
+ static unsigned int memory_consumption ();
+
protected:
/**
* Help function for unroll.
+template <int dim>
+inline
+unsigned int
+Tensor<1,dim>::memory_consumption ()
+{
+ return sizeof(Tensor<1,dim>);
+};
+
+
+
/**
* Output operator for tensors of rank 1. Print the elements
* consecutively, with a space in between.
#include <base/data_out_base.h>
#include <base/parameter_handler.h>
+#include <base/memory_consumption.h>
DataOutBase::UcdFlags::UcdFlags (const bool write_preamble) :
};
+unsigned int
+DataOutBase::UcdFlags::memory_consumption () const
+{
+ // only simple data elements, so
+ // use sizeof operator
+ return sizeof (*this);
+};
+
+
void DataOutBase::GnuplotFlags::declare_parameters (ParameterHandler &/*prm*/)
{};
+unsigned int
+DataOutBase::GnuplotFlags::memory_consumption () const
+{
+ // only simple data elements, so
+ // use sizeof operator
+ return sizeof (*this);
+};
+
+
+
+
void DataOutBase::PovrayFlags::declare_parameters (ParameterHandler &prm)
{
prm.declare_entry ("Use smooth triangles", "false",
+unsigned int
+DataOutBase::PovrayFlags::memory_consumption () const
+{
+ // only simple data elements, so
+ // use sizeof operator
+ return sizeof (*this);
+};
+
+
+
DataOutBase::EpsFlags::EpsFlags (const unsigned int height_vector,
const unsigned int color_vector,
const SizeType size_type,
+unsigned int
+DataOutBase::EpsFlags::memory_consumption () const
+{
+ // only simple data elements, so
+ // use sizeof operator
+ return sizeof (*this);
+};
+
+
+
void DataOutBase::GmvFlags::declare_parameters (ParameterHandler &/*prm*/)
{};
void DataOutBase::GmvFlags::parse_parameters (ParameterHandler &/*prm*/)
{};
+
+
+unsigned int
+DataOutBase::GmvFlags::memory_consumption () const
+{
+ // only simple data elements, so
+ // use sizeof operator
+ return sizeof (*this);
+};
+
+
+
+unsigned int DataOutBase::memory_consumption ()
+{
+ return 0;
+};
+
+
#include <base/data_out_base.h>
#include <base/parameter_handler.h>
#include <base/thread_management.h>
+#include <base/memory_consumption.h>
#include <iomanip>
#include <ctime>
+template <int dim, int spacedim>
+unsigned int
+DataOutBase::Patch<dim,spacedim>::memory_consumption () const
+{
+ return (sizeof(vertices) / sizeof(vertices[0]) *
+ MemoryConsumption::memory_consumption(vertices[0])
+ +
+ MemoryConsumption::memory_consumption(n_subdivisions)
+ +
+ MemoryConsumption::memory_consumption(data));
+};
+
+
+
template <int dim, int spacedim>
void DataOutBase::write_ucd (const vector<Patch<dim,spacedim> > &patches,
const vector<string> &data_names,
-
/* --------------------------- class DataOutInterface ---------------------- */
}
+template <int dim, int spacedim>
+unsigned int
+DataOutInterface<dim,spacedim>::memory_consumption () const
+{
+ return (sizeof (default_fmt) +
+ MemoryConsumption::memory_consumption (ucd_flags) +
+ MemoryConsumption::memory_consumption (gnuplot_flags) +
+ MemoryConsumption::memory_consumption (povray_flags) +
+ MemoryConsumption::memory_consumption (eps_flags) +
+ MemoryConsumption::memory_consumption (gmv_flags));
+};
+
+
+
+
// explicit instantiations. functions in DataOutBase are instantiated by
// the respective functions in DataOut_Interface
template class DataOutInterface<data_out_dimension,data_out_dimension>;
this->vector_laplacian (points[i], laplacians[i]);
}
+
+
+template <int dim>
+unsigned int
+Function<dim>::memory_consumption () const
+{
+ // only simple data elements, so
+ // use sizeof operator
+ return sizeof (*this);
+};
+
+
//------------------------------------------------------------//
template <int dim>
};
};
+
+
+template <int dim>
+unsigned int
+ConstantFunction<dim>::memory_consumption () const
+{
+ // only simple data elements, so
+ // use sizeof operator
+ return sizeof (*this);
+};
+
//------------------------------------------------------------//
template <int dim>
}
+
+template <int dim>
+unsigned int
+ComponentSelectFunction<dim>::memory_consumption () const
+{
+ // only simple data elements, so
+ // use sizeof operator
+ return sizeof (*this);
+};
+
+
// explicit instantiations
template class Function<1>;
template <int dim>
FunctionDerivative<dim>::FunctionDerivative (const Function<dim>& f,
const Point<dim>& dir)
- :
- Function<dim> (f.n_components, f.get_time()),
- f(f),
- direction(dir)
+ :
+ Function<dim> (f.n_components, f.get_time()),
+ f(f),
+ direction(dir)
{
set_h();
set_formula();
{
switch (formula)
{
- case Euler:
- return (f.value(p+incr, component)-f.value(p-incr, component))/(2*h);
- case UpwindEuler:
- return (f.value(p, component)-f.value(p-incr, component))/h;
- case FourthOrder:
- return (-f.value(p+2*incr, component) + 8*f.value(p+incr, component)
- -8*f.value(p-incr, component) + f.value(p-2*incr, component))/(12*h);
- default:
- Assert(false, ExcInvalidFormula());
+ case Euler:
+ return (f.value(p+incr, component)-f.value(p-incr, component))/(2*h);
+ case UpwindEuler:
+ return (f.value(p, component)-f.value(p-incr, component))/h;
+ case FourthOrder:
+ return (-f.value(p+2*incr, component) + 8*f.value(p+incr, component)
+ -8*f.value(p-incr, component) + f.value(p-2*incr, component))/(12*h);
+ default:
+ Assert(false, ExcInvalidFormula());
}
return 0.;
}
}
+
+template <int dim>
+unsigned int
+FunctionDerivative<dim>::memory_consumption () const
+{
+ // only simple data elements, so
+ // use sizeof operator
+ return sizeof (*this);
+};
+
+
template FunctionDerivative<1>;
template FunctionDerivative<2>;
template FunctionDerivative<3>;
}
+
+template <int dim>
+unsigned int
+JumpFunction<dim>::memory_consumption () const
+{
+ // only simple data elements, so
+ // use sizeof operator
+ return sizeof (*this);
+};
+
+
template SquareFunction<1>;
template SquareFunction<2>;
template SquareFunction<3>;
#include <base/logstream.h>
#include <base/job_identifier.h>
+#include <base/memory_consumption.h>
#include <sys/resource.h>
#include <iomanip>
}
+
+unsigned int
+LogStream::memory_consumption () const
+{
+ unsigned int mem = sizeof(*this);
+ // to determine size of stack
+ // elements, we have to copy the
+ // stack since we can't access
+ // elements from further below
+ stack<string> tmp;
+ while (tmp.size() > 0)
+ {
+ mem += MemoryConsumption::memory_consumption (tmp.top());
+ tmp.pop ();
+ };
+
+ return mem;
+};
--- /dev/null
+//---------------------------- function.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 1998, 1999, 2000 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- function.cc ---------------------------
+
+
+#include <base/memory_consumption.h>
+
+
+namespace MemoryConsumption
+{
+ unsigned int memory_consumption (const string &s)
+ {
+ return sizeof(s) + s.length();
+ };
+
+
+
+ unsigned int memory_consumption (const vector<string> &v)
+ {
+ unsigned int mem = sizeof(v);
+ for (unsigned int i=0; i<v.size(); ++i)
+ mem += memory_consumption(v[i]);
+ return mem;
+ };
+
+
+};
+unsigned int
+MultithreadInfo::memory_consumption ()
+{
+ // only simple data elements, so
+ // use sizeof operator
+ return sizeof (MultithreadInfo);
+};
+
+
// definition of the variable which is declared `extern' in the .h file
MultithreadInfo multithread_info;
#include <base/parameter_handler.h>
#include <base/logstream.h>
+#include <base/memory_consumption.h>
#include <fstream>
#include <iomanip>
#include <strstream>
{};
+ unsigned int
+ PatternBase::memory_consumption () const
+ {
+ if (dynamic_cast<const Integer*>(this) != 0)
+ return sizeof(Integer);
+ else if (dynamic_cast<const Double*>(this) != 0)
+ return sizeof(Double);
+ else if (dynamic_cast<const Bool*>(this) != 0)
+ return sizeof(Bool);
+ else if (dynamic_cast<const Anything*>(this) != 0)
+ return sizeof(Anything);
+ else
+ return sizeof(*this) + 32;
+ };
+
+
+
Integer::Integer (const int lower_bound,
const int upper_bound) :
};
+ unsigned int
+ Selection::memory_consumption () const
+ {
+ return (sizeof(PatternBase) +
+ MemoryConsumption::memory_consumption(sequence));
+ };
+
MultipleSelection::MultipleSelection (const string &seq)
{
};
+ unsigned int
+ MultipleSelection::memory_consumption () const
+ {
+ return (sizeof(PatternBase) +
+ MemoryConsumption::memory_consumption(sequence));
+ };
+
+
Bool::Bool () :
Selection ("true|false")
-void ParameterHandler::log_parameters_section (LogStream &out)
+void ParameterHandler::log_parameters_section (LogStream &out)
{
Section *pd = get_present_defaults_subsection ();
Section *pc = get_present_changed_subsection ();
};
-ParameterHandler::Section::~Section () {
+
+unsigned int
+ParameterHandler::memory_consumption () const
+{
+ return (MemoryConsumption::memory_consumption (status) +
+ MemoryConsumption::memory_consumption (subsection_path) +
+ MemoryConsumption::memory_consumption (defaults) +
+ MemoryConsumption::memory_consumption (changed_entries));
+};
+
+
+
+ParameterHandler::Section::~Section ()
+{
entries.clear ();
map<string, Section*>::iterator p;
for (p=subsections.begin(); p!=subsections.end(); ++p)
delete p->second;
+ subsections.clear ();
+};
+
+
-subsections.clear ();
+unsigned int
+ParameterHandler::Section::memory_consumption () const
+{
+ unsigned int mem = 0;
+ for (EntryType::const_iterator i=entries.begin(); i!=entries.end(); ++i)
+ mem += (MemoryConsumption::memory_consumption (i->first) +
+ MemoryConsumption::memory_consumption (i->second.first) +
+ MemoryConsumption::memory_consumption (*i->second.second));
+ for (map<string, Section*>::const_iterator i=subsections.begin(); i!=subsections.end(); ++i)
+ mem += (MemoryConsumption::memory_consumption (i->first) +
+ MemoryConsumption::memory_consumption (*(i->second)));
+ return mem;
};
+
MultipleParameterLoop::MultipleParameterLoop() :
n_branches(0)
{};
+
+unsigned int
+MultipleParameterLoop::memory_consumption () const
+{
+ unsigned int mem = ParameterHandler::memory_consumption ();
+ for (unsigned int i=0; i<multiple_choices.size(); ++i)
+ mem += multiple_choices[i].memory_consumption ();
+
+ return mem;
+};
+
+
+
MultipleParameterLoop::Entry::Entry (const vector<string> &ssp,
const string& Name,
const string& Value) :
};
+unsigned int
+MultipleParameterLoop::Entry::memory_consumption () const
+{
+ return (MemoryConsumption::memory_consumption (subsection_path) +
+ MemoryConsumption::memory_consumption (entry_name) +
+ MemoryConsumption::memory_consumption (entry_value) +
+ MemoryConsumption::memory_consumption (different_values) +
+ sizeof (type));
+};
+
#include <grid/geometry_info.h>
#include <base/quadrature.h>
+#include <base/memory_consumption.h>
#include <cmath>
+template <int dim>
+unsigned int
+Quadrature<dim>::memory_consumption () const
+{
+ return (MemoryConsumption::memory_consumption (quadrature_points) +
+ MemoryConsumption::memory_consumption (weights));
+};
+
+
+
template <>
void QProjector<2>::project_to_face (const Quadrature<1> &quadrature,
const unsigned int face_no,
*/
void print (ostream &) const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception
*/
const Triangulation<dim> & get_tria () const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ *
+ * This function is made virtual,
+ * since a dof handler object
+ * might be accessed through a
+ * pointers to thisr base class,
+ * although the actual object
+ * might be a derived class.
+ */
+ virtual unsigned int memory_consumption () const;
+
/**
* Exception
*/
* detailed information.
*/
vector<unsigned int> line_dofs;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
};
* detailed information.
*/
vector<unsigned int> quad_dofs;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
};
* detailed information.
*/
vector<unsigned int> hex_dofs;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
};
*/
bool restriction_is_additive (const unsigned int component) const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ *
+ * This function is made virtual,
+ * since finite element objects
+ * are usually accessed through
+ * pointers to their base class,
+ * rather than the class itself.
+ */
+ virtual unsigned int memory_consumption () const;
+
/**
* Exception
*/
* @author Wolfgang Bangerth, 1998
*/
template <int dim>
-class FECrissCross : public FiniteElement<dim> {
+class FECrissCross : public FiniteElement<dim>
+{
public:
/**
* Constructor
};
+
/**
* Quadrature formula for the criss-cross element. This quadrature
* formula uses one point at the barycenter of each of the four subtriangles.
* formula is not implemented for one space dimension.
*/
template <int dim>
-class QCrissCross1 : public Quadrature<dim> {
+class QCrissCross1 : public Quadrature<dim>
+{
public:
QCrissCross1 ();
*/
virtual const FiniteElement<dim>& base_element(unsigned int index) const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ *
+ * This function is made virtual,
+ * since finite element objects
+ * are usually accessed through
+ * pointers to their base class,
+ * rather than the class itself.
+ */
+ virtual unsigned int memory_consumption () const;
+
private:
/**
* created by the constructor and
* constant afterwards.
*/
- vector< ElementPair > base_elements;
+ vector<ElementPair> base_elements;
/**
*/
const DoFHandler<dim>::cell_iterator & get_cell() const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception
*/
};
+
/**
* Represent a finite element evaluated with a specific quadrature rule on
* a cell.
*/
void reinit (const typename DoFHandler<dim>::cell_iterator &);
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
private:
/**
* Store the gradients of the shape
*/
DoFHandler<dim>::face_iterator get_face() const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
protected:
/**
};
+
/**
* Represent a finite element evaluated with a specific quadrature rule on
* the face of a cell.
*/
static string get_output_format_names ();
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
/**
* Exception
* destination grid.
*/
const GridClass<dim> & get_destination_grid () const;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
/**
* Exception
*/
virtual void read_flags(istream &in);
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ virtual unsigned int memory_consumption () const;
+
/**
* Exception.
*/
* by default.
*/
TriaNumberCache ();
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
};
* by default.
*/
TriaNumberCache ();
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
};
* by default.
*/
TriaNumberCache ();
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
};
unsigned int max_adjacent_cells () const;
/*@}*/
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ *
+ * This function is made virtual,
+ * since a triangulation object
+ * might be accessed through a
+ * pointer to this base class,
+ * even if the actual object is a
+ * derived class.
+ */
+ virtual unsigned int memory_consumption () const;
+
/**
* @name Exceptions
vector<bool> &v,
const unsigned int magic_number2,
istream &in);
-
+
private:
/**
* Refine all cells on all levels which
vector<bool> vertices_used;
/**
- * Collection of boundary objects.
+ * Collection of boundary
+ * objects. We only need 255
+ * objects rather than 256,
+ * since the indicator 255 is
+ * reserved for interior faces
+ * and can thus never be
+ * associated with a boundary.
*/
const Boundary<dim>* boundary[255];
*/
void set_quad (const int i, const int index);
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ static unsigned int memory_consumption ();
+
/**
* Exception
*/
};
+
+inline
+unsigned int
+Hexahedron::memory_consumption ()
+{
+ return sizeof(Hexahedron);
+};
+
#endif
void print (ostream &out) const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
+
/**@name Exceptions*/
/*@{*/
/**
* @em{used} lines, quads, cells, etc.
*/
template <int dim, typename Accessor>
-class TriaIterator : public TriaRawIterator<dim,Accessor> {
+class TriaIterator : public TriaRawIterator<dim,Accessor>
+{
public:
/**
* Empty constructor. Such an object
* refined and thus a cell on which calculations on the finest level are done.
*/
template <int dim, typename Accessor>
-class TriaActiveIterator : public TriaIterator<dim,Accessor> {
+class TriaActiveIterator : public TriaIterator<dim,Accessor>
+{
public:
/**
* Empty constructor. Such an object
+template <int dim, typename Accessor>
+inline
+unsigned int
+TriaRawIterator<dim,Accessor>::memory_consumption () const
+{
+ return sizeof(TriaRawIterator<dim,Accessor>);
+};
+
+
+
template <int dim, typename Accessor>
template <typename OtherAccessor>
inline
*/
void monitor_memory (const unsigned int true_dimension) const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception
*/
* @ref{TriangulationLevel} classes.
*/
void monitor_memory (const unsigned int true_dimension) const;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
};
*/
vector<Quad> quads;
/**
- * Same as for the @ref{TriangulationLevel<1>::LinesData}@p{::chilren}
- * array, but since there are four
- * children, the index points to the
- * first while the other three are
- * following immediately afterwards.
+ * Same as for the
+ * @ref{TriangulationLevel<1>::LinesData}@p{::chilren}
+ * array, but since there
+ * are four children, the
+ * index points to the first
+ * while the other three are
+ * following immediately
+ * afterwards.
*/
vector<int> children;
/**
- * Same as for @ref{TriangulationLevel<1>::LinesData}@p{::used}.
+ * Same as for
+ * @ref{TriangulationLevel<1>::LinesData}@p{::used}.
*/
vector<bool> used;
/**
- * Same as for @ref{TriangulationLevel<1>::LinesData}@p{::used}.
+ * Same as for
+ * @ref{TriangulationLevel<1>::LinesData}@p{::used}.
*/
vector<bool> user_flags;
* @ref{TriangulationLevel} classes.
*/
void monitor_memory (const unsigned int true_dimension) const;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
};
* level.
*
* It is fully analogous to the
- * @ref{TriangulationLevel<1>::LinesData} structure inherited from
+ * @ref{TriangulationLevel<1>::LinesData}
+ * structure inherited from
* @ref{Triangulation<1>}.
*/
struct HexesData
*/
vector<Hexahedron> hexes;
/**
- * Same as for the @ref{TriangulationLevel<1>::LinesData}@p{::chilren}
- * array, but since there are four
- * children, the index points to the
- * first while the other three are
- * following immediately afterwards.
+ * Same as for the
+ * @ref{TriangulationLevel<1>::LinesData}@p{::chilren}
+ * array, but since there
+ * are four children, the
+ * index points to the first
+ * while the other three are
+ * following immediately
+ * afterwards.
*/
vector<int> children;
/**
- * Same as for @ref{TriangulationLevel<1>::LinesData}@p{::used}.
+ * Same as for
+ * @ref{TriangulationLevel<1>::LinesData}@p{::used}.
*/
vector<bool> used;
/**
- * Same as for @ref{TriangulationLevel<1>::LinesData}@p{::used}.
+ * Same as for
+ * @ref{TriangulationLevel<1>::LinesData}@p{::used}.
*/
vector<bool> user_flags;
* @ref{TriangulationLevel} classes.
*/
void monitor_memory (const unsigned int true_dimension) const;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
};
*/
void set_vertex (const int i, const int index);
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ static unsigned int memory_consumption ();
+
/**
* Exception
*/
/*----------------------------- Inline Function: Line ------------------------*/
-inline // wahrlich inline hier!
+inline // truly in-line here!
Line::Line (const int i0, const int i1)
{
end_points[0] = i0;
};
+
+inline
+unsigned int
+Line::memory_consumption ()
+{
+ return sizeof(Line);
+};
+
+
#endif
*/
void set_line (const int i, const int index);
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ static unsigned int memory_consumption ();
+
/**
* Exception
*/
};
+
+inline
+unsigned int
+Quad::memory_consumption ()
+{
+ return sizeof(Quad);
+};
+
#endif
//---------------------------- dof_handler.cc ---------------------------
+#include <base/memory_consumption.h>
#include <dofs/dof_handler.h>
#include <dofs/dof_levels.h>
#include <dofs/dof_accessor.h>
+template <int dim>
+unsigned int
+DoFHandler<dim>::memory_consumption () const
+{
+ unsigned int mem = (MemoryConsumption::memory_consumption (tria) +
+ MemoryConsumption::memory_consumption (selected_fe) +
+ MemoryConsumption::memory_consumption (tria) +
+ MemoryConsumption::memory_consumption (levels) +
+ MemoryConsumption::memory_consumption (used_dofs) +
+ MemoryConsumption::memory_consumption (vertex_dofs));
+ for (unsigned int i=0; i<levels.size(); ++i)
+ mem += MemoryConsumption::memory_consumption (*levels[i]);
+
+ return mem;
+};
+
+
+
template <int dim>
void DoFHandler<dim>::distribute_dofs (const FiniteElement<dim> &ff,
const unsigned int offset)
--- /dev/null
+//---------------------------- dof_levels.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 1998, 1999, 2000 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- dof_levels.cc ---------------------------
+
+
+#include <base/memory_consumption.h>
+#include <dofs/dof_levels.h>
+
+
+unsigned int
+DoFLevel<1>::memory_consumption () const
+{
+ return MemoryConsumption::memory_consumption (line_dofs);
+};
+
+
+
+unsigned int
+DoFLevel<2>::memory_consumption () const
+{
+ return (DoFLevel<1>::memory_consumption () +
+ MemoryConsumption::memory_consumption (quad_dofs));
+};
+
+
+
+unsigned int
+DoFLevel<3>::memory_consumption () const
+{
+ return (DoFLevel<2>::memory_consumption () +
+ MemoryConsumption::memory_consumption (hex_dofs));
+};
#include <fe/fe.h>
+#include <base/memory_consumption.h>
#include <base/quadrature.h>
#include <grid/tria.h>
#include <grid/tria_iterator.h>
};
+
+template <int dim>
+unsigned int
+FiniteElementBase<dim>::memory_consumption () const
+{
+ return (sizeof(FiniteElementData<dim>) +
+ MemoryConsumption::
+ memory_consumption<FullMatrix<double>, sizeof(restriction)/sizeof(restriction[0])>
+ (restriction)+
+ MemoryConsumption::memory_consumption
+ <FullMatrix<double>, sizeof(prolongation)/sizeof(prolongation[0])>
+ (prolongation) +
+ MemoryConsumption::memory_consumption (interface_constraints) +
+ MemoryConsumption::memory_consumption (system_to_component_table) +
+ MemoryConsumption::memory_consumption (face_system_to_component_table) +
+ MemoryConsumption::memory_consumption (component_to_system_table) +
+ MemoryConsumption::memory_consumption (face_component_to_system_table) +
+ MemoryConsumption::memory_consumption (component_to_base_table) +
+ MemoryConsumption::memory_consumption (restriction_is_additive_flags));
+};
+
+
/*------------------------------- FiniteElement ----------------------*/
//---------------------------- fe_system.cc ---------------------------
+#include <base/memory_consumption.h>
#include <fe/fe_system.h>
#include <grid/tria_iterator.h>
#include <dofs/dof_accessor.h>
}
+
+template <int dim>
+unsigned int
+FESystem<dim>::memory_consumption () const
+{
+ // neglect size of data stored in
+ // @p{base_elements} due to some
+ // problems with teh
+ // compiler. should be neglectable
+ // after all, considering the size
+ // of the data of the subelements
+ unsigned int mem = (FiniteElement<dim>::memory_consumption () +
+ sizeof (base_elements));
+ for (unsigned int i=0; i<base_elements.size(); ++i)
+ mem += MemoryConsumption::memory_consumption (*base_elements[i].first);
+ return mem;
+};
+
+
+
// explicit instantiations
template class FESystem<deal_II_dimension>;
#include <fe/fe.h>
#include <fe/fe_values.h>
+#include <base/memory_consumption.h>
#include <base/quadrature.h>
#include <grid/tria_iterator.h>
#include <grid/tria_accessor.h>
};
+
+template <int dim>
+unsigned int
+FEValuesBase<dim>::memory_consumption () const
+{
+ return (MemoryConsumption::memory_consumption (shape_values) +
+ MemoryConsumption::memory_consumption (shape_gradients) +
+ MemoryConsumption::memory_consumption (shape_2nd_derivatives) +
+ MemoryConsumption::memory_consumption (weights) +
+ MemoryConsumption::memory_consumption (JxW_values) +
+ MemoryConsumption::memory_consumption (quadrature_points) +
+ MemoryConsumption::memory_consumption (support_points) +
+ MemoryConsumption::memory_consumption (jacobi_matrices) +
+ MemoryConsumption::memory_consumption (jacobi_matrices_grad) +
+ MemoryConsumption::memory_consumption (shape_values_transform) +
+ MemoryConsumption::memory_consumption (selected_dataset) +
+ MemoryConsumption::memory_consumption (jacobi_matrices) +
+ sizeof(update_flags) +
+ MemoryConsumption::memory_consumption (present_cell) +
+ MemoryConsumption::memory_consumption (fe));
+};
+
+
/*------------------------------- FEValues -------------------------------*/
template <int dim>
};
+
+template <int dim>
+unsigned int
+FEValues<dim>::memory_consumption () const
+{
+ return (FEValuesBase<dim>::memory_consumption () +
+ MemoryConsumption::memory_consumption (unit_shape_gradients) +
+ MemoryConsumption::memory_consumption (unit_shape_2nd_derivatives) +
+ MemoryConsumption::memory_consumption (unit_shape_gradients_transform) +
+ MemoryConsumption::memory_consumption (unit_quadrature_points));
+};
+
+
/*------------------------------- FEFaceValuesBase --------------------------*/
};
+
+
+template <int dim>
+unsigned int
+FEFaceValuesBase<dim>::memory_consumption () const
+{
+ return (FEValuesBase<dim>::memory_consumption () +
+ MemoryConsumption::memory_consumption (unit_shape_gradients) +
+ MemoryConsumption::memory_consumption (unit_shape_2nd_derivatives) +
+ MemoryConsumption::memory_consumption (unit_shape_gradients_transform) +
+ MemoryConsumption::memory_consumption (unit_face_quadrature_points) +
+ MemoryConsumption::memory_consumption (unit_quadrature_points) +
+ MemoryConsumption::memory_consumption (face_jacobi_determinants) +
+ MemoryConsumption::memory_consumption (normal_vectors) +
+ MemoryConsumption::memory_consumption (present_face));
+};
+
+
/*------------------------------- FEFaceValues -------------------------------*/
};
-string GridOut::get_output_format_names () {
+string GridOut::get_output_format_names ()
+{
return "gnuplot|eps";
};
+unsigned int
+GridOut::memory_consumption () const
+{
+ return (sizeof(ucd_flags) +
+ sizeof(gnuplot_flags) +
+ sizeof(eps_flags_1) +
+ sizeof(eps_flags_2) +
+ sizeof(eps_flags_3));
+};
//---------------------------- intergrid_map.cc ---------------------------
+#include <base/memory_consumption.h>
#include <grid/tria.h>
#include <dofs/dof_handler.h>
#include <grid/tria_accessor.h>
return *destination_grid;
};
-
+
+
+template <template <int> class GridClass, int dim>
+unsigned int
+InterGridMap<GridClass,dim>::memory_consumption () const
+{
+ return (MemoryConsumption::memory_consumption (mapping) +
+ MemoryConsumption::memory_consumption (source_grid) +
+ MemoryConsumption::memory_consumption (destination_grid));
+};
+
// explicit instantiations
//---------------------------- persistent_tria.cc ---------------------------
+#include <base/memory_consumption.h>
#include <grid/persistent_tria.h>
#include <grid/magic_numbers.h>
#include <iostream>
}
+
+template <int dim>
+unsigned int
+PersistentTriangulation<dim>::memory_consumption () const
+{
+ return (Triangulation<dim>::memory_consumption () +
+ MemoryConsumption::memory_consumption (coarse_grid) +
+ MemoryConsumption::memory_consumption (refine_flags) +
+ MemoryConsumption::memory_consumption (coarsen_flags));
+};
+
+
// explicit instantiations
template class PersistentTriangulation<deal_II_dimension>;
//---------------------------- tria.all_dimensions.cc ---------------------------
+#include <base/memory_consumption.h>
#include <grid/tria.h>
#include <grid/tria_levels.h>
#include <grid/tria_boundary.h>
+unsigned int
+TriangulationLevel<0>::memory_consumption () const
+{
+ return (MemoryConsumption::memory_consumption (refine_flags) +
+ MemoryConsumption::memory_consumption (coarsen_flags) +
+ MemoryConsumption::memory_consumption (neighbors));
+};
+
+
+
void TriangulationLevel<1>::reserve_space (const unsigned int new_lines)
{
const unsigned int new_size = new_lines +
+unsigned int
+TriangulationLevel<1>::memory_consumption () const
+{
+ return (TriangulationLevel<0>::memory_consumption() +
+ MemoryConsumption::memory_consumption (lines.lines) +
+ MemoryConsumption::memory_consumption (lines.children) +
+ MemoryConsumption::memory_consumption (lines.used) +
+ MemoryConsumption::memory_consumption (lines.user_flags) +
+ MemoryConsumption::memory_consumption (lines.material_id) +
+ MemoryConsumption::memory_consumption (lines.user_pointers));
+};
+
+
void TriangulationLevel<2>::reserve_space (const unsigned int new_quads)
{
const unsigned int new_size = new_quads +
+unsigned int
+TriangulationLevel<2>::memory_consumption () const
+{
+ return (TriangulationLevel<1>::memory_consumption() +
+ MemoryConsumption::memory_consumption (quads.quads) +
+ MemoryConsumption::memory_consumption (quads.children) +
+ MemoryConsumption::memory_consumption (quads.used) +
+ MemoryConsumption::memory_consumption (quads.user_flags) +
+ MemoryConsumption::memory_consumption (quads.material_id) +
+ MemoryConsumption::memory_consumption (quads.user_pointers));
+};
+
+
+
void TriangulationLevel<3>::reserve_space (const unsigned int new_hexes)
{
const unsigned int new_size = new_hexes +
+unsigned int
+TriangulationLevel<3>::memory_consumption () const
+{
+ return (TriangulationLevel<2>::memory_consumption() +
+ MemoryConsumption::memory_consumption (hexes.hexes) +
+ MemoryConsumption::memory_consumption (hexes.children) +
+ MemoryConsumption::memory_consumption (hexes.used) +
+ MemoryConsumption::memory_consumption (hexes.user_flags) +
+ MemoryConsumption::memory_consumption (hexes.material_id) +
+ MemoryConsumption::memory_consumption (hexes.user_pointers));
+};
+
+
+
TriaNumberCache<1>::TriaNumberCache () :
n_lines (0),
n_active_lines (0)
+unsigned int
+TriaNumberCache<1>::memory_consumption () const
+{
+ return (MemoryConsumption::memory_consumption (n_lines) +
+ MemoryConsumption::memory_consumption (n_lines_level) +
+ MemoryConsumption::memory_consumption (n_active_lines) +
+ MemoryConsumption::memory_consumption (n_active_lines_level));
+};
+
+
TriaNumberCache<2>::TriaNumberCache () :
n_quads (0),
n_active_quads (0)
+unsigned int
+TriaNumberCache<2>::memory_consumption () const
+{
+ return (TriaNumberCache<1>::memory_consumption () +
+ MemoryConsumption::memory_consumption (n_quads) +
+ MemoryConsumption::memory_consumption (n_quads_level) +
+ MemoryConsumption::memory_consumption (n_active_quads) +
+ MemoryConsumption::memory_consumption (n_active_quads_level));
+};
+
+
+
TriaNumberCache<3>::TriaNumberCache () :
n_hexes (0),
n_active_hexes (0)
// all other fields are
// default constructed
{};
+
+
+
+unsigned int
+TriaNumberCache<3>::memory_consumption () const
+{
+ return (TriaNumberCache<2>::memory_consumption () +
+ MemoryConsumption::memory_consumption (n_hexes) +
+ MemoryConsumption::memory_consumption (n_hexes_level) +
+ MemoryConsumption::memory_consumption (n_active_hexes) +
+ MemoryConsumption::memory_consumption (n_active_hexes_level));
+};
//---------------------------- tria.cc ---------------------------
+#include <base/memory_consumption.h>
#include <grid/tria.h>
#include <grid/tria_levels.h>
#include <grid/tria_boundary.h>
};
+
+template <int dim>
+unsigned int
+Triangulation<dim>::memory_consumption () const
+{
+ unsigned int mem = 0;
+ mem += MemoryConsumption::memory_consumption(levels);
+ for (unsigned int i=0; i<levels.size(); ++i)
+ mem += MemoryConsumption::memory_consumption (*levels[i]);
+ mem += MemoryConsumption::memory_consumption (vertices);
+ mem += MemoryConsumption::memory_consumption (vertices_used);
+ mem += sizeof(boundary);
+ mem += sizeof(smooth_grid);
+ mem += MemoryConsumption::memory_consumption (number_cache);
+
+ return mem;
+};
+
+
+
+
template <int dim>
void Triangulation<dim>::update_number_cache_lines ()
{
* objects.
*/
void swap (BlockIndices &b);
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
private:
/**
+inline
+unsigned int
+BlockIndices::memory_consumption () const
+{
+ return (sizeof(*this) +
+ start_indices.size() * sizeof(start_indices[0]));
+};
+
+
+
/* ----------------- global functions ---------------------------- */
const BlockSparsityPattern &
get_sparsity_pattern () const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception
*/
#define __deal2__block_sparse_matrix_templates_h
+#include <base/memory_consumption.h>
#include <lac/block_sparse_matrix.h>
+template <typename number, int rows, int columns>
+unsigned int
+BlockSparseMatrix<number,rows,columns>::memory_consumption () const
+{
+ unsigned int mem = sizeof(*this);
+ for (unsigned int r=0; r<rows; ++r)
+ for (unsigned int c=0; c<columns; ++c)
+ mem += MemoryConsumption::memory_consumption(sub_objects[r][c]);
+ return mem;
+};
+
+
+
#endif // ifdef block_sparse_matrix_templates_h
*/
bool is_compressed () const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception
*/
* file, but not more.
*/
void block_read (istream &in);
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
//@}
protected:
#define __deal2__block_vector_templates_h
+#include <base/memory_consumption.h>
#include <lac/block_vector.h>
#include <cmath>
#include <algorithm>
}
+
template <typename Number>
void BlockVector<Number>::block_write (ostream &out) const
{
}
+
template <typename Number>
void BlockVector<Number>::block_read (istream &in)
{
}
}
+
+template <typename Number>
+unsigned int
+BlockVector<Number>::memory_consumption () const
+{
+ unsigned int mem = sizeof(num_blocks);
+ for (unsigned int i=0; i<components.size(); ++i)
+ mem += MemoryConsumption::memory_consumption (components[i]);
+ mem += MemoryConsumption::memory_consumption (block_indices);
+ return mem;
+};
+
+
+
+
+
#endif
*/
void print_formatted (ostream &out,
const unsigned int presicion=3) const;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
/**
* Exception
return sqrt(sum);
}
+
+
+template <typename number>
+unsigned int
+FullMatrix<number>::memory_consumption () const
+{
+ return sizeof(*this) + val_size*sizeof(number);
+};
+
+
#endif
*/
unsigned int block_size () const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Determine, whether inverses
* have been computed.
#include <base/exceptions.h>
#include <base/logstream.h>
+#include <base/memory_consumption.h>
#include <lac/precondition_block.h>
#include <lac/vector.h>
#include <lac/full_matrix.h>
}
+
+template <typename number, typename inverse_type>
+unsigned int
+PreconditionBlock<number,inverse_type>::memory_consumption () const
+{
+ unsigned int mem = sizeof(*this);
+ for (unsigned int i=0; i<var_inverse.size(); ++i)
+ mem += MemoryConsumption::memory_consumption(var_inverse[i]);
+ for (unsigned int i=0; i<var_diagonal.size(); ++i)
+ mem += MemoryConsumption::memory_consumption(var_diagonal[i]);
+ return mem;
+};
+
+
+
+
/*--------------------- PreconditionBlockJacobi -----------------------*/
void vmult (Vector<somenumber> &dst,
const Vector<somenumber> &src) const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception
*/
};
+
+template <typename number>
+unsigned int
+SparseILU<number>::memory_consumption () const
+{
+ return SparseMatrix<number>::memory_consumption ();
+};
+
+
+
/*---------------------------- sparse_ilu.templates.h ---------------------------*/
#endif
const unsigned int width = 0,
const char *zero_string = " ",
const double denominator = 1.) const;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
/**
* Exception
// out.setf (0, ios::floatfield); // reset output format
};
+
+
+template <typename number>
+unsigned int
+SparseMatrix<number>::memory_consumption () const
+{
+ return sizeof(*this) + max_len*sizeof(number);
+};
+
+
#endif
void apply_preconditioner (Vector<number2> &dst,
const Vector<number2> &src,
const vector<bool> *dof_mask = 0) const;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
private:
/**
void vmult (Vector<number2> &dst,
const Vector<number2> &src) const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
private:
/**
* Store the number of blocks.
#define __deal2__sparse_vanka_templates_h
+#include <base/memory_consumption.h>
#include <lac/sparse_vanka.h>
#include <lac/full_matrix.h>
#include <lac/sparse_matrix.h>
};
+
+template <typename number>
+unsigned int
+SparseVanka<number>::memory_consumption () const
+{
+ unsigned int mem = (sizeof(*this) +
+ MemoryConsumption::memory_consumption (selected));
+ for (unsigned int i=0; i<inverses.size(); ++i)
+ mem += MemoryConsumption::memory_consumption (*inverses[i]);
+
+ return mem;
+};
+
+
+
+
template <typename number>
SparseBlockVanka<number>::SparseBlockVanka (const SparseMatrix<number> &M,
const vector<bool> &selected,
}
}
+
+
+template <typename number>
+unsigned int
+SparseBlockVanka<number>::memory_consumption () const
+{
+ unsigned int mem = SparseVanka<number>::memory_consumption();
+ for (unsigned int i=0; i<dof_masks.size(); ++i)
+ mem += MemoryConsumption::memory_consumption (dof_masks[i]);
+ return mem;
+};
+
+
+
#endif
*/
const unsigned int * get_column_numbers () const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
/**
* Exception
*/
const string & get_filename () const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception.
*/
#define __deal2__swappable_vector_templates_h
+#include <base/memory_consumption.h>
#include <lac/swappable_vector.h>
#include <fstream>
#include <iostream>
+template <typename number>
+unsigned int
+SwappableVector<number>::memory_consumption () const
+{
+ return (MemoryConsumption::memory_consumption (filename) +
+ sizeof(lock) +
+ MemoryConsumption::memory_consumption (data_is_preloaded) +
+ Vector<number>::memory_consumption ());
+};
+
+
+
#endif // __deal2__swappable_vector_templates_h
* file, but not more.
*/
void block_read (istream &in);
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
//@}
/**
AssertThrow (in, ExcIO());
}
+
+
+template <typename Number>
+unsigned int
+Vector<Number>::memory_consumption () const
+{
+ return sizeof(*this) + (maxdim * sizeof(Number));
+};
+
+
#endif
//
//---------------------------- block_block_sparsity_pattern.cc ---------------------------
+#include <base/memory_consumption.h>
#include <lac/block_sparsity_pattern.h>
return true;
};
+
+unsigned int
+BlockSparsityPattern::memory_consumption () const
+{
+ unsigned int mem = 0;
+ mem += (MemoryConsumption::memory_consumption (rows) +
+ MemoryConsumption::memory_consumption (columns) +
+ MemoryConsumption::memory_consumption (sub_objects) +
+ MemoryConsumption::memory_consumption (row_indices) +
+ MemoryConsumption::memory_consumption (column_indices));
+ for (unsigned int r=0; r<rows; ++r)
+ for (unsigned int c=0; c<columns; ++c)
+ mem += MemoryConsumption::memory_consumption (*sub_objects[r][c]);
+
+ return mem;
+};
return b;
};
+
+
+unsigned int
+SparsityPattern::memory_consumption () const
+{
+ return (sizeof(*this) +
+ max_dim * sizeof(unsigned int) +
+ max_vec_len * sizeof(unsigned int));
+};