]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make the Epetra objects in the TrilinosWrapper classes private. We can still handle...
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Wed, 25 Feb 2009 16:16:12 +0000 (16:16 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Wed, 25 Feb 2009 16:16:12 +0000 (16:16 +0000)
git-svn-id: https://svn.dealii.org/trunk@18430 0785d39b-7218-0410-832d-ea1e28bc413d

13 files changed:
deal.II/deal.II/source/grid/grid_refinement.cc
deal.II/examples/step-32/step-32.cc
deal.II/examples/step-33/step-33.cc
deal.II/lac/include/lac/trilinos_sparse_matrix.h
deal.II/lac/include/lac/trilinos_sparsity_pattern.h
deal.II/lac/include/lac/trilinos_vector_base.h
deal.II/lac/include/lac/vector.templates.h
deal.II/lac/source/trilinos_precondition.cc
deal.II/lac/source/trilinos_precondition_block.cc
deal.II/lac/source/trilinos_solver.cc
deal.II/lac/source/trilinos_solver_block.cc
deal.II/lac/source/trilinos_sparse_matrix.cc
deal.II/lac/source/trilinos_vector.cc

index 8633c1ea418b95f13ceaa5daa2268ce3ed4152b6..ba33ff56a196d6183fcbbb792827f3791fb84791 100644 (file)
@@ -83,7 +83,7 @@ namespace
   max_element (const TrilinosWrappers::Vector &criteria)
   {
     TrilinosScalar m = 0;
-    criteria.vector->MaxValue(&m);
+    criteria.trilinos_vector().MaxValue(&m);
     return m;
   }
 
@@ -92,7 +92,7 @@ namespace
   min_element (const TrilinosWrappers::Vector &criteria)
   {
     TrilinosScalar m = 0;
-    criteria.vector->MinValue(&m);
+    criteria.trilinos_vector().MinValue(&m);
     return m;
   }
 #endif
index 867b43f08603a9462586e97af9e3a5504f8e0315..3687414cca88ec246fc17b16d4ddb04e50a9bcaf 100644 (file)
@@ -263,7 +263,7 @@ namespace LinearSolvers
                  stokes_matrix           (&S),
                  m_inverse               (&Mpinv),
                  a_preconditioner        (Apreconditioner),
-                 tmp                     (stokes_matrix->block(1,1).matrix->RowMap())
+                 tmp                     (stokes_matrix->block(1,1).row_partitioner())
   {}
 
 
@@ -1298,8 +1298,8 @@ void BoussinesqFlowProblem<dim>::project_temperature_field ()
 
   std::vector<double> rhs_values(n_q_points);
 
-  TrilinosWrappers::MPI::Vector rhs (temperature_mass_matrix.matrix->RowMap()), 
-    sol (temperature_mass_matrix.matrix->RowMap());
+  TrilinosWrappers::MPI::Vector rhs (temperature_mass_matrix.row_partitioner()), 
+    sol (temperature_mass_matrix.row_partitioner());
       
   for (; cell!=endc; ++cell) 
     if (cell->subdomain_id() == 
index b6ced66928a7b6cf0ae3c626887df373a9dab82a..46bfe39dd17b77ba546b3ea2df7e7d390099854c 100644 (file)
@@ -2671,13 +2671,16 @@ ConservationLaw<dim>::solve (Vector<double> &newton_update)
                                       // deal.II wrapper class itself. So
                                       // we access to the actual Trilinos
                                       // matrix in the Trilinos wrapper
-                                      // class, and create a plain pointer
-                                      // when passing it in.
+                                      // class by the command
+                                      // trilinos_matrix(). Trilinos wants
+                                      // the matrix to be non-constant, so
+                                      // we have to manually remove the
+                                      // constantness using a const_cast.
       case Parameters::Solver::gmres:
       {
-       Epetra_Vector x(View, system_matrix.matrix->RowMap(), 
+       Epetra_Vector x(View, system_matrix.domain_partitioner(), 
                        newton_update.begin());
-       Epetra_Vector b(View, system_matrix.matrix->RowMap(), 
+       Epetra_Vector b(View, system_matrix.range_partitioner(), 
                        right_hand_side.begin());
 
        AztecOO solver;
@@ -2702,7 +2705,8 @@ ConservationLaw<dim>::solve (Vector<double> &newton_update)
        solver.SetAztecParam(AZ_athresh,   parameters.ilut_atol);
        solver.SetAztecParam(AZ_rthresh,   parameters.ilut_rtol);
 
-       solver.SetUserMatrix(&*system_matrix.matrix);
+       solver.SetUserMatrix(const_cast<Epetra_CrsMatrix*>
+                            (&system_matrix.trilinos_matrix()));
 
        solver.Iterate(parameters.max_iterations, parameters.linear_residual);
 
index 922aa01c2959560d46c458a9618121e7c35eff88..4e4285e835cf6776e23341dd28f46b0ae0eb278b 100755 (executable)
@@ -1583,6 +1583,69 @@ namespace TrilinosWrappers
       TrilinosScalar frobenius_norm () const;
 
 //@}
+/**
+ * @name Access to underlying Trilinos data
+ */
+//@{
+
+                                       /**
+                                        * Return a const reference to the
+                                        * underlying Trilinos
+                                        * Epetra_CrsMatrix data.
+                                        */
+      const Epetra_CrsMatrix & trilinos_matrix () const;
+
+                                       /**
+                                        * Return a const reference to the
+                                        * underlying Trilinos
+                                        * Epetra_CrsGraph data that stores
+                                        * the sparsity pattern of the
+                                        * matrix.
+                                        */
+      const Epetra_CrsGraph & trilinos_sparsity_pattern () const;
+
+                                       /**
+                                        * Return a const reference to the
+                                        * underlying Trilinos Epetra_Map
+                                        * that sets the partitioning of the
+                                        * domain space of this matrix, i.e.,
+                                        * the partitioning of the vectors
+                                        * this matrix has to be multiplied
+                                        * with.
+                                        */
+      const Epetra_Map & domain_partitioner () const;
+
+                                       /**
+                                        * Return a const reference to the
+                                        * underlying Trilinos Epetra_Map
+                                        * that sets the partitioning of the
+                                        * range space of this matrix, i.e.,
+                                        * the partitioning of the vectors
+                                        * that are result from matrix-vector
+                                        * products.
+                                        */
+      const Epetra_Map & range_partitioner () const;
+
+                                       /**
+                                        * Return a const reference to the
+                                        * underlying Trilinos Epetra_Map
+                                        * that sets the partitioning of the
+                                        * matrix rows. Equal to the
+                                        * partitioning of the range.
+                                        */
+      const Epetra_Map & row_partitioner () const;
+
+                                       /**
+                                        * Return a const reference to the
+                                        * underlying Trilinos Epetra_Map
+                                        * that sets the partitioning of the
+                                        * matrix columns. This is in general
+                                        * not equal to the partitioner
+                                        * Epetra_Map for the domain because
+                                        * of overlap in the matrix.
+                                        */
+      const Epetra_Map & col_partitioner () const;
+//@}
 /**
  * @name Iterators
  */
@@ -1793,7 +1856,6 @@ namespace TrilinosWrappers
                                        */
       std::vector<TrilinosScalar> column_values;
 
-    public:
                                        /**
                                         * A sparse matrix object in
                                         * Trilinos to be used for
@@ -1803,9 +1865,6 @@ namespace TrilinosWrappers
                                         * elements.  The actual type,
                                         * a sparse matrix, is set in
                                         * the constructor.
-                                       *
-                                       * TODO: This object should
-                                       * finally become private.
                                         */
       std::auto_ptr<Epetra_FECrsMatrix> matrix;
 
@@ -2455,6 +2514,59 @@ namespace TrilinosWrappers
   }
 
 
+
+  inline
+  const Epetra_CrsMatrix &
+  SparseMatrix::trilinos_matrix () const
+  {
+    return static_cast<Epetra_CrsMatrix&>(*matrix);
+  }
+
+
+
+  inline
+  const Epetra_CrsGraph &
+  SparseMatrix::trilinos_sparsity_pattern () const
+  {
+    return matrix->Graph();
+  }
+
+
+
+  inline
+  const Epetra_Map &
+  SparseMatrix::domain_partitioner () const
+  {
+    return matrix->DomainMap();
+  }
+
+
+
+  inline
+  const Epetra_Map &
+  SparseMatrix::range_partitioner () const
+  {
+    return matrix->RangeMap();
+  }
+
+
+
+  inline
+  const Epetra_Map &
+  SparseMatrix::row_partitioner () const
+  {
+    return matrix->RowMap();
+  }
+
+
+
+  inline
+  const Epetra_Map &
+  SparseMatrix::col_partitioner () const
+  {
+    return matrix->ColMap();
+  }
+
 #endif // DOXYGEN      
 }
 
index 461550176b5f1fbb806d793165f6648afaf82c3f..bf4e2ca5f5a83045225327cb88c59e48dfb5878f 100755 (executable)
@@ -811,6 +811,63 @@ namespace TrilinosWrappers
                const unsigned int    n_cols,
                const unsigned int   *col_indices);
 //@}
+/**
+ * @name Access of underlying Trilinos data
+ */
+//@{
+
+                                       /**
+                                        * Return a const reference to the
+                                        * underlying Trilinos
+                                        * Epetra_CrsGraph data that stores
+                                        * the sparsity pattern.
+                                        */
+      const Epetra_CrsGraph & trilinos_sparsity_pattern () const;
+
+                                       /**
+                                        * Return a const reference to the
+                                        * underlying Trilinos Epetra_Map
+                                        * that sets the parallel
+                                        * partitioning of the domain space
+                                        * of this sparsity pattern, i.e.,
+                                        * the partitioning of the vectors
+                                        * matrices based on this sparsity
+                                        * pattern are multiplied with.
+                                        */
+      const Epetra_Map & domain_partitioner () const;
+
+                                       /**
+                                        * Return a const reference to the
+                                        * underlying Trilinos Epetra_Map
+                                        * that sets the partitioning of the
+                                        * range space of this sparsity
+                                        * pattern, i.e., the partitioning of
+                                        * the vectors that are result from
+                                        * matrix-vector products.
+                                        */
+      const Epetra_Map & range_partitioner () const;
+
+                                       /**
+                                        * Return a const reference to the
+                                        * underlying Trilinos Epetra_Map
+                                        * that sets the partitioning of the
+                                        * sparsity pattern rows. Equal to
+                                        * the partitioning of the range.
+                                        */
+      const Epetra_Map & row_partitioner () const;
+
+                                       /**
+                                        * Return a const reference to the
+                                        * underlying Trilinos Epetra_Map
+                                        * that sets the partitioning of the
+                                        * sparsity pattern columns. This is
+                                        * in general not equal to the
+                                        * partitioner Epetra_Map for the
+                                        * domain because of overlap in the
+                                        * matrix.
+                                        */
+      const Epetra_Map & col_partitioner () const;
+//@}
 /**
  * @name Iterators
  */
@@ -1021,7 +1078,6 @@ namespace TrilinosWrappers
                                        */
       unsigned int row_in_cache;
 
-      friend class SparseMatrix;
       friend class SparsityPatternIterators::const_iterator;
       friend class SparsityPatternIterators::const_iterator::Accessor;
   };
@@ -1309,7 +1365,7 @@ namespace TrilinosWrappers
     if (n_cols == 0)
       return;
 
-    int * col_index_ptr = (int*)col_indices;
+    int * col_index_ptr = (int*)(col_indices);
     compressed = false;
 
     int ierr;
@@ -1320,25 +1376,17 @@ namespace TrilinosWrappers
                                   // Epetra_CrsGraph input function, which
                                   // is much faster than the
                                   // Epetra_FECrsGraph function.
-    if (row_map.MyGID(row) == true)
-      ierr = graph->Epetra_CrsGraph::InsertGlobalIndices(row, 
-                                                        n_cols,
-                                                        col_index_ptr);
-    else
+    //if (row_map.MyGID(row) == true)
+    //ierr = graph->Epetra_CrsGraph::InsertGlobalIndices(row, 
+    //                                          n_cols,
+    //                                          col_index_ptr);
+    //else
       {
                                   // When we're at off-processor data, we
                                   // have to stick with the standard
-                                  // SumIntoGlobalValues
-                                  // function. Nevertheless, the way we
-                                  // call it is the fastest one (any other
-                                  // will lead to repeated allocation and
-                                  // deallocation of memory in order to
-                                  // call the function we already use,
-                                  // which is very unefficient if writing
-                                  // one element at a time).
-
-       ierr = graph->InsertGlobalIndices (1, (int*)&row, n_cols, 
-                                          col_index_ptr);
+                                  // SumIntoGlobalValues method.
+
+       ierr = graph->InsertGlobalIndices (1, (int*)&row, n_cols, col_index_ptr);
       }
 
     //Assert (ierr <= 0, ExcAccessToNonPresentElement(row, col_index_ptr[0]));
@@ -1346,6 +1394,51 @@ namespace TrilinosWrappers
   }
 
 
+
+  inline
+  const Epetra_CrsGraph &
+  SparsityPattern::trilinos_sparsity_pattern () const
+  {
+    return static_cast<Epetra_CrsGraph&>(*graph);
+  }
+
+
+
+  inline
+  const Epetra_Map &
+  SparsityPattern::domain_partitioner () const
+  {
+    return (Epetra_Map &) graph->DomainMap();
+  }
+
+
+
+  inline
+  const Epetra_Map &
+  SparsityPattern::range_partitioner () const
+  {
+    return (Epetra_Map &) graph->RangeMap();
+  }
+
+
+
+  inline
+  const Epetra_Map &
+  SparsityPattern::row_partitioner () const
+  {
+    return (Epetra_Map &) graph->RowMap();
+  }
+
+
+
+  inline
+  const Epetra_Map &
+  SparsityPattern::col_partitioner () const
+  {
+    return (Epetra_Map &) graph->ColMap();
+  }
+
+
 #endif // DOXYGEN      
 }
 
index 268f6e2cc816dc59afcd5681196fba93d087fe00..a9890a017feb6db8c48d2d0aaaf93434a16db26a 100644 (file)
@@ -798,6 +798,28 @@ namespace TrilinosWrappers
                                        */
                                       //@{
 
+                                       /**
+                                        * Return a const reference to the
+                                        * underlying Trilinos
+                                        * Epetra_MultiVector class.
+                                        */
+      const Epetra_MultiVector & trilinos_vector () const;
+
+                                       /**
+                                        * Return a (modifyable) reference to
+                                        * the underlying Trilinos
+                                        * Epetra_FEVector class.
+                                        */
+      Epetra_FEVector & trilinos_vector ();
+
+                                       /**
+                                        * Return a const reference to the
+                                        * underlying Trilinos Epetra_Map
+                                        * that sets the parallel
+                                        * partitioning of the vector.
+                                        */
+      const Epetra_Map & vector_partitioner () const;
+
                                       /**
                                        *  Output of vector in
                                        *  user-defined format in analogy
@@ -914,13 +936,10 @@ namespace TrilinosWrappers
                                        */
       bool compressed;
 
-    public:
                                        /**
                                         * An Epetra distibuted vector
                                         * type. Requires an existing
                                         * Epetra_Map for storing data.
-                                        * TODO: Should become private
-                                        * at some point.
                                         */
       std::auto_ptr<Epetra_FEVector> vector;
 
@@ -1191,6 +1210,32 @@ namespace TrilinosWrappers
   }
 
 
+
+  inline
+  const Epetra_MultiVector &
+  VectorBase::trilinos_vector () const
+  {
+    return static_cast<Epetra_MultiVector &>(*vector);
+  }
+
+
+
+  inline
+  Epetra_FEVector &
+  VectorBase::trilinos_vector ()
+  {
+    return *vector;
+  }
+
+
+
+  inline
+  const Epetra_Map &
+  VectorBase::vector_partitioner () const
+  {
+    return (Epetra_Map &)vector->Map();
+  }
+
 #endif // DOXYGEN
 
 }
index b3f6c2515efef47bcc6ea8f6b26400c1cdd542b7..c6aad6382717ae64f2e0d05c7b3c316ed3ab0da0 100644 (file)
@@ -196,7 +196,7 @@ Vector<Number>::Vector (const TrilinosWrappers::MPI::Vector &v)
                                        // and copy it
       TrilinosScalar **start_ptr;
 
-      int ierr = localized_vector.vector->ExtractView (&start_ptr);
+      int ierr = localized_vector.trilinos_vector().ExtractView (&start_ptr);
       AssertThrow (ierr == 0, ExcTrilinosError(ierr));
       
       std::copy (start_ptr[0], start_ptr[0]+vec_size, begin());
@@ -222,7 +222,7 @@ Vector<Number>::Vector (const TrilinosWrappers::Vector &v)
                                        // and copy it
       TrilinosScalar **start_ptr;
 
-      int ierr = v.vector->ExtractView (&start_ptr);
+      int ierr = v.trilinos_vector().ExtractView (&start_ptr);
       AssertThrow (ierr == 0, ExcTrilinosError(ierr));
       
       std::copy (start_ptr[0], start_ptr[0]+vec_size, begin());
@@ -723,7 +723,7 @@ Vector<Number>::operator = (const TrilinosWrappers::Vector &v)
                                        // get a representation of the vector
                                        // and copy it
       TrilinosScalar **start_ptr;
-      int ierr = v.vector->ExtractView (&start_ptr);
+      int ierr = v.trilinos_vector().ExtractView (&start_ptr);
       AssertThrow (ierr == 0, ExcTrilinosError(ierr));
       
       std::copy (start_ptr[0], start_ptr[0]+vec_size, begin());
index 6198f20bcca0e3ee7277d73cbc2b5c7bf4be9deb..5019b3fc8c3b8a21e300f84ef05bca2f90a3de83 100755 (executable)
@@ -65,12 +65,13 @@ namespace TrilinosWrappers
   PreconditionBase::vmult (VectorBase       &dst,
                           const VectorBase &src) const
   {
-    Assert (dst.vector->Map().SameAs(preconditioner->OperatorRangeMap()),
+    Assert (dst.vector_partitioner().SameAs(preconditioner->OperatorRangeMap()),
            ExcNonMatchingMaps("dst"));
-    Assert (src.vector->Map().SameAs(preconditioner->OperatorDomainMap()),
+    Assert (src.vector_partitioner().SameAs(preconditioner->OperatorDomainMap()),
            ExcNonMatchingMaps("src"));
     
-    const int ierr = preconditioner->ApplyInverse (*src.vector, *dst.vector);
+    const int ierr = preconditioner->ApplyInverse (src.trilinos_vector(), 
+                                                  dst.trilinos_vector());
     AssertThrow (ierr == 0, ExcTrilinosError(ierr));
   }
 
@@ -133,8 +134,10 @@ namespace TrilinosWrappers
     preconditioner.release();
     ifpack.release();
 
-    ifpack = Teuchos::rcp (Ifpack().Create ("point relaxation", 
-                                           &*matrix.matrix, 0));
+    ifpack = Teuchos::rcp (Ifpack().Create 
+                          ("point relaxation", 
+                           const_cast<Epetra_CrsMatrix*>(&matrix.trilinos_matrix()), 
+                           0));
 
     Assert (&*ifpack != 0, ExcMessage ("Trilinos could not create this "
                                       "preconditioner"));
@@ -183,9 +186,10 @@ namespace TrilinosWrappers
     preconditioner.release();
     ifpack.release();
 
-    ifpack = Teuchos::rcp (Ifpack().Create ("point relaxation",
-                                           &*matrix.matrix, 
-                                           additional_data.overlap));
+    ifpack = Teuchos::rcp (Ifpack().Create 
+                          ("point relaxation",
+                           const_cast<Epetra_CrsMatrix*>(&matrix.trilinos_matrix()), 
+                           additional_data.overlap));
 
     Assert (&*ifpack != 0, ExcMessage ("Trilinos could not create this "
                                       "preconditioner"));
@@ -235,9 +239,10 @@ namespace TrilinosWrappers
     preconditioner.release();
     ifpack.release();
 
-    ifpack = Teuchos::rcp (Ifpack().Create ("point relaxation",
-                                           &*matrix.matrix, 
-                                           additional_data.overlap));
+    ifpack = Teuchos::rcp (Ifpack().Create 
+                          ("point relaxation",
+                           const_cast<Epetra_CrsMatrix*>(&matrix.trilinos_matrix()), 
+                           additional_data.overlap));
 
     Assert (&*ifpack != 0, ExcMessage ("Trilinos could not create this "
                                       "preconditioner"));
@@ -289,8 +294,10 @@ namespace TrilinosWrappers
     preconditioner.release();
     ifpack.release();
 
-    ifpack = Teuchos::rcp (Ifpack().Create ("IC", &*matrix.matrix, 
-                                           additional_data.overlap));
+    ifpack = Teuchos::rcp (Ifpack().Create 
+                          ("IC", 
+                           const_cast<Epetra_CrsMatrix*>(&matrix.trilinos_matrix()), 
+                           additional_data.overlap));
 
     Assert (&*ifpack != 0, ExcMessage ("Trilinos could not create this "
                                       "preconditioner"));
@@ -340,8 +347,10 @@ namespace TrilinosWrappers
     preconditioner.release();
     ifpack.release();
 
-    ifpack = Teuchos::rcp (Ifpack().Create ("ILU", &*matrix.matrix, 
-                                           additional_data.overlap));
+    ifpack = Teuchos::rcp (Ifpack().Create 
+                          ("ILU", 
+                           const_cast<Epetra_CrsMatrix*>(&matrix.trilinos_matrix()), 
+                           additional_data.overlap));
 
     Assert (&*ifpack != 0, ExcMessage ("Trilinos could not create this "
                                       "preconditioner"));
@@ -393,8 +402,10 @@ namespace TrilinosWrappers
     preconditioner.release();
     ifpack.release();
 
-    ifpack = Teuchos::rcp (Ifpack().Create ("ILUT", &*matrix.matrix, 
-                                           additional_data.overlap));
+    ifpack = Teuchos::rcp (Ifpack().Create 
+                          ("ILUT", 
+                           const_cast<Epetra_CrsMatrix*>(&matrix.trilinos_matrix()), 
+                           additional_data.overlap));
 
     Assert (&*ifpack != 0, ExcMessage ("Trilinos could not create this "
                                       "preconditioner"));
@@ -439,8 +450,10 @@ namespace TrilinosWrappers
     preconditioner.release();
     ifpack.release();
 
-    ifpack = Teuchos::rcp (Ifpack().Create ("Amesos", &*matrix.matrix, 
-                                           additional_data.overlap));
+    ifpack = Teuchos::rcp (Ifpack().Create 
+                          ("Amesos", 
+                           const_cast<Epetra_CrsMatrix*>(&matrix.trilinos_matrix()), 
+                           additional_data.overlap));
     Assert (&*ifpack != 0, ExcMessage ("Trilinos could not create this "
                                       "preconditioner"));
 
@@ -490,7 +503,7 @@ namespace TrilinosWrappers
     preconditioner.release();
     ifpack.release();
 
-    ifpack = Teuchos::rcp (new Ifpack_Chebyshev(&*matrix.matrix));
+    ifpack = Teuchos::rcp (new Ifpack_Chebyshev (&matrix.trilinos_matrix()));
     Assert (&*ifpack != 0, ExcMessage ("Trilinos could not create this "
                                       "preconditioner"));
 
@@ -610,7 +623,7 @@ namespace TrilinosWrappers
     else
       parameter_list.set("ML output", 0);  
 
-    const Epetra_Map & domain_map = matrix.matrix->DomainMap();
+    const Epetra_Map & domain_map = matrix.domain_partitioner();
     
     Epetra_MultiVector distributed_constant_modes (domain_map, 
                                                   constant_modes_dimension);
@@ -649,7 +662,8 @@ namespace TrilinosWrappers
       }
 
     multilevel_operator = Teuchos::rcp (new ML_Epetra::MultiLevelPreconditioner(
-                                       *matrix.matrix, parameter_list, true));
+                                       matrix.trilinos_matrix(), parameter_list,
+                                       true));
 
     if (additional_data.output_details)
       multilevel_operator->PrintUnused(0);
index b2e6b0cec2134637159b6301184730fb66484ccf..e313aa660daccad77d453ecabd6df122b977d07a 100755 (executable)
@@ -61,7 +61,7 @@ namespace TrilinosWrappers
                                        // (Thyra wrapper around the
                                        // matrix).
     Teuchos::RCP<const Thyra::LinearOpBase<double> > tmpM = 
-      Thyra::epetraLinearOp(Teuchos::rcp(&*input_M.matrix, false));
+      Thyra::epetraLinearOp(Teuchos::rcp(&input_M.trilinos_matrix(), false));
 
     Teuchos::RCP<const Thyra::LinearOpSourceBase<double> > M 
       = Teuchos::rcp(new Thyra::DefaultLinearOpSource<double>(tmpM), true);
@@ -333,7 +333,8 @@ namespace TrilinosWrappers
     else
       {
        Teuchos::RCP<const Thyra::LinearOpBase<double> >
-         tmpFp = Thyra::epetraLinearOp(Teuchos::rcp(&*Fp_matrix.matrix,false));
+         tmpFp = Thyra::epetraLinearOp(Teuchos::rcp(&Fp_matrix.trilinos_matrix(),
+                                                    false));
        Fp_op = tmpFp;
       }
 
@@ -366,12 +367,12 @@ namespace TrilinosWrappers
                                        // gradient and divergence
                                        // operators in Thyra format.
     Teuchos::RCP<const Thyra::LinearOpBase<double> > tmpS01 = 
-      Thyra::epetraLinearOp(Teuchos::rcp(&*system_matrix.block(0,1).matrix
+      Thyra::epetraLinearOp(Teuchos::rcp(&system_matrix.block(0,1).trilinos_matrix()
                                         false));
     Thyra::ConstLinearOperator<double> S01 = tmpS01;
 
     Teuchos::RCP<const Thyra::LinearOpBase<double> > tmpS10 = 
-      Thyra::epetraLinearOp(Teuchos::rcp(&*system_matrix.block(1,0).matrix
+      Thyra::epetraLinearOp(Teuchos::rcp(&system_matrix.block(1,0).trilinos_matrix()
                                         false));
     Thyra::ConstLinearOperator<double> S10 = tmpS10;
 
index d22462b4b7a380ed37f19bf664da5d99480bdda7..81097f8f104f483f8ef4f64399da8b93c9c531d3 100644 (file)
@@ -81,9 +81,10 @@ namespace TrilinosWrappers
                                        // to let the AztecOO solver
                                        // know about the matrix and
                                        // vectors.
-    linear_problem = std::auto_ptr<Epetra_LinearProblem> (
-                             new Epetra_LinearProblem(&*(A.matrix), &*x.vector,
-                                                      &*b.vector));
+    linear_problem = std::auto_ptr<Epetra_LinearProblem> 
+      (new Epetra_LinearProblem(const_cast<Epetra_CrsMatrix*>(&A.trilinos_matrix()), 
+                               &x.trilinos_vector(),
+                               const_cast<Epetra_MultiVector*>(&b.trilinos_vector())));
 
                                        // Next we can allocate the
                                        // AztecOO solver...
@@ -164,11 +165,11 @@ namespace TrilinosWrappers
            ExcDimensionMismatch(b.size(), A.m()));
     Assert (A.local_range ().second == A.m(),
            ExcMessage ("Can only work in serial when using deal.II vectors."));
-    Assert (A.matrix->Filled(),
+    Assert (A.trilinos_matrix().Filled(),
            ExcMessage ("Matrix is not compressed. Call compress() method."));
 
-    Epetra_Vector ep_x (View, A.matrix->DomainMap(), x.begin());
-    Epetra_Vector ep_b (View, A.matrix->RangeMap(), const_cast<double*>(b.begin()));
+    Epetra_Vector ep_x (View, A.domain_partitioner(), x.begin());
+    Epetra_Vector ep_b (View, A.range_partitioner(), const_cast<double*>(b.begin()));
 
                                        // We need an
                                        // Epetra_LinearProblem object
@@ -176,7 +177,8 @@ namespace TrilinosWrappers
                                        // know about the matrix and
                                        // vectors.
     linear_problem = std::auto_ptr<Epetra_LinearProblem> 
-      (new Epetra_LinearProblem(&*(A.matrix), &ep_x, &ep_b));
+      (new Epetra_LinearProblem
+       (const_cast<Epetra_CrsMatrix*>(&A.trilinos_matrix()), &ep_x, &ep_b));
 
                                        // Next we can allocate the
                                        // AztecOO solver...
@@ -398,9 +400,10 @@ namespace TrilinosWrappers
                                        // to let the AztecOO solver
                                        // know about the matrix and
                                        // vectors.
-    linear_problem = std::auto_ptr<Epetra_LinearProblem> (
-                             new Epetra_LinearProblem(&*(A.matrix), &*x.vector,
-                                                      &*b.vector));
+    linear_problem = std::auto_ptr<Epetra_LinearProblem>
+      (new Epetra_LinearProblem(const_cast<Epetra_CrsMatrix*>(&A.trilinos_matrix()), 
+                               &x.trilinos_vector(),
+                               const_cast<Epetra_MultiVector*>(&b.trilinos_vector())));
 
                                        // Next we can allocate the
                                        // AztecOO solver...
@@ -456,8 +459,8 @@ namespace TrilinosWrappers
            ExcDimensionMismatch(b.size(), A.m()));
     Assert (A.local_range ().second == A.m(),
            ExcMessage ("Can only work in serial when using deal.II vectors."));
-    Epetra_Vector ep_x (View, A.matrix->DomainMap(), x.begin());
-    Epetra_Vector ep_b (View, A.matrix->RangeMap(), const_cast<double*>(b.begin()));
+    Epetra_Vector ep_x (View, A.domain_partitioner(), x.begin());
+    Epetra_Vector ep_b (View, A.range_partitioner(), const_cast<double*>(b.begin()));
 
                                        // We need an
                                        // Epetra_LinearProblem object
@@ -465,7 +468,8 @@ namespace TrilinosWrappers
                                        // know about the matrix and
                                        // vectors.
     linear_problem = std::auto_ptr<Epetra_LinearProblem> 
-      (new Epetra_LinearProblem(&*(A.matrix), &ep_x, &ep_b));
+      (new Epetra_LinearProblem
+       (const_cast<Epetra_CrsMatrix*>(&A.trilinos_matrix()), &ep_x, &ep_b));
 
                                        // Next we can allocate the
                                        // AztecOO solver...
index 63b374fa740929eefc1402ca848ad87d435aa90e..a9f1ed8faa1762c5ea6d6697244962a74b10ef0a 100644 (file)
@@ -104,9 +104,9 @@ namespace TrilinosWrappers
     MPI::BlockVector tmpb (b.n_blocks());
     for (unsigned int i=0; i<x.n_blocks(); ++i)
       {
-       tmpx.block(i).reinit (A.block(i,i).matrix->DomainMap(), false);
+       tmpx.block(i).reinit (A.block(i,i).domain_partitioner(), false);
        tmpx.block(i) = x.block(i);
-       tmpb.block(i).reinit (A.block(i,i).matrix->RangeMap(), false);
+       tmpb.block(i).reinit (A.block(i,i).range_partitioner(), false);
        tmpb.block(i) = b.block(i);
       }
     tmpx.collect_sizes();
@@ -153,9 +153,9 @@ namespace TrilinosWrappers
 
     for (unsigned int i=0; i<n_rows; ++i)
       {
-       AssertThrow (input_x.block(i).vector->Map().UniqueGIDs() == true,
+       AssertThrow (input_x.block(i).vector_partitioner().UniqueGIDs() == true,
                     ExcOverlappingMaps("vector", "x"));
-       AssertThrow (input_b.block(i).vector->Map().UniqueGIDs() == true,
+       AssertThrow (input_b.block(i).vector_partitioner().UniqueGIDs() == true,
                     ExcOverlappingMaps("vector", "b"));
        for (unsigned int j=0; j<n_cols; ++j)
          {
@@ -164,8 +164,8 @@ namespace TrilinosWrappers
              i_str << i;
              std::ostringstream error_component;
              error_component << "x.block(" << i_str.str() << ")";
-             AssertThrow (input_x.block(j).vector->Map().SameAs(
-                            input_A.block(i,j).matrix->DomainMap()) == true,
+             AssertThrow (input_x.block(j).vector_partitioner().SameAs(
+                            input_A.block(i,j).domain_partitioner()) == true,
                           ExcNonMatchingMaps (error_component.str()));
            }
            {
@@ -173,8 +173,8 @@ namespace TrilinosWrappers
              i_str << j;
              std::ostringstream error_component;
              error_component << "b.block(" << i_str.str() << ")";
-             AssertThrow (input_b.block(i).vector->Map().SameAs(
-                            input_A.block(i,j).matrix->RangeMap()) == true,
+             AssertThrow (input_b.block(i).vector_partitioner().SameAs(
+                            input_A.block(i,j).range_partitioner()) == true,
                           ExcNonMatchingMaps (error_component.str()));
            }
          }
@@ -196,8 +196,8 @@ namespace TrilinosWrappers
       {
        Teuchos::RCP<const Thyra::VectorSpaceBase<double> > tmp_space
          = Thyra::create_VectorSpace(
-                   Teuchos::rcp(&input_A.block(i,i).matrix->DomainMap(), 
-                                false));
+                                     Teuchos::rcp(&input_A.block(i,i).domain_partitioner(), 
+                                                  false));
 
        epetra_vector_spaces.push_back(tmp_space);
       }
@@ -212,7 +212,7 @@ namespace TrilinosWrappers
       for (unsigned int j=0; j<n_cols; ++j)
        {
          Teuchos::RCP<const Thyra::LinearOpBase<double> > 
-           A_ij = Thyra::epetraLinearOp(Teuchos::rcp(&*input_A.block(i,j).matrix
+           A_ij = Thyra::epetraLinearOp(Teuchos::rcp(&input_A.block(i,j).trilinos_matrix()
                                                      false));
          tmpA->setBlock(i, j, A_ij);
        }
@@ -229,14 +229,15 @@ namespace TrilinosWrappers
     Thyra::Vector<double> sol = A.domain().createMember();
     for (unsigned int i=0; i<n_rows; ++i)
       {
-       Epetra_Vector *block_ptr = (*input_b.block(i).vector)(0);
+       Epetra_Vector *block_ptr = const_cast<Epetra_Vector*>
+         ((input_b.block(i).trilinos_vector())(0));
        Teuchos::RCP<Thyra::VectorBase<double> > tmp_rhs_i
          = Thyra::create_Vector(Teuchos::rcp(block_ptr, false), 
                                 epetra_vector_spaces[i]);
        const Thyra::Vector<double> rhs_i = tmp_rhs_i;
        rhs.setBlock(i, rhs_i);
 
-       block_ptr = (*input_x.block(i).vector)(0);
+       block_ptr = (input_x.block(i).trilinos_vector())(0);
        Teuchos::RCP<Thyra::VectorBase<double> > tmp_sol_i
          = Thyra::create_Vector(Teuchos::rcp(block_ptr, false), 
                                 epetra_vector_spaces[i]);
index c22d34781da22b4a740730de3a8dfc4cfaec3c6c..bdd7c77a2b35b6d7ff08b364d9a2f56197bb8028 100755 (executable)
@@ -53,8 +53,9 @@ namespace TrilinosWrappers
       TrilinosScalar *values = new TrilinosScalar(colnums);
       
       int ierr;
-      ierr = matrix->matrix->ExtractGlobalRowCopy((int)this->a_row, colnums,  
-                                                 ncols, &(values[0]));
+      ierr = matrix->trilinos_matrix().ExtractGlobalRowCopy((int)this->a_row, 
+                                                           colnums,  
+                                                           ncols, &(values[0]));
       AssertThrow (ierr == 0, ExcTrilinosError(ierr));
 
                                  // copy it into our caches if the
@@ -213,14 +214,16 @@ namespace TrilinosWrappers
   SparseMatrix::SparseMatrix (const SparsityPattern &InputSP)
                  :
                   Subscriptor(),
-                  row_map (InputSP.row_map),
-                 col_map (InputSP.col_map),
+                  row_map (InputSP.range_partitioner()),
+                 col_map (InputSP.domain_partitioner()),
                  last_action (Zero),
                  compressed (true),
                  matrix (std::auto_ptr<Epetra_FECrsMatrix>
-                         (new Epetra_FECrsMatrix(Copy, *InputSP.graph, false)))
+                         (new Epetra_FECrsMatrix(Copy, 
+                                                 InputSP.trilinos_sparsity_pattern(), 
+                                                 false)))
   {
-    Assert(InputSP.graph->Filled() == true,
+    Assert(InputSP.trilinos_sparsity_pattern().Filled() == true,
           ExcMessage("The Trilinos sparsity pattern has not been compressed."));
     compress();
   }
@@ -543,14 +546,15 @@ namespace TrilinosWrappers
   {
     matrix.reset();
 
-    row_map = sparsity_pattern.row_map;
-    col_map = sparsity_pattern.col_map;
+    row_map = sparsity_pattern.range_partitioner();
+    col_map = sparsity_pattern.domain_partitioner();
 
-    Assert (sparsity_pattern.graph->Filled() == true,
+    Assert (sparsity_pattern.trilinos_sparsity_pattern().Filled() == true,
            ExcMessage("The Trilinos sparsity pattern has not been compressed"));
 
     matrix = std::auto_ptr<Epetra_FECrsMatrix>
-      (new Epetra_FECrsMatrix(Copy, *sparsity_pattern.graph, false));
+      (new Epetra_FECrsMatrix(Copy, sparsity_pattern.trilinos_sparsity_pattern(),
+                             false));
 
     compress();
   }
@@ -565,7 +569,8 @@ namespace TrilinosWrappers
     row_map = sparse_matrix.row_map;
     col_map = sparse_matrix.col_map;
     matrix = std::auto_ptr<Epetra_FECrsMatrix>
-      (new Epetra_FECrsMatrix(Copy, sparse_matrix.matrix->Graph(), false));
+      (new Epetra_FECrsMatrix(Copy, sparse_matrix.trilinos_sparsity_pattern(), 
+                             false));
 
     compress();
   }
@@ -1135,12 +1140,13 @@ namespace TrilinosWrappers
     if (matrix->Filled() == false)
       matrix->FillComplete(col_map, row_map, true);
 
-    Assert (src.vector->Map().SameAs(matrix->DomainMap()) == true,
+    Assert (src.vector_partitioner().SameAs(matrix->DomainMap()) == true,
            ExcMessage ("Column map of matrix does not fit with vector map!"));
-    Assert (dst.vector->Map().SameAs(matrix->RangeMap()) == true,
+    Assert (dst.vector_partitioner().SameAs(matrix->RangeMap()) == true,
            ExcMessage ("Row map of matrix does not fit with vector map!"));
 
-    const int ierr = matrix->Multiply (false, *(src.vector), *(dst.vector));
+    const int ierr = matrix->Multiply (false, src.trilinos_vector(), 
+                                      dst.trilinos_vector());
     AssertThrow (ierr == 0, ExcTrilinosError(ierr));
   }
 
@@ -1155,12 +1161,13 @@ namespace TrilinosWrappers
     if (matrix->Filled() == false)
       matrix->FillComplete(col_map, row_map, true);
 
-    Assert (src.vector->Map().SameAs(matrix->RangeMap()) == true,
+    Assert (src.vector_partitioner().SameAs(matrix->RangeMap()) == true,
            ExcMessage ("Column map of matrix does not fit with vector map!"));
-    Assert (dst.vector->Map().SameAs(matrix->DomainMap()) == true,
+    Assert (dst.vector_partitioner().SameAs(matrix->DomainMap()) == true,
            ExcMessage ("Row map of matrix does not fit with vector map!"));
 
-    const int ierr = matrix->Multiply (true, *(src.vector), *(dst.vector));
+    const int ierr = matrix->Multiply (true, src.trilinos_vector(), 
+                                      dst.trilinos_vector());
     AssertThrow (ierr == 0, ExcTrilinosError(ierr));
   }
 
index 0bab6e5c051df466c85f435f0a79a7030b272d8b..ebeed0896fb4bdbf7d649681da6227ee1054ff13 100755 (executable)
@@ -235,16 +235,16 @@ namespace TrilinosWrappers
     Vector::import_nonlocal_data_for_fe (const TrilinosWrappers::SparseMatrix &m,
                                         const Vector                         &v)
     {
-      Assert (m.matrix->Filled() == true,
+      Assert (m.trilinos_matrix().Filled() == true,
              ExcMessage ("Matrix is not compressed. "
                          "Cannot find exchange information!"));
       Assert (v.vector->Map().UniqueGIDs() == true,
              ExcMessage ("The input vector has overlapping data, "
                          "which is not allowed."));
 
-      if (vector->Map().SameAs(m.matrix->ColMap()) == false)
+      if (vector->Map().SameAs(m.col_partitioner()) == false)
        {
-         map = m.matrix->ColMap();
+         map = m.col_partitioner();
          vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector(map));
        }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.