From: heister Date: Fri, 3 May 2013 15:15:18 +0000 (+0000) Subject: fix Trilinos SparseMatrix adding instead of inserting entries in parallel. Also leave... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43c7644064742b79abd46c06ecc2e7d782061105;p=dealii-svn.git fix Trilinos SparseMatrix adding instead of inserting entries in parallel. Also leave a todo. git-svn-id: https://svn.dealii.org/trunk@29446 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 415883084e..572d9d1cb9 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -64,6 +64,12 @@ this function.
    +
  1. Fixed: setting values in TrilinosWrappers::SparseMatrix + in parallel was adding the values instead. +
    + (Bruno Turcksin, Timo Heister, 2013/05/03) +
  2. +
  3. New: The step-49 tutorial program now also has a discussion on what to do once you have a coarse mesh and want to refine it.
    diff --git a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h index 36a7123ced..bc1c3091c7 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h @@ -543,7 +543,7 @@ namespace TrilinosWrappers typedef TrilinosScalar value_type; /** - * @name Constructors and initalization. + * @name Constructors and initialization. */ //@{ /** @@ -769,7 +769,7 @@ namespace TrilinosWrappers * they might be spread out. The * second Epetra_Map is only used to * specify the number of columns and - * for internal arragements when + * for internal arrangements when * doing matrix-vector products with * vectors based on that column map. * @@ -3032,12 +3032,32 @@ namespace TrilinosWrappers inline void - SparseMatrix::compress (::dealii::VectorOperation::values /*operation*/) + SparseMatrix::compress (::dealii::VectorOperation::values operation) { + + Epetra_CombineMode mode = last_action; + if (last_action == Zero) + { + if (operation==::dealii::VectorOperation::add) + mode = Add; + else if (operation==::dealii::VectorOperation::insert) + mode = Insert; + } + else + { + Assert( + ((last_action == Add) && (operation==::dealii::VectorOperation::add)) + || + ((last_action == Insert) && (operation==::dealii::VectorOperation::insert)), + ExcMessage("operation and argument to compress() do not match")); + } + + std::cout << "compress " << (mode==Add) << (mode==Insert) << std::endl; + // flush buffers int ierr; ierr = matrix->GlobalAssemble (*column_space_map, matrix->RowMap(), - true); + true, mode); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); @@ -3301,6 +3321,7 @@ namespace TrilinosWrappers // zero. However, these actions are done // in case we pass on to the other // function. + // TODO: fix this (do not run compress here, but fail) if (last_action == Insert) { int ierr;