]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove deprecated TrilinosWrappers constructors and reinitializations
authorDaniel Arndt <arndtd@ornl.gov>
Thu, 23 Apr 2020 02:56:01 +0000 (22:56 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Thu, 23 Apr 2020 03:15:34 +0000 (23:15 -0400)
20 files changed:
include/deal.II/lac/block_sparsity_pattern.h
include/deal.II/lac/trilinos_block_sparse_matrix.h
include/deal.II/lac/trilinos_sparse_matrix.h
include/deal.II/lac/trilinos_sparsity_pattern.h
source/lac/block_sparsity_pattern.cc
source/lac/trilinos_block_sparse_matrix.cc
source/lac/trilinos_precondition_ml.cc
source/lac/trilinos_precondition_muelu.cc
source/lac/trilinos_sparse_matrix.cc
source/lac/trilinos_sparse_matrix.inst.in
source/lac/trilinos_sparsity_pattern.cc
tests/trilinos/64.cc
tests/trilinos/parallel_sparse_matrix_01.cc
tests/trilinos/sparse_matrix_02.cc
tests/trilinos/sparse_matrix_03.cc
tests/trilinos/sparse_matrix_04.cc
tests/trilinos/sparse_matrix_05.cc
tests/trilinos/sparse_matrix_07.cc
tests/trilinos/sparse_matrix_07_rectangle.cc
tests/trilinos/sparse_matrix_copy_from_01.cc

index 71484356a47b63fc88580a306008bfbcd1ac3322..6f9164903399d70bec39b89887047409cc0a0fa3 100644 (file)
@@ -650,19 +650,6 @@ namespace TrilinosWrappers
     BlockSparsityPattern(const std::vector<size_type> &row_block_sizes,
                          const std::vector<size_type> &col_block_sizes);
 
-    /**
-     * Initialize the pattern with an array Epetra_Map that specifies both
-     * rows and columns of the matrix (so the final matrix will be a square
-     * matrix), where the Epetra_Map specifies the parallel distribution of
-     * the degrees of freedom on the individual block.  This function is
-     * equivalent to calling the second constructor with the length of the
-     * mapping vector and then entering the index values.
-     *
-     * @deprecated Use the respective method with IndexSet arguments instead.
-     */
-    DEAL_II_DEPRECATED
-    BlockSparsityPattern(const std::vector<Epetra_Map> &parallel_partitioning);
-
     /**
      * Initialize the pattern with an array of index sets that specifies both
      * rows and columns of the matrix (so the final matrix will be a square
@@ -703,17 +690,6 @@ namespace TrilinosWrappers
     reinit(const std::vector<size_type> &row_block_sizes,
            const std::vector<size_type> &col_block_sizes);
 
-    /**
-     * Resize the matrix to a square tensor product of matrices with parallel
-     * distribution according to the specifications in the array of
-     * Epetra_Maps.
-     *
-     * @deprecated Use the respective method with IndexSet arguments instead.
-     */
-    DEAL_II_DEPRECATED
-    void
-    reinit(const std::vector<Epetra_Map> &parallel_partitioning);
-
     /**
      * Resize the matrix to a square tensor product of matrices. See the
      * constructor that takes a vector of IndexSets for details.
index ab8d8a3f27d687e952bb770e6bebc02556ce5b0d..a3dd36d2b2d0a07fbd785490d2fbaf909b9587f5 100644 (file)
@@ -147,17 +147,6 @@ namespace TrilinosWrappers
     void
     reinit(const size_type n_block_rows, const size_type n_block_columns);
 
-    /**
-     * Resize the matrix, by using an array of Epetra maps to determine the
-     * %parallel distribution of the individual matrices. This function
-     * assumes that a quadratic block matrix is generated.
-     */
-    template <typename BlockSparsityPatternType>
-    void
-    reinit(const std::vector<Epetra_Map> & input_maps,
-           const BlockSparsityPatternType &block_sparsity_pattern,
-           const bool                      exchange_data = false);
-
     /**
      * Resize the matrix, by using an array of index sets to determine the
      * %parallel distribution of the individual matrices. This function
@@ -179,20 +168,6 @@ namespace TrilinosWrappers
     void
     reinit(const BlockSparsityPatternType &block_sparsity_pattern);
 
-    /**
-     * This function initializes the Trilinos matrix using the deal.II sparse
-     * matrix and the entries stored therein. It uses a threshold to copy only
-     * elements whose modulus is larger than the threshold (so zeros in the
-     * deal.II matrix can be filtered away).
-     *
-     * @deprecated Use the respective method with IndexSet arguments instead.
-     */
-    DEAL_II_DEPRECATED
-    void
-    reinit(const std::vector<Epetra_Map> &            input_maps,
-           const ::dealii::BlockSparseMatrix<double> &deal_ii_sparse_matrix,
-           const double                               drop_tolerance = 1e-13);
-
     /**
      * This function initializes the Trilinos matrix using the deal.II sparse
      * matrix and the entries stored therein. It uses a threshold to copy only
index 7c864504d3de957857f2ccd887fc7f0c7b16a5a8..4d2513bbb850669493e36cfad2b6376a97d36ea5 100644 (file)
@@ -699,188 +699,7 @@ namespace TrilinosWrappers
     void
     reinit(const Epetra_CrsMatrix &input_matrix, const bool copy_values = true);
     //@}
-    /**
-     * @name Constructors and initialization using an Epetra_Map description
-     */
-    //@{
-    /**
-     * Constructor using an Epetra_Map to describe the %parallel partitioning.
-     * The parameter @p n_max_entries_per_row sets the number of nonzero
-     * entries in each row that will be allocated. Note that this number does
-     * not need to be exact, and it is even allowed that the actual matrix
-     * structure has more nonzero entries than specified in the constructor.
-     * However it is still advantageous to provide good estimates here since
-     * this will considerably increase the performance of the matrix setup.
-     * However, there is no effect in the performance of matrix-vector
-     * products, since Trilinos reorganizes the matrix memory prior to use (in
-     * the compress() step).
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    DEAL_II_DEPRECATED
-    SparseMatrix(const Epetra_Map &parallel_partitioning,
-                 const size_type   n_max_entries_per_row = 0);
-
-    /**
-     * Same as before, but now set a value of nonzeros for each matrix row.
-     * Since we know the number of elements in the matrix exactly in this
-     * case, we can already allocate the right amount of memory, which makes
-     * the creation process including the insertion of nonzero elements by the
-     * respective SparseMatrix::reinit call considerably faster.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    DEAL_II_DEPRECATED
-    SparseMatrix(const Epetra_Map &               parallel_partitioning,
-                 const std::vector<unsigned int> &n_entries_per_row);
-
-    /**
-     * This constructor is similar to the one above, but it now takes two
-     * different Epetra maps for rows and columns. This interface is meant to
-     * be used for generating rectangular matrices, where one map describes
-     * the %parallel partitioning of the dofs associated with the matrix rows
-     * and the other one the partitioning of dofs in the matrix columns. Note
-     * that there is no real parallelism along the columns &ndash; the
-     * processor that owns a certain row always owns all the column elements,
-     * no matter how far they might be spread out. The second Epetra_Map is
-     * only used to specify the number of columns and for internal
-     * arrangements when doing matrix-vector products with vectors based on
-     * that column map.
-     *
-     * The integer input @p n_max_entries_per_row defines the number of
-     * columns entries per row that will be allocated.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    DEAL_II_DEPRECATED
-    SparseMatrix(const Epetra_Map &row_parallel_partitioning,
-                 const Epetra_Map &col_parallel_partitioning,
-                 const size_type   n_max_entries_per_row = 0);
-
-    /**
-     * This constructor is similar to the one above, but it now takes two
-     * different Epetra maps for rows and columns. This interface is meant to
-     * be used for generating rectangular matrices, where one map specifies
-     * the %parallel distribution of degrees of freedom associated with matrix
-     * rows and the second one specifies the %parallel distribution the dofs
-     * associated with columns in the matrix. The second map also provides
-     * information for the internal arrangement in matrix vector products
-     * (i.e., the distribution of vector this matrix is to be multiplied
-     * with), but is not used for the distribution of the columns &ndash;
-     * rather, all column elements of a row are stored on the same processor
-     * in any case. The vector <tt>n_entries_per_row</tt> specifies the number
-     * of entries in each row of the newly generated matrix.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    DEAL_II_DEPRECATED
-    SparseMatrix(const Epetra_Map &               row_parallel_partitioning,
-                 const Epetra_Map &               col_parallel_partitioning,
-                 const std::vector<unsigned int> &n_entries_per_row);
-
-    /**
-     * This function is initializes the Trilinos Epetra matrix according to
-     * the specified sparsity_pattern, and also reassigns the matrix rows to
-     * different processes according to a user-supplied Epetra map. In
-     * programs following the style of the tutorial programs, this function
-     * (and the respective call for a rectangular matrix) are the natural way
-     * to initialize the matrix size, its distribution among the MPI processes
-     * (if run in %parallel) as well as the location of non-zero elements.
-     * Trilinos stores the sparsity pattern internally, so it won't be needed
-     * any more after this call, in contrast to the deal.II own object. The
-     * optional argument @p exchange_data can be used for reinitialization
-     * with a sparsity pattern that is not fully constructed. This feature is
-     * only implemented for input sparsity patterns of type
-     * DynamicSparsityPattern. If the flag is not set, each processor just
-     * sets the elements in the sparsity pattern that belong to its rows.
-     *
-     * If the sparsity pattern given to this function is of type
-     * DynamicSparsity pattern, then a matrix will be created that allows
-     * several threads to write into different rows of the matrix at the same
-     * also with MPI, as opposed to most other reinit() methods.
-     *
-     * This is a collective operation that needs to be called on all
-     * processors in order to avoid a dead lock.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    template <typename SparsityPatternType>
-    DEAL_II_DEPRECATED void
-    reinit(const Epetra_Map &         parallel_partitioning,
-           const SparsityPatternType &sparsity_pattern,
-           const bool                 exchange_data = false);
-
-    /**
-     * This function is similar to the other initialization function above,
-     * but now also reassigns the matrix rows and columns according to two
-     * user-supplied Epetra maps.  To be used for rectangular matrices. The
-     * optional argument @p exchange_data can be used for reinitialization
-     * with a sparsity pattern that is not fully constructed. This feature is
-     * only implemented for input sparsity patterns of type
-     * DynamicSparsityPattern.
-     *
-     * This is a collective operation that needs to be called on all
-     * processors in order to avoid a dead lock.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    template <typename SparsityPatternType>
-    DEAL_II_DEPRECATED void
-    reinit(const Epetra_Map &         row_parallel_partitioning,
-           const Epetra_Map &         col_parallel_partitioning,
-           const SparsityPatternType &sparsity_pattern,
-           const bool                 exchange_data = false);
 
-    /**
-     * This function initializes the Trilinos matrix using the deal.II sparse
-     * matrix and the entries stored therein. It uses a threshold to copy only
-     * elements with modulus larger than the threshold (so zeros in the
-     * deal.II matrix can be filtered away). In contrast to the other reinit
-     * function with deal.II sparse matrix argument, this function takes a
-     * %parallel partitioning specified by the user instead of internally
-     * generating it.
-     *
-     * The optional parameter <tt>copy_values</tt> decides whether only the
-     * sparsity structure of the input matrix should be used or the matrix
-     * entries should be copied, too.
-     *
-     * This is a collective operation that needs to be called on all
-     * processors in order to avoid a dead lock.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    template <typename number>
-    DEAL_II_DEPRECATED void
-    reinit(const Epetra_Map &                    parallel_partitioning,
-           const ::dealii::SparseMatrix<number> &dealii_sparse_matrix,
-           const double                          drop_tolerance    = 1e-13,
-           const bool                            copy_values       = true,
-           const ::dealii::SparsityPattern *     use_this_sparsity = nullptr);
-
-    /**
-     * This function is similar to the other initialization function with
-     * deal.II sparse matrix input above, but now takes Epetra maps for both
-     * the rows and the columns of the matrix. Chosen for rectangular
-     * matrices.
-     *
-     * The optional parameter <tt>copy_values</tt> decides whether only the
-     * sparsity structure of the input matrix should be used or the matrix
-     * entries should be copied, too.
-     *
-     * This is a collective operation that needs to be called on all
-     * processors in order to avoid a dead lock.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    template <typename number>
-    DEAL_II_DEPRECATED void
-    reinit(const Epetra_Map &                    row_parallel_partitioning,
-           const Epetra_Map &                    col_parallel_partitioning,
-           const ::dealii::SparseMatrix<number> &dealii_sparse_matrix,
-           const double                          drop_tolerance    = 1e-13,
-           const bool                            copy_values       = true,
-           const ::dealii::SparsityPattern *     use_this_sparsity = nullptr);
-    //@}
     /**
      * @name Constructors and initialization using an IndexSet description
      */
@@ -990,7 +809,9 @@ namespace TrilinosWrappers
      * processors in order to avoid a dead lock.
      */
     template <typename SparsityPatternType>
-    void
+    typename std::enable_if<
+      !std::is_same<SparsityPatternType,
+                    dealii::SparseMatrix<double>>::value>::type
     reinit(const IndexSet &           row_parallel_partitioning,
            const IndexSet &           col_parallel_partitioning,
            const SparsityPatternType &sparsity_pattern,
index 47f3b7d4452f241609e95e271ad4479518d8ca99..bf956ea9b1d7cdef91a532f151474747f72dc02a 100644 (file)
@@ -421,200 +421,7 @@ namespace TrilinosWrappers
     void
     compress();
     //@}
-    /**
-     * @name Constructors and initialization using an Epetra_Map description
-     */
-    //@{
-
-    /**
-     * Constructor for a square sparsity pattern using an Epetra_map for the
-     * description of the %parallel partitioning. Moreover, the number of
-     * nonzero entries in the rows of the sparsity pattern can be specified.
-     * Note that this number does not need to be exact, and it is allowed that
-     * the actual sparsity structure has more nonzero entries than specified
-     * in the constructor (the usual case when the function
-     * DoFTools::make_sparsity_pattern() is called). However it is still
-     * advantageous to provide good estimates here since a good value will
-     * avoid repeated allocation of memory, which considerably increases the
-     * performance when creating the sparsity pattern.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    DEAL_II_DEPRECATED
-    SparsityPattern(const Epetra_Map &parallel_partitioning,
-                    const size_type   n_entries_per_row = 0);
-
-    /**
-     * Same as before, but now use the exact number of nonzeros in each m row.
-     * Since we know the number of elements in the sparsity pattern exactly in
-     * this case, we can already allocate the right amount of memory, which
-     * makes the creation process by the respective SparsityPattern::reinit
-     * call considerably faster. However, this is a rather unusual situation,
-     * since knowing the number of entries in each row is usually connected to
-     * knowing the indices of nonzero entries, which the sparsity pattern is
-     * designed to describe.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    DEAL_II_DEPRECATED
-    SparsityPattern(const Epetra_Map &            parallel_partitioning,
-                    const std::vector<size_type> &n_entries_per_row);
-
-    /**
-     * This constructor is similar to the one above, but it now takes two
-     * different Epetra maps for rows and columns. This interface is meant to
-     * be used for generating rectangular sparsity pattern, where one map
-     * describes the %parallel partitioning of the dofs associated with the
-     * sparsity pattern rows and the other one of the sparsity pattern
-     * columns. Note that there is no real parallelism along the columns
-     * &ndash; the processor that owns a certain row always owns all the
-     * column elements, no matter how far they might be spread out. The second
-     * Epetra_Map is only used to specify the number of columns and for
-     * specifying the correct domain space when performing matrix-vector
-     * products with vectors based on the same column map.
-     *
-     * The number of columns entries per row is specified as the maximum
-     * number of entries argument.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    DEAL_II_DEPRECATED
-    SparsityPattern(const Epetra_Map &row_parallel_partitioning,
-                    const Epetra_Map &col_parallel_partitioning,
-                    const size_type   n_entries_per_row = 0);
-
-    /**
-     * This constructor is similar to the one above, but it now takes two
-     * different Epetra maps for rows and columns. This interface is meant to
-     * be used for generating rectangular matrices, where one map specifies
-     * the %parallel distribution of rows and the second one specifies the
-     * distribution of degrees of freedom associated with matrix columns. This
-     * second map is however not used for the distribution of the columns
-     * themselves &ndash; rather, all column elements of a row are stored on
-     * the same processor. The vector <tt>n_entries_per_row</tt> specifies the
-     * number of entries in each row of the newly generated matrix.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    DEAL_II_DEPRECATED
-    SparsityPattern(const Epetra_Map &            row_parallel_partitioning,
-                    const Epetra_Map &            col_parallel_partitioning,
-                    const std::vector<size_type> &n_entries_per_row);
-
-    /**
-     * Reinitialization function for generating a square sparsity pattern
-     * using an Epetra_Map for the description of the %parallel partitioning
-     * and the number of nonzero entries in the rows of the sparsity pattern.
-     * Note that this number does not need to be exact, and it is even allowed
-     * that the actual sparsity structure has more nonzero entries than
-     * specified in the constructor. However it is still advantageous to
-     * provide good estimates here since this will considerably increase the
-     * performance when creating the sparsity pattern.
-     *
-     * This function does not create any entries by itself, but provides the
-     * correct data structures that can be used by the respective add()
-     * function.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    DEAL_II_DEPRECATED
-    void
-    reinit(const Epetra_Map &parallel_partitioning,
-           const size_type   n_entries_per_row = 0);
-
-    /**
-     * Same as before, but now use the exact number of nonzeros in each m row.
-     * Since we know the number of elements in the sparsity pattern exactly in
-     * this case, we can already allocate the right amount of memory, which
-     * makes process of adding entries to the sparsity pattern considerably
-     * faster. However, this is a rather unusual situation, since knowing the
-     * number of entries in each row is usually connected to knowing the
-     * indices of nonzero entries, which the sparsity pattern is designed to
-     * describe.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    DEAL_II_DEPRECATED
-    void
-    reinit(const Epetra_Map &            parallel_partitioning,
-           const std::vector<size_type> &n_entries_per_row);
-
-    /**
-     * This reinit function is similar to the one above, but it now takes two
-     * different Epetra maps for rows and columns. This interface is meant to
-     * be used for generating rectangular sparsity pattern, where one map
-     * describes the %parallel partitioning of the dofs associated with the
-     * sparsity pattern rows and the other one of the sparsity pattern
-     * columns. Note that there is no real parallelism along the columns
-     * &ndash; the processor that owns a certain row always owns all the
-     * column elements, no matter how far they might be spread out. The second
-     * Epetra_Map is only used to specify the number of columns and for
-     * internal arrangements when doing matrix-vector products with vectors
-     * based on that column map.
-     *
-     * The number of columns entries per row is specified by the argument
-     * <tt>n_entries_per_row</tt>.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    DEAL_II_DEPRECATED
-    void
-    reinit(const Epetra_Map &row_parallel_partitioning,
-           const Epetra_Map &col_parallel_partitioning,
-           const size_type   n_entries_per_row = 0);
-
-    /**
-     * This reinit function is similar to the one above, but it now takes two
-     * different Epetra maps for rows and columns. This interface is meant to
-     * be used for generating rectangular matrices, where one map specifies
-     * the %parallel distribution of rows and the second one specifies the
-     * distribution of degrees of freedom associated with matrix columns. This
-     * second map is however not used for the distribution of the columns
-     * themselves &ndash; rather, all column elements of a row are stored on
-     * the same processor. The vector <tt>n_entries_per_row</tt> specifies the
-     * number of entries in each row of the newly generated matrix.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    DEAL_II_DEPRECATED
-    void
-    reinit(const Epetra_Map &            row_parallel_partitioning,
-           const Epetra_Map &            col_parallel_partitioning,
-           const std::vector<size_type> &n_entries_per_row);
-
-    /**
-     * Reinit function. Takes one of the deal.II sparsity patterns and a
-     * %parallel partitioning of the rows and columns for initializing the
-     * current Trilinos sparsity pattern. The optional argument @p
-     * exchange_data can be used for reinitialization with a sparsity pattern
-     * that is not fully constructed. This feature is only implemented for
-     * input sparsity patterns of type DynamicSparsityPattern.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    template <typename SparsityPatternType>
-    DEAL_II_DEPRECATED void
-    reinit(const Epetra_Map &         row_parallel_partitioning,
-           const Epetra_Map &         col_parallel_partitioning,
-           const SparsityPatternType &nontrilinos_sparsity_pattern,
-           const bool                 exchange_data = false);
 
-    /**
-     * Reinit function. Takes one of the deal.II sparsity patterns and a
-     * %parallel partitioning of the rows and columns for initializing the
-     * current Trilinos sparsity pattern. The optional argument @p
-     * exchange_data can be used for reinitialization with a sparsity pattern
-     * that is not fully constructed. This feature is only implemented for
-     * input sparsity patterns of type DynamicSparsityPattern.
-     *
-     * @deprecated Use the respective method with IndexSet argument instead.
-     */
-    template <typename SparsityPatternType>
-    DEAL_II_DEPRECATED void
-    reinit(const Epetra_Map &         parallel_partitioning,
-           const SparsityPatternType &nontrilinos_sparsity_pattern,
-           const bool                 exchange_data = false);
-    //@}
     /**
      * @name Constructors and initialization using an IndexSet description
      */
@@ -1000,10 +807,7 @@ namespace TrilinosWrappers
      * 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.
-     *
-     * @deprecated Use locally_owned_domain_indices() instead.
      */
-    DEAL_II_DEPRECATED
     const Epetra_Map &
     domain_partitioner() const;
 
@@ -1012,46 +816,10 @@ namespace TrilinosWrappers
      * 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.
-     *
-     * @deprecated Use locally_owned_range_indices() instead.
      */
-    DEAL_II_DEPRECATED
     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.
-     *
-     * @deprecated Use locally_owned_range_indices() instead.
-     */
-    DEAL_II_DEPRECATED
-    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.
-     *
-     * @deprecated Usually not necessary. If desired, access via the
-     * Epetra_FECrsGraph.
-     */
-    DEAL_II_DEPRECATED
-    const Epetra_Map &
-    col_partitioner() const;
-
-    /**
-     * Return a const reference to the communicator used for this object.
-     *
-     * @deprecated Use get_mpi_communicator instead.
-     */
-    DEAL_II_DEPRECATED
-    const Epetra_Comm &
-    trilinos_communicator() const;
-
     /**
      * Return the MPI communicator object in use with this matrix.
      */
index 2ffc8a7c23f9c8d2caf552491aa4f96746224a43..edb74ccaec34b74e87afa9a5a4ba60c79ee31a10 100644 (file)
@@ -529,20 +529,6 @@ namespace TrilinosWrappers
 
 
 
-  BlockSparsityPattern::BlockSparsityPattern(
-    const std::vector<Epetra_Map> &parallel_partitioning)
-    : BlockSparsityPatternBase<SparsityPattern>(parallel_partitioning.size(),
-                                                parallel_partitioning.size())
-  {
-    for (size_type i = 0; i < parallel_partitioning.size(); ++i)
-      for (size_type j = 0; j < parallel_partitioning.size(); ++j)
-        this->block(i, j).reinit(parallel_partitioning[i],
-                                 parallel_partitioning[j]);
-    this->collect_sizes();
-  }
-
-
-
   BlockSparsityPattern::BlockSparsityPattern(
     const std::vector<IndexSet> &parallel_partitioning,
     const MPI_Comm &             communicator)
@@ -593,21 +579,6 @@ namespace TrilinosWrappers
 
 
 
-  void
-  BlockSparsityPattern::reinit(
-    const std::vector<Epetra_Map> &parallel_partitioning)
-  {
-    dealii::BlockSparsityPatternBase<SparsityPattern>::reinit(
-      parallel_partitioning.size(), parallel_partitioning.size());
-    for (size_type i = 0; i < parallel_partitioning.size(); ++i)
-      for (size_type j = 0; j < parallel_partitioning.size(); ++j)
-        this->block(i, j).reinit(parallel_partitioning[i],
-                                 parallel_partitioning[j]);
-    this->collect_sizes();
-  }
-
-
-
   void
   BlockSparsityPattern::reinit(
     const std::vector<IndexSet> &parallel_partitioning,
index 6c0f5b55acc2f79d3d163ce403e5494c7999d2f0..ea801539827c4f713c45fa356b3d179c34ab2cb5 100644 (file)
@@ -71,20 +71,24 @@ namespace TrilinosWrappers
   template <typename BlockSparsityPatternType>
   void
   BlockSparseMatrix::reinit(
-    const std::vector<Epetra_Map> & parallel_partitioning,
+    const std::vector<IndexSet> &   parallel_partitioning,
     const BlockSparsityPatternType &block_sparsity_pattern,
+    const MPI_Comm &                communicator,
     const bool                      exchange_data)
   {
-    Assert(parallel_partitioning.size() ==
-             block_sparsity_pattern.n_block_rows(),
-           ExcDimensionMismatch(parallel_partitioning.size(),
+    std::vector<Epetra_Map> epetra_maps;
+    for (size_type i = 0; i < block_sparsity_pattern.n_block_rows(); ++i)
+      epetra_maps.push_back(
+        parallel_partitioning[i].make_trilinos_map(communicator, false));
+
+    Assert(epetra_maps.size() == block_sparsity_pattern.n_block_rows(),
+           ExcDimensionMismatch(epetra_maps.size(),
                                 block_sparsity_pattern.n_block_rows()));
-    Assert(parallel_partitioning.size() ==
-             block_sparsity_pattern.n_block_cols(),
-           ExcDimensionMismatch(parallel_partitioning.size(),
+    Assert(epetra_maps.size() == block_sparsity_pattern.n_block_cols(),
+           ExcDimensionMismatch(epetra_maps.size(),
                                 block_sparsity_pattern.n_block_cols()));
 
-    const size_type n_block_rows = parallel_partitioning.size();
+    const size_type n_block_rows = epetra_maps.size();
     (void)n_block_rows;
 
     Assert(n_block_rows == block_sparsity_pattern.n_block_rows(),
@@ -111,42 +115,22 @@ namespace TrilinosWrappers
           this->sub_objects[r][c]->reinit(parallel_partitioning[r],
                                           parallel_partitioning[c],
                                           block_sparsity_pattern.block(r, c),
+                                          communicator,
                                           exchange_data);
         }
   }
 
 
 
-  template <typename BlockSparsityPatternType>
-  void
-  BlockSparseMatrix::reinit(
-    const std::vector<IndexSet> &   parallel_partitioning,
-    const BlockSparsityPatternType &block_sparsity_pattern,
-    const MPI_Comm &                communicator,
-    const bool                      exchange_data)
-  {
-    std::vector<Epetra_Map> epetra_maps;
-    for (size_type i = 0; i < block_sparsity_pattern.n_block_rows(); ++i)
-      epetra_maps.push_back(
-        parallel_partitioning[i].make_trilinos_map(communicator, false));
-
-    reinit(epetra_maps, block_sparsity_pattern, exchange_data);
-  }
-
-
-
   template <typename BlockSparsityPatternType>
   void
   BlockSparseMatrix::reinit(
     const BlockSparsityPatternType &block_sparsity_pattern)
   {
-    std::vector<Epetra_Map> parallel_partitioning;
+    std::vector<IndexSet> parallel_partitioning;
     for (size_type i = 0; i < block_sparsity_pattern.n_block_rows(); ++i)
       parallel_partitioning.emplace_back(
-        static_cast<TrilinosWrappers::types::int_type>(
-          block_sparsity_pattern.block(i, 0).n_rows()),
-        0,
-        Utilities::Trilinos::comm_self());
+        complete_index_set(block_sparsity_pattern.block(i, 0).n_rows()));
 
     reinit(parallel_partitioning, block_sparsity_pattern);
   }
@@ -176,41 +160,6 @@ namespace TrilinosWrappers
 
 
 
-  void
-  BlockSparseMatrix::reinit(
-    const std::vector<Epetra_Map> &            parallel_partitioning,
-    const ::dealii::BlockSparseMatrix<double> &dealii_block_sparse_matrix,
-    const double                               drop_tolerance)
-  {
-    const size_type n_block_rows = parallel_partitioning.size();
-
-    Assert(n_block_rows == dealii_block_sparse_matrix.n_block_rows(),
-           ExcDimensionMismatch(n_block_rows,
-                                dealii_block_sparse_matrix.n_block_rows()));
-    Assert(n_block_rows == dealii_block_sparse_matrix.n_block_cols(),
-           ExcDimensionMismatch(n_block_rows,
-                                dealii_block_sparse_matrix.n_block_cols()));
-
-    // Call the other basic reinit function ...
-    reinit(n_block_rows, n_block_rows);
-
-    // ... and then assign the correct
-    // data to the blocks.
-    for (size_type r = 0; r < this->n_block_rows(); ++r)
-      for (size_type c = 0; c < this->n_block_cols(); ++c)
-        {
-          this->sub_objects[r][c]->reinit(parallel_partitioning[r],
-                                          parallel_partitioning[c],
-                                          dealii_block_sparse_matrix.block(r,
-                                                                           c),
-                                          drop_tolerance);
-        }
-
-    collect_sizes();
-  }
-
-
-
   void
   BlockSparseMatrix::reinit(
     const ::dealii::BlockSparseMatrix<double> &dealii_block_sparse_matrix,
@@ -224,23 +173,15 @@ namespace TrilinosWrappers
            ExcDimensionMismatch(dealii_block_sparse_matrix.m(),
                                 dealii_block_sparse_matrix.n()));
 
-    // produce a dummy local map and pass it
-    // off to the other function
-#  ifdef DEAL_II_WITH_MPI
-    Epetra_MpiComm trilinos_communicator(MPI_COMM_SELF);
-#  else
-    Epetra_SerialComm trilinos_communicator;
-#  endif
-
-    std::vector<Epetra_Map> parallel_partitioning;
+    std::vector<IndexSet> parallel_partitioning;
     for (size_type i = 0; i < dealii_block_sparse_matrix.n_block_rows(); ++i)
       parallel_partitioning.emplace_back(
-        static_cast<TrilinosWrappers::types::int_type>(
-          dealii_block_sparse_matrix.block(i, 0).m()),
-        0,
-        trilinos_communicator);
+        complete_index_set(dealii_block_sparse_matrix.block(i, 0).m()));
 
-    reinit(parallel_partitioning, dealii_block_sparse_matrix, drop_tolerance);
+    reinit(parallel_partitioning,
+           dealii_block_sparse_matrix,
+           MPI_COMM_SELF,
+           drop_tolerance);
   }
 
 
@@ -376,15 +317,6 @@ namespace TrilinosWrappers
   template void
   BlockSparseMatrix::reinit(const dealii::BlockDynamicSparsityPattern &);
 
-  template void
-  BlockSparseMatrix::reinit(const std::vector<Epetra_Map> &,
-                            const dealii::BlockSparsityPattern &,
-                            const bool);
-  template void
-  BlockSparseMatrix::reinit(const std::vector<Epetra_Map> &,
-                            const dealii::BlockDynamicSparsityPattern &,
-                            const bool);
-
   template void
   BlockSparseMatrix::reinit(const std::vector<IndexSet> &,
                             const dealii::BlockDynamicSparsityPattern &,
index 435ea9f8480f96ea0349b540a7208ad172cf3ff3..2a5ea5305e770e84daea2075f6bda2fd735a2026 100644 (file)
@@ -284,19 +284,21 @@ namespace TrilinosWrappers
     preconditioner.reset();
     const size_type n_rows = deal_ii_sparse_matrix.m();
 
-    // Init Epetra Matrix using an
-    // equidistributed map; avoid
-    // storing the nonzero
-    // elements.
-    vector_distributor = std::make_shared<Epetra_Map>(
-      static_cast<TrilinosWrappers::types::int_type>(n_rows), 0, communicator);
+    // Init Epetra Matrix using an equidistributed map; avoid storing the
+    // nonzero elements.
+    IndexSet           distributor(n_rows);
+    const unsigned int n_mpi_processes = communicator.NumProc();
+    const unsigned int my_id           = communicator.MyPID();
+    distributor.add_range(my_id * n_rows / n_mpi_processes,
+                          (my_id + 1) * n_rows / n_mpi_processes);
 
     if (trilinos_matrix.get() == nullptr)
       trilinos_matrix = std::make_shared<SparseMatrix>();
 
-    trilinos_matrix->reinit(*vector_distributor,
-                            *vector_distributor,
+    trilinos_matrix->reinit(distributor,
+                            distributor,
                             deal_ii_sparse_matrix,
+                            communicator.Comm(),
                             drop_tolerance,
                             true,
                             use_this_sparsity);
index ed1ae4ee589ebb7194549700dfbb5f80c5a5e545..fd10f6a7815473755beed38f6d3fdb03ddcac157 100644 (file)
@@ -214,19 +214,21 @@ namespace TrilinosWrappers
     preconditioner.reset();
     const size_type n_rows = deal_ii_sparse_matrix.m();
 
-    // Init Epetra Matrix using an
-    // equidistributed map; avoid
-    // storing the nonzero
-    // elements.
-    vector_distributor = std::make_shared<Epetra_Map>(
-      static_cast<TrilinosWrappers::types::int_type>(n_rows), 0, communicator);
+    // Init Epetra Matrix using an equidistributed map; avoid storing the
+    // nonzero elements.
+    IndexSet           distributor(n_rows);
+    const unsigned int n_mpi_processes = communicator.NumProc();
+    const unsigned int my_id           = communicator.MyPID();
+    distributor.add_range(my_id * n_rows / n_mpi_processes,
+                          (my_id + 1) * n_rows / n_mpi_processes);
 
     if (trilinos_matrix.get() == nullptr)
       trilinos_matrix = std::make_shared<SparseMatrix>();
 
-    trilinos_matrix->reinit(*vector_distributor,
-                            *vector_distributor,
+    trilinos_matrix->reinit(distributor,
+                            distributor,
                             deal_ii_sparse_matrix,
+                            communicator.Comm(),
                             drop_tolerance,
                             true,
                             use_this_sparsity);
index bd04d29cc61bf115c4ab3787bc51ffc8c2157059..2d8031a1b05077cb9f7010eb0bc6f09a7c6ced69 100644 (file)
@@ -218,66 +218,6 @@ namespace TrilinosWrappers
 
 
 
-  SparseMatrix::SparseMatrix(const Epetra_Map &input_map,
-                             const size_type   n_max_entries_per_row)
-    : column_space_map(new Epetra_Map(input_map))
-    , matrix(new Epetra_FECrsMatrix(Copy,
-                                    *column_space_map,
-                                    TrilinosWrappers::types::int_type(
-                                      n_max_entries_per_row),
-                                    false))
-    , last_action(Zero)
-    , compressed(false)
-  {}
-
-
-
-  SparseMatrix::SparseMatrix(const Epetra_Map &               input_map,
-                             const std::vector<unsigned int> &n_entries_per_row)
-    : column_space_map(new Epetra_Map(input_map))
-    , matrix(new Epetra_FECrsMatrix(Copy,
-                                    *column_space_map,
-                                    reinterpret_cast<int *>(
-                                      const_cast<unsigned int *>(
-                                        n_entries_per_row.data())),
-                                    false))
-    , last_action(Zero)
-    , compressed(false)
-  {}
-
-
-
-  SparseMatrix::SparseMatrix(const Epetra_Map &input_row_map,
-                             const Epetra_Map &input_col_map,
-                             const size_type   n_max_entries_per_row)
-    : column_space_map(new Epetra_Map(input_col_map))
-    , matrix(new Epetra_FECrsMatrix(Copy,
-                                    input_row_map,
-                                    TrilinosWrappers::types::int_type(
-                                      n_max_entries_per_row),
-                                    false))
-    , last_action(Zero)
-    , compressed(false)
-  {}
-
-
-
-  SparseMatrix::SparseMatrix(const Epetra_Map &               input_row_map,
-                             const Epetra_Map &               input_col_map,
-                             const std::vector<unsigned int> &n_entries_per_row)
-    : column_space_map(new Epetra_Map(input_col_map))
-    , matrix(new Epetra_FECrsMatrix(Copy,
-                                    input_row_map,
-                                    reinterpret_cast<int *>(
-                                      const_cast<unsigned int *>(
-                                        n_entries_per_row.data())),
-                                    false))
-    , last_action(Zero)
-    , compressed(false)
-  {}
-
-
-
   SparseMatrix::SparseMatrix(const size_type    m,
                              const size_type    n,
                              const unsigned int n_max_entries_per_row)
@@ -512,11 +452,12 @@ namespace TrilinosWrappers
 
     template <typename SparsityPatternType>
     void
-    reinit_matrix(const Epetra_Map &                   input_row_map,
-                  const Epetra_Map &                   input_col_map,
-                  const SparsityPatternType &          sparsity_pattern,
-                  const bool                           exchange_data,
-                  std::unique_ptr<Epetra_Map> &        column_space_map,
+    reinit_matrix(const IndexSet &             row_parallel_partitioning,
+                  const IndexSet &             column_parallel_partitioning,
+                  const SparsityPatternType &  sparsity_pattern,
+                  const bool                   exchange_data,
+                  const MPI_Comm &             communicator,
+                  std::unique_ptr<Epetra_Map> &column_space_map,
                   std::unique_ptr<Epetra_FECrsMatrix> &matrix,
                   std::unique_ptr<Epetra_CrsMatrix> &  nonlocal_matrix,
                   std::unique_ptr<Epetra_Export> &     nonlocal_matrix_exporter)
@@ -526,15 +467,19 @@ namespace TrilinosWrappers
       nonlocal_matrix.reset();
       nonlocal_matrix_exporter.reset();
 
-      if (input_row_map.Comm().MyPID() == 0)
+      column_space_map = std_cxx14::make_unique<Epetra_Map>(
+        column_parallel_partitioning.make_trilinos_map(communicator, false));
+
+      if (column_space_map->Comm().MyPID() == 0)
         {
           AssertDimension(sparsity_pattern.n_rows(),
-                          TrilinosWrappers::n_global_elements(input_row_map));
+                          row_parallel_partitioning.size());
           AssertDimension(sparsity_pattern.n_cols(),
-                          TrilinosWrappers::n_global_elements(input_col_map));
+                          column_parallel_partitioning.size());
         }
 
-      column_space_map = std_cxx14::make_unique<Epetra_Map>(input_col_map);
+      Epetra_Map row_space_map =
+        row_parallel_partitioning.make_trilinos_map(communicator, false);
 
       // if we want to exchange data, build a usual Trilinos sparsity pattern
       // and let that handle the exchange. otherwise, manually create a
@@ -543,9 +488,10 @@ namespace TrilinosWrappers
       if (exchange_data)
         {
           SparsityPattern trilinos_sparsity;
-          trilinos_sparsity.reinit(input_row_map,
-                                   input_col_map,
+          trilinos_sparsity.reinit(row_parallel_partitioning,
+                                   column_parallel_partitioning,
                                    sparsity_pattern,
+                                   communicator,
                                    exchange_data);
           matrix = std_cxx14::make_unique<Epetra_FECrsMatrix>(
             Copy, trilinos_sparsity.trilinos_sparsity_pattern(), false);
@@ -553,9 +499,9 @@ namespace TrilinosWrappers
           return;
         }
 
-      const size_type first_row = TrilinosWrappers::min_my_gid(input_row_map),
+      const size_type first_row = TrilinosWrappers::min_my_gid(row_space_map),
                       last_row =
-                        TrilinosWrappers::max_my_gid(input_row_map) + 1;
+                        TrilinosWrappers::max_my_gid(row_space_map) + 1;
       std::vector<int> n_entries_per_row(last_row - first_row);
 
       for (size_type row = first_row; row < last_row; ++row)
@@ -576,12 +522,16 @@ namespace TrilinosWrappers
       // distributed). for only one processor, we can directly assign the
       // columns as well. Compare this with bug # 4123 in the Sandia Bugzilla.
       std::unique_ptr<Epetra_CrsGraph> graph;
-      if (input_row_map.Comm().NumProc() > 1)
+      if (row_space_map.Comm().NumProc() > 1)
         graph = std_cxx14::make_unique<Epetra_CrsGraph>(
-          Copy, input_row_map, n_entries_per_row.data(), true);
+          Copy, row_space_map, n_entries_per_row.data(), true);
       else
-        graph = std_cxx14::make_unique<Epetra_CrsGraph>(
-          Copy, input_row_map, input_col_map, n_entries_per_row.data(), true);
+        graph =
+          std_cxx14::make_unique<Epetra_CrsGraph>(Copy,
+                                                  row_space_map,
+                                                  *column_space_map,
+                                                  n_entries_per_row.data(),
+                                                  true);
 
       // This functions assumes that the sparsity pattern sits on all
       // processors (completely). The parallel version uses an Epetra graph
@@ -612,7 +562,7 @@ namespace TrilinosWrappers
       // contiguous, etc). note that the documentation of the function indeed
       // states that we first need to provide the column (domain) map and then
       // the row (range) map
-      graph->FillComplete(input_col_map, input_row_map);
+      graph->FillComplete(*column_space_map, row_space_map);
       graph->OptimizeStorage();
 
       // check whether we got the number of columns right.
@@ -649,15 +599,17 @@ namespace TrilinosWrappers
     };
 
 
+
     // specialization for DynamicSparsityPattern which can provide us with
     // more information about the non-locally owned rows
     template <>
     void
-    reinit_matrix(const Epetra_Map &                   input_row_map,
-                  const Epetra_Map &                   input_col_map,
-                  const DynamicSparsityPattern &       sparsity_pattern,
-                  const bool                           exchange_data,
-                  std::unique_ptr<Epetra_Map> &        column_space_map,
+    reinit_matrix(const IndexSet &              row_parallel_partitioning,
+                  const IndexSet &              column_parallel_partitioning,
+                  const DynamicSparsityPattern &sparsity_pattern,
+                  const bool                    exchange_data,
+                  const MPI_Comm &              communicator,
+                  std::unique_ptr<Epetra_Map> & column_space_map,
                   std::unique_ptr<Epetra_FECrsMatrix> &matrix,
                   std::unique_ptr<Epetra_CrsMatrix> &  nonlocal_matrix,
                   std::unique_ptr<Epetra_Export> &     nonlocal_matrix_exporter)
@@ -666,25 +618,29 @@ namespace TrilinosWrappers
       nonlocal_matrix.reset();
       nonlocal_matrix_exporter.reset();
 
+      column_space_map = std_cxx14::make_unique<Epetra_Map>(
+        column_parallel_partitioning.make_trilinos_map(communicator, false));
+
       AssertDimension(sparsity_pattern.n_rows(),
-                      TrilinosWrappers::n_global_elements(input_row_map));
+                      row_parallel_partitioning.size());
       AssertDimension(sparsity_pattern.n_cols(),
-                      TrilinosWrappers::n_global_elements(input_col_map));
+                      column_parallel_partitioning.size());
 
-      column_space_map = std_cxx14::make_unique<Epetra_Map>(input_col_map);
+      Epetra_Map row_space_map =
+        row_parallel_partitioning.make_trilinos_map(communicator, false);
 
       IndexSet relevant_rows(sparsity_pattern.row_index_set());
       // serial case
       if (relevant_rows.size() == 0)
         {
           relevant_rows.set_size(
-            TrilinosWrappers::n_global_elements(input_row_map));
+            TrilinosWrappers::n_global_elements(row_space_map));
           relevant_rows.add_range(
-            0, TrilinosWrappers::n_global_elements(input_row_map));
+            0, TrilinosWrappers::n_global_elements(row_space_map));
         }
       relevant_rows.compress();
       Assert(relevant_rows.n_elements() >=
-               static_cast<unsigned int>(input_row_map.NumMyElements()),
+               static_cast<unsigned int>(row_space_map.NumMyElements()),
              ExcMessage(
                "Locally relevant rows of sparsity pattern must contain "
                "all locally owned rows"));
@@ -704,8 +660,8 @@ namespace TrilinosWrappers
              reinterpret_cast<TrilinosWrappers::types::int_type *>(
                indices.data())),
           0,
-          input_row_map.Comm());
-        if (relevant_map.SameAs(input_row_map))
+          row_space_map.Comm());
+        if (relevant_map.SameAs(row_space_map))
           have_ghost_rows = false;
         else
           have_ghost_rows = true;
@@ -713,13 +669,13 @@ namespace TrilinosWrappers
 
       const unsigned int n_rows = relevant_rows.n_elements();
       std::vector<TrilinosWrappers::types::int_type> ghost_rows;
-      std::vector<int> n_entries_per_row(input_row_map.NumMyElements());
+      std::vector<int> n_entries_per_row(row_space_map.NumMyElements());
       std::vector<int> n_entries_per_ghost_row;
       for (unsigned int i = 0, own = 0; i < n_rows; ++i)
         {
           const TrilinosWrappers::types::int_type global_row =
             relevant_rows.nth_index_in_set(i);
-          if (input_row_map.MyGID(global_row))
+          if (row_space_map.MyGID(global_row))
             n_entries_per_row[own++] = sparsity_pattern.row_length(global_row);
           else if (sparsity_pattern.row_length(global_row) > 0)
             {
@@ -735,15 +691,15 @@ namespace TrilinosWrappers
                                      (ghost_rows.data()) :
                                      nullptr,
                                    0,
-                                   input_row_map.Comm());
+                                   row_space_map.Comm());
 
       std::unique_ptr<Epetra_CrsGraph>    graph;
       std::unique_ptr<Epetra_CrsGraphMod> nonlocal_graph;
-      if (input_row_map.Comm().NumProc() > 1)
+      if (row_space_map.Comm().NumProc() > 1)
         {
           graph = std_cxx14::make_unique<Epetra_CrsGraph>(
             Copy,
-            input_row_map,
+            row_space_map,
             (n_entries_per_row.size() > 0) ? (n_entries_per_row.data()) :
                                              nullptr,
             exchange_data ? false : true);
@@ -754,8 +710,8 @@ namespace TrilinosWrappers
       else
         graph = std_cxx14::make_unique<Epetra_CrsGraph>(
           Copy,
-          input_row_map,
-          input_col_map,
+          row_space_map,
+          *column_space_map,
           (n_entries_per_row.size() > 0) ? (n_entries_per_row.data()) : nullptr,
           true);
 
@@ -774,7 +730,7 @@ namespace TrilinosWrappers
           for (int col = 0; col < row_length; ++col)
             row_indices[col] = sparsity_pattern.column_number(global_row, col);
 
-          if (input_row_map.MyGID(global_row))
+          if (row_space_map.MyGID(global_row))
             graph->InsertGlobalIndices(global_row,
                                        row_length,
                                        row_indices.data());
@@ -797,13 +753,13 @@ namespace TrilinosWrappers
           nonlocal_graph->SetIndicesAreGlobal();
           Assert(nonlocal_graph->IndicesAreGlobal() == true,
                  ExcInternalError());
-          nonlocal_graph->FillComplete(input_col_map, input_row_map);
+          nonlocal_graph->FillComplete(*column_space_map, row_space_map);
           nonlocal_graph->OptimizeStorage();
 
           // insert data from nonlocal graph into the final sparsity pattern
           if (exchange_data)
             {
-              Epetra_Export exporter(nonlocal_graph->RowMap(), input_row_map);
+              Epetra_Export exporter(nonlocal_graph->RowMap(), row_space_map);
               int ierr = graph->Export(*nonlocal_graph, exporter, Add);
               (void)ierr;
               Assert(ierr == 0, ExcTrilinosError(ierr));
@@ -813,7 +769,7 @@ namespace TrilinosWrappers
             std_cxx14::make_unique<Epetra_CrsMatrix>(Copy, *nonlocal_graph);
         }
 
-      graph->FillComplete(input_col_map, input_row_map);
+      graph->FillComplete(*column_space_map, row_space_map);
       graph->OptimizeStorage();
 
       AssertDimension(sparsity_pattern.n_cols(),
@@ -829,19 +785,11 @@ namespace TrilinosWrappers
   void
   SparseMatrix::reinit(const SparsityPatternType &sparsity_pattern)
   {
-    const Epetra_Map rows(static_cast<TrilinosWrappers::types::int_type>(
-                            sparsity_pattern.n_rows()),
-                          0,
-                          Utilities::Trilinos::comm_self());
-    const Epetra_Map columns(static_cast<TrilinosWrappers::types::int_type>(
-                               sparsity_pattern.n_cols()),
-                             0,
-                             Utilities::Trilinos::comm_self());
-
-    reinit_matrix(rows,
-                  columns,
+    reinit_matrix(complete_index_set(sparsity_pattern.n_rows()),
+                  complete_index_set(sparsity_pattern.n_cols()),
                   sparsity_pattern,
                   false,
+                  MPI_COMM_SELF,
                   column_space_map,
                   matrix,
                   nonlocal_matrix,
@@ -851,63 +799,20 @@ namespace TrilinosWrappers
 
 
   template <typename SparsityPatternType>
-  void
-  SparseMatrix::reinit(const Epetra_Map &         input_map,
-                       const SparsityPatternType &sparsity_pattern,
-                       const bool                 exchange_data)
-  {
-    reinit_matrix(input_map,
-                  input_map,
-                  sparsity_pattern,
-                  exchange_data,
-                  column_space_map,
-                  matrix,
-                  nonlocal_matrix,
-                  nonlocal_matrix_exporter);
-  }
-
-
-
-  template <typename SparsityPatternType>
-  inline void
+  inline typename std::enable_if<
+    !std::is_same<SparsityPatternType,
+                  dealii::SparseMatrix<double>>::value>::type
   SparseMatrix::reinit(const IndexSet &           row_parallel_partitioning,
                        const IndexSet &           col_parallel_partitioning,
                        const SparsityPatternType &sparsity_pattern,
                        const MPI_Comm &           communicator,
                        const bool                 exchange_data)
   {
-    Epetra_Map row_map =
-      row_parallel_partitioning.make_trilinos_map(communicator, false);
-    Epetra_Map col_map =
-      col_parallel_partitioning.make_trilinos_map(communicator, false);
-    reinit_matrix(row_map,
-                  col_map,
-                  sparsity_pattern,
-                  exchange_data,
-                  column_space_map,
-                  matrix,
-                  nonlocal_matrix,
-                  nonlocal_matrix_exporter);
-
-    // In the end, the matrix needs to be compressed in order to be really
-    // ready.
-    last_action = Zero;
-    compress(VectorOperation::insert);
-  }
-
-
-
-  template <typename SparsityPatternType>
-  inline void
-  SparseMatrix::reinit(const Epetra_Map &         row_map,
-                       const Epetra_Map &         col_map,
-                       const SparsityPatternType &sparsity_pattern,
-                       const bool                 exchange_data)
-  {
-    reinit_matrix(row_map,
-                  col_map,
+    reinit_matrix(row_parallel_partitioning,
+                  col_parallel_partitioning,
                   sparsity_pattern,
                   exchange_data,
+                  communicator,
                   column_space_map,
                   matrix,
                   nonlocal_matrix,
@@ -1101,47 +1006,6 @@ namespace TrilinosWrappers
 
 
 
-  template <typename number>
-  void
-  SparseMatrix::reinit(
-    const Epetra_Map &                    input_map,
-    const ::dealii::SparseMatrix<number> &dealii_sparse_matrix,
-    const double                          drop_tolerance,
-    const bool                            copy_values,
-    const ::dealii::SparsityPattern *     use_this_sparsity)
-  {
-    reinit(IndexSet(input_map),
-           IndexSet(input_map),
-           dealii_sparse_matrix,
-           MPI_COMM_SELF,
-           drop_tolerance,
-           copy_values,
-           use_this_sparsity);
-  }
-
-
-
-  template <typename number>
-  void
-  SparseMatrix::reinit(
-    const Epetra_Map &                    input_row_map,
-    const Epetra_Map &                    input_col_map,
-    const ::dealii::SparseMatrix<number> &dealii_sparse_matrix,
-    const double                          drop_tolerance,
-    const bool                            copy_values,
-    const ::dealii::SparsityPattern *     use_this_sparsity)
-  {
-    reinit(IndexSet(input_row_map),
-           IndexSet(input_col_map),
-           dealii_sparse_matrix,
-           MPI_COMM_SELF,
-           drop_tolerance,
-           copy_values,
-           use_this_sparsity);
-  }
-
-
-
   void
   SparseMatrix::reinit(const Epetra_CrsMatrix &input_matrix,
                        const bool              copy_values)
@@ -3471,24 +3335,6 @@ namespace TrilinosWrappers
   template void
   SparseMatrix::reinit(const DynamicSparsityPattern &);
 
-  template void
-  SparseMatrix::reinit(const Epetra_Map &,
-                       const dealii::SparsityPattern &,
-                       const bool);
-  template void
-  SparseMatrix::reinit(const Epetra_Map &,
-                       const DynamicSparsityPattern &,
-                       const bool);
-  template void
-  SparseMatrix::reinit(const Epetra_Map &,
-                       const Epetra_Map &,
-                       const dealii::SparsityPattern &,
-                       const bool);
-  template void
-  SparseMatrix::reinit(const Epetra_Map &,
-                       const Epetra_Map &,
-                       const DynamicSparsityPattern &,
-                       const bool);
   template void
   SparseMatrix::reinit(const IndexSet &,
                        const IndexSet &,
index dfa1ccbc4fbdcdb780ca75cf2b413c76c8bda402..1518885796710052971ecb90ac048a6d30965202 100644 (file)
@@ -25,19 +25,6 @@ for (S : REAL_SCALARS)
                            const bool,
                            const dealii::SparsityPattern *);
       template void
-      SparseMatrix::reinit(const Epetra_Map &,
-                           const dealii::SparseMatrix<S> &,
-                           const double,
-                           const bool,
-                           const dealii::SparsityPattern *);
-      template void
-      SparseMatrix::reinit(const Epetra_Map &,
-                           const Epetra_Map &,
-                           const dealii::SparseMatrix<S> &,
-                           const double,
-                           const bool,
-                           const dealii::SparsityPattern *);
-      template void
       SparseMatrix::reinit(const IndexSet &,
                            const IndexSet &,
                            const dealii::SparseMatrix<S> &,
index 290bfa848e68fc08edc2cb0bddf216d4b76ac06a..08c9e3e6eb426fe7b4a15b9999df7a7de7b18ed7 100644 (file)
@@ -95,41 +95,6 @@ namespace TrilinosWrappers
   }
 
 
-  SparsityPattern::SparsityPattern(const Epetra_Map &input_map,
-                                   const size_type   n_entries_per_row)
-  {
-    reinit(input_map, input_map, n_entries_per_row);
-  }
-
-
-
-  SparsityPattern::SparsityPattern(
-    const Epetra_Map &            input_map,
-    const std::vector<size_type> &n_entries_per_row)
-  {
-    reinit(input_map, input_map, n_entries_per_row);
-  }
-
-
-
-  SparsityPattern::SparsityPattern(const Epetra_Map &input_row_map,
-                                   const Epetra_Map &input_col_map,
-                                   const size_type   n_entries_per_row)
-  {
-    reinit(input_row_map, input_col_map, n_entries_per_row);
-  }
-
-
-
-  SparsityPattern::SparsityPattern(
-    const Epetra_Map &            input_row_map,
-    const Epetra_Map &            input_col_map,
-    const std::vector<size_type> &n_entries_per_row)
-  {
-    reinit(input_row_map, input_col_map, n_entries_per_row);
-  }
-
-
 
   SparsityPattern::SparsityPattern(const size_type m,
                                    const size_type n,
@@ -472,63 +437,6 @@ namespace TrilinosWrappers
   } // namespace
 
 
-  void
-  SparsityPattern::reinit(const Epetra_Map &input_map,
-                          const size_type   n_entries_per_row)
-  {
-    reinit_sp(input_map,
-              input_map,
-              n_entries_per_row,
-              column_space_map,
-              graph,
-              nonlocal_graph);
-  }
-
-
-
-  void
-  SparsityPattern::reinit(const Epetra_Map &input_row_map,
-                          const Epetra_Map &input_col_map,
-                          const size_type   n_entries_per_row)
-  {
-    reinit_sp(input_row_map,
-              input_col_map,
-              n_entries_per_row,
-              column_space_map,
-              graph,
-              nonlocal_graph);
-  }
-
-
-
-  void
-  SparsityPattern::reinit(const Epetra_Map &            input_map,
-                          const std::vector<size_type> &n_entries_per_row)
-  {
-    reinit_sp(input_map,
-              input_map,
-              n_entries_per_row,
-              column_space_map,
-              graph,
-              nonlocal_graph);
-  }
-
-
-
-  void
-  SparsityPattern::reinit(const Epetra_Map &            input_row_map,
-                          const Epetra_Map &            input_col_map,
-                          const std::vector<size_type> &n_entries_per_row)
-  {
-    reinit_sp(input_row_map,
-              input_col_map,
-              n_entries_per_row,
-              column_space_map,
-              graph,
-              nonlocal_graph);
-  }
-
-
 
   void
   SparsityPattern::reinit(const IndexSet &parallel_partitioning,
@@ -685,42 +593,6 @@ namespace TrilinosWrappers
 
 
 
-  template <typename SparsityPatternType>
-  void
-  SparsityPattern::reinit(const Epetra_Map &         input_map,
-                          const SparsityPatternType &sp,
-                          const bool                 exchange_data)
-  {
-    reinit_sp(input_map,
-              input_map,
-              sp,
-              exchange_data,
-              column_space_map,
-              graph,
-              nonlocal_graph);
-  }
-
-
-
-  template <typename SparsityPatternType>
-  void
-  SparsityPattern::reinit(const Epetra_Map &         input_row_map,
-                          const Epetra_Map &         input_col_map,
-                          const SparsityPatternType &sp,
-                          const bool                 exchange_data)
-  {
-    reinit_sp(input_row_map,
-              input_col_map,
-              sp,
-              exchange_data,
-              column_space_map,
-              graph,
-              nonlocal_graph);
-    compress();
-  }
-
-
-
   SparsityPattern &
   SparsityPattern::operator=(const SparsityPattern &)
   {
@@ -1067,36 +939,6 @@ namespace TrilinosWrappers
 
 
 
-  const Epetra_Map &
-  SparsityPattern::row_partitioner() const
-  {
-    // TODO A dynamic_cast fails here, this is suspicious.
-    const auto &row_map =
-      static_cast<const Epetra_Map &>(graph->RowMap()); // NOLINT
-    return row_map;
-  }
-
-
-
-  const Epetra_Map &
-  SparsityPattern::col_partitioner() const
-  {
-    // TODO A dynamic_cast fails here, this is suspicious.
-    const auto &col_map =
-      static_cast<const Epetra_Map &>(graph->ColMap()); // NOLINT
-    return col_map;
-  }
-
-
-
-  const Epetra_Comm &
-  SparsityPattern::trilinos_communicator() const
-  {
-    return graph->RangeMap().Comm();
-  }
-
-
-
   MPI_Comm
   SparsityPattern::get_mpi_communicator() const
   {
@@ -1200,28 +1042,6 @@ namespace TrilinosWrappers
   template void
   SparsityPattern::copy_from(const dealii::DynamicSparsityPattern &);
 
-
-  template void
-  SparsityPattern::reinit(const Epetra_Map &,
-                          const dealii::SparsityPattern &,
-                          bool);
-  template void
-  SparsityPattern::reinit(const Epetra_Map &,
-                          const dealii::DynamicSparsityPattern &,
-                          bool);
-
-  template void
-  SparsityPattern::reinit(const Epetra_Map &,
-                          const Epetra_Map &,
-                          const dealii::SparsityPattern &,
-                          bool);
-  template void
-  SparsityPattern::reinit(const Epetra_Map &,
-                          const Epetra_Map &,
-                          const dealii::DynamicSparsityPattern &,
-                          bool);
-
-
   template void
   SparsityPattern::reinit(const IndexSet &,
                           const dealii::SparsityPattern &,
index e49c6373e4037b5c475bf8bfe5178e15ac26ac4f..e49bb0878ec7ff522179194a1da15e7d81e25088 100644 (file)
@@ -68,15 +68,15 @@ main(int argc, char **argv)
 
         // check
         // TrilinosWrappers::SparseMatrix
-        const unsigned int n_jobs = Utilities::Trilinos::get_n_mpi_processes(
-          Utilities::Trilinos::comm_world());
+        const unsigned int n_jobs =
+          Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
+        const unsigned int my_id =
+          Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
         Assert(n_dofs % n_jobs == 0, ExcInternalError());
         const unsigned int n_local_dofs = n_dofs / n_jobs;
-        Epetra_Map map(static_cast<TrilinosWrappers::types::int_type>(n_dofs),
-                       static_cast<TrilinosWrappers::types::int_type>(
-                         n_local_dofs),
-                       Utilities::Trilinos::comm_world());
-        TrilinosWrappers::SparseMatrix v2(map, 5);
+        IndexSet           local_rows(n_dofs);
+        local_rows.add_range(n_local_dofs * my_id, n_local_dofs * (my_id + 1));
+        TrilinosWrappers::SparseMatrix v2(local_rows, MPI_COMM_WORLD, 5);
         test(v2);
       }
     }
index cc061bc9e5a5fc6e2b5b16fdc9a660a65e27b5e4..8c95c9228c44d1bb57703da2d1a70160c5ecc8a4 100644 (file)
@@ -81,19 +81,14 @@ test()
   //                    start_row[bj] + (i+2*k) % local_rows_per_process[bj]);
 
 
-
   // now create a matrix with this sparsity
   // pattern
-  Epetra_Map map(
-    TrilinosWrappers::types::int_type(-1),
-    TrilinosWrappers::types::int_type(
-      local_rows_per_process[Utilities::Trilinos::get_this_mpi_process(
-        Utilities::Trilinos::comm_world())]),
-    0,
-    Utilities::Trilinos::comm_world());
+  const unsigned int my_id = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
+  IndexSet           locally_owned_dofs(N);
+  locally_owned_dofs.add_range(start_row[my_id], local_rows_per_process[my_id]);
 
   TrilinosWrappers::SparseMatrix m;
-  m.reinit(map, csp);
+  m.reinit(locally_owned_dofs, locally_owned_dofs, csp, MPI_COMM_WORLD);
   // now write into the exact same matrix
   // entries as have been created by the
   // sparsity pattern above
index 6b0464dcb6a54e9a637d156a0a88a0591c2b66f3..3184ccb499d552cfae4658c984e93e3f3d28591e 100644 (file)
@@ -54,12 +54,9 @@ main(int argc, char **argv)
   matrix.print_formatted(deallog.get_file_stream());
 
   // now copy everything into a Trilinos matrix
-  Epetra_Map                     map(TrilinosWrappers::types::int_type(5),
-                 TrilinosWrappers::types::int_type(5),
-                 0,
-                 Utilities::Trilinos::comm_world());
+  const auto                     local_rows = complete_index_set(5);
   TrilinosWrappers::SparseMatrix tmatrix;
-  tmatrix.reinit(map, map, matrix);
+  tmatrix.reinit(local_rows, local_rows, matrix, MPI_COMM_SELF);
 
   deallog << "Copy with all values:" << std::endl;
   tmatrix.print(deallog.get_file_stream());
index 17a80fe08216d38e18a7369ec28f730c37f7faee..17eae9a1f830c25424457daff4e17ba80f9d36c5 100644 (file)
@@ -54,12 +54,9 @@ main(int argc, char **argv)
   matrix.print_formatted(deallog.get_file_stream());
 
   // now copy everything into a Trilinos matrix
-  Epetra_Map                     map(TrilinosWrappers::types::int_type(5),
-                 5,
-                 0,
-                 Utilities::Trilinos::comm_world());
+  const auto                     local_rows = complete_index_set(5);
   TrilinosWrappers::SparseMatrix tmatrix;
-  tmatrix.reinit(map, map, matrix, 4.);
+  tmatrix.reinit(local_rows, local_rows, matrix, MPI_COMM_SELF, 4.);
 
   deallog << "Copy with a drop tolerance of 4:" << std::endl;
   tmatrix.print(deallog.get_file_stream());
index 53768bb2c90e79e79a998237c99ed765ac9c1fa1..03ed5a978b697c8fc924386471849a8ca8a8e788 100644 (file)
@@ -54,13 +54,9 @@ main(int argc, char **argv)
   matrix.print_formatted(deallog.get_file_stream());
 
   // now copy everything into a Trilinos matrix
-  Epetra_Map map(TrilinosWrappers::types::int_type(5),
-                 TrilinosWrappers::types::int_type(5),
-                 0,
-                 Utilities::Trilinos::comm_world());
-
+  const auto                     local_rows = complete_index_set(5);
   TrilinosWrappers::SparseMatrix tmatrix;
-  tmatrix.reinit(map, map, matrix, 0, false);
+  tmatrix.reinit(local_rows, local_rows, matrix, MPI_COMM_SELF, 0, false);
 
   deallog << "Copy structure only:" << std::endl;
   tmatrix.print(deallog.get_file_stream());
index 5349978c8689a795a79d2dbd00f4ce1a4394471a..5b1ce6abf32e8f4f86f8555d02351858e87d9827 100644 (file)
@@ -61,12 +61,10 @@ main(int argc, char **argv)
 
 
   // now copy everything into a Trilinos matrix
-  Epetra_Map                     map(TrilinosWrappers::types::int_type(5),
-                 5,
-                 0,
-                 Utilities::Trilinos::comm_world());
+  const auto                     local_rows = complete_index_set(5);
   TrilinosWrappers::SparseMatrix tmatrix;
-  tmatrix.reinit(map, map, matrix, 0, true, &xsparsity);
+  tmatrix.reinit(
+    local_rows, local_rows, matrix, MPI_COMM_SELF, 0, true, &xsparsity);
 
   deallog << "Copy structure only:" << std::endl;
   tmatrix.print(deallog.get_file_stream());
index bff267210302e6103af476e6054a45205fb1a163..66d2b416323ee5d6f4a1292d039b1110d51b48a9 100644 (file)
@@ -63,14 +63,11 @@ main(int argc, char **argv)
   xsparsity.add(2, 1);
   xsparsity.compress();
 
-
   // now copy everything into a Trilinos matrix
-  Epetra_Map                     map(TrilinosWrappers::types::int_type(5),
-                 5,
-                 0,
-                 Utilities::Trilinos::comm_world());
+  const auto                     local_rows = complete_index_set(5);
   TrilinosWrappers::SparseMatrix tmatrix;
-  tmatrix.reinit(map, map, matrix, 0, true, &xsparsity);
+  tmatrix.reinit(
+    local_rows, local_rows, matrix, MPI_COMM_SELF, 0, true, &xsparsity);
 
   deallog << "Copy structure only:" << std::endl;
   tmatrix.print(deallog.get_file_stream());
index 0e33341dd813e8894c0e0761400a361517ec1333..ba74436c5a8afcbfc2cd589b8242b1994237acad 100644 (file)
@@ -63,17 +63,11 @@ main(int argc, char **argv)
 
 
   // now copy everything into a Trilinos matrix
-  Epetra_Map rowmap(TrilinosWrappers::types::int_type(4),
-                    4,
-                    0,
-                    Utilities::Trilinos::comm_world());
-  Epetra_Map colmap(TrilinosWrappers::types::int_type(5),
-                    5,
-                    0,
-                    Utilities::Trilinos::comm_world());
-
+  const auto                     local_rows = complete_index_set(4);
+  const auto                     local_cols = complete_index_set(5);
   TrilinosWrappers::SparseMatrix tmatrix;
-  tmatrix.reinit(rowmap, colmap, matrix, 0, true, &xsparsity);
+  tmatrix.reinit(
+    local_rows, local_cols, matrix, MPI_COMM_SELF, 0, true, &xsparsity);
 
   deallog << "Copy structure only:" << std::endl;
   tmatrix.print(deallog.get_file_stream());
index 8ce1589f4567f392faaace08b26c8a428751ec61..9de742b1220512f5214bc9e015d7296d6e1cdb10 100644 (file)
@@ -60,7 +60,8 @@ main(int argc, char **argv)
                  0,
                  Utilities::Trilinos::comm_world());
   TrilinosWrappers::SparseMatrix tmatrix;
-  tmatrix.reinit(map, map, matrix);
+  const auto                     local_rows = complete_index_set(5);
+  tmatrix.reinit(local_rows, local_rows, matrix, MPI_COMM_SELF);
 
   // now copy things back into a SparseMatrix
   SparseMatrix<double> copy(sparsity);

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.