From a14e38852df4d77649d5cd37aac7ebba6967a1d4 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Sun, 22 Jan 2006 18:55:11 +0000 Subject: [PATCH] SparseMatrixEZ use removed git-svn-id: https://svn.dealii.org/trunk@12118 0785d39b-7218-0410-832d-ea1e28bc413d --- .../source/multigrid/mg_transfer_block.cc | 73 ++----------------- .../source/multigrid/mg_transfer_prebuilt.cc | 17 +---- .../multigrid/multigrid.all_dimensions.cc | 16 +++- 3 files changed, 22 insertions(+), 84 deletions(-) diff --git a/deal.II/deal.II/source/multigrid/mg_transfer_block.cc b/deal.II/deal.II/source/multigrid/mg_transfer_block.cc index 6dc0a77c95..f12d288370 100644 --- a/deal.II/deal.II/source/multigrid/mg_transfer_block.cc +++ b/deal.II/deal.II/source/multigrid/mg_transfer_block.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 2003, 2004, 2005, 2006 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -145,21 +145,14 @@ void MGTransferBlockBase::build_matrices ( // deleting the object it points to // by itself prolongation_matrices.resize (0); -#ifndef DEAL_PREFER_MATRIX_EZ prolongation_sparsities.resize (0); -#endif for (unsigned int i=0; i (new BlockSparsityPattern)); prolongation_matrices .push_back (boost::shared_ptr > (new BlockSparseMatrix)); -#else - prolongation_matrices - .push_back (boost::shared_ptr > (new BlockSparseMatrixEZ)); -#endif } // two fields which will store the @@ -185,26 +178,6 @@ void MGTransferBlockBase::build_matrices ( // is necessary. this, is the // number of degrees of freedom // per cell -#ifdef DEAL_PREFER_MATRIX_EZ -//TODO:[GK] Optimize here: -// this allocates too much memory, since the cell matrices contain -// many zeroes. If SparseMatrixEZ::reinit can handle a vector of -// row-lengths, this should be used here to specify the length of -// every single row. - - prolongation_matrices[level]->reinit (n_components, n_components); - for (unsigned int i=0;iblock(i,j) - .reinit(sizes[level+1][i], - sizes[level][j], dofs_per_cell, 0); - else - prolongation_matrices[level]->block(i,j) - .reinit(sizes[level+1][i], - sizes[level][j], 0); - prolongation_matrices[level]->collect_sizes(); -#else prolongation_sparsities[level]->reinit (n_components, n_components); for (unsigned int i=0; icompress (); prolongation_matrices[level]->reinit (*prolongation_sparsities[level]); -#endif // now actually build the matrices for (typename MGDoFHandler::cell_iterator cell=mg_dof.begin(level); cell != mg_dof.end(level); ++cell) @@ -289,48 +261,13 @@ void MGTransferBlockBase::build_matrices ( prolongation_matrices[level]->set(dof_indices_child[i], dof_indices_parent[j], prolongation(i,j)); - }; - }; - }; - }; -#if defined(DEAL_PREFER_MATRIX_EZ) && 1 == 0 - deallog.push("Transfer"); - for (unsigned int level=0;levelblock(i,j).print_statistics(deallog,true); - } - deallog.pop(); -#endif -} - - -//TODO[GK]: the following function needs to be in mg_transfer_base.all_dimensions.cc -//TODO:[GK] Add all those little vectors. -unsigned int -MGTransferBlockBase::memory_consumption () const -{ - unsigned int result = sizeof(*this); - result += sizeof(unsigned int) * sizes.size(); -#ifdef DEAL_PREFER_MATRIX_EZ - std::vector > >::const_iterator m; - const std::vector > >::const_iterator end = prolongation_matrices.end(); - for (m = prolongation_matrices.begin(); m != end ; ++m) - result += *m->memory_consumption(); -#else - for (unsigned int i=0;imemory_consumption() - + prolongation_sparsities[i]->memory_consumption(); -#endif - return result; + } + } + } + } } - template template void MGTransferBlock::build_matrices ( diff --git a/deal.II/deal.II/source/multigrid/mg_transfer_prebuilt.cc b/deal.II/deal.II/source/multigrid/mg_transfer_prebuilt.cc index 0cc34d8cb8..42f06b0f84 100644 --- a/deal.II/deal.II/source/multigrid/mg_transfer_prebuilt.cc +++ b/deal.II/deal.II/source/multigrid/mg_transfer_prebuilt.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 2003, 2004, 2005, 2006 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -50,21 +50,14 @@ void MGTransferPrebuilt::build_matrices ( // deleting the object it points to // by itself prolongation_matrices.resize (0); -#ifndef DEAL_PREFER_MATRIX_EZ prolongation_sparsities.resize (0); -#endif - + for (unsigned int i=0; i (new SparsityPattern)); prolongation_matrices .push_back (boost::shared_ptr > (new SparseMatrix)); -#else - prolongation_matrices - .push_back (boost::shared_ptr > (new SparseMatrixEZ)); -#endif } // two fields which will store the @@ -87,11 +80,6 @@ void MGTransferPrebuilt::build_matrices ( // necessary. this, of course, is the // number of degrees of freedom per // cell -#ifdef DEAL_PREFER_MATRIX_EZ - prolongation_matrices[level]->reinit (sizes[level+1], - sizes[level], - dofs_per_cell); -#else // increment dofs_per_cell // since a useless diagonal // element will be stored @@ -133,7 +121,6 @@ void MGTransferPrebuilt::build_matrices ( prolongation_sparsities[level]->compress (); prolongation_matrices[level]->reinit (*prolongation_sparsities[level]); -#endif // now actually build the matrices for (typename MGDoFHandler::cell_iterator cell=mg_dof.begin(level); diff --git a/deal.II/deal.II/source/multigrid/multigrid.all_dimensions.cc b/deal.II/deal.II/source/multigrid/multigrid.all_dimensions.cc index a4204673e9..1772228711 100644 --- a/deal.II/deal.II/source/multigrid/multigrid.all_dimensions.cc +++ b/deal.II/deal.II/source/multigrid/multigrid.all_dimensions.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -208,6 +208,20 @@ void MGTransferBlock::restrict_and_add ( +//TODO:[GK] Add all those little vectors. +unsigned int +MGTransferBlockBase::memory_consumption () const +{ + unsigned int result = sizeof(*this); + result += sizeof(unsigned int) * sizes.size(); + for (unsigned int i=0;imemory_consumption() + + prolongation_sparsities[i]->memory_consumption(); + return result; +} + + +//----------------------------------------------------------------------// template MGTransferSelect::~MGTransferSelect () -- 2.39.5