From 8bf7a3d6f930c7cfc943dfbbd196c265621db511 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Tue, 8 Sep 2009 06:40:01 +0000 Subject: [PATCH] Fix memory consumption. git-svn-id: https://svn.dealii.org/trunk@19412 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-37/doc/results.dox | 42 ++++++++++++------------ deal.II/examples/step-37/step-37.cc | 10 ++++-- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/deal.II/examples/step-37/doc/results.dox b/deal.II/examples/step-37/doc/results.dox index bbb859840b..a1ddd0c1c0 100644 --- a/deal.II/examples/step-37/doc/results.dox +++ b/deal.II/examples/step-37/doc/results.dox @@ -9,38 +9,38 @@ output: @code Cycle 0 Number of degrees of freedom: 337 -System matrix memory consumption: 0.02232 MBytes. -Multigrid objects memory consumption: 0.04438 MBytes. -Convergence in 9 CG iterations. +System matrix memory consumption: 0.0224 MBytes. +Multigrid objects memory consumption: 0.04636 MBytes. +Convergence in 10 CG iterations. Cycle 1 Number of degrees of freedom: 1313 -System matrix memory consumption: 0.08101 MBytes. -Multigrid objects memory consumption: 0.1564 MBytes. +System matrix memory consumption: 0.08109 MBytes. +Multigrid objects memory consumption: 0.1635 MBytes. Convergence in 10 CG iterations. Cycle 2 Number of degrees of freedom: 5185 System matrix memory consumption: 0.3141 MBytes. -Multigrid objects memory consumption: 0.5939 MBytes. +Multigrid objects memory consumption: 0.6208 MBytes. Convergence in 10 CG iterations. Cycle 3 Number of degrees of freedom: 20609 System matrix memory consumption: 1.243 MBytes. -Multigrid objects memory consumption: 2.328 MBytes. +Multigrid objects memory consumption: 2.434 MBytes. Convergence in 10 CG iterations. Cycle 4 Number of degrees of freedom: 82177 System matrix memory consumption: 4.951 MBytes. -Multigrid objects memory consumption: 9.238 MBytes. -Convergence in 9 CG iterations. +Multigrid objects memory consumption: 9.658 MBytes. +Convergence in 10 CG iterations. Cycle 5 Number of degrees of freedom: 328193 System matrix memory consumption: 19.77 MBytes. -Multigrid objects memory consumption: 36.83 MBytes. +Multigrid objects memory consumption: 38.5 MBytes. Convergence in 10 CG iterations. @endcode @@ -51,33 +51,33 @@ program in three dimensions: @code Cycle 0 Number of degrees of freedom: 517 -System matrix memory consumption: 0.09649 MBytes. -Multigrid objects memory consumption: 0.1389 MBytes. +System matrix memory consumption: 0.09657 MBytes. +Multigrid objects memory consumption: 0.1413 MBytes. Convergence in 9 CG iterations. Cycle 1 Number of degrees of freedom: 3817 -System matrix memory consumption: 0.6333 MBytes. -Multigrid objects memory consumption: 0.8396 MBytes. -Convergence in 9 CG iterations. +System matrix memory consumption: 0.6334 MBytes. +Multigrid objects memory consumption: 0.8567 MBytes. +Convergence in 10 CG iterations. Cycle 2 Number of degrees of freedom: 29521 System matrix memory consumption: 4.882 MBytes. -Multigrid objects memory consumption: 6.273 MBytes. -Convergence in 9 CG iterations. +Multigrid objects memory consumption: 6.403 MBytes. +Convergence in 10 CG iterations. Cycle 3 Number of degrees of freedom: 232609 System matrix memory consumption: 38.68 MBytes. -Multigrid objects memory consumption: 49.26 MBytes. -Convergence in 9 CG iterations. +Multigrid objects memory consumption: 50.28 MBytes. +Convergence in 11 CG iterations. Cycle 4 Number of degrees of freedom: 1847617 System matrix memory consumption: 308.4 MBytes. -Multigrid objects memory consumption: 391.5 MBytes. -Convergence in 9 CG iterations. +Multigrid objects memory consumption: 399.6 MBytes. +Convergence in 11 CG iterations. @endcode A comparison of the memory consumption of the MatrixFree class with a diff --git a/deal.II/examples/step-37/step-37.cc b/deal.II/examples/step-37/step-37.cc index 9cee8280a9..13903fda7c 100644 --- a/deal.II/examples/step-37/step-37.cc +++ b/deal.II/examples/step-37/step-37.cc @@ -736,7 +736,10 @@ MatrixFree::el (const unsigned int row, // matrix, and finally multiply with the // second basis function. This is exactly // the value that would be written into the - // diagonal of a sparse matrix. + // diagonal of a sparse matrix. Note that + // we need to condense hanging node + // constraints and set the diagonals to + // one. template void MatrixFree::calculate_diagonal() const @@ -782,7 +785,8 @@ std::size_t MatrixFree::memory_consumption () const std::size_t glob_size = derivatives.memory_consumption() + indices_local_to_global.memory_consumption() + constraints.memory_consumption() + - small_matrix.memory_consumption() + sizeof(*this); + small_matrix.memory_consumption() + + diagonal_values.memory_consumption() + sizeof(*this); return glob_size; } @@ -1420,7 +1424,7 @@ void LaplaceProblem::run () int main () { deallog.depth_console (0); - LaplaceProblem<3> laplace_problem (2); + LaplaceProblem<2> laplace_problem (2); laplace_problem.run (); return 0; -- 2.39.5