*/
void clear();
- //////
+ /**
+ * @brief Coarsest level for multigrid.
+ */
unsigned int get_minlevel () const;
+
+ /**
+ * Ignored
+ */
unsigned int get_maxlevel () const;
+ /**
+ * Memory used by this object.
+ */
+ unsigned int memory_consumption () const;
private:
/**
}
+template<class Object>
+unsigned int
+MGLevelObject<Object>::memory_consumption () const
+{
+ unsigned int result = sizeof(*this);
+ typedef typename std::vector<boost::shared_ptr<Object> >::const_iterator Iter;
+ const Iter end = objects.end();
+ for (Iter o=objects.begin(); o!=end; ++o)
+ result += o->memory_consumption();
+
+ return result;
+}
+
+
/*----------------------- mg_level_object.h -----------------------*/
#endif
* a certain level.
*/
virtual void Tvmult_add(unsigned int level, VECTOR& dst,
- const VECTOR& src) const;
+ const VECTOR& src) const;
+
+ /**
+ * Memory used by this object.
+ */
+ unsigned int memory_consumption () const;
+
private:
/**
}
+template <class MATRIX, class VECTOR>
+unsigned int
+MGMatrix<MATRIX, VECTOR>::memory_consumption () const
+{
+ return sizeof(*this) + matrix->memory_consumption();
+}
+
/*----------------------------------------------------------------------*/
template <class MATRIX, typename number>
* methods.
*/
MGLevelObject<RELAX> smoothers;
+
+ /**
+ * Memory used by this object.
+ */
+ unsigned int memory_consumption () const;
+
private:
/**
* Pointer to the matrices.
mem.free(d);
}
+
+//TODO:[GK] Add other values
+template <class MATRIX, class RELAX, class VECTOR>
+inline unsigned int
+MGSmootherRelaxation<MATRIX, RELAX, VECTOR>::
+memory_consumption () const
+{
+ return sizeof(*this)
+ + matrices.memory_consumption()
+ + smoothers.memory_consumption();
+}
+
+
+
#endif
*/
DeclException0(ExcMatricesNotBuilt);
+ /**
+ * Memory used by this object.
+ */
+ unsigned int memory_consumption () const;
+
+
private:
/**
*/
class MGTransferBlockBase
{
+ public:
+ /**
+ * Memory used by this object.
+ */
+ unsigned int memory_consumption () const;
+
+
protected:
/**
* Actually build the prolongation
std::vector<unsigned int> component_start;
/**
- * Start index of eah component on
+ * Start index of each component on
* all levels.
*/
std::vector<std::vector<unsigned int> > mg_component_start;
OutVector &dst,
const MGLevelObject<BlockVector<number> > &src) const;
+ MGTransferBlockBase::memory_consumption;
+
private:
/**
* Structure that is used to
BlockVector<number2> &dst,
const MGLevelObject<Vector<number> > &src) const;
+ /**
+ * Memory used by this object.
+ */
+ unsigned int memory_consumption () const;
+
private:
/**
* Transfer from multi-level vector to
}
+template <typename number>
+unsigned int
+MGTransferPrebuilt<number>::memory_consumption () const
+{
+ unsigned int result = sizeof(*this);
+ result += sizeof(unsigned int) * sizes.size();
+#ifdef DEAL_PREFER_MATRIX_EZ
+ std::vector<boost::shared_ptr<SparseMatrixEZ<double> > >::const_iterator m;
+ const std::vector<boost::shared_ptr<SparseMatrixEZ<double> > >::const_iterator end = prolongation_matrices.end();
+ for (m = prolongation_matrices.begin(); m != end ; ++m)
+ result += *m->memory_consumption();
+#else
+ for (unsigned int i=0;i<prolongation_matrices.size();++i)
+ result += prolongation_matrices[i]->memory_consumption()
+ + prolongation_sparsities[i]->memory_consumption();
+#endif
+ return result;
+}
/* --------------------- MGTransferSelect -------------- */
}
+template <typename number>
+unsigned int
+MGTransferSelect<number>::memory_consumption () const
+{
+ return sizeof(int) + MGTransferBlockBase::memory_consumption();
+}
+
/* --------------------- MGTransferBlock -------------- */
#endif
}
+//TODO:[GK] Add all those little vectors.
+unsigned int
+MGTransferBlockBase::memory_consumption () const
+{
+ unsigned int result = sizeof(*this);
+ result += sizeof(unsigned int) * sizes.size();
+#ifdef DEAL_PREFER_MATRIX_EZ
+ std::vector<boost::shared_ptr<SparseMatrixEZ<double> > >::const_iterator m;
+ const std::vector<boost::shared_ptr<SparseMatrixEZ<double> > >::const_iterator end = prolongation_matrices.end();
+ for (m = prolongation_matrices.begin(); m != end ; ++m)
+ result += *m->memory_consumption();
+#else
+ for (unsigned int i=0;i<prolongation_matrices.size();++i)
+ result += prolongation_matrices[i]->memory_consumption()
+ + prolongation_sparsities[i]->memory_consumption();
+#endif
+ return result;
+}
+
+
template <typename number>
template <int dim>