BlockVector<long double>;
@DEAL_II_EXPAND_TRILINOS_VECTOR@;
+ @DEAL_II_EXPAND_TRILINOS_MPI_VECTOR@;
@DEAL_II_EXPAND_PETSC_VECTOR@;
@DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR@;
+ @DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR@;
@DEAL_II_EXPAND_PETSC_BLOCKVECTOR@;
}
DEAL_II_DEFINE_DEAL_II_USE_PETSC
DEAL_II_EXPAND_TRILINOS_VECTOR
DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR
+DEAL_II_EXPAND_TRILINOS_MPI_VECTOR
+DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR
USE_CONTRIB_TRILINOS
DEAL_II_TRILINOS_DIR
DEAL_II_TRILINOS_SHARED
DEAL_II_EXPAND_TRILINOS_VECTOR="TrilinosWrappers::Vector"
DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR="TrilinosWrappers::BlockVector"
+ DEAL_II_EXPAND_TRILINOS_MPI_VECTOR="TrilinosWrappers::MPI::Vector"
+ DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR="TrilinosWrappers::MPI::BlockVector"
if test "x$with_trilinos" = "x" ; then
with_trilinos="yes"
DEAL_II_DEFINE_DEAL_II_USE_PETSC!$DEAL_II_DEFINE_DEAL_II_USE_PETSC$ac_delim
DEAL_II_EXPAND_TRILINOS_VECTOR!$DEAL_II_EXPAND_TRILINOS_VECTOR$ac_delim
DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR!$DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR$ac_delim
+DEAL_II_EXPAND_TRILINOS_MPI_VECTOR!$DEAL_II_EXPAND_TRILINOS_MPI_VECTOR$ac_delim
+DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR!$DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR$ac_delim
USE_CONTRIB_TRILINOS!$USE_CONTRIB_TRILINOS$ac_delim
DEAL_II_TRILINOS_DIR!$DEAL_II_TRILINOS_DIR$ac_delim
DEAL_II_TRILINOS_SHARED!$DEAL_II_TRILINOS_SHARED$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 29; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 31; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
void
get_interpolated_dof_values (const TrilinosWrappers::BlockVector &in,
Vector<TrilinosScalar> &out) const = 0;
+ /**
+ * Call
+ * @p get_interpolated_dof_values
+ * of the iterator with the
+ * given arguments.
+ */
+
+ virtual
+ void
+ get_interpolated_dof_values (const TrilinosWrappers::MPI::Vector &in,
+ Vector<TrilinosScalar> &out) const = 0;
+
+ /**
+ * Call
+ * @p get_interpolated_dof_values
+ * of the iterator with the
+ * given arguments.
+ */
+ virtual
+ void
+ get_interpolated_dof_values (const TrilinosWrappers::MPI::BlockVector &in,
+ Vector<TrilinosScalar> &out) const = 0;
#endif
};
void
get_interpolated_dof_values (const TrilinosWrappers::BlockVector &in,
Vector<TrilinosScalar> &out) const;
+
+ /**
+ * Call
+ * @p get_interpolated_dof_values
+ * of the iterator with the
+ * given arguments.
+ */
+ virtual
+ void
+ get_interpolated_dof_values (const TrilinosWrappers::MPI::Vector &in,
+ Vector<TrilinosScalar> &out) const;
+
+ /**
+ * Call
+ * @p get_interpolated_dof_values
+ * of the iterator with the
+ * given arguments.
+ */
+ virtual
+ void
+ get_interpolated_dof_values (const TrilinosWrappers::MPI::BlockVector &in,
+ Vector<TrilinosScalar> &out) const;
#endif
private:
void
get_interpolated_dof_values (const TrilinosWrappers::BlockVector &in,
Vector<TrilinosScalar> &out) const;
+
+ /**
+ * Call
+ * @p get_interpolated_dof_values
+ * of the iterator with the
+ * given arguments.
+ */
+ virtual
+ void
+ get_interpolated_dof_values (const TrilinosWrappers::MPI::Vector &in,
+ Vector<TrilinosScalar> &out) const;
+
+ /**
+ * Call
+ * @p get_interpolated_dof_values
+ * of the iterator with the
+ * given arguments.
+ */
+ virtual
+ void
+ get_interpolated_dof_values (const TrilinosWrappers::MPI::BlockVector &in,
+ Vector<TrilinosScalar> &out) const;
#endif
private:
class Vector;
class BlockSparseMatrix;
class BlockVector;
+ namespace MPI
+ {
+ class Vector;
+ class BlockVector;
+ }
}
#endif
#ifdef DEAL_II_USE_TRILINOS
/**
- * Apply dirichlet boundary conditions to
- * the system matrix and vectors as
- * described in the general
- * documentation. This function works on
- * the classes that are used to wrap
- * Trilinos objects.
+ * Apply dirichlet boundary
+ * conditions to the system matrix
+ * and vectors as described in the
+ * general documentation. This
+ * function works on the classes
+ * that are used to wrap Trilinos
+ * objects.
*
- * Note that this function is not very
- * efficient: it needs to alternatingly
- * read and write into the matrix, a
- * situation that Trilinos does not handle
- * too well. In addition, we only get rid
- * of rows corresponding to boundary
- * nodes, but the corresponding case of
- * deleting the respective columns
- * (i.e. if @p eliminate_columns is @p
- * true) is not presently implemented,
- * and probably will never because it is
- * too expensive without direct access to
- * the Trilinos data structures. (This leads
- * to the situation where the action
- * indicates by the default value of the
- * last argument is actually not
- * implemented; that argument has
- * <code>true</code> as its default value
- * to stay consistent with the other
- * functions of same name in this class.)
- * A third reason against this function
- * is that it doesn't handle the case
- * where the matrix is distributed across
- * an MPI system.
+ * Note that this function is not
+ * very efficient: it needs to
+ * alternatingly read and write
+ * into the matrix, a situation
+ * that Trilinos does not handle
+ * too well. In addition, we only
+ * get rid of rows corresponding to
+ * boundary nodes, but the
+ * corresponding case of deleting
+ * the respective columns (i.e. if
+ * @p eliminate_columns is @p true)
+ * is not presently implemented,
+ * and probably will never because
+ * it is too expensive without
+ * direct access to the Trilinos
+ * data structures. (This leads to
+ * the situation where the action
+ * indicates by the default value
+ * of the last argument is actually
+ * not implemented; that argument
+ * has <code>true</code> as its
+ * default value to stay consistent
+ * with the other functions of same
+ * name in this class.) A third
+ * reason against this function is
+ * that it doesn't handle the case
+ * where the matrix is distributed
+ * across an MPI system.
+ */
+ static void
+ apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+ TrilinosWrappers::SparseMatrix &matrix,
+ TrilinosWrappers::Vector &solution,
+ TrilinosWrappers::Vector &right_hand_side,
+ const bool eliminate_columns = true);
+
+ /**
+ * This function does the same as
+ * the one above, except now
+ * working on block structures.
+ */
+ static void
+ apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+ TrilinosWrappers::BlockSparseMatrix &matrix,
+ TrilinosWrappers::BlockVector &solution,
+ TrilinosWrappers::BlockVector &right_hand_side,
+ const bool eliminate_columns = true);
+
+ /**
+ * Apply dirichlet boundary
+ * conditions to the system matrix
+ * and vectors as described in the
+ * general documentation. This
+ * function works on the classes
+ * that are used to wrap Trilinos
+ * objects.
+ *
+ * Note that this function is not
+ * very efficient: it needs to
+ * alternatingly read and write
+ * into the matrix, a situation
+ * that Trilinos does not handle
+ * too well. In addition, we only
+ * get rid of rows corresponding to
+ * boundary nodes, but the
+ * corresponding case of deleting
+ * the respective columns (i.e. if
+ * @p eliminate_columns is @p true)
+ * is not presently implemented,
+ * and probably will never because
+ * it is too expensive without
+ * direct access to the Trilinos
+ * data structures. (This leads to
+ * the situation where the action
+ * indicates by the default value
+ * of the last argument is actually
+ * not implemented; that argument
+ * has <code>true</code> as its
+ * default value to stay consistent
+ * with the other functions of same
+ * name in this class.) This
+ * function does work on MPI vector
+ * types.
*/
static void
apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
TrilinosWrappers::SparseMatrix &matrix,
- TrilinosWrappers::Vector &solution,
- TrilinosWrappers::Vector &right_hand_side,
+ TrilinosWrappers::MPI::Vector &solution,
+ TrilinosWrappers::MPI::Vector &right_hand_side,
const bool eliminate_columns = true);
/**
static void
apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
TrilinosWrappers::BlockSparseMatrix &matrix,
- TrilinosWrappers::BlockVector &solution,
- TrilinosWrappers::BlockVector &right_hand_side,
+ TrilinosWrappers::MPI::BlockVector &solution,
+ TrilinosWrappers::MPI::BlockVector &right_hand_side,
const bool eliminate_columns = true);
#endif
#ifdef DEAL_II_USE_TRILINOS
VECTOR_FUNCTIONS(TrilinosWrappers::Vector);
VECTOR_FUNCTIONS(TrilinosWrappers::BlockVector);
+VECTOR_FUNCTIONS(TrilinosWrappers::MPI::Vector);
+VECTOR_FUNCTIONS(TrilinosWrappers::MPI::BlockVector);
#endif
cell->get_interpolated_dof_values (in, out);
}
+
+
+template <int dim>
+template <typename CI>
+void
+FEValuesBase<dim>::CellIterator<CI>::
+get_interpolated_dof_values (const TrilinosWrappers::MPI::Vector &in,
+ Vector<TrilinosScalar> &out) const
+{
+ cell->get_interpolated_dof_values (in, out);
+}
+
+
+
+template <int dim>
+template <typename CI>
+void
+FEValuesBase<dim>::CellIterator<CI>::
+get_interpolated_dof_values (const TrilinosWrappers::MPI::BlockVector &in,
+ Vector<TrilinosScalar> &out) const
+{
+ cell->get_interpolated_dof_values (in, out);
+}
+
#endif
Assert (false, ExcMessage (message_string));
}
+
+
+template <int dim>
+void
+FEValuesBase<dim>::TriaCellIterator::
+get_interpolated_dof_values (const TrilinosWrappers::MPI::Vector &,
+ Vector<TrilinosScalar> &) const
+{
+ Assert (false, ExcMessage (message_string));
+}
+
+
+
+template <int dim>
+void
+FEValuesBase<dim>::TriaCellIterator::
+get_interpolated_dof_values (const TrilinosWrappers::MPI::BlockVector &,
+ Vector<TrilinosScalar> &) const
+{
+ Assert (false, ExcMessage (message_string));
+}
+
#endif
INSTANTIATE(TrilinosWrappers::Vector,hp::DoFHandler<deal_II_dimension>);
INSTANTIATE(TrilinosWrappers::BlockVector,hp::DoFHandler<deal_II_dimension>);
+
+INSTANTIATE(TrilinosWrappers::MPI::Vector,DoFHandler<deal_II_dimension>);
+INSTANTIATE(TrilinosWrappers::MPI::BlockVector,DoFHandler<deal_II_dimension>);
+
+INSTANTIATE(TrilinosWrappers::MPI::Vector,hp::DoFHandler<deal_II_dimension>);
+INSTANTIATE(TrilinosWrappers::MPI::BlockVector,hp::DoFHandler<deal_II_dimension>);
#endif
#undef INSTANTIATE
TrilinosMatrix &matrix,
TrilinosVector &solution,
TrilinosVector &right_hand_side,
- const bool eliminate_columns)
+ const bool eliminate_columns)
{
Assert (eliminate_columns == false, ExcNotImplemented());
solution.compress ();
right_hand_side.compress ();
}
+
+
+
+ template <typename TrilinosMatrix, typename TrilinosBlockVector>
+ void
+ apply_block_boundary_values (const std::map<unsigned int,double> &boundary_values,
+ TrilinosMatrix &matrix,
+ TrilinosBlockVector &solution,
+ TrilinosBlockVector &right_hand_side,
+ const bool eliminate_columns)
+ {
+ Assert (matrix.n() == right_hand_side.size(),
+ ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
+ Assert (matrix.n() == solution.size(),
+ ExcDimensionMismatch(matrix.n(), solution.size()));
+ Assert (matrix.n_block_rows() == matrix.n_block_cols(),
+ ExcNotQuadratic());
+
+ const unsigned int n_blocks = matrix.n_block_rows();
+
+ matrix.compress();
+
+ // We need to find the subdivision
+ // into blocks for the boundary values.
+ // To this end, generate a vector of
+ // maps with the respective indices.
+ std::vector<std::map<unsigned int,double> > block_boundary_values(n_blocks);
+ {
+ int offset = 0, block=0;
+ for (std::map<unsigned int,double>::const_iterator
+ dof = boundary_values.begin();
+ dof != boundary_values.end();
+ ++dof)
+ {
+ if (dof->first >= matrix.block(block,0).m() + offset)
+ {
+ offset += matrix.block(block,0).m();
+ block++;
+ }
+ const unsigned int index = dof->first - offset;
+ block_boundary_values[block].insert(
+ std::pair<unsigned int, double> (index,dof->second));
+ }
+ }
+
+ // Now call the non-block variants on
+ // the diagonal subblocks and the
+ // solution/rhs.
+ for (unsigned int block=0; block<n_blocks; ++block)
+ TrilinosWrappers::apply_boundary_values(block_boundary_values[block],
+ matrix.block(block,block),
+ solution.block(block),
+ right_hand_side.block(block),
+ eliminate_columns);
+
+ // Finally, we need to do something
+ // about the off-diagonal matrices. This
+ // is luckily not difficult. Just clear
+ // the whole row.
+ for (unsigned int block_m=0; block_m<n_blocks; ++block_m)
+ {
+ const std::pair<unsigned int, unsigned int> local_range
+ = matrix.block(block_m,0).local_range();
+
+ std::vector<unsigned int> constrained_rows;
+ for (std::map<unsigned int,double>::const_iterator
+ dof = block_boundary_values[block_m].begin();
+ dof != block_boundary_values[block_m].end();
+ ++dof)
+ if ((dof->first >= local_range.first) &&
+ (dof->first < local_range.second))
+ constrained_rows.push_back (dof->first);
+
+ for (unsigned int block_n=0; block_n<n_blocks; ++block_n)
+ if (block_m != block_n)
+ matrix.block(block_m,block_n).clear_rows(constrained_rows);
+ }
+ }
+
}
MatrixTools::
apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
TrilinosWrappers::SparseMatrix &matrix,
- TrilinosWrappers::Vector &solution,
- TrilinosWrappers::Vector &right_hand_side,
+ TrilinosWrappers::Vector &solution,
+ TrilinosWrappers::Vector &right_hand_side,
const bool eliminate_columns)
{
// simply redirect to the generic function
right_hand_side, eliminate_columns);
}
+
+
+void
+MatrixTools::
+apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+ TrilinosWrappers::SparseMatrix &matrix,
+ TrilinosWrappers::MPI::Vector &solution,
+ TrilinosWrappers::MPI::Vector &right_hand_side,
+ const bool eliminate_columns)
+{
+ // simply redirect to the generic function
+ // used for both trilinos matrix types
+ TrilinosWrappers::apply_boundary_values (boundary_values, matrix, solution,
+ right_hand_side, eliminate_columns);
+}
+
+
+
void
MatrixTools::
apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
TrilinosWrappers::BlockVector &right_hand_side,
const bool eliminate_columns)
{
- Assert (matrix.n() == right_hand_side.size(),
- ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
- Assert (matrix.n() == solution.size(),
- ExcDimensionMismatch(matrix.n(), solution.size()));
- Assert (matrix.n_block_rows() == matrix.n_block_cols(),
- ExcNotQuadratic());
-
- const unsigned int n_blocks = matrix.n_block_rows();
+ TrilinosWrappers::apply_block_boundary_values (boundary_values, matrix,
+ solution, right_hand_side,
+ eliminate_columns);
+}
- matrix.compress();
- // We need to find the subdivision
- // into blocks for the boundary values.
- // To this end, generate a vector of
- // maps with the respective indices.
- std::vector<std::map<unsigned int,double> > block_boundary_values(n_blocks);
- {
- int offset = 0, block=0;
- for (std::map<unsigned int,double>::const_iterator
- dof = boundary_values.begin();
- dof != boundary_values.end();
- ++dof)
- {
- if (dof->first >= matrix.block(block,0).m() + offset)
- {
- offset += matrix.block(block,0).m();
- block++;
- }
- const unsigned int index = dof->first - offset;
- block_boundary_values[block].insert(std::pair<unsigned int, double> (index,dof->second));
- }
- }
-
- // Now call the non-block variants on
- // the diagonal subblocks and the
- // solution/rhs.
- for (unsigned int block=0; block<n_blocks; ++block)
- TrilinosWrappers::apply_boundary_values(block_boundary_values[block],
- matrix.block(block,block),
- solution.block(block),
- right_hand_side.block(block),
- eliminate_columns);
-
- // Finally, we need to do something
- // about the off-diagonal matrices. This
- // is luckily not difficult. Just clear
- // the whole row.
- for (unsigned int block_m=0; block_m<n_blocks; ++block_m)
- {
- const std::pair<unsigned int, unsigned int> local_range
- = matrix.block(block_m,0).local_range();
-
- std::vector<unsigned int> constrained_rows;
- for (std::map<unsigned int,double>::const_iterator
- dof = block_boundary_values[block_m].begin();
- dof != block_boundary_values[block_m].end();
- ++dof)
- if ((dof->first >= local_range.first) &&
- (dof->first < local_range.second))
- constrained_rows.push_back (dof->first);
-
- for (unsigned int block_n=0; block_n<n_blocks; ++block_n)
- if (block_m != block_n)
- matrix.block(block_m,block_n).clear_rows(constrained_rows);
- }
+
+void
+MatrixTools::
+apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+ TrilinosWrappers::BlockSparseMatrix &matrix,
+ TrilinosWrappers::MPI::BlockVector &solution,
+ TrilinosWrappers::MPI::BlockVector &right_hand_side,
+ const bool eliminate_columns)
+{
+ TrilinosWrappers::apply_block_boundary_values (boundary_values, matrix,
+ solution, right_hand_side,
+ eliminate_columns);
}
#endif
template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::BlockVector, DoFHandler<deal_II_dimension> >;
template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::BlockVector, hp::DoFHandler<deal_II_dimension> >;
+
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::Vector, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::Vector, hp::DoFHandler<deal_II_dimension> >;
+
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::BlockVector, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::BlockVector, hp::DoFHandler<deal_II_dimension> >;
#endif
/*---------------------------- solution_transfer.cc ----------------------*/
BlockVector::reinit (const unsigned int num_blocks)
{
std::vector<unsigned int> block_sizes (num_blocks, 0);
- this->block_indices.reinit (block_sizes);
- if (this->components.size() != this->n_blocks())
- this->components.resize(this->n_blocks());
+ block_indices.reinit (block_sizes);
+ if (components.size() != n_blocks())
+ components.resize(n_blocks());
- for (unsigned int i=0;i<this->n_blocks();++i)
+ for (unsigned int i=0;i<n_blocks();++i)
block(i).clear();
}
BlockVector &
BlockVector::operator = (const BlockVector &v)
{
- Assert (n_blocks() == v.n_blocks(),
- ExcDimensionMismatch(n_blocks(),v.n_blocks()));
+ if (n_blocks() != v.n_blocks())
+ {
+ std::vector<unsigned int> block_sizes (v.n_blocks(), 0);
+ block_indices.reinit (block_sizes);
+ if (components.size() != n_blocks())
+ components.resize(n_blocks());
+ }
for (unsigned int i=0; i<this->n_blocks(); ++i)
this->components[i] = v.block(i);
+ collect_sizes();
+
return *this;
}