]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Require MPI for Trilinos
authorDaniel Arndt <arndtd@ornl.gov>
Wed, 2 Jun 2021 15:52:53 +0000 (11:52 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Wed, 2 Jun 2021 16:45:31 +0000 (12:45 -0400)
24 files changed:
cmake/configure/configure_2_trilinos.cmake
doc/news/changes/incompatibilities/20210602DanielArndt [new file with mode: 0644]
include/deal.II/dofs/dof_accessor.templates.h
include/deal.II/lac/read_write_vector.h
include/deal.II/lac/read_write_vector.templates.h
include/deal.II/lac/trilinos_epetra_communication_pattern.h
include/deal.II/lac/trilinos_epetra_vector.h
include/deal.II/lac/trilinos_precondition.h
include/deal.II/lac/trilinos_sparse_matrix.h
include/deal.II/lac/trilinos_sparsity_pattern.h
include/deal.II/lac/trilinos_tpetra_communication_pattern.h
include/deal.II/lac/trilinos_tpetra_vector.h
include/deal.II/lac/trilinos_tpetra_vector.templates.h
include/deal.II/lac/trilinos_vector.h
include/deal.II/lac/vector_element_access.h
include/deal.II/numerics/data_out_dof_data.templates.h
source/lac/trilinos_epetra_communication_pattern.cc
source/lac/trilinos_epetra_vector.cc
source/lac/trilinos_precondition.cc
source/lac/trilinos_sparse_matrix.cc
source/lac/trilinos_sparsity_pattern.cc
source/lac/trilinos_tpetra_communication_pattern.cc
source/lac/trilinos_tpetra_vector.cc
source/lac/trilinos_vector.cc

index cc722180a5f1e2d84bc5e3635790d43c14f8ecdd..fd415de1a16de8eebc5dceda92edd0ad3ce9e4d0 100644 (file)
@@ -17,6 +17,7 @@
 # Configuration for the trilinos library:
 #
 
+SET(FEATURE_TRILINOS_DEPENDS MPI)
 
 MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var)
   FIND_PACKAGE(TRILINOS)
@@ -87,41 +88,19 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var)
     # Trilinos has to be configured with the same MPI configuration as
     # deal.II.
     #
-    IF( (TRILINOS_WITH_MPI AND NOT DEAL_II_WITH_MPI)
-         OR
-         (NOT TRILINOS_WITH_MPI AND DEAL_II_WITH_MPI))
+    IF(NOT TRILINOS_WITH_MPI)
       MESSAGE(STATUS "Could not find a sufficient Trilinos installation: "
-        "Trilinos has to be configured with the same MPI configuration as deal.II."
+        "Trilinos has to have MPI support enabled."
         )
       SET(TRILINOS_ADDITIONAL_ERROR_STRING
         ${TRILINOS_ADDITIONAL_ERROR_STRING}
         "The Trilinos installation (found at \"${TRILINOS_DIR}\")\n"
-        "has to be configured with the same MPI configuration as deal.II, but found:\n"
-        "  DEAL_II_WITH_MPI = ${DEAL_II_WITH_MPI}\n"
+        "has to be configured with MPI support, but found:\n"
         "  TRILINOS_WITH_MPI = ${TRILINOS_WITH_MPI}\n"
         )
       SET(${var} FALSE)
     ENDIF()
 
-    #
-    # deal.II has to be configured with MPI if both Trilinos and PETSc are
-    # enabled.
-    #
-    IF(DEAL_II_WITH_TRILINOS AND DEAL_II_WITH_PETSC AND NOT DEAL_II_WITH_MPI)
-      MESSAGE(STATUS "Incompatible configuration settings: "
-        "MPI must be enabled to use both Trilinos and PETSc, as both libraries "
-        "provide mutually incompatible MPI stubs."
-        )
-      SET(TRILINOS_ADDITIONAL_ERROR_STRING
-        ${TRILINOS_ADDITIONAL_ERROR_STRING}
-        "Incompatible Trilinos and PETSc libraries found. Both libraries were "
-        "configured without MPI support and cannot be used at the same time due "
-        "to incompatible MPI stub files. Either reconfigure deal.II, Trilinos, "
-        "and PETSc with MPI support, or disable one of the libraries.\n"
-        )
-      SET(${var} FALSE)
-    ENDIF()
-
     #
     # Trilinos has to be configured with 32bit indices if deal.II uses
     # unsigned int.
@@ -391,15 +370,13 @@ MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL)
       "TrilinosWrappers::BlockSparseMatrix")
   SET(DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR "TrilinosWrappers::MPI::BlockVector")
   SET(DEAL_II_EXPAND_TRILINOS_MPI_VECTOR "TrilinosWrappers::MPI::Vector")
-  IF (TRILINOS_WITH_MPI)
-    SET(DEAL_II_EXPAND_EPETRA_VECTOR "LinearAlgebra::EpetraWrappers::Vector")
-    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>")
-      IF (${DEAL_II_WITH_COMPLEX_NUMBERS})
-        SET(DEAL_II_EXPAND_TPETRA_VECTOR_COMPLEX_DOUBLE "LinearAlgebra::TpetraWrappers::Vector<std::complex<double>>")
-        SET(DEAL_II_EXPAND_TPETRA_VECTOR_COMPLEX_FLOAT "LinearAlgebra::TpetraWrappers::Vector<std::complex<float>>")
-      ENDIF()
+  SET(DEAL_II_EXPAND_EPETRA_VECTOR "LinearAlgebra::EpetraWrappers::Vector")
+  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>")
+    IF (${DEAL_II_WITH_COMPLEX_NUMBERS})
+      SET(DEAL_II_EXPAND_TPETRA_VECTOR_COMPLEX_DOUBLE "LinearAlgebra::TpetraWrappers::Vector<std::complex<double>>")
+      SET(DEAL_II_EXPAND_TPETRA_VECTOR_COMPLEX_FLOAT "LinearAlgebra::TpetraWrappers::Vector<std::complex<float>>")
     ENDIF()
   ENDIF()
   IF(${DEAL_II_TRILINOS_WITH_SACADO})
diff --git a/doc/news/changes/incompatibilities/20210602DanielArndt b/doc/news/changes/incompatibilities/20210602DanielArndt
new file mode 100644 (file)
index 0000000..1cccd04
--- /dev/null
@@ -0,0 +1,4 @@
+Changed: Trilinos support in deal.II requires both deal.II and Trilinos to be
+configured with MPI support.
+<br>
+(Daniel Arndt, 2021/06/02)
index b6f11ba067ca1c04deab5096a5d2ccf7dd768ce0..7bf7c0333d0dfe064b59535b20e4f26e78f57b94 100644 (file)
@@ -705,7 +705,7 @@ namespace internal
 
 
 
-#if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI)
+#if defined(DEAL_II_WITH_TRILINOS)
       static std::vector<unsigned int>
       sort_indices(const types::global_dof_index *v_begin,
                    const types::global_dof_index *v_end)
index 48d62e8e8387720e976797dec424bfa703e0c5de..2e2fecad4ea5fc7415f07d57ed1f283ea1eb345b 100644 (file)
@@ -218,7 +218,6 @@ namespace LinearAlgebra
 
 
 #ifdef DEAL_II_WITH_TRILINOS
-#  ifdef DEAL_II_WITH_MPI
     /**
      * Initialize this ReadWriteVector by supplying access to all locally
      * available entries in the given ghosted or non-ghosted vector.
@@ -232,7 +231,6 @@ namespace LinearAlgebra
      */
     void
     reinit(const TrilinosWrappers::MPI::Vector &trilinos_vec);
-#  endif
 #endif
 
     /**
@@ -365,8 +363,7 @@ namespace LinearAlgebra
            const std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
              &communication_pattern = {});
 
-#  ifdef DEAL_II_WITH_MPI
-#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
+#  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
@@ -380,7 +377,7 @@ namespace LinearAlgebra
            VectorOperation::values               operation,
            const std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
              &communication_pattern = {});
-#    endif
+#  endif
 
     /**
      * Imports all the elements present in the vector's IndexSet from the input
@@ -395,7 +392,6 @@ namespace LinearAlgebra
            VectorOperation::values       operation,
            const std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
              &communication_pattern = {});
-#  endif
 #endif
 
 #ifdef DEAL_II_WITH_CUDA
@@ -697,7 +693,7 @@ namespace LinearAlgebra
     void
     resize_val(const size_type new_allocated_size);
 
-#if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI)
+#if defined(DEAL_II_WITH_TRILINOS)
 #  ifdef DEAL_II_TRILINOS_WITH_TPETRA
     /**
      * Return a TpetraWrappers::CommunicationPattern and store it for future
index 7334d813c8a97e926f80d372e50d4e51bdd04d0d..59f92e4479a10559247a61edc4231571845764ee 100644 (file)
@@ -299,7 +299,7 @@ namespace LinearAlgebra
 
 
 
-#if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI)
+#if defined(DEAL_II_WITH_TRILINOS)
   template <typename Number>
   void
   ReadWriteVector<Number>::reinit(
@@ -570,7 +570,7 @@ namespace LinearAlgebra
 
 
 
-#if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI)
+#if defined(DEAL_II_WITH_TRILINOS)
 #  ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template <typename Number>
   void
@@ -1033,7 +1033,7 @@ namespace LinearAlgebra
 
 
 
-#if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI)
+#if defined(DEAL_II_WITH_TRILINOS)
 #  ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template <typename Number>
   TpetraWrappers::CommunicationPattern
index 9a55623a733f71e7899e03c430221b0f6de9f59f..2168c0af61989d8b7637b32bb254f97f37bc36f1 100644 (file)
 
 #ifdef DEAL_II_WITH_TRILINOS
 
-#  ifdef DEAL_II_WITH_MPI
+#  include <deal.II/base/communication_pattern_base.h>
 
-#    include <deal.II/base/communication_pattern_base.h>
+#  include <Epetra_Import.h>
 
-#    include <Epetra_Import.h>
-
-#    include <memory>
+#  include <memory>
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -90,8 +88,6 @@ namespace LinearAlgebra
 
 DEAL_II_NAMESPACE_CLOSE
 
-#  endif
-
 #endif
 
 #endif
index 8251cbc88282a388cbeae8494a3d79f99559e7a4..400dc2ec5db6c6d78b601a0e65c83fac2372df39 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_WITH_TRILINOS)
 
 #  include <deal.II/base/index_set.h>
 #  include <deal.II/base/subscriptor.h>
index b9bf3e112bb189835e34db33e5adb4b9272357f8..e02048e45f47735066a6ea03cdbd43cd0ab5cd11 100644 (file)
 #    include <deal.II/lac/la_parallel_vector.h>
 #    include <deal.II/lac/trilinos_vector.h>
 
-#    include <memory>
-
-#    ifdef DEAL_II_WITH_MPI
-#      include <Epetra_MpiComm.h>
-#    else
-#      include <Epetra_SerialComm.h>
-#    endif
 #    include <Epetra_Map.h>
+#    include <Epetra_MpiComm.h>
 #    include <Epetra_MultiVector.h>
 #    include <Epetra_RowMatrix.h>
 #    include <Epetra_Vector.h>
 #    include <Teuchos_ParameterList.hpp>
 
+#    include <memory>
+
 // forward declarations
 #    ifndef DOXYGEN
 class Ifpack_Preconditioner;
@@ -239,11 +235,7 @@ namespace TrilinosWrappers
      * Internal communication pattern in case the matrix needs to be copied
      * from deal.II format.
      */
-#    ifdef DEAL_II_WITH_MPI
     Epetra_MpiComm communicator;
-#    else
-    Epetra_SerialComm communicator;
-#    endif
 
     /**
      * Internal Trilinos map in case the matrix needs to be copied from
index 204641022acb329e4260c7913efc985d30e21ecf..c73d4e4a3659c986a8e58eb6cec90d682e128876 100644 (file)
 #    include <Epetra_Export.h>
 #    include <Epetra_FECrsMatrix.h>
 #    include <Epetra_Map.h>
+#    include <Epetra_MpiComm.h>
 #    include <Epetra_MultiVector.h>
 #    include <Epetra_Operator.h>
+#    include <mpi.h>
 
 #    include <cmath>
 #    include <memory>
 #    include <type_traits>
 #    include <vector>
-#    ifdef DEAL_II_WITH_MPI
-#      include <Epetra_MpiComm.h>
-#      include <mpi.h>
-#    else
-#      include <Epetra_SerialComm.h>
-#    endif
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -2348,11 +2344,7 @@ namespace TrilinosWrappers
          * Internal communication pattern in case the matrix needs to be copied
          * from deal.II format.
          */
-#    ifdef DEAL_II_WITH_MPI
         Epetra_MpiComm communicator;
-#    else
-        Epetra_SerialComm communicator;
-#    endif
 
         /**
          * Epetra_Map that sets the partitioning of the domain space of
index badaa307fd90b7951f8bd01db02a0324d8923035..4241dfa9d06422c7ef6907d5bb4cfe73b80af184 100644 (file)
 
 #    include <Epetra_FECrsGraph.h>
 #    include <Epetra_Map.h>
+#    include <Epetra_MpiComm.h>
+#    include <mpi.h>
 
 #    include <cmath>
 #    include <memory>
 #    include <vector>
-#    ifdef DEAL_II_WITH_MPI
-#      include <Epetra_MpiComm.h>
-#      include <mpi.h>
-#    else
-#      include <Epetra_SerialComm.h>
-#    endif
 
 
 DEAL_II_NAMESPACE_OPEN
index 4d6ee23800e4a3ea28b84a767357cc81b725319d..fe14d69af0ba13038c227cfa1253f60c16a75ebe 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <deal.II/base/config.h>
 
-#if defined(DEAL_II_TRILINOS_WITH_TPETRA) && defined(DEAL_II_WITH_MPI)
+#if defined(DEAL_II_TRILINOS_WITH_TPETRA)
 
 #  include <deal.II/base/communication_pattern_base.h>
 
index 08857a4726761b9613576182341cbbee776dacf6..82fd1aa6061e8c9ff1784284702b74a4c9cbfd79 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <deal.II/base/config.h>
 
-#if defined(DEAL_II_TRILINOS_WITH_TPETRA) && defined(DEAL_II_WITH_MPI)
+#if defined(DEAL_II_TRILINOS_WITH_TPETRA)
 
 #  include <deal.II/base/index_set.h>
 #  include <deal.II/base/subscriptor.h>
index 25aec238d7d857c8982dd113f99be8f69b200b00..20ff03151c927fcd531fa625c9176e212506a236 100644 (file)
 
 #ifdef DEAL_II_TRILINOS_WITH_TPETRA
 
-#  ifdef DEAL_II_WITH_MPI
+#  include <deal.II/base/index_set.h>
 
-#    include <deal.II/base/index_set.h>
+#  include <deal.II/lac/read_write_vector.h>
 
-#    include <deal.II/lac/read_write_vector.h>
+#  include <boost/io/ios_state.hpp>
 
-#    include <boost/io/ios_state.hpp>
+#  include <Teuchos_DefaultMpiComm.hpp>
+#  include <Tpetra_Import_def.hpp>
+#  include <Tpetra_Map_def.hpp>
 
-#    include <Teuchos_DefaultMpiComm.hpp>
-#    include <Tpetra_Import_def.hpp>
-#    include <Tpetra_Map_def.hpp>
-
-#    include <memory>
+#  include <memory>
 
 
 DEAL_II_NAMESPACE_OPEN
@@ -684,8 +682,6 @@ namespace LinearAlgebra
 
 DEAL_II_NAMESPACE_CLOSE
 
-#  endif
-
 #endif
 
 #endif
index 4a73bb9a8f4763ca868cec0cc8ab53acadb9ee74..c7a7239f8ecefe84ec6ffd7190a3a906a3033ea3 100644 (file)
 #  include <deal.II/lac/vector_type_traits.h>
 
 #  include <Epetra_ConfigDefs.h>
+#  include <Epetra_FEVector.h>
+#  include <Epetra_LocalMap.h>
+#  include <Epetra_Map.h>
+#  include <Epetra_MpiComm.h>
+#  include <mpi.h>
 
 #  include <memory>
 #  include <utility>
 #  include <vector>
-#  ifdef DEAL_II_WITH_MPI // only if MPI is installed
-#    include <Epetra_MpiComm.h>
-#    include <mpi.h>
-#  else
-#    include <Epetra_SerialComm.h>
-#  endif
-#  include <Epetra_FEVector.h>
-#  include <Epetra_LocalMap.h>
-#  include <Epetra_Map.h>
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -2167,18 +2163,10 @@ namespace TrilinosWrappers
     {
       static MPI_Comm comm;
 
-#    ifdef DEAL_II_WITH_MPI
-
       const Epetra_MpiComm *mpi_comm =
         dynamic_cast<const Epetra_MpiComm *>(&vector->Map().Comm());
       comm = mpi_comm->Comm();
 
-#    else
-
-      comm = MPI_COMM_SELF;
-
-#    endif
-
       return comm;
     }
 
index 46087fe43daea905926d5530b08eface79a40bac..ff0c2aa9af1077a927a6fdcbc8d85f17f6dea1b9 100644 (file)
@@ -78,7 +78,7 @@ namespace internal
 
 
 
-#if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI)
+#if defined(DEAL_II_WITH_TRILINOS)
   template <>
   inline void
   ElementAccess<LinearAlgebra::EpetraWrappers::Vector>::add(
index ba4077e2e0778ee7cc4ed7df6f67afedc71fdb32..547603ce43e6987230aabb27d9fbd9941549529d 100644 (file)
@@ -665,7 +665,7 @@ namespace internal
 
 
 
-#if defined(DEAL_II_TRILINOS_WITH_TPETRA) && defined(DEAL_II_WITH_MPI)
+#if defined(DEAL_II_TRILINOS_WITH_TPETRA)
     template <>
     inline void
     VectorHelper<LinearAlgebra::TpetraWrappers::Vector<double>>::extract(
index 868527d663f08f23729d921cab3267591a37616f..7c34e3ed0e593c98d15e8619692b5fb74205c206 100644 (file)
 
 #ifdef DEAL_II_WITH_TRILINOS
 
-#  ifdef DEAL_II_WITH_MPI
+#  include <deal.II/base/index_set.h>
 
-#    include <deal.II/base/index_set.h>
+#  include <Epetra_Map.h>
 
-#    include <Epetra_Map.h>
-
-#    include <memory>
+#  include <memory>
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -85,6 +83,4 @@ namespace LinearAlgebra
 
 DEAL_II_NAMESPACE_CLOSE
 
-#  endif
-
 #endif
index 57980bb36df1633d8503457ddac212f51b35a2e4..5671daf54401bd503f19453d68c9f893ceda8e53 100644 (file)
 
 #ifdef DEAL_II_WITH_TRILINOS
 
-#  ifdef DEAL_II_WITH_MPI
+#  include <deal.II/base/index_set.h>
 
-#    include <deal.II/base/index_set.h>
+#  include <deal.II/lac/read_write_vector.h>
 
-#    include <deal.II/lac/read_write_vector.h>
+#  include <boost/io/ios_state.hpp>
 
-#    include <boost/io/ios_state.hpp>
+#  include <Epetra_Import.h>
+#  include <Epetra_Map.h>
+#  include <Epetra_MpiComm.h>
 
-#    include <Epetra_Import.h>
-#    include <Epetra_Map.h>
-#    include <Epetra_MpiComm.h>
-
-#    include <memory>
+#  include <memory>
 
 
 DEAL_II_NAMESPACE_OPEN
@@ -243,7 +241,7 @@ namespace LinearAlgebra
           Assert(this->size() == down_V.size(),
                  ExcDimensionMismatch(this->size(), down_V.size()));
 
-#    if DEAL_II_TRILINOS_VERSION_GTE(11, 11, 0)
+#  if DEAL_II_TRILINOS_VERSION_GTE(11, 11, 0)
           Epetra_Import data_exchange(vector->Map(),
                                       down_V.trilinos_vector().Map());
           const int     ierr = vector->Import(down_V.trilinos_vector(),
@@ -251,7 +249,7 @@ namespace LinearAlgebra
                                           Epetra_AddLocalAlso);
           Assert(ierr == 0, ExcTrilinosError(ierr));
           (void)ierr;
-#    else
+#  else
           // In versions older than 11.11 the Import function is broken for
           // adding Hence, we provide a workaround in this case
 
@@ -266,7 +264,7 @@ namespace LinearAlgebra
           ierr = vector->Update(1.0, dummy, 1.0);
           Assert(ierr == 0, ExcTrilinosError(ierr));
           (void)ierr;
-#    endif
+#  endif
         }
 
       return *this;
@@ -532,11 +530,11 @@ namespace LinearAlgebra
     Vector::size_type
     Vector::size() const
     {
-#    ifndef DEAL_II_WITH_64BIT_INDICES
+#  ifndef DEAL_II_WITH_64BIT_INDICES
       return vector->GlobalLength();
-#    else
+#  else
       return vector->GlobalLength64();
-#    endif
+#  endif
     }
 
 
@@ -568,23 +566,23 @@ namespace LinearAlgebra
       // easy case: local range is contiguous
       if (vector->Map().LinearMap())
         {
-#    ifndef DEAL_II_WITH_64BIT_INDICES
+#  ifndef DEAL_II_WITH_64BIT_INDICES
           is.add_range(vector->Map().MinMyGID(), vector->Map().MaxMyGID() + 1);
-#    else
+#  else
           is.add_range(vector->Map().MinMyGID64(),
                        vector->Map().MaxMyGID64() + 1);
-#    endif
+#  endif
         }
       else if (vector->Map().NumMyElements() > 0)
         {
           const size_type n_indices = vector->Map().NumMyElements();
-#    ifndef DEAL_II_WITH_64BIT_INDICES
+#  ifndef DEAL_II_WITH_64BIT_INDICES
           unsigned int *vector_indices =
             reinterpret_cast<unsigned int *>(vector->Map().MyGlobalElements());
-#    else
+#  else
           size_type *vector_indices =
             reinterpret_cast<size_type *>(vector->Map().MyGlobalElements64());
-#    endif
+#  endif
           is.add_indices(vector_indices, vector_indices + n_indices);
         }
       is.compress();
@@ -673,6 +671,4 @@ namespace LinearAlgebra
 
 DEAL_II_NAMESPACE_CLOSE
 
-#  endif
-
 #endif
index af0451586d963559fc81eaf276660029587cfffd..f52a1b0f5ac89baac032c4f733e13b70bd7ebbcf 100644 (file)
@@ -32,9 +32,7 @@ DEAL_II_NAMESPACE_OPEN
 namespace TrilinosWrappers
 {
   PreconditionBase::PreconditionBase()
-#  ifdef DEAL_II_WITH_MPI
     : communicator(MPI_COMM_SELF)
-#  endif
   {}
 
 
@@ -42,12 +40,8 @@ namespace TrilinosWrappers
   PreconditionBase::PreconditionBase(const PreconditionBase &base)
     : Subscriptor()
     , preconditioner(base.preconditioner)
-    ,
-#  ifdef DEAL_II_WITH_MPI
-    communicator(base.communicator)
-    ,
-#  endif
-    vector_distributor(new Epetra_Map(*base.vector_distributor))
+    , communicator(base.communicator)
+    , vector_distributor(new Epetra_Map(*base.vector_distributor))
   {}
 
 
@@ -56,9 +50,7 @@ namespace TrilinosWrappers
   PreconditionBase::clear()
   {
     preconditioner.reset();
-#  ifdef DEAL_II_WITH_MPI
     communicator = MPI_COMM_SELF;
-#  endif
     vector_distributor.reset();
   }
 
@@ -66,11 +58,7 @@ namespace TrilinosWrappers
   MPI_Comm
   PreconditionBase::get_mpi_communicator() const
   {
-#  ifdef DEAL_II_WITH_MPI
     return communicator.Comm();
-#  else
-    return MPI_COMM_SELF;
-#  endif
   }
 
 
index 56520cb0bf813a96c8225195bbc9d62b39f191c3..5fe22dadf9e1195030de4ec81c2def43dcb840e6 100644 (file)
@@ -76,7 +76,6 @@ namespace TrilinosWrappers
       return V.end();
     }
 
-#  ifdef DEAL_II_WITH_MPI
     template <>
     double *
     begin(LinearAlgebra::EpetraWrappers::Vector &V)
@@ -105,7 +104,7 @@ namespace TrilinosWrappers
       return V.trilinos_vector()[0] + V.trilinos_vector().MyLength();
     }
 
-#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
+#  ifdef DEAL_II_TRILINOS_WITH_TPETRA
     template <typename Number>
     Number *
     begin(LinearAlgebra::TpetraWrappers::Vector<Number> &V)
@@ -135,7 +134,6 @@ namespace TrilinosWrappers
       return V.trilinos_vector().getData().get() +
              V.trilinos_vector().getLocalLength();
     }
-#    endif
 #  endif
   } // namespace internal
 
@@ -2306,17 +2304,10 @@ namespace TrilinosWrappers
   MPI_Comm
   SparseMatrix::get_mpi_communicator() const
   {
-#  ifdef DEAL_II_WITH_MPI
-
     const Epetra_MpiComm *mpi_comm =
       dynamic_cast<const Epetra_MpiComm *>(&matrix->RangeMap().Comm());
     Assert(mpi_comm != nullptr, ExcInternalError());
     return mpi_comm->Comm();
-#  else
-
-    return MPI_COMM_SELF;
-
-#  endif
   }
 } // namespace TrilinosWrappers
 
@@ -2325,35 +2316,13 @@ namespace TrilinosWrappers
 {
   namespace internal
   {
-    namespace
-    {
-#  ifndef DEAL_II_WITH_MPI
-      Epetra_Map
-      make_serial_Epetra_map(const IndexSet &serial_partitioning)
-      {
-        // See IndexSet::make_trilinos_map
-        return Epetra_Map(
-          TrilinosWrappers::types::int_type(serial_partitioning.size()),
-          TrilinosWrappers::types::int_type(serial_partitioning.n_elements()),
-          0,
-          Epetra_SerialComm());
-      }
-#  endif
-    } // namespace
-
     namespace LinearOperatorImplementation
     {
       TrilinosPayload::TrilinosPayload()
         : use_transpose(false)
-        ,
-#  ifdef DEAL_II_WITH_MPI
-        communicator(MPI_COMM_SELF)
+        , communicator(MPI_COMM_SELF)
         , domain_map(IndexSet().make_trilinos_map(communicator.Comm()))
         , range_map(IndexSet().make_trilinos_map(communicator.Comm()))
-#  else
-        domain_map(internal::make_serial_Epetra_map(IndexSet()))
-        , range_map(internal::make_serial_Epetra_map(IndexSet()))
-#  endif
       {
         vmult = [](Range &, const Domain &) {
           Assert(false,
@@ -2386,21 +2355,13 @@ namespace TrilinosWrappers
         const TrilinosWrappers::SparseMatrix &matrix_exemplar,
         const TrilinosWrappers::SparseMatrix &matrix)
         : use_transpose(matrix_exemplar.trilinos_matrix().UseTranspose())
-        ,
-#  ifdef DEAL_II_WITH_MPI
-        communicator(matrix_exemplar.get_mpi_communicator())
+        , communicator(matrix_exemplar.get_mpi_communicator())
         , domain_map(
             matrix_exemplar.locally_owned_domain_indices().make_trilinos_map(
               communicator.Comm()))
         , range_map(
             matrix_exemplar.locally_owned_range_indices().make_trilinos_map(
               communicator.Comm()))
-#  else
-        domain_map(internal::make_serial_Epetra_map(
-          matrix_exemplar.locally_owned_domain_indices()))
-        , range_map(internal::make_serial_Epetra_map(
-            matrix_exemplar.locally_owned_range_indices()))
-#  endif
       {
         vmult = [&matrix_exemplar, &matrix](Range &       tril_dst,
                                             const Domain &tril_src) {
@@ -2471,21 +2432,13 @@ namespace TrilinosWrappers
         const TrilinosWrappers::SparseMatrix &    matrix_exemplar,
         const TrilinosWrappers::PreconditionBase &preconditioner)
         : use_transpose(matrix_exemplar.trilinos_matrix().UseTranspose())
-        ,
-#  ifdef DEAL_II_WITH_MPI
-        communicator(matrix_exemplar.get_mpi_communicator())
+        , communicator(matrix_exemplar.get_mpi_communicator())
         , domain_map(
             matrix_exemplar.locally_owned_domain_indices().make_trilinos_map(
               communicator.Comm()))
         , range_map(
             matrix_exemplar.locally_owned_range_indices().make_trilinos_map(
               communicator.Comm()))
-#  else
-        domain_map(internal::make_serial_Epetra_map(
-          matrix_exemplar.locally_owned_domain_indices()))
-        , range_map(internal::make_serial_Epetra_map(
-            matrix_exemplar.locally_owned_range_indices()))
-#  endif
       {
         vmult = [&matrix_exemplar, &preconditioner](Range &       tril_dst,
                                                     const Domain &tril_src) {
@@ -2592,19 +2545,11 @@ namespace TrilinosWrappers
         const TrilinosWrappers::PreconditionBase &preconditioner)
         : use_transpose(
             preconditioner_exemplar.trilinos_operator().UseTranspose())
-        ,
-#  ifdef DEAL_II_WITH_MPI
-        communicator(preconditioner_exemplar.get_mpi_communicator())
+        , communicator(preconditioner_exemplar.get_mpi_communicator())
         , domain_map(preconditioner_exemplar.locally_owned_domain_indices()
                        .make_trilinos_map(communicator.Comm()))
         , range_map(preconditioner_exemplar.locally_owned_range_indices()
                       .make_trilinos_map(communicator.Comm()))
-#  else
-        domain_map(internal::make_serial_Epetra_map(
-          preconditioner_exemplar.locally_owned_domain_indices()))
-        , range_map(internal::make_serial_Epetra_map(
-            preconditioner_exemplar.locally_owned_range_indices()))
-#  endif
       {
         vmult = [&preconditioner_exemplar,
                  &preconditioner](Range &tril_dst, const Domain &tril_src) {
@@ -2828,11 +2773,7 @@ namespace TrilinosWrappers
       MPI_Comm
       TrilinosPayload::get_mpi_communicator() const
       {
-#  ifdef DEAL_II_WITH_MPI
         return communicator.Comm();
-#  else
-        return MPI_COMM_SELF;
-#  endif
       }
 
 
@@ -3330,8 +3271,7 @@ namespace TrilinosWrappers
     dealii::LinearAlgebra::distributed::Vector<double> &,
     const dealii::LinearAlgebra::distributed::Vector<double> &) const;
 
-#    ifdef DEAL_II_WITH_MPI
-#      ifdef DEAL_II_TRILINOS_WITH_TPETRA
+#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template void
   SparseMatrix::vmult(
     dealii::LinearAlgebra::TpetraWrappers::Vector<double> &,
@@ -3341,13 +3281,12 @@ namespace TrilinosWrappers
   SparseMatrix::vmult(
     dealii::LinearAlgebra::TpetraWrappers::Vector<float> &,
     const dealii::LinearAlgebra::TpetraWrappers::Vector<float> &) const;
-#      endif
+#    endif
 
   template void
   SparseMatrix::vmult(
     dealii::LinearAlgebra::EpetraWrappers::Vector &,
     const dealii::LinearAlgebra::EpetraWrappers::Vector &) const;
-#    endif
 
   template void
   SparseMatrix::Tvmult(MPI::Vector &, const MPI::Vector &) const;
@@ -3361,8 +3300,7 @@ namespace TrilinosWrappers
     dealii::LinearAlgebra::distributed::Vector<double> &,
     const dealii::LinearAlgebra::distributed::Vector<double> &) const;
 
-#    ifdef DEAL_II_WITH_MPI
-#      ifdef DEAL_II_TRILINOS_WITH_TPETRA
+#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template void
   SparseMatrix::Tvmult(
     dealii::LinearAlgebra::TpetraWrappers::Vector<double> &,
@@ -3372,13 +3310,12 @@ namespace TrilinosWrappers
   SparseMatrix::Tvmult(
     dealii::LinearAlgebra::TpetraWrappers::Vector<float> &,
     const dealii::LinearAlgebra::TpetraWrappers::Vector<float> &) const;
-#      endif
+#    endif
 
   template void
   SparseMatrix::Tvmult(
     dealii::LinearAlgebra::EpetraWrappers::Vector &,
     const dealii::LinearAlgebra::EpetraWrappers::Vector &) const;
-#    endif
 
   template void
   SparseMatrix::vmult_add(MPI::Vector &, const MPI::Vector &) const;
@@ -3392,8 +3329,7 @@ namespace TrilinosWrappers
     dealii::LinearAlgebra::distributed::Vector<double> &,
     const dealii::LinearAlgebra::distributed::Vector<double> &) const;
 
-#    ifdef DEAL_II_WITH_MPI
-#      ifdef DEAL_II_TRILINOS_WITH_TPETRA
+#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template void
   SparseMatrix::vmult_add(
     dealii::LinearAlgebra::TpetraWrappers::Vector<double> &,
@@ -3403,13 +3339,12 @@ namespace TrilinosWrappers
   SparseMatrix::vmult_add(
     dealii::LinearAlgebra::TpetraWrappers::Vector<float> &,
     const dealii::LinearAlgebra::TpetraWrappers::Vector<float> &) const;
-#      endif
+#    endif
 
   template void
   SparseMatrix::vmult_add(
     dealii::LinearAlgebra::EpetraWrappers::Vector &,
     const dealii::LinearAlgebra::EpetraWrappers::Vector &) const;
-#    endif
 
   template void
   SparseMatrix::Tvmult_add(MPI::Vector &, const MPI::Vector &) const;
@@ -3423,8 +3358,7 @@ namespace TrilinosWrappers
     dealii::LinearAlgebra::distributed::Vector<double> &,
     const dealii::LinearAlgebra::distributed::Vector<double> &) const;
 
-#    ifdef DEAL_II_WITH_MPI
-#      ifdef DEAL_II_TRILINOS_WITH_TPETRA
+#    ifdef DEAL_II_TRILINOS_WITH_TPETRA
   template void
   SparseMatrix::Tvmult_add(
     dealii::LinearAlgebra::TpetraWrappers::Vector<double> &,
@@ -3434,13 +3368,12 @@ namespace TrilinosWrappers
   SparseMatrix::Tvmult_add(
     dealii::LinearAlgebra::TpetraWrappers::Vector<float> &,
     const dealii::LinearAlgebra::TpetraWrappers::Vector<float> &) const;
-#      endif
+#    endif
 
   template void
   SparseMatrix::Tvmult_add(
     dealii::LinearAlgebra::EpetraWrappers::Vector &,
     const dealii::LinearAlgebra::EpetraWrappers::Vector &) const;
-#    endif
 } // namespace TrilinosWrappers
 #  endif // DOXYGEN
 
index 719978f904b333172ad9c4c3d5e7b1f7ae6c6f0e..dfbcc6fe0dc39a77c2acbbde3f912c5fe592fa99 100644 (file)
@@ -942,17 +942,10 @@ namespace TrilinosWrappers
   MPI_Comm
   SparsityPattern::get_mpi_communicator() const
   {
-#  ifdef DEAL_II_WITH_MPI
-
     const Epetra_MpiComm *mpi_comm =
       dynamic_cast<const Epetra_MpiComm *>(&graph->RangeMap().Comm());
     Assert(mpi_comm != nullptr, ExcInternalError());
     return mpi_comm->Comm();
-#  else
-
-    return MPI_COMM_SELF;
-
-#  endif
   }
 
 
index fb2c2709042b0c5d78fba55255101da4171ce1a5..cb6973cc2d98e58c6dd668c94fd93ff94ade0868 100644 (file)
 
 #ifdef DEAL_II_TRILINOS_WITH_TPETRA
 
-#  ifdef DEAL_II_WITH_MPI
+#  include <deal.II/base/index_set.h>
 
-#    include <deal.II/base/index_set.h>
+#  include <Tpetra_Map.hpp>
 
-#    include <Tpetra_Map.hpp>
-
-#    include <memory>
+#  include <memory>
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -99,6 +97,4 @@ namespace LinearAlgebra
 
 DEAL_II_NAMESPACE_CLOSE
 
-#  endif
-
 #endif
index b269bdabcf88a30e8361c0a1ff31aad67a6506aa..6308274e8cc2af3d500620bee497611ccc7eec15 100644 (file)
@@ -16,7 +16,6 @@
 #include <deal.II/lac/trilinos_tpetra_vector.templates.h>
 
 #ifdef DEAL_II_TRILINOS_WITH_TPETRA
-#  ifdef DEAL_II_WITH_MPI
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -26,14 +25,13 @@ namespace LinearAlgebra
   {
     template class Vector<float>;
     template class Vector<double>;
-#    ifdef DEAL_II_WITH_COMPLEX_VALUES
+#  ifdef DEAL_II_WITH_COMPLEX_VALUES
     template class Vector<std::complex<float>>;
     template class Vector<std::complex<double>>;
-#    endif
+#  endif
   } // namespace TpetraWrappers
 } // namespace LinearAlgebra
 
 DEAL_II_NAMESPACE_CLOSE
 
-#  endif
 #endif
index 53b4a28fc1948bdd483c7cc47727340d3be79924..021da0fd94a96b8b0f82f3be98117f2ac5cfe755 100644 (file)
@@ -140,11 +140,7 @@ namespace TrilinosWrappers
     {
       // When we clear the vector, reset the pointer and generate an empty
       // vector.
-#  ifdef DEAL_II_WITH_MPI
       Epetra_Map map(0, 0, Epetra_MpiComm(MPI_COMM_SELF));
-#  else
-      Epetra_Map map(0, 0, Epetra_SerialComm());
-#  endif
 
       has_ghosts  = false;
       vector      = std::make_unique<Epetra_FEVector>(map);
@@ -210,7 +206,6 @@ namespace TrilinosWrappers
           // version in case the underlying Epetra_MpiComm object is the same,
           // otherwise we might access an MPI_Comm object that has been
           // deleted
-#  ifdef DEAL_II_WITH_MPI
           const Epetra_MpiComm *my_comm =
             dynamic_cast<const Epetra_MpiComm *>(&vector->Comm());
           const Epetra_MpiComm *v_comm =
@@ -218,9 +213,6 @@ namespace TrilinosWrappers
           const bool same_communicators =
             my_comm != nullptr && v_comm != nullptr &&
             my_comm->DataPtr() == v_comm->DataPtr();
-#  else
-          const bool same_communicators = true;
-#  endif
           if (!same_communicators ||
               vector->Map().SameAs(v.vector->Map()) == false)
             {
@@ -267,7 +259,7 @@ namespace TrilinosWrappers
 
           last_action = Insert;
         }
-#  if defined(DEBUG) && defined(DEAL_II_WITH_MPI)
+#  if defined(DEBUG)
       const Epetra_MpiComm *comm_ptr =
         dynamic_cast<const Epetra_MpiComm *>(&(v.vector->Comm()));
       Assert(comm_ptr != nullptr, ExcInternalError());
@@ -343,7 +335,7 @@ namespace TrilinosWrappers
         }
       else
         vector = std::move(actual_vec);
-#  if defined(DEBUG) && defined(DEAL_II_WITH_MPI)
+#  if defined(DEBUG)
       const Epetra_MpiComm *comm_ptr =
         dynamic_cast<const Epetra_MpiComm *>(&(vector->Comm()));
       Assert(comm_ptr != nullptr, ExcInternalError());
@@ -422,7 +414,6 @@ namespace TrilinosWrappers
 
       // check equality for MPI communicators to avoid accessing a possibly
       // invalid MPI_Comm object
-#  ifdef DEAL_II_WITH_MPI
       const Epetra_MpiComm *my_comm =
         dynamic_cast<const Epetra_MpiComm *>(&vector->Comm());
       const Epetra_MpiComm *v_comm =
@@ -450,9 +441,6 @@ namespace TrilinosWrappers
       //    else
       //      same_communicators = true;
       //  }
-#  else
-      const bool same_communicators = true;
-#  endif
 
       // distinguish three cases. First case: both vectors have the same
       // layout (just need to copy the local data, not reset the memory and
@@ -612,7 +600,6 @@ namespace TrilinosWrappers
 
 
 #  ifdef DEBUG
-#    ifdef DEAL_II_WITH_MPI
       // check that every process has decided to use the same mode. This will
       // otherwise result in undefined behavior in the call to
       // GlobalAssemble().
@@ -628,7 +615,6 @@ namespace TrilinosWrappers
                "this vector was an addition or a set operation. This will "
                "prevent the compress() operation from succeeding."));
 
-#    endif
 #  endif
 
       // Now pass over the information about what we did last to the vector.
@@ -756,7 +742,6 @@ namespace TrilinosWrappers
           ++ptr;
         }
 
-#  ifdef DEAL_II_WITH_MPI
       // in parallel, check that the vector
       // is zero on _all_ processors.
       const Epetra_MpiComm *mpi_comm =
@@ -764,9 +749,6 @@ namespace TrilinosWrappers
       Assert(mpi_comm != nullptr, ExcInternalError());
       unsigned int num_nonzero = Utilities::MPI::sum(flag, mpi_comm->Comm());
       return num_nonzero == 0;
-#  else
-      return flag == 0;
-#  endif
     }
 
 
@@ -774,14 +756,12 @@ namespace TrilinosWrappers
     bool
     Vector::is_non_negative() const
     {
-#  ifdef DEAL_II_WITH_MPI
       // if this vector is a parallel one, then
       // we need to communicate to determine
       // the answer to the current
       // function. this still has to be
       // implemented
       AssertThrow(local_size() == size(), ExcNotImplemented());
-#  endif
       // get a representation of the vector and
       // loop over all the elements
       TrilinosScalar *start_ptr;

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.