From: kanschat Date: Mon, 20 Sep 2010 16:54:45 +0000 (+0000) Subject: add memory consmuption info to meshworker classes X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=741abe40cd67ac1e29a8691d6995c9d5876e8869;p=dealii-svn.git add memory consmuption info to meshworker classes git-svn-id: https://svn.dealii.org/trunk@22089 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/numerics/mesh_worker.h b/deal.II/deal.II/include/numerics/mesh_worker.h index 97b53e3308..ee1bfe6213 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker.h +++ b/deal.II/deal.II/include/numerics/mesh_worker.h @@ -333,6 +333,11 @@ namespace MeshWorker * at quadrature point k */ number quadrature_value(unsigned int k, unsigned int i) const; + + /** + * The memory used by this object. + */ + unsigned int memory_consumption () const; private: /** diff --git a/deal.II/deal.II/include/numerics/mesh_worker_info.h b/deal.II/deal.II/include/numerics/mesh_worker_info.h index 40bd127aa0..551016033f 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_info.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_info.h @@ -226,6 +226,11 @@ namespace MeshWorker template void assemble(ASSEMBLER& ass) const; + /** + * The memory used by this object. + */ + unsigned int memory_consumption () const; + /** * The data for the cell. @@ -478,6 +483,11 @@ namespace MeshWorker */ std_cxx1x::shared_ptr > global_data; + /** + * The memory used by this object. + */ + unsigned int memory_consumption () const; + private: /** * Use the finite element @@ -607,6 +617,11 @@ namespace MeshWorker unsigned int n_boundary_points, unsigned int n_face_points); + /** + * The memory used by this object. + */ + unsigned int memory_consumption () const; + /** * The set of update flags * for boundary cell integration. diff --git a/deal.II/deal.II/include/numerics/mesh_worker_info.templates.h b/deal.II/deal.II/include/numerics/mesh_worker_info.templates.h index 0fb6456c03..068db97164 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_info.templates.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_info.templates.h @@ -179,6 +179,19 @@ namespace MeshWorker } + template + unsigned int + IntegrationInfo::memory_consumption () const + { + unsigned int mem = sizeof(*this) + + MemoryConsumption::memory_consumption(fevalv) + - sizeof (fevalv) + ; + for (unsigned int i=0;imemory_consumption(); + return mem; + } + //----------------------------------------------------------------------// @@ -223,6 +236,45 @@ namespace MeshWorker if (face) face_flags |= flags; if (neighbor) neighbor_flags |= flags; } + + + template + unsigned int + IntegrationInfoBox::memory_consumption () const + { + unsigned int mem = sizeof(*this) + + MemoryConsumption::memory_consumption(cell_quadrature) + - sizeof (cell_quadrature) + + MemoryConsumption::memory_consumption(boundary_quadrature) + - sizeof (boundary_quadrature) + + MemoryConsumption::memory_consumption(face_quadrature) + - sizeof (face_quadrature) + + MemoryConsumption::memory_consumption(cell_selector) + -sizeof (cell_selector) + + MemoryConsumption::memory_consumption(boundary_selector) + -sizeof (boundary_selector) + + MemoryConsumption::memory_consumption(face_selector) + -sizeof (face_selector) + + MemoryConsumption::memory_consumption(cell) + - sizeof(cell) + + MemoryConsumption::memory_consumption(boundary) + - sizeof(boundary) + + MemoryConsumption::memory_consumption(face) + - sizeof(face) + + MemoryConsumption::memory_consumption(subface) + - sizeof(subface) + + MemoryConsumption::memory_consumption(neighbor) + - sizeof(neighbor) + ; +// if (cell_data != 0) +// mem += MemoryConsumption::memory_consumption(*cell_data); +// if (boundary_data != 0) +// mem += MemoryConsumption::memory_consumption(*boundary_data); +// if (face_data != 0) +// mem += MemoryConsumption::memory_consumption(*face_data); + + return mem; + } } diff --git a/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.h b/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.h index 2a01c5839e..8af1bf4de1 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.h @@ -166,6 +166,11 @@ namespace MeshWorker template void print (STREAM& s) const; + /** + * The memory used by this object. + */ + unsigned int memory_consumption () const; + protected: /** * Selection of the vectors @@ -314,6 +319,11 @@ namespace MeshWorker unsigned int n_comp, unsigned int start, unsigned int size) const; + + /** + * The memory used by this object. + */ + unsigned int memory_consumption () const; }; @@ -377,7 +387,13 @@ namespace MeshWorker unsigned int component, unsigned int n_comp, unsigned int start, - unsigned int size) const; + unsigned int size) const; + + /** + * The memory used by this object. + */ + unsigned int memory_consumption () const; + private: NamedData > > data; }; @@ -445,6 +461,12 @@ namespace MeshWorker unsigned int n_comp, unsigned int start, unsigned int size) const; + + /** + * The memory used by this object. + */ + unsigned int memory_consumption () const; + private: NamedData,MGVectorData > > data; }; @@ -579,8 +601,18 @@ namespace MeshWorker s << " '" << v.name(hessian_selection(i)) << '\''; s << std::endl; } + + + inline unsigned int + VectorSelector::memory_consumption () const + { + unsigned int mem = sizeof(*this); + return mem; + } + } + DEAL_II_NAMESPACE_CLOSE #endif diff --git a/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.templates.h b/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.templates.h index 053f5f4369..346e111eff 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.templates.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.templates.h @@ -69,6 +69,8 @@ namespace MeshWorker { Assert(false, ExcNotImplemented()); } + + //----------------------------------------------------------------------// template @@ -141,6 +143,16 @@ namespace MeshWorker } } + + template + unsigned int + VectorData::memory_consumption () const + { + unsigned int mem = VectorSelector::memory_consumption(); + mem += sizeof (data); + return mem; + } + //----------------------------------------------------------------------// template @@ -214,6 +226,16 @@ namespace MeshWorker fe.get_function_hessians(src, make_slice(index, start, size), dst, true); } } + + + template + unsigned int + MGVectorData::memory_consumption () const + { + unsigned int mem = VectorSelector::memory_consumption(); + mem += sizeof (data); + return mem; + } } DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/deal.II/source/numerics/mesh_worker.cc b/deal.II/deal.II/source/numerics/mesh_worker.cc index 662cffde0f..e78ecee64b 100644 --- a/deal.II/deal.II/source/numerics/mesh_worker.cc +++ b/deal.II/deal.II/source/numerics/mesh_worker.cc @@ -36,6 +36,21 @@ LocalResults::reinit(const BlockIndices& bi) quadrature_values[k][i] = 0.; } + +template +unsigned int +LocalResults::memory_consumption () const +{ + unsigned int mem = sizeof(*this) + + MemoryConsumption::memory_consumption(J) + + MemoryConsumption::memory_consumption(R) + + MemoryConsumption::memory_consumption(M1) + + MemoryConsumption::memory_consumption(M2) + + MemoryConsumption::memory_consumption(quadrature_values); + return mem; +} + + template class LocalResults; template class LocalResults; diff --git a/deal.II/lac/include/lac/matrix_block.h b/deal.II/lac/include/lac/matrix_block.h index ce414d21e9..00597ecd44 100644 --- a/deal.II/lac/include/lac/matrix_block.h +++ b/deal.II/lac/include/lac/matrix_block.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -290,8 +291,13 @@ class MatrixBlock * matching #matrix. */ template - void Tvmult_add (VECTOR& w, const VECTOR& v) const; - + void Tvmult_add (VECTOR& w, const VECTOR& v) const; + + /** + * The memory used by this object. + */ + unsigned int memory_consumption () const; + /** * The block number computed from * an index by using @@ -364,6 +370,11 @@ class MatrixBlockVector : public NamedDatai. @@ -428,6 +439,11 @@ class MGMatrixBlockVector : public NamedData& block(unsigned int i); + /** + * The memory used by this object. + */ + unsigned int memory_consumption () const; + /** * Access the matrix at position * i for read and write @@ -644,6 +660,16 @@ MatrixBlock::Tvmult_add (VECTOR& w, const VECTOR& v) const } +template +inline +unsigned int +MatrixBlock::memory_consumption () const +{ + unsigned int mem = sizeof(*this) + + MemoryConsumption::memory_consumption(matrix) + - sizeof(matrix); + return mem; +} //----------------------------------------------------------------------//