]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make Tpetra optional
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Tue, 5 Feb 2019 20:56:33 +0000 (21:56 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 20 Feb 2019 12:46:19 +0000 (13:46 +0100)
22 files changed:
cmake/configure/configure_2_trilinos.cmake
include/deal.II/base/config.h.in
include/deal.II/base/index_set.h
include/deal.II/dofs/dof_accessor.templates.h
include/deal.II/fe/fe_tools_extrapolate.templates.h
include/deal.II/fe/fe_tools_interpolate.templates.h
include/deal.II/lac/read_write_vector.h
include/deal.II/lac/read_write_vector.templates.h
include/deal.II/lac/trilinos_tpetra_communication_pattern.h
include/deal.II/lac/trilinos_tpetra_vector.h
include/deal.II/lac/vector_element_access.h
include/deal.II/multigrid/mg_transfer.h
source/base/index_set.cc
source/lac/trilinos_sparse_matrix.cc
source/lac/trilinos_tpetra_communication_pattern.cc
source/lac/trilinos_tpetra_vector.cc
tests/trilinos/tpetra_vector_01.mpirun=2.with_trilinos_with_tpetra=on.output [moved from tests/trilinos/tpetra_vector_01.mpirun=2.output with 100% similarity]
tests/trilinos/tpetra_vector_02.mpirun=2.with_trilinos_with_tpetra=on.output [moved from tests/trilinos/tpetra_vector_02.mpirun=2.output with 100% similarity]
tests/trilinos/tpetra_vector_03.with_trilinos_with_tpetra=on.with_complex_values=off.mpirun=2.output [moved from tests/trilinos/tpetra_vector_03.with_complex_values=off.mpirun=2.output with 100% similarity]
tests/trilinos/tpetra_vector_03.with_trilinos_with_tpetra=on.with_complex_values=off.mpirun=4.output [moved from tests/trilinos/tpetra_vector_03.with_complex_values=off.mpirun=4.output with 100% similarity]
tests/trilinos/tpetra_vector_03.with_trilinos_with_tpetra=on.with_complex_values=on.mpirun=2.output [moved from tests/trilinos/tpetra_vector_03.with_complex_values=on.mpirun=2.output with 100% similarity]
tests/trilinos/tpetra_vector_03.with_trilinos_with_tpetra=on.with_complex_values=on.mpirun=4.output [moved from tests/trilinos/tpetra_vector_03.with_complex_values=on.mpirun=4.output with 100% similarity]

index c159fe255270ddf74655ca2562b943591bd32ce5..eca8862a0a409104835b79168827204f24aab412 100644 (file)
@@ -42,7 +42,7 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var)
       )
 
     FOREACH(_module
-        Amesos Epetra Ifpack AztecOO Teuchos Tpetra ML MueLu
+        Amesos Epetra Ifpack AztecOO Teuchos ML MueLu
       )
       ITEM_MATCHES(_module_found ${_module} ${Trilinos_PACKAGE_LIST})
       IF(_module_found)
@@ -146,7 +146,7 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var)
     CHECK_MPI_INTERFACE(TRILINOS ${var})
 
     IF (${var})
-      FOREACH(_optional_module EpetraExt ROL Sacado Zoltan)
+      FOREACH(_optional_module EpetraExt ROL Sacado Tpetra Zoltan)
       ITEM_MATCHES(_module_found ${_optional_module} ${Trilinos_PACKAGE_LIST})
       IF(_module_found)
           MESSAGE(STATUS "Found ${_optional_module}")
@@ -227,8 +227,10 @@ MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL)
   SET(DEAL_II_EXPAND_TRILINOS_MPI_VECTOR "TrilinosWrappers::MPI::Vector")
   IF (TRILINOS_WITH_MPI)
     SET(DEAL_II_EXPAND_EPETRA_VECTOR "LinearAlgebra::EpetraWrappers::Vector")
-    SET(DEAL_II_EXPAND_TPETRA_VECTOR_DOUBLE "LinearAlgebra::TpetraWrappers::Vector<double>")
-    SET(DEAL_II_EXPAND_TPETRA_VECTOR_FLOAT "LinearAlgebra::TpetraWrappers::Vector<float>")
+    IF (${DEAL_II_TRILINOS_WITH_TPETRA})
+      SET(DEAL_II_EXPAND_TPETRA_VECTOR_DOUBLE "LinearAlgebra::TpetraWrappers::Vector<double>")
+      SET(DEAL_II_EXPAND_TPETRA_VECTOR_FLOAT "LinearAlgebra::TpetraWrappers::Vector<float>")
+    ENDIF()
   ENDIF()
   IF(${DEAL_II_TRILINOS_WITH_SACADO})
     # Note: Only CMake 3.0 and greater support line continuation with the "\" character
index 23690507599dcead59881a8c7b65f288b8c51fc1..6cf6971a90f7fbacaa6fb7ba2b4aa572c415bb06 100644 (file)
 #cmakedefine DEAL_II_TRILINOS_WITH_EPETRAEXT
 #cmakedefine DEAL_II_TRILINOS_WITH_ROL
 #cmakedefine DEAL_II_TRILINOS_WITH_SACADO
+#cmakedefine DEAL_II_TRILINOS_WITH_TPETRA
 #cmakedefine DEAL_II_TRILINOS_WITH_ZOLTAN
 
 
index afb90fe2d784cf9502f231ff0542d5b3e6488fbb..4800633ada5dfbbd089a68eabc530fe350907100 100644 (file)
@@ -31,7 +31,9 @@
 
 #ifdef DEAL_II_WITH_TRILINOS
 #  include <Epetra_Map.h>
-#  include <Tpetra_Map.hpp>
+#  ifdef DEAL_II_TRILINOS_WITH_TPETRA
+#    include <Tpetra_Map.hpp>
+#  endif
 #endif
 
 #if defined(DEAL_II_WITH_MPI) || defined(DEAL_II_WITH_PETSC)
@@ -448,9 +450,11 @@ public:
   make_trilinos_map(const MPI_Comm &communicator = MPI_COMM_WORLD,
                     const bool      overlapping  = false) const;
 
+#  ifdef DEAL_II_TRILINOS_WITH_TPETRA
   Tpetra::Map<int, types::global_dof_index>
   make_tpetra_map(const MPI_Comm &communicator = MPI_COMM_WORLD,
                   const bool      overlapping  = false) const;
+#  endif
 #endif
 
 
index 9b89e6e31f470c7194cdb01f27035aef19e40684..d7a097f669174bdb4f89de38d671106586d45f81 100644 (file)
@@ -1534,6 +1534,7 @@ namespace internal
 
 
 
+#  ifdef DEAL_II_TRILINOS_WITH_TPETRA
       template <typename ForwardIterator, typename Number>
       static void
       extract_subvector_to(
@@ -1559,6 +1560,7 @@ namespace internal
         for (unsigned int i = 0; i < cache_size; ++i, ++local_values_begin)
           *local_values_begin = read_write_vector[sorted_indices_pos[i]];
       }
+#  endif
 
 
 
index ea76059356c799cb0708bcba4f4158a439b0a422..eb210626d7c5981b5b2839f40f5e0dbbed24d066 100644 (file)
@@ -1581,6 +1581,7 @@ namespace FETools
 
 
 #  ifdef DEAL_II_WITH_MPI
+#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
     template <int dim, int spacedim, typename Number>
     void
     reinit_distributed(const DoFHandler<dim, spacedim> &              dh,
@@ -1595,6 +1596,7 @@ namespace FETools
       const IndexSet &locally_owned_dofs = dh.locally_owned_dofs();
       vector.reinit(locally_owned_dofs, parallel_tria->get_communicator());
     }
+#    endif
 
     template <int dim, int spacedim>
     void
index 9699c0a9b43dddf2993bc1c0acd4c793075ff59f..a453ae0572b44919f8aa5cf13d2848e8c7ad3ea2 100644 (file)
@@ -513,6 +513,7 @@ namespace FETools
       AssertThrow(false, ExcNotImplemented());
     }
 
+#  ifdef DEAL_II_TRILINOS_WITH_TPETRA
     template <int dim, int spacedim, typename Number>
     void
     back_interpolate(
@@ -527,6 +528,7 @@ namespace FETools
     {
       AssertThrow(false, ExcNotImplemented());
     }
+#  endif
 #endif
 
 
index b72a95eae23345c8e5b9edb1835b4534c25ff4af..f752ff815aa1f593dcd3ff9e7876015972aa9923 100644 (file)
@@ -335,6 +335,7 @@ namespace LinearAlgebra
                std::shared_ptr<const CommunicationPatternBase>());
 
 #  ifdef DEAL_II_WITH_MPI
+#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
     /**
      * Imports all the elements present in the vector's IndexSet from the input
      * vector @p tpetra_vec. VectorOperation::values @p operation is used to
@@ -349,6 +350,7 @@ namespace LinearAlgebra
            const std::shared_ptr<const CommunicationPatternBase>
              &communication_pattern =
                std::shared_ptr<const CommunicationPatternBase>());
+#    endif
 
     /**
      * Imports all the elements present in the vector's IndexSet from the input
@@ -609,6 +611,7 @@ namespace LinearAlgebra
 
   protected:
 #ifdef DEAL_II_WITH_TRILINOS
+#  ifdef DEAL_II_TRILINOS_WITH_TPETRA
     /**
      * Import all the elements present in the vector's IndexSet from the input
      * vector @p tpetra_vector. This is an helper function and it should not be
@@ -622,6 +625,7 @@ namespace LinearAlgebra
       const MPI_Comm &        mpi_comm,
       const std::shared_ptr<const CommunicationPatternBase>
         &communication_pattern);
+#  endif
 
     /**
      * Import all the elements present in the vector's IndexSet from the input
@@ -656,6 +660,7 @@ namespace LinearAlgebra
     resize_val(const size_type new_allocated_size);
 
 #if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI)
+#  ifdef DEAL_II_TRILINOS_WITH_TPETRA
     /**
      * Return a TpetraWrappers::CommunicationPattern and store it for future
      * use.
@@ -663,6 +668,7 @@ namespace LinearAlgebra
     TpetraWrappers::CommunicationPattern
     create_tpetra_comm_pattern(const IndexSet &source_index_set,
                                const MPI_Comm &mpi_comm);
+#  endif
 
     /**
      * Return a EpetraWrappers::CommunicationPattern and store it for future
index 572c28f1dec919cdc3f1a88db0ac1fce159f75cd..1444b00856d5fee5e4aed28cef4067d73d4f6c31 100644 (file)
@@ -506,6 +506,7 @@ namespace LinearAlgebra
 
 
 #if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI)
+#  ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template <typename Number>
   void
   ReadWriteVector<Number>::import(
@@ -595,6 +596,7 @@ namespace LinearAlgebra
           AssertThrow(false, ExcNotImplemented());
       }
   }
+#  endif
 
 
 
@@ -743,6 +745,7 @@ namespace LinearAlgebra
 
 
 
+#  ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template <typename Number>
   void
   ReadWriteVector<Number>::import(
@@ -757,6 +760,7 @@ namespace LinearAlgebra
            trilinos_vec.get_mpi_communicator(),
            communication_pattern);
   }
+#  endif
 
 
 
@@ -901,6 +905,7 @@ namespace LinearAlgebra
 
 
 #if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI)
+#  ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template <typename Number>
   TpetraWrappers::CommunicationPattern
   ReadWriteVector<Number>::create_tpetra_comm_pattern(
@@ -915,6 +920,8 @@ namespace LinearAlgebra
 
     return epetra_comm_pattern;
   }
+#  endif
+
 
 
   template <typename Number>
index fd3e074b2aa9595b37b00d4081d1c2e8248fdaad..45c6f1d34dd914980e09509d887fd6022037b52e 100644 (file)
 
 #include <deal.II/base/config.h>
 
-#ifdef DEAL_II_WITH_TRILINOS
+#if defined(DEAL_II_TRILINOS_WITH_TPETRA) && defined(DEAL_II_WITH_MPI)
 
-#  ifdef DEAL_II_WITH_MPI
+#  include <deal.II/lac/communication_pattern_base.h>
 
-#    include <deal.II/lac/communication_pattern_base.h>
+#  include <Tpetra_Export.hpp>
+#  include <Tpetra_Import.hpp>
 
-#    include <Tpetra_Export.hpp>
-#    include <Tpetra_Import.hpp>
-
-#    include <memory>
+#  include <memory>
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -102,8 +100,6 @@ namespace LinearAlgebra
 
 DEAL_II_NAMESPACE_CLOSE
 
-#  endif
-
 #endif
 
 #endif
index 911863c9d99e39ee4a77b8ac6b8207acbe9247f5..a91d4e4b5547385202b4959f80002185d3f32839 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <deal.II/base/config.h>
 
-#if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI)
+#if defined(DEAL_II_TRILINOS_WITH_TPETRA) && defined(DEAL_II_WITH_MPI)
 
 #  include <deal.II/base/index_set.h>
 #  include <deal.II/base/subscriptor.h>
index 4a81d97fdbc17f93defea4444c2661c87bea9b04..236203e1984061315987fccce95f1cc37cfe285a 100644 (file)
@@ -125,6 +125,7 @@ namespace internal
 
 
 
+#  ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template <>
   inline void
   ElementAccess<LinearAlgebra::TpetraWrappers::Vector<double>>::add(
@@ -270,6 +271,7 @@ namespace internal
     // We're going to modify the data on host.
     return vector_1d(trilinos_i);
   }
+#  endif
 #endif
 } // namespace internal
 
index 961b0223dfc32f4a33fe07a55a005da000b36652..82a82150e89e0c0b5d900021bf7c670949cad14e 100644 (file)
@@ -132,6 +132,7 @@ namespace internal
   };
 
 #  ifdef DEAL_II_WITH_MPI
+#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template <typename Number>
   struct MatrixSelector<dealii::LinearAlgebra::TpetraWrappers::Vector<Number>>
   {
@@ -163,6 +164,7 @@ namespace internal
                     true);
     }
   };
+#    endif
 
   template <>
   struct MatrixSelector<dealii::LinearAlgebra::EpetraWrappers::Vector>
index d9257454852e02760fc66e7163828d7fba2e8b17..9e5cc43c279f39da979ab63ccea5debc72801320 100644 (file)
@@ -519,6 +519,7 @@ IndexSet::fill_index_vector(std::vector<size_type> &indices) const
 
 
 #ifdef DEAL_II_WITH_TRILINOS
+#  ifdef DEAL_II_TRILINOS_WITH_TPETRA
 
 Tpetra::Map<int, types::global_dof_index>
 IndexSet::make_tpetra_map(const MPI_Comm &communicator,
@@ -527,7 +528,7 @@ IndexSet::make_tpetra_map(const MPI_Comm &communicator,
   compress();
   (void)communicator;
 
-#  ifdef DEBUG
+#    ifdef DEBUG
   if (!overlapping)
     {
       const size_type n_global_elements =
@@ -549,7 +550,7 @@ IndexSet::make_tpetra_map(const MPI_Comm &communicator,
                         "by any processor, or there are indices that are "
                         "claimed by multiple processors."));
     }
-#  endif
+#    endif
 
   // Find out if the IndexSet is ascending and 1:1. This corresponds to a
   // linear Tpetra::Map. Overlapping IndexSets are never 1:1.
@@ -560,11 +561,11 @@ IndexSet::make_tpetra_map(const MPI_Comm &communicator,
       size(),
       n_elements(),
       0,
-#  ifdef DEAL_II_WITH_MPI
+#    ifdef DEAL_II_WITH_MPI
       Teuchos::rcp(new Teuchos::MpiComm<int>(communicator))
-#  else
+#    else
       Teuchos::rcp(new Teuchos::Comm<int>())
-#  endif
+#    endif
     );
   else
     {
@@ -577,14 +578,15 @@ IndexSet::make_tpetra_map(const MPI_Comm &communicator,
         size(),
         arr_view,
         0,
-#  ifdef DEAL_II_WITH_MPI
+#    ifdef DEAL_II_WITH_MPI
         Teuchos::rcp(new Teuchos::MpiComm<int>(communicator))
-#  else
+#    else
         Teuchos::rcp(new Teuchos::Comm<int>())
-#  endif
+#    endif
       );
     }
 }
+#  endif
 
 
 
@@ -657,7 +659,6 @@ IndexSet::make_trilinos_map(const MPI_Comm &communicator,
 #endif
 
 
-
 bool
 IndexSet::is_ascending_and_one_to_one(const MPI_Comm &communicator) const
 {
index 250a6d0519183b2490b48ee89836b2ac5d40595a..d87c7e88c18b57aeecd2d289408fbe3d5ffc170c 100644 (file)
@@ -104,6 +104,7 @@ namespace TrilinosWrappers
       return V.trilinos_vector()[0] + V.trilinos_vector().MyLength();
     }
 
+#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
     template <typename Number>
     Number *
     begin(LinearAlgebra::TpetraWrappers::Vector<Number> &V)
@@ -133,6 +134,7 @@ namespace TrilinosWrappers
       return V.trilinos_vector().getData().get() +
              V.trilinos_vector().getLocalLength();
     }
+#    endif
 #  endif
   } // namespace internal
 
@@ -3510,6 +3512,7 @@ namespace TrilinosWrappers
     const dealii::LinearAlgebra::distributed::Vector<double> &) const;
 
 #  ifdef DEAL_II_WITH_MPI
+#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template void
   SparseMatrix::vmult(
     dealii::LinearAlgebra::TpetraWrappers::Vector<double> &,
@@ -3519,6 +3522,7 @@ namespace TrilinosWrappers
   SparseMatrix::vmult(
     dealii::LinearAlgebra::TpetraWrappers::Vector<float> &,
     const dealii::LinearAlgebra::TpetraWrappers::Vector<float> &) const;
+#    endif
 
   template void
   SparseMatrix::vmult(
@@ -3539,6 +3543,7 @@ namespace TrilinosWrappers
     const dealii::LinearAlgebra::distributed::Vector<double> &) const;
 
 #  ifdef DEAL_II_WITH_MPI
+#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template void
   SparseMatrix::Tvmult(
     dealii::LinearAlgebra::TpetraWrappers::Vector<double> &,
@@ -3548,6 +3553,7 @@ namespace TrilinosWrappers
   SparseMatrix::Tvmult(
     dealii::LinearAlgebra::TpetraWrappers::Vector<float> &,
     const dealii::LinearAlgebra::TpetraWrappers::Vector<float> &) const;
+#    endif
 
   template void
   SparseMatrix::Tvmult(
@@ -3568,6 +3574,7 @@ namespace TrilinosWrappers
     const dealii::LinearAlgebra::distributed::Vector<double> &) const;
 
 #  ifdef DEAL_II_WITH_MPI
+#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template void
   SparseMatrix::vmult_add(
     dealii::LinearAlgebra::TpetraWrappers::Vector<double> &,
@@ -3577,6 +3584,7 @@ namespace TrilinosWrappers
   SparseMatrix::vmult_add(
     dealii::LinearAlgebra::TpetraWrappers::Vector<float> &,
     const dealii::LinearAlgebra::TpetraWrappers::Vector<float> &) const;
+#    endif
 
   template void
   SparseMatrix::vmult_add(
@@ -3597,6 +3605,7 @@ namespace TrilinosWrappers
     const dealii::LinearAlgebra::distributed::Vector<double> &) const;
 
 #  ifdef DEAL_II_WITH_MPI
+#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template void
   SparseMatrix::Tvmult_add(
     dealii::LinearAlgebra::TpetraWrappers::Vector<double> &,
@@ -3606,6 +3615,7 @@ namespace TrilinosWrappers
   SparseMatrix::Tvmult_add(
     dealii::LinearAlgebra::TpetraWrappers::Vector<float> &,
     const dealii::LinearAlgebra::TpetraWrappers::Vector<float> &) const;
+#    endif
 
   template void
   SparseMatrix::Tvmult_add(
index 626622d49d36a8d459ee56880032ef9c787c8997..99d3aa5f57c4d5c0e5ad900b095ed3ca798e8554 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <deal.II/lac/trilinos_tpetra_communication_pattern.h>
 
-#ifdef DEAL_II_WITH_TRILINOS
+#ifdef DEAL_II_TRILINOS_WITH_TPETRA
 
 #  ifdef DEAL_II_WITH_MPI
 
index 6eb2b6e1f71d9c24ab17ae7fe4d97be06777d458..428182e916149ed5729190f1054fb692b9b77a89 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <deal.II/lac/trilinos_tpetra_vector.h>
 
-#ifdef DEAL_II_WITH_TRILINOS
+#ifdef DEAL_II_TRILINOS_WITH_TPETRA
 
 #  ifdef DEAL_II_WITH_MPI
 

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.