From 05b89d5b52db52f3a6ad3932c7b7bf53694e8552 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 17 Jan 2000 14:25:40 +0000 Subject: [PATCH] Small restructuring in preparation of larger ones. git-svn-id: https://svn.dealii.org/trunk@2233 0785d39b-7218-0410-832d-ea1e28bc413d --- .../lac/include/lac/sparse_vanka.templates.h | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/deal.II/lac/include/lac/sparse_vanka.templates.h b/deal.II/lac/include/lac/sparse_vanka.templates.h index 60e6b88ccd..4f8de920fb 100644 --- a/deal.II/lac/include/lac/sparse_vanka.templates.h +++ b/deal.II/lac/include/lac/sparse_vanka.templates.h @@ -79,14 +79,19 @@ SparseVanka::operator ()(Vector &dst, } } - // alias to the matrix which is + // if we don't store the + // inverse matrices, then alias + // the entry in the global + // vector to the local matrix // to be used - FullMatrix &A = (conserve_mem ? - local_matrix : - (*inverses[row])); - - if (build_matrix) - A.reinit(row_length); + if (conserve_mem == true) + { + inverses[row] = &local_matrix; + inverses[row]->reinit (row_length, row_length); + } + else + if (build_matrix) + inverses[row]->reinit (row_length, row_length); Vector b(row_length); Vector x(row_length); @@ -153,14 +158,14 @@ SparseVanka::operator ()(Vector &dst, // if so, then build the // matrix out of it if (build_matrix) - A(i,js->second) = matrix->raw_entry(irow,j); + (*inverses[row])(i,js->second) = matrix->raw_entry(irow,j); } } } // Compute new values if (build_matrix) - A.gauss_jordan(); - A.vmult(x,b); + inverses[row]->gauss_jordan(); + inverses[row]->vmult(x,b); // Distribute new values for (map::const_iterator is=local_index.begin(); @@ -169,7 +174,13 @@ SparseVanka::operator ()(Vector &dst, const unsigned int irow = is->first; const unsigned int i = is->second; dst(irow) = x(i); - } + }; + + // if we don't store the + // inverses, then unalias the + // local matrix + if (conserve_mem == true) + inverses[row] = 0; } } -- 2.39.5