]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add memory consmuption info to meshworker classes
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Sep 2010 16:54:45 +0000 (16:54 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Sep 2010 16:54:45 +0000 (16:54 +0000)
git-svn-id: https://svn.dealii.org/trunk@22089 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/mesh_worker.h
deal.II/deal.II/include/numerics/mesh_worker_info.h
deal.II/deal.II/include/numerics/mesh_worker_info.templates.h
deal.II/deal.II/include/numerics/mesh_worker_vector_selector.h
deal.II/deal.II/include/numerics/mesh_worker_vector_selector.templates.h
deal.II/deal.II/source/numerics/mesh_worker.cc
deal.II/lac/include/lac/matrix_block.h

index 97b53e33084d1b19ae971da04eae66b2a0b954ae..ee1bfe6213849c2f36ce7e4b86f206af3e898532 100644 (file)
@@ -333,6 +333,11 @@ namespace MeshWorker
                                        * at quadrature point <i>k</i>
                                        */
       number quadrature_value(unsigned int k, unsigned int i) const;
+
+                                      /**
+                                       * The memory used by this object.
+                                       */
+      unsigned int memory_consumption () const;
       
     private:
                                       /**
index 40bd127aa00de4e65520c388dbf006d0431bce5d..551016033ff240491689322c04c76f8d714a535f 100644 (file)
@@ -226,6 +226,11 @@ namespace MeshWorker
       template <class ASSEMBLER>
       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<VectorDataBase<dim, spacedim> > 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.
index 0fb6456c0321ceed51fe29774a00ed88b1f3bf67..068db9716484dbec0d37776ca962ae0648b4ad18 100644 (file)
@@ -179,6 +179,19 @@ namespace MeshWorker
   }
 
 
+  template<int dim, int sdim>
+  unsigned int
+  IntegrationInfo<dim,sdim>::memory_consumption () const
+  {
+    unsigned int mem = sizeof(*this)
+                      + MemoryConsumption::memory_consumption(fevalv)
+                      - sizeof (fevalv)
+                      ;
+    for (unsigned int i=0;i<fevalv.size();++i)
+      mem += fevalv[i]->memory_consumption();
+    return mem;
+  }
+  
 //----------------------------------------------------------------------//
 
 
@@ -223,6 +236,45 @@ namespace MeshWorker
     if (face) face_flags |= flags;
     if (neighbor) neighbor_flags |= flags;
   }
+
+  
+  template<int dim, int sdim>
+  unsigned int
+  IntegrationInfoBox<dim,sdim>::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;
+  }
 }
 
 
index 2a01c5839e4fe7d59e4c15e073fda0f28513c76f..8af1bf4de129f3c394f7efdf52b060d461471921 100644 (file)
@@ -166,6 +166,11 @@ namespace MeshWorker
       template <class STREAM>
       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<SmartPointer<const VECTOR,VectorData<VECTOR,dim,spacedim> > > 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<SmartPointer<const MGLevelObject<VECTOR>,MGVectorData<VECTOR,dim,spacedim> > > 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
index 053f5f436984eb539b5dc81d5d6b4a07ab78e25b..346e111efffa9865f8609d9cecf49d98c3d23355 100644 (file)
@@ -69,6 +69,8 @@ namespace MeshWorker
   {
     Assert(false, ExcNotImplemented());
   }
+  
+
 //----------------------------------------------------------------------//
 
   template <class VECTOR, int dim, int spacedim>
@@ -141,6 +143,16 @@ namespace MeshWorker
       }
   }
 
+
+  template <class VECTOR, int dim, int spacedim>
+  unsigned int
+  VectorData<VECTOR, dim, spacedim>::memory_consumption () const
+  {
+    unsigned int mem = VectorSelector::memory_consumption();
+    mem += sizeof (data);
+    return mem;
+  }
+
 //----------------------------------------------------------------------//
 
   template <class VECTOR, int dim, int spacedim>
@@ -214,6 +226,16 @@ namespace MeshWorker
        fe.get_function_hessians(src, make_slice(index, start, size), dst, true);
       }
   }
+
+
+  template <class VECTOR, int dim, int spacedim>
+  unsigned int
+  MGVectorData<VECTOR, dim, spacedim>::memory_consumption () const
+  {
+    unsigned int mem = VectorSelector::memory_consumption();
+    mem += sizeof (data);
+    return mem;
+  }
 }
 
 DEAL_II_NAMESPACE_CLOSE
index 662cffde0ff0476fff80724d0ad34d05849c5d03..e78ecee64b6fb7786eb303781e0af54d8c7fe5a8 100644 (file)
@@ -36,6 +36,21 @@ LocalResults<number>::reinit(const BlockIndices& bi)
       quadrature_values[k][i] = 0.;
 }
 
+
+template <typename number>
+unsigned int
+LocalResults<number>::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<float>;
 template class LocalResults<double>;
 
index ce414d21e9161e2f6251182403fb48798347fc47..00597ecd4486749ec5b73fd9ed21ea1b1f802b18 100644 (file)
@@ -17,6 +17,7 @@
 #include <base/named_data.h>
 #include <base/smartpointer.h>
 #include <base/std_cxx1x/shared_ptr.h>
+#include <base/memory_consumption.h>
 #include <lac/block_indices.h>
 #include <lac/block_sparsity_pattern.h>
 #include <lac/sparse_matrix.h>
@@ -290,8 +291,13 @@ class MatrixBlock
                                      * matching #matrix.
                                      */
     template<class VECTOR>
-    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 NamedData<std_cxx1x::shared_ptr<MatrixBlock<MAT
                                      */
     void reinit(const BlockSparsityPattern& sparsity);
     
+                                    /**
+                                     * The memory used by this object.
+                                     */
+    unsigned int memory_consumption () const;
+
                                     /**
                                      * Access a constant reference to
                                      * the block at position <i>i</i>.
@@ -428,6 +439,11 @@ class MGMatrixBlockVector : public NamedData<std_cxx1x::shared_ptr<MatrixBlock<M
                                      */
     MatrixBlock<MATRIX>& block(unsigned int i);
     
+                                    /**
+                                     * The memory used by this object.
+                                     */
+    unsigned int memory_consumption () const;
+    
                                     /**
                                      * Access the matrix at position
                                      * <i>i</i> for read and write
@@ -644,6 +660,16 @@ MatrixBlock<MATRIX>::Tvmult_add (VECTOR& w, const VECTOR& v) const
 }
 
 
+template <class MATRIX>
+inline
+unsigned int
+MatrixBlock<MATRIX>::memory_consumption () const
+{
+  unsigned int mem = sizeof(*this)
+                    + MemoryConsumption::memory_consumption(matrix)
+                    - sizeof(matrix);
+  return mem;
+}
 
 //----------------------------------------------------------------------//
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.