From: Peter Munch Date: Sun, 2 Oct 2022 11:01:59 +0000 (+0200) Subject: Implement some memory_consumption() functions X-Git-Tag: v9.5.0-rc1~906^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4240407c2df8fe7094cfb8e87b13b855908d2770;p=dealii.git Implement some memory_consumption() functions --- diff --git a/include/deal.II/matrix_free/constraint_info.h b/include/deal.II/matrix_free/constraint_info.h index b11e18aeb4..194afa3ebe 100644 --- a/include/deal.II/matrix_free/constraint_info.h +++ b/include/deal.II/matrix_free/constraint_info.h @@ -57,6 +57,12 @@ namespace internal const std::vector> &entries); + /** + * Return the memory consumption of the allocated memory in this class. + */ + std::size_t + memory_consumption() const; + std::vector> constraint_entries; std::vector constraint_indices; @@ -129,6 +135,12 @@ namespace internal const bool transpose, AlignedVector &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 constraint_values; @@ -717,6 +729,55 @@ namespace internal } + + template + inline std::size_t + ConstraintInfo::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 + inline std::size_t + ConstraintValues::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 diff --git a/include/deal.II/matrix_free/hanging_nodes_internal.h b/include/deal.II/matrix_free/hanging_nodes_internal.h index ba20ae6f3c..b5cc0cf6bb 100644 --- a/include/deal.II/matrix_free/hanging_nodes_internal.h +++ b/include/deal.II/matrix_free/hanging_nodes_internal.h @@ -270,6 +270,12 @@ namespace internal */ HangingNodes(const Triangulation &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 + inline std::size_t + HangingNodes::memory_consumption() const + { + return MemoryConsumption::memory_consumption(line_to_cells); + } + + + template inline void HangingNodes::setup_line_to_cell( diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h index 6fe22ecdcc..e88f145829 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -3122,8 +3122,7 @@ MGTwoLevelTransfer>:: 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; }