]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Implement some memory_consumption() functions 14330/head
authorPeter Munch <peterrmuench@gmail.com>
Sun, 2 Oct 2022 11:01:59 +0000 (13:01 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Sun, 2 Oct 2022 11:01:59 +0000 (13:01 +0200)
include/deal.II/matrix_free/constraint_info.h
include/deal.II/matrix_free/hanging_nodes_internal.h
include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h

index b11e18aeb4057f3582c08c16da95b975cd6c57e2..194afa3ebeaad2fb9542e9377ce57b69fa367a76 100644 (file)
@@ -57,6 +57,12 @@ namespace internal
         const std::vector<std::pair<types::global_dof_index, number2>>
           &entries);
 
+      /**
+       * Return the memory consumption of the allocated memory in this class.
+       */
+      std::size_t
+      memory_consumption() const;
+
       std::vector<std::pair<types::global_dof_index, double>>
                                            constraint_entries;
       std::vector<types::global_dof_index> constraint_indices;
@@ -129,6 +135,12 @@ namespace internal
         const bool             transpose,
         AlignedVector<Number> &evaluation_data_coarse) const;
 
+      /**
+       * Return the memory consumption of the allocated memory in this class.
+       */
+      std::size_t
+      memory_consumption() const;
+
     private:
       // for setup
       ConstraintValues<double>               constraint_values;
@@ -717,6 +729,55 @@ namespace internal
     }
 
 
+
+    template <int dim, typename Number>
+    inline std::size_t
+    ConstraintInfo<dim, Number>::memory_consumption() const
+    {
+      std::size_t size = 0;
+
+      size += MemoryConsumption::memory_consumption(constraint_values);
+      size += MemoryConsumption::memory_consumption(dof_indices_per_cell);
+      size += MemoryConsumption::memory_consumption(plain_dof_indices_per_cell);
+      size +=
+        MemoryConsumption::memory_consumption(constraint_indicator_per_cell);
+
+      if (hanging_nodes)
+        size += MemoryConsumption::memory_consumption(*hanging_nodes);
+
+      size += MemoryConsumption::memory_consumption(lexicographic_numbering);
+      size += MemoryConsumption::memory_consumption(dof_indices);
+      size += MemoryConsumption::memory_consumption(constraint_indicator);
+      size += MemoryConsumption::memory_consumption(row_starts);
+      size += MemoryConsumption::memory_consumption(plain_dof_indices);
+      size += MemoryConsumption::memory_consumption(row_starts_plain_indices);
+      size += MemoryConsumption::memory_consumption(constraint_pool_data);
+      size += MemoryConsumption::memory_consumption(constraint_pool_row_index);
+      size += MemoryConsumption::memory_consumption(shape_infos);
+      size +=
+        MemoryConsumption::memory_consumption(hanging_node_constraint_masks);
+      size += MemoryConsumption::memory_consumption(active_fe_indices);
+
+      return size;
+    }
+
+
+
+    template <typename Number>
+    inline std::size_t
+    ConstraintValues<Number>::memory_consumption() const
+    {
+      std::size_t size = 0;
+
+      size += MemoryConsumption::memory_consumption(constraint_entries);
+      size += MemoryConsumption::memory_consumption(constraint_indices);
+
+      // TODO: map does not have memory_consumption()
+      // size += MemoryConsumption::memory_consumption(constraints);
+
+      return size;
+    }
+
   } // namespace MatrixFreeFunctions
 } // namespace internal
 
index ba20ae6f3caf1cb652a7e1d6d8eb0a9c0301140a..b5cc0cf6bb21a69c9712aa3028a9479c7eabb629 100644 (file)
@@ -270,6 +270,12 @@ namespace internal
        */
       HangingNodes(const Triangulation<dim> &triangualtion);
 
+      /**
+       * Return the memory consumption of the allocated memory in this class.
+       */
+      std::size_t
+      memory_consumption() const;
+
       /**
        * Compute the value of the constraint mask for a given cell.
        */
@@ -361,6 +367,15 @@ namespace internal
 
 
 
+    template <int dim>
+    inline std::size_t
+    HangingNodes<dim>::memory_consumption() const
+    {
+      return MemoryConsumption::memory_consumption(line_to_cells);
+    }
+
+
+
     template <int dim>
     inline void
     HangingNodes<dim>::setup_line_to_cell(
index 6fe22ecdcc6c619606284751db0aae9da9ab04f8..e88f1458299ebbfe50e6f468ffc3d8c5f7382e77 100644 (file)
@@ -3122,8 +3122,7 @@ MGTwoLevelTransfer<dim, LinearAlgebra::distributed::Vector<Number>>::
   size += vec_coarse.memory_consumption();
   size += MemoryConsumption::memory_consumption(weights);
   size += MemoryConsumption::memory_consumption(level_dof_indices_fine);
-
-  // size += constraint_info.memory_consumption(); // TODO
+  size += constraint_info.memory_consumption();
 
   return size;
 }

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.