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> ¶llel_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
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> ¶llel_partitioning);
-
/**
* Resize the matrix to a square tensor product of matrices. See the
* constructor that takes a vector of IndexSets for details.
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
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
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 ¶llel_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 – 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 –
- * 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
*/
* 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,
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 ¶llel_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
- * – 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 – 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 ¶llel_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
- * – 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 – 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
*/
* 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;
* 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.
*/
- BlockSparsityPattern::BlockSparsityPattern(
- const std::vector<Epetra_Map> ¶llel_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> ¶llel_partitioning,
const MPI_Comm & communicator)
- void
- BlockSparsityPattern::reinit(
- const std::vector<Epetra_Map> ¶llel_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> ¶llel_partitioning,
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(),
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);
}
- 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,
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);
}
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 &,
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);
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);
- 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)
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)
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
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);
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)
// 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
// 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.
};
+
// 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)
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"));
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;
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)
{
(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);
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);
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());
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));
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(),
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,
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,
- 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)
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 &,
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> &,
}
- 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,
} // 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 ¶llel_partitioning,
- 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 &)
{
- 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
{
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 &,
// 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);
}
}
// 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
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());
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());
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());
// 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());
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());
// 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());
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);