]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix some errors in the TrilinosWrapper.
authorBruno Turcksin <bruno.turcksin@gmail.com>
Tue, 12 Mar 2013 00:59:19 +0000 (00:59 +0000)
committerBruno Turcksin <bruno.turcksin@gmail.com>
Tue, 12 Mar 2013 00:59:19 +0000 (00:59 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@28861 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/types.h
deal.II/include/deal.II/lac/sparse_direct.h
deal.II/include/deal.II/lac/trilinos_block_sparse_matrix.h
deal.II/include/deal.II/lac/trilinos_sparse_matrix.h
deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h
deal.II/include/deal.II/lac/trilinos_vector.h
deal.II/include/deal.II/lac/trilinos_vector_base.h
deal.II/source/lac/trilinos_block_sparse_matrix.cc
deal.II/source/lac/trilinos_precondition.cc
deal.II/source/lac/trilinos_sparse_matrix.cc
deal.II/source/lac/trilinos_sparsity_pattern.cc

index 6cf53a84407053d30947d08fa5de2fd2b37a7644..544178d1720b0c53bea2acee0f3198192fb61dfc 100644 (file)
@@ -145,6 +145,7 @@ namespace TrilinosWrapper
 {
   namespace types
   {
+#define DEAL_II_EPETRA_NO_64BIT_GLOBAL_INDICES
 #ifdef DEAL_II_EPETRA_NO_64BIT_GLOBAL_INDICES
     /**
      * Declare type of integer used in the Epetra package of Trilinos.
index 14adaac7ce3eeaa8cb9c62def0862eb640604715..c4566f101b6b1dcbea9362195d865b00f9504d8c 100644 (file)
@@ -1071,6 +1071,11 @@ private:
 class SparseDirectUMFPACK : public Subscriptor
 {
 public:
+  /**
+   * Declare type for container size.
+   */
+  typedef types::global_dof_index size_type;
+
   /**
    * Dummy class needed for the
    * usual initalization interface
index 181a471786b72f2914d6aafef739c8d1fd52da0e..5f295a977a160a9ac18774c9be3d6c462bfe1a95 100644 (file)
@@ -70,11 +70,6 @@ namespace TrilinosWrappers
   class BlockSparseMatrix : public BlockMatrixBase<SparseMatrix>
   {
   public:
-    /**
-     * Declare the type for container size.
-     */
-    typedef types::global_dof_index size_type;
-
     /**
      * Typedef the base class for simpler
      * access to its own typedefs.
index 0910b7b1b319516e55a648d41738c4c694fcdb62..176910aa1412c614b86ea2ec06bc60513078c3ba 100644 (file)
@@ -511,6 +511,11 @@ namespace TrilinosWrappers
   class SparseMatrix : public Subscriptor
   {
   public:
+    /**
+     * Declare the type for container size.
+     */
+    typedef types::global_dof_index size_type;
+
     /**
      * A structure that describes
      * some of the traits of this
@@ -2651,7 +2656,7 @@ namespace TrilinosWrappers
 
 
     inline
-    size_type
+    AccessorBase::size_type
     AccessorBase::row() const
     {
       Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix());
@@ -2660,7 +2665,7 @@ namespace TrilinosWrappers
 
 
     inline
-    size_type
+    AccessorBase::size_type
     AccessorBase::column() const
     {
       Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix());
@@ -2669,7 +2674,7 @@ namespace TrilinosWrappers
 
 
     inline
-    size_type
+    AccessorBase::size_type
     AccessorBase::index() const
     {
       Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix());
@@ -3179,7 +3184,7 @@ namespace TrilinosWrappers
 
     TrilinosWrapper::types::int_type *col_index_ptr;
     TrilinosScalar const *col_value_ptr;
-    TrilinosWrapper::types::int_typeint_type n_columns;
+    TrilinosWrapper::types::int_type n_columns;
 
     // If we don't elide zeros, the pointers
     // are already available...
@@ -3516,7 +3521,7 @@ namespace TrilinosWrappers
   // called frequently and do only involve
   // a call to some Trilinos function.
   inline
-  size_type
+  SparseMatrix::size_type
   SparseMatrix::m () const
   {
     return matrix -> NumGlobalRows();
@@ -3525,7 +3530,7 @@ namespace TrilinosWrappers
 
 
   inline
-  size_type
+  SparseMatrix::size_type
   SparseMatrix::n () const
   {
     return matrix -> NumGlobalCols();
@@ -3534,7 +3539,7 @@ namespace TrilinosWrappers
 
 
   inline
-  size_type
+  SparseMatrix::size_type
   SparseMatrix::local_size () const
   {
     return matrix -> NumMyRows();
@@ -3543,7 +3548,7 @@ namespace TrilinosWrappers
 
 
   inline
-  std::pair<size_type, size_type>
+  std::pair<SparseMatrix::size_type, SparseMatrix::size_type>
   SparseMatrix::local_range () const
   {
     size_type begin, end;
@@ -3556,7 +3561,7 @@ namespace TrilinosWrappers
 
 
   inline
-  size_type
+  SparseMatrix::size_type
   SparseMatrix::n_nonzero_elements () const
   {
     return matrix->NumGlobalNonzeros();
index 09d601890c3a6d5f95fc277ccff90a8ed0268820..99b547e9271d841391ecb15d6b63a32d284de2b4 100644 (file)
@@ -183,6 +183,10 @@ namespace TrilinosWrappers
     class Iterator
     {
     public:
+      /**
+       * Declare type for container size.
+       */
+      typedef types::global_dof_index size_type;
 
       /**
        * Constructor. Create an
@@ -240,7 +244,7 @@ namespace TrilinosWrappers
        * Exception
        */
       DeclException2 (ExcInvalidIndexWithinRow,
-                      size_type, syze_type,
+                      size_type, size_type,
                       << "Attempt to access element " << arg2
                       << " of row " << arg1
                       << " which doesn't have that many elements.");
@@ -282,6 +286,11 @@ namespace TrilinosWrappers
   {
   public:
 
+    /**
+     * Declare type for container size.
+     */
+    typedef types::global_dof_index size_type;
+
     /**
      * Declare a typedef for the
      * iterator class.
@@ -572,7 +581,7 @@ namespace TrilinosWrappers
      */
     SparsityPattern (const Epetra_Map             &row_parallel_partitioning,
                      const Epetra_Map             &col_parallel_partitioning,
-                     const std::vector<size_tyoe> &n_entries_per_row);
+                     const std::vector<size_type> &n_entries_per_row);
 
     /**
      * Reinitialization function for
@@ -623,7 +632,7 @@ namespace TrilinosWrappers
      */
     void
     reinit (const Epetra_Map             &parallel_partitioning,
-            const std::vector<size_tyep> &n_entries_per_row);
+            const std::vector<size_type> &n_entries_per_row);
 
     /**
      * This reinit function is similar to
@@ -1399,7 +1408,7 @@ namespace TrilinosWrappers
 
 
     inline
-    size_type
+    Accessor::size_type
     Accessor::row() const
     {
       Assert (a_row < sparsity_pattern->n_rows(), ExcBeyondEndOfSparsityPattern());
@@ -1409,7 +1418,7 @@ namespace TrilinosWrappers
 
 
     inline
-    size_type
+    Accessor::size_type
     Accessor::column() const
     {
       Assert (a_row < sparsity_pattern->n_rows(), ExcBeyondEndOfSparsityPattern());
@@ -1419,7 +1428,7 @@ namespace TrilinosWrappers
 
 
     inline
-    size_type
+    Accessor::size_type
     Accessor::index() const
     {
       Assert (a_row < sparsity_pattern->n_rows(), ExcBeyondEndOfSparsityPattern());
@@ -1809,7 +1818,7 @@ namespace TrilinosWrappers
   SparsityPattern::reinit (const IndexSet     &row_parallel_partitioning,
                            const IndexSet     &col_parallel_partitioning,
                            const MPI_Comm     &communicator,
-                           const std::vector<TrilinosWrapper::types::int_type> &n_entries_per_row)
+                           const std::vector<size_type> &n_entries_per_row)
   {
     Epetra_Map row_map =
       row_parallel_partitioning.make_trilinos_map (communicator, false);
index bb3964e69782a7fdbdd7f388d95dcecb2a0a1b4f..7ce20c91a2e7717e3db1f1b83681bcaf9dfcc9ee 100644 (file)
@@ -520,7 +520,7 @@ namespace TrilinosWrappers
       // Need to copy out values, since the
       // deal.II might not use doubles, so
       // that a direct access is not possible.
-      for (Trilinos::Wrapper::Types::int_type i=0; i<size; ++i)
+      for (TrilinosWrapper::types::int_type i=0; i<size; ++i)
         (*vector)[0][i] = v(parallel_partitioner.GID(i));
     }
 
index 4b021208dc4f3e6180627e3fbf1cf8c079cf9711..1a33030c7d7fdc2b064411790cd27222ef445448 100644 (file)
@@ -65,6 +65,11 @@ namespace TrilinosWrappers
    */
   namespace internal
   {
+    /**
+     * Declare type for container size.
+     */
+    typedef types::global_dof_index size_type;
+
     /**
      * This class implements a
      * wrapper for accessing the
@@ -94,10 +99,6 @@ namespace TrilinosWrappers
                        const size_type  index);
 
     public:
-      /**
-       * Declare type for container size.
-       */
-      typedef types::global_dof_index size_type;
 
       /**
        * This looks like a copy
@@ -1072,8 +1073,8 @@ namespace TrilinosWrappers
   namespace internal
   {
     inline
-    VectorReference::VectorReference (VectorBase   &vector,
-                                      const size_t  index)
+    VectorReference::VectorReference (VectorBase      &vector,
+                                      const size_type  index)
       :
       vector (vector),
       index (index)
@@ -1381,7 +1382,7 @@ namespace TrilinosWrappers
     for (size_type i=0; i<n_elements; ++i)
       {
         const size_type row = indices[i];
-        const TrilinosWrapper::types::int_type local_row = vector->Map().LID(static_cast<TrilinosWrapper::Types::int_type>(row));
+        const TrilinosWrapper::types::int_type local_row = vector->Map().LID(static_cast<TrilinosWrapper::types::int_type>(row));
         if (local_row == -1)
           {
             const int ierr = vector->ReplaceGlobalValues (1,
@@ -1449,7 +1450,7 @@ namespace TrilinosWrappers
     for (size_type i=0; i<n_elements; ++i)
       {
         const size_type row = indices[i];
-        const TrilinosWrapper::types::int_type local_row = vector->Map().LID(static_cast<TrilinosWrapper::Types::int_type>(row));
+        const TrilinosWrapper::types::int_type local_row = vector->Map().LID(static_cast<TrilinosWrapper::types::int_type>(row));
         if (local_row == -1)
           {
             const int ierr = vector->SumIntoGlobalValues (1,
@@ -1466,7 +1467,7 @@ namespace TrilinosWrappers
 
 
   inline
-  size_type
+  VectorBase::size_type
   VectorBase::size () const
   {
     return (size_type) (vector->Map().MaxAllGID() + 1 -
@@ -1476,7 +1477,7 @@ namespace TrilinosWrappers
 
 
   inline
-  size_type
+  VectorBase::size_type
   VectorBase::local_size () const
   {
     return (size_type) vector->Map().NumMyElements();
@@ -1485,7 +1486,7 @@ namespace TrilinosWrappers
 
 
   inline
-  std::pair<size_type, size_type>
+  std::pair<VectorBase::size_type, VectorBase::size_type>
   VectorBase::local_range () const
   {
     TrilinosWrapper::types::int_type begin, end;
index ec72a3f67f57fcbbebe4fc3f9499c99a2f666cdb..7cd896a529dbb1ccd3138b5726ab2af304123abc 100644 (file)
@@ -260,7 +260,7 @@ namespace TrilinosWrappers
 
 
 
-  size_type
+  BlockSparseMatrix::size_type
   BlockSparseMatrix::n_nonzero_elements () const
   {
     size_type n_nonzero = 0;
index a0bdc3d167704df0311abd4ffc71bea3aef39879..b7c046c0544b315d3d2246a52a97d2f7be42c2e5 100644 (file)
@@ -695,7 +695,7 @@ namespace TrilinosWrappers
 
 
 
-  size_type
+  PreconditionAMG::size_type
   PreconditionAMG::memory_consumption() const
   {
     unsigned int memory = sizeof(this);
index 25e6f8665fdbbb94e7b050f31898e2415c7e5a69..d92784cee39b65def31fef9e748d7860ecaa69e4 100644 (file)
@@ -378,8 +378,8 @@ namespace TrilinosWrappers
       }
 
       void copy_row (const dealii::SparsityPattern &csp,
-                     const size_int                 row,
-                     std::vector<TrilinosWrapper::types::int_type>         &row_indices)
+                     const size_type                row,
+                     std::vector<TrilinosWrapper::types::int_type> &row_indices)
       {
         dealii::SparsityPattern::iterator col_num = csp.begin (row);
         for (size_type col=0; col_num != csp.end (row); ++col_num, ++col)
@@ -937,7 +937,7 @@ namespace TrilinosWrappers
 
 
 
-  size_type
+  SparseMatrix::size_type
   SparseMatrix::row_length (const size_type row) const
   {
     Assert (row < m(), ExcInternalError());
@@ -964,6 +964,8 @@ namespace TrilinosWrappers
 
   namespace internals
   {
+    typedef types::global_dof_index size_type;
+
     void perform_mmult (const SparseMatrix &inputleft,
                         const SparseMatrix &inputright,
                         SparseMatrix       &result,
@@ -1059,7 +1061,7 @@ namespace TrilinosWrappers
               inputleft.trilinos_sparsity_pattern().ExtractMyRowView(i, num_entries,
                                                                      indices);
               Assert (num_entries >= 0, ExcInternalError());
-              const sizretype GID = inputleft.row_partitioner().GID(i);
+              const size_type GID = inputleft.row_partitioner().GID(i);
               for (TrilinosWrapper::types::int_type j=0; j<num_entries; ++j)
                 sparsity_transposed.add (inputleft.col_partitioner().GID(indices[j]),
                                          GID);
@@ -1390,7 +1392,7 @@ namespace TrilinosWrappers
 
 
 
-  size_type
+  SparseMatrix::size_type
   SparseMatrix::memory_consumption () const
   {
     size_type static_memory = sizeof(this) + sizeof (*matrix)
index 08dcfc7df47524d6a9e9b490f5e05532b772876d..b6826e4fa62cf4b0d3c287d11d40b2f3d5a120de 100644 (file)
@@ -240,7 +240,7 @@ namespace TrilinosWrappers
   void
   SparsityPattern::reinit (const Epetra_Map   &input_row_map,
                            const Epetra_Map   &input_col_map,
-                           const std::vector<TrilinosWrapper::types::int_type> &n_entries_per_row)
+                           const std::vector<size_type> &n_entries_per_row)
   {
     // release memory before reallocation
     graph.reset ();
@@ -277,6 +277,7 @@ namespace TrilinosWrappers
   {
     namespace
     {
+      typedef types::global_dof_index size_type;
     // distinguish between compressed sparsity types that define row_begin()
     // and SparsityPattern that uses begin() as iterator type
       template <typename Sparsity>
@@ -324,7 +325,7 @@ namespace TrilinosWrappers
 
     const size_type first_row = input_row_map.MinMyGID(),
                        last_row = input_row_map.MaxMyGID()+1;
-    std::vector<TrilinosWrapper::type::int_type> n_entries_per_row(last_row - first_row);
+    std::vector<TrilinosWrapper::types::int_type> n_entries_per_row(last_row - first_row);
 
     for (size_type row=first_row; row<last_row; ++row)
       n_entries_per_row[row-first_row] = sp.row_length(row);
@@ -518,7 +519,7 @@ namespace TrilinosWrappers
 
 
 
-  size_type
+  SparsityPattern::size_type
   SparsityPattern::bandwidth () const
   {
     size_type local_b=0;
@@ -530,7 +531,7 @@ namespace TrilinosWrappers
         graph->ExtractMyRowView(i, num_entries, indices);
         for (size_type j=0; j<(size_type)num_entries; ++j)
           {
-            if (static_cast<size_type>(std::abs(static_cast<int_int>(i-indices[j]))) > local_b)
+            if (static_cast<size_type>(std::abs(static_cast<size_type>(i-indices[j]))) > local_b)
               local_b = std::abs(static_cast<size_type>(i-indices[j]));
           }
       }
@@ -540,7 +541,7 @@ namespace TrilinosWrappers
 
 
 
-  size_type
+  SparsityPattern::size_type
   SparsityPattern::n_rows () const
   {
     const TrilinosWrapper::types::int_type n_rows = graph -> NumGlobalRows();
@@ -549,7 +550,7 @@ namespace TrilinosWrappers
 
 
 
-  size_type
+  SparsityPattern::size_type
   SparsityPattern::n_cols () const
   {
     TrilinosWrapper::types::int_type n_cols;
@@ -563,7 +564,7 @@ namespace TrilinosWrappers
 
 
 
-  size_type
+  SparsityPattern::size_type
   SparsityPattern::local_size () const
   {
     TrilinosWrapper::types::int_type n_rows = graph -> NumMyRows();
@@ -573,7 +574,7 @@ namespace TrilinosWrappers
 
 
 
-  std::pair<size_type, size_type>
+  std::pair<SparsityPattern::size_type, SparsityPattern::size_type>
   SparsityPattern::local_range () const
   {
     size_type begin, end;
@@ -585,7 +586,7 @@ namespace TrilinosWrappers
 
 
 
-  size_type
+  SparsityPattern::size_type
   SparsityPattern::n_nonzero_elements () const
   {
     TrilinosWrapper::types::int_type nnz = graph->NumGlobalEntries();
@@ -595,7 +596,7 @@ namespace TrilinosWrappers
 
 
 
-  size_type
+  SparsityPattern::size_type
   SparsityPattern::max_entries_per_row () const
   {
     TrilinosWrapper::types::int_type nnz = graph->MaxNumIndices();
@@ -605,7 +606,7 @@ namespace TrilinosWrappers
 
 
 
-  size_type
+  SparsityPattern::size_type
   SparsityPattern::row_length (const size_type row) const
   {
     Assert (row < n_rows(), ExcInternalError());
@@ -669,7 +670,7 @@ namespace TrilinosWrappers
     Assert (graph->Filled() == true, ExcInternalError());
     for (size_type row=0; row<local_size(); ++row)
       {
-        signed TrilinosWrapper::types::int_type *indices;
+        TrilinosWrapper::types::int_type *indices;
         TrilinosWrapper::types::int_type num_entries;
         graph->ExtractMyRowView (row, num_entries, indices);
 
@@ -680,7 +681,7 @@ namespace TrilinosWrappers
           // x-y, that is we have to exchange
           // the order of output
           out << indices[graph->GRID(static_cast<TrilinosWrapper::types::int_type>(j))]
-            << " " << -static_cast<signed TrilinosWrapper::types::int_type>(row)
+            << " " << -static_cast<TrilinosWrapper::types::int_type>(row)
             << std::endl;
       }
 

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.