From ca92e6433a8c872397834a5f6a74b4bdea74da24 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Tue, 11 Mar 2003 13:48:30 +0000 Subject: [PATCH] block-transfer with easy matrices works, but not sufficient git-svn-id: https://svn.dealii.org/trunk@7313 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/include/multigrid/mg_transfer.h | 15 ++++++- deal.II/deal.II/source/multigrid/multigrid.cc | 44 ++++++++++++++++--- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/deal.II/deal.II/include/multigrid/mg_transfer.h b/deal.II/deal.II/include/multigrid/mg_transfer.h index b7bb6d19f9..00addb9200 100644 --- a/deal.II/deal.II/include/multigrid/mg_transfer.h +++ b/deal.II/deal.II/include/multigrid/mg_transfer.h @@ -249,8 +249,20 @@ class MGTransferBlockBase */ DeclException0(ExcMatricesNotBuilt); +#ifdef DEAL_PREFER_MATRIX_EZ + protected: + + /** + * The actual prolongation matrix. + * column indices belong to the + * dof indices of the mother cell, + * i.e. the coarse level. + * while row indices belong to the + * child cell, i.e. the fine level. + */ + std::vector > prolongation_matrices; +#else private: - std::vector prolongation_sparsities; protected: @@ -264,6 +276,7 @@ class MGTransferBlockBase * child cell, i.e. the fine level. */ std::vector > prolongation_matrices; +#endif }; diff --git a/deal.II/deal.II/source/multigrid/multigrid.cc b/deal.II/deal.II/source/multigrid/multigrid.cc index 05c958b057..d238ba7037 100644 --- a/deal.II/deal.II/source/multigrid/multigrid.cc +++ b/deal.II/deal.II/source/multigrid/multigrid.cc @@ -11,6 +11,7 @@ // //----------------------------------------------------------------------- +#include #include #include @@ -167,9 +168,6 @@ void MGTransferBlockBase::build_matrices ( const MGDoFHandler &mg_dof, std::vector select) { - prolongation_matrices.clear(); - prolongation_sparsities.clear(); - const FiniteElement& fe = mg_dof.get_fe(); const unsigned int n_components = fe.n_components(); const unsigned int dofs_per_cell = fe.dofs_per_cell; @@ -185,7 +183,11 @@ void MGTransferBlockBase::build_matrices ( // reset the size of the array of // matrices + prolongation_matrices.clear(); +#ifndef DEAL_PREFER_MATRIX_EZ + prolongation_sparsities.clear(); prolongation_sparsities.resize (n_levels-1); +#endif prolongation_matrices.resize (n_levels-1); // two fields which will store the @@ -211,6 +213,26 @@ 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;i::cell_iterator cell=mg_dof.begin(level); cell != mg_dof.end(level); ++cell) @@ -325,7 +347,19 @@ void MGTransferBlockBase::build_matrices ( component_start[i] = k; k += t; } - +#if defined(DEAL_PREFER_MATRIX_EZ) && 1 == 0 + deallog.push("Transfer"); + for (unsigned int level=0;level