@DEAL_II_EXPAND_EPETRA_VECTOR@;
@DEAL_II_EXPAND_PETSC_MPI_VECTOR@;
- @DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR@;
@DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR@;
@DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR@;
}
@DEAL_II_EXPAND_PETSC_MPI_VECTOR_REAL@;
}
-// wrappers for non-MPI vectors (PETSc/Trilinos)
-EXTERNAL_SEQUENTIAL_VECTORS := { @DEAL_II_EXPAND_TRILINOS_VECTOR@;
- @DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR@;
- }
-
// wrappers for MPI vectors (PETSc/Trilinos)
EXTERNAL_PARALLEL_VECTORS := { @DEAL_II_EXPAND_TRILINOS_MPI_VECTOR@;
@DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR@;
MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL)
- SET(DEAL_II_EXPAND_TRILINOS_VECTOR "TrilinosWrappers::Vector")
- SET(DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR "TrilinosWrappers::BlockVector")
+ SET(DEAL_II_EXPAND_TRILINOS_VECTOR "TrilinosWrappers::VectorBase")
SET(DEAL_II_EXPAND_TRILINOS_SPARSITY_PATTERN "TrilinosWrappers::SparsityPattern")
SET(DEAL_II_EXPAND_TRILINOS_BLOCK_SPARSITY_PATTERN "TrilinosWrappers::BlockSparsityPattern")
SET(DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR "TrilinosWrappers::MPI::BlockVector")
SET(DEAL_II_EXPAND_TRILINOS_MPI_VECTOR "TrilinosWrappers::MPI::Vector")
+
IF (TRILINOS_WITH_MPI)
SET(DEAL_II_EXPAND_EPETRA_VECTOR "LinearAlgebra::EpetraWrappers::Vector")
ENDIF()
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <queue>
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/constraint_matrix.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_iterator.h>
#ifdef DEAL_II_WITH_TRILINOS
namespace TrilinosWrappers
{
- class BlockVector;
+ namespace MPI
+ {
+ class BlockVector;
+ }
}
#endif
* A copy constructor taking a (parallel) Trilinos block vector and copying
* it into the deal.II own format.
*/
- BlockVector (const TrilinosWrappers::BlockVector &v);
+ BlockVector (const TrilinosWrappers::MPI::BlockVector &v);
#endif
/**
* vector.
*/
BlockVector<Number> &
- operator= (const TrilinosWrappers::BlockVector &V);
+ operator= (const TrilinosWrappers::MPI::BlockVector &V);
#endif
/**
#include <deal.II/base/config.h>
#include <deal.II/lac/block_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <cmath>
#include <algorithm>
#ifdef DEAL_II_WITH_TRILINOS
template <typename Number>
-BlockVector<Number>::BlockVector (const TrilinosWrappers::BlockVector &v)
+BlockVector<Number>::BlockVector (const TrilinosWrappers::MPI::BlockVector &v)
{
this->block_indices = v.get_block_indices();
this->components.resize(this->n_blocks());
template <typename Number>
inline
BlockVector<Number> &
-BlockVector<Number>::operator= (const TrilinosWrappers::BlockVector &v)
+BlockVector<Number>::operator= (const TrilinosWrappers::MPI::BlockVector &v)
{
BaseClass::operator= (v);
return *this;
{
// we have to check after using Insert/Add in any case to be
// consistent with the MPI communication model (see the comments in
- // the documentation of TrilinosWrappers::Vector), but we can save
+ // the documentation of TrilinosWrappers::VectorBase), but we can save
// some work if the addend is zero. However, these actions are done
// in case we pass on to the other function.
prepare_action(VectorOperation::add);
# include <deal.II/base/template_constraints.h>
# include <deal.II/lac/block_matrix_base.h>
# include <deal.II/lac/trilinos_sparse_matrix.h>
-# include <deal.II/lac/trilinos_block_vector.h>
+# include <deal.II/lac/trilinos_parallel_block_vector.h>
# include <deal.II/lac/full_matrix.h>
# include <deal.II/lac/exceptions.h>
* Source <i>x</i> and destination <i>dst</i> must not be the same vector.
*
* Note that both vectors have to be distributed vectors generated using
- * the same Map as was used for the matrix in case you work on a
- * distributed memory architecture, using the interface in the
- * TrilinosWrappers::MPI::BlockVector class.
+ * the same Map as was used for the matrix.
+ *
+ * This function only applicable if the matrix only has one block row.
*/
TrilinosScalar residual (MPI::BlockVector &dst,
const MPI::BlockVector &x,
* defined to be <i>r=b-Mx</i>. Write the residual into @p dst. The
* <i>l<sub>2</sub></i> norm of the residual vector is returned.
*
- * Source <i>x</i> and destination <i>dst</i> must not be the same vector.
- *
- * Note that both vectors have to be distributed vectors generated using
- * the same Map as was used for the matrix in case you work on a
- * distributed memory architecture, using the interface in the
- * TrilinosWrappers::BlockVector class. Since the block matrix is in
- * general distributed among processes, this function only works when
- * running the program on one processor.
- */
- TrilinosScalar residual (BlockVector &dst,
- const BlockVector &x,
- const BlockVector &b) const;
-
- /**
- * Compute the residual of an equation <i>Mx=b</i>, where the residual is
- * defined to be <i>r=b-Mx</i>. Write the residual into @p dst. The
- * <i>l<sub>2</sub></i> norm of the residual vector is returned. Just like
- * the previous function, but only applicable if the matrix only has one
- * block row.
+ * This function is only applicable if the matrix only has one block row.
*/
TrilinosScalar residual (MPI::BlockVector &dst,
const MPI::Vector &x,
/**
* Compute the residual of an equation <i>Mx=b</i>, where the residual is
* defined to be <i>r=b-Mx</i>. Write the residual into @p dst. The
- * <i>l<sub>2</sub></i> norm of the residual vector is returned. Just like
- * the previous function, but only applicable if the matrix only has one
- * block row.
- */
- TrilinosScalar residual (BlockVector &dst,
- const Vector &x,
- const BlockVector &b) const;
-
- /**
- * Compute the residual of an equation <i>Mx=b</i>, where the residual is
- * defined to be <i>r=b-Mx</i>. Write the residual into @p dst. The
- * <i>l<sub>2</sub></i> norm of the residual vector is returned. Just like
- * the previous function, but only applicable if the matrix only has one
- * block column.
+ * <i>l<sub>2</sub></i> norm of the residual vector is returned.
+ *
+ * This function is only applicable if the matrix only has one block column.
*/
TrilinosScalar residual (MPI::Vector &dst,
const MPI::BlockVector &x,
/**
* Compute the residual of an equation <i>Mx=b</i>, where the residual is
* defined to be <i>r=b-Mx</i>. Write the residual into @p dst. The
- * <i>l<sub>2</sub></i> norm of the residual vector is returned. Just like
- * the previous function, but only applicable if the matrix only has one
- * block column.
- */
- TrilinosScalar residual (Vector &dst,
- const BlockVector &x,
- const Vector &b) const;
-
- /**
- * Compute the residual of an equation <i>Mx=b</i>, where the residual is
- * defined to be <i>r=b-Mx</i>. Write the residual into @p dst. The
- * <i>l<sub>2</sub></i> norm of the residual vector is returned. Just like
- * the previous function, but only applicable if the matrix only has one
- * block.
+ * <i>l<sub>2</sub></i> norm of the residual vector is returned.
+ *
+ * This function is only applicable if the matrix only has one block.
*/
TrilinosScalar residual (VectorBase &dst,
const VectorBase &x,
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2008 - 2017 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE at
-// the top level of the deal.II distribution.
-//
-// ---------------------------------------------------------------------
-
-#ifndef dealii__trilinos_block_vector_h
-#define dealii__trilinos_block_vector_h
-
-
-#include <deal.II/base/config.h>
-
-#ifdef DEAL_II_WITH_TRILINOS
-
-# include <deal.II/lac/trilinos_vector.h>
-# include <deal.II/lac/trilinos_parallel_block_vector.h>
-# include <deal.II/lac/block_indices.h>
-# include <deal.II/lac/block_vector_base.h>
-# include <deal.II/lac/exceptions.h>
-# include <deal.II/lac/vector_type_traits.h>
-
-DEAL_II_NAMESPACE_OPEN
-
-// forward declaration
-template <typename Number> class BlockVector;
-
-/*! @addtogroup TrilinosWrappers
- *@{
- */
-
-namespace TrilinosWrappers
-{
- // forward declaration
- namespace MPI
- {
- class BlockVector;
- }
- class BlockVector;
- class BlockSparseMatrix;
-
-
- /**
- * An implementation of block vectors based on the vector class implemented
- * in TrilinosWrappers. While the base class provides for most of the
- * interface, this class handles the actual allocation of vectors and
- * provides functions that are specific to the underlying vector type.
- *
- * In contrast to the class MPI::BlockVector, this class is based on a
- * localized version of the vectors, which means that the whole vector is
- * stored on each processor. Note that matrix vector products with this
- * block vector class do only work in case the program is run on only one
- * processor, since the Trilinos matrices are inherently parallel.
- *
- * This class is deprecated, use TrilinosWrappers::MPI::BlockVector instead.
- *
- * @ingroup Vectors
- * @ingroup TrilinosWrappers @see
- * @ref GlossBlockLA "Block (linear algebra)"
- * @author Martin Kronbichler, 2008
- */
- class BlockVector : public BlockVectorBase<Vector>
- {
- public:
- /**
- * Typedef the base class for simpler access to its own typedefs.
- */
- typedef BlockVectorBase<Vector> BaseClass;
-
- /**
- * Typedef the type of the underlying vector.
- */
- typedef BaseClass::BlockType BlockType;
-
- /**
- * Import the typedefs from the base class.
- */
- typedef BaseClass::value_type value_type;
- typedef BaseClass::pointer pointer;
- typedef BaseClass::const_pointer const_pointer;
- typedef BaseClass::reference reference;
- typedef BaseClass::const_reference const_reference;
- typedef BaseClass::size_type size_type;
- typedef BaseClass::iterator iterator;
- typedef BaseClass::const_iterator const_iterator;
-
- /**
- * Default constructor. Generate an empty vector without any blocks.
- */
- BlockVector ();
-
- /**
- * Destructor. Clears memory
- */
- ~BlockVector ();
-
- /**
- * Copy operator: fill all components of the vector that are locally
- * stored with the given scalar value.
- */
- BlockVector &
- operator = (const value_type s);
-
- /**
- * Copy operator for a distributed Trilinos vector to a localized one.
- */
- BlockVector &
- operator = (const MPI::BlockVector &V);
-
- /**
- * Copy operator for arguments of the same type.
- */
- BlockVector &
- operator = (const BlockVector &V);
-
- /**
- * Another copy function. This one takes a deal.II block vector and copies
- * it into a TrilinosWrappers block vector. Note that the number of blocks
- * has to be the same in the vector as in the input vector. Use the
- * reinit() command for resizing the BlockVector or for changing the
- * internal structure of the block components.
- *
- * Since Trilinos only works on doubles, this function is limited to
- * accept only one possible number type in the deal.II vector.
- */
- template <typename Number>
- BlockVector &
- operator = (const ::dealii::BlockVector<Number> &V);
-
- /**
- * Reinitialize the BlockVector to contain as many blocks as there are
- * Epetra_Maps given in the input argument, according to the global size
- * of the individual components described in the maps. Note that the
- * resulting vector will be stored completely on each process. The
- * Epetra_Map is useful when data exchange with a distributed vector based
- * on the same Epetra_map is intended. In that case, the same communicator
- * is used for data exchange.
- *
- * If <tt>omit_zeroing_entries==false</tt>, the vector is filled with
- * zeros.
- */
- void reinit (const std::vector<Epetra_Map> &partitioning,
- const bool omit_zeroing_entries = false);
-
- /**
- * Reinitialize the BlockVector to contain as many blocks as there are
- * index sets given in the input argument, according to the global size of
- * the individual components described in the index set, and using a given
- * MPI communicator. The MPI communicator is useful when data exchange
- * with a distributed vector based on the same initialization is intended.
- * In that case, the same communicator is used for data exchange.
- *
- * If <tt>omit_zeroing_entries==false</tt>, the vector is filled with
- * zeros.
- */
- void reinit (const std::vector<IndexSet> &partitioning,
- const MPI_Comm &communicator = MPI_COMM_WORLD,
- const bool omit_zeroing_entries = false);
-
- /**
- * Reinitialize the BlockVector to contain as many blocks as there are
- * elements in the first argument, and with the respective sizes. Since no
- * distribution map is given, all vectors are local vectors.
- *
- * If <tt>omit_zeroing_entries==false</tt>, the vector is filled with
- * zeros.
- */
- void reinit (const std::vector<size_type> &N,
- const bool omit_zeroing_entries=false);
-
- /**
- * Reinitialize the vector in the same way as the given to a distributed
- * block vector. The elements will be copied in this process.
- */
- void reinit (const MPI::BlockVector &V);
-
- /**
- * Change the dimension to that of the vector <tt>V</tt>. The same applies
- * as for the other reinit() function.
- *
- * The elements of <tt>V</tt> are not copied, i.e. this function is the
- * same as calling <tt>reinit (V.size(), omit_zeroing_entries)</tt>.
- *
- * Note that you must call this (or the other reinit() functions)
- * function, rather than calling the reinit() functions of an individual
- * block, to allow the block vector to update its caches of vector sizes.
- * If you call reinit() on one of the blocks, then subsequent actions on
- * this object may yield unpredictable results since they may be routed to
- * the wrong block.
- */
- void reinit (const BlockVector &V,
- const bool omit_zeroing_entries = false);
-
- /**
- * Change the number of blocks to <tt>num_blocks</tt>. The individual
- * blocks will get initialized with zero size, so it is assumed that the
- * user resizes the individual blocks by herself in an appropriate way,
- * and calls <tt>collect_sizes</tt> afterwards.
- */
- void reinit (const size_type num_blocks);
-
- /**
- * Swap the contents of this vector and the other vector <tt>v</tt>. One
- * could do this operation with a temporary variable and copying over the
- * data elements, but this function is significantly more efficient since
- * it only swaps the pointers to the data of the two vectors and therefore
- * does not need to allocate temporary storage and move data around.
- *
- * Limitation: right now this function only works if both vectors have the
- * same number of blocks. If needed, the numbers of blocks should be
- * exchanged, too.
- *
- * This function is analogous to the the swap() function of all C++
- * standard containers. Also, there is a global function swap(u,v) that
- * simply calls <tt>u.swap(v)</tt>, again in analogy to standard
- * functions.
- */
- void swap (BlockVector &v);
-
- /**
- * Print to a stream.
- */
- void print (std::ostream &out,
- const unsigned int precision = 3,
- const bool scientific = true,
- const bool across = true) const;
-
- /**
- * Exception
- */
- DeclException0 (ExcIteratorRangeDoesNotMatchVectorSize);
-
- /**
- * Exception
- */
- DeclException0 (ExcNonMatchingBlockVectors);
-
- /**
- * Exception
- */
- DeclException2 (ExcNonLocalizedMap,
- int, int,
- << "For the generation of a localized vector the map has "
- << "to assign all elements to all vectors! "
- << "local_size = global_size is a necessary condition, but"
- << arg1 << " != " << arg2 << " was given!");
-
- };
-
-
-
- /*----------------------- Inline functions ----------------------------------*/
-
-
-
- inline
- BlockVector::BlockVector () = default;
-
-
-
- inline
- BlockVector::~BlockVector() = default;
-
-
-
- inline
- void
- BlockVector::swap (BlockVector &v)
- {
- Assert (n_blocks() == v.n_blocks(),
- ExcDimensionMismatch(n_blocks(),v.n_blocks()));
-
- for (unsigned int row=0; row<n_blocks(); ++row)
- block(row).swap (v.block(row));
- }
-
-
- template <typename Number>
- BlockVector &
- BlockVector::operator = (const ::dealii::BlockVector<Number> &v)
- {
- if (n_blocks() != v.n_blocks())
- {
- std::vector<size_type> block_sizes (v.n_blocks(), 0);
- block_indices.reinit (block_sizes);
- if (components.size() != n_blocks())
- components.resize(n_blocks());
- }
-
- for (size_type i=0; i<this->n_blocks(); ++i)
- this->components[i] = v.block(i);
-
- collect_sizes();
-
- return *this;
- }
-
-
- /**
- * Global function which overloads the default implementation of the C++
- * standard library which uses a temporary object. The function simply
- * exchanges the data of the two vectors.
- *
- * @relates TrilinosWrappers::BlockVector
- * @author Martin Kronbichler, 2008
- */
- inline
- void swap (BlockVector &u,
- BlockVector &v)
- {
- u.swap (v);
- }
-
-} /* namespace TrilinosWrappers */
-
-/*@}*/
-
-
-namespace internal
-{
- namespace LinearOperator
- {
- template <typename> class ReinitHelper;
-
- /**
- * A helper class used internally in linear_operator.h. Specialization for
- * TrilinosWrappers::BlockVector.
- */
- template<>
- class ReinitHelper<TrilinosWrappers::BlockVector>
- {
- public:
- template <typename Matrix>
- static
- void reinit_range_vector (const Matrix &matrix,
- TrilinosWrappers::BlockVector &v,
- bool omit_zeroing_entries)
- {
- v.reinit(matrix.range_partitioner(), omit_zeroing_entries);
- }
-
- template <typename Matrix>
- static
- void reinit_domain_vector(const Matrix &matrix,
- TrilinosWrappers::BlockVector &v,
- bool omit_zeroing_entries)
- {
- v.reinit(matrix.domain_partitioner(), omit_zeroing_entries);
- }
- };
-
- } /* namespace LinearOperator */
-} /* namespace internal */
-
-
-/**
- * Declare dealii::TrilinosWrappers::BlockVector as serial vector.
- *
- * @author Uwe Koecher, 2017
- */
-template <>
-struct is_serial_vector< TrilinosWrappers::BlockVector > : std::true_type
-{
-};
-
-
-/**
- * Declare dealii::TrilinosWrappers::MPI::BlockVector as distributed vector.
- *
- * @author Uwe Koecher, 2017
- */
-template <>
-struct is_serial_vector< TrilinosWrappers::MPI::BlockVector > : std::false_type
-{
-};
-
-
-DEAL_II_NAMESPACE_CLOSE
-
-#endif // DEAL_II_WITH_TRILINOS
-
-#endif
DEAL_II_NAMESPACE_OPEN
// forward declaration
-template <typename Number> class BlockVector;
+template <typename Number> class BlockVectorBase;
/*! @addtogroup TrilinosWrappers
*@{
{
class BlockVector;
}
- class BlockVector;
class BlockSparseMatrix;
* @ref GlossBlockLA "Block (linear algebra)"
* @author Martin Kronbichler, Wolfgang Bangerth, 2008, 2009
*/
- class BlockVector : public BlockVectorBase<Vector>
+ class BlockVector : public dealii::BlockVectorBase<MPI::Vector>
{
public:
/**
* Typedef the base class for simpler access to its own typedefs.
*/
- typedef BlockVectorBase<Vector> BaseClass;
+ typedef dealii::BlockVectorBase<MPI::Vector> BaseClass;
/**
* Typedef the type of the underlying vector.
*/
BlockVector &operator= (BlockVector &&v);
- /**
- * Copy operator for arguments of the localized Trilinos vector type.
- */
- BlockVector &
- operator= (const ::dealii::TrilinosWrappers::BlockVector &v);
-
/**
* Another copy function. This one takes a deal.II block vector and
* copies it into a TrilinosWrappers block vector. Note that the number
inline
BlockVector::BlockVector (const BlockVector &v)
:
- BlockVectorBase<Vector > ()
+ dealii::BlockVectorBase<MPI::Vector> ()
{
this->components.resize (v.n_blocks());
this->block_indices = v.block_indices;
} /* namespace internal */
+/**
+ * Declare dealii::TrilinosWrappers::MPI::BlockVector as distributed vector.
+ *
+ * @author Uwe Koecher, 2017
+ */
+template <>
+struct is_serial_vector< TrilinosWrappers::MPI::BlockVector > : std::false_type
+{
+};
+
DEAL_II_NAMESPACE_CLOSE
#endif // DEAL_II_WITH_TRILINOS
* Source and destination must not be the same vector.
*
* This function can be called with several different vector objects,
- * namely TrilinosWrappers::Vector, TrilinosWrappers::MPI::Vector as well
+ * namely TrilinosWrappers::VectorBase, TrilinosWrappers::MPI::Vector as well
* as deal.II's own vector classes Vector<double> and
* LinearAlgebra::distributed::Vector<double>.
*
* Source and destination must not be the same vector.
*
* This function can be called with several different vector objects,
- * namely TrilinosWrappers::Vector, TrilinosWrappers::MPI::Vector as well
+ * namely TrilinosWrappers::VectorBase, TrilinosWrappers::MPI::Vector as well
* as deal.II's own vector classes Vector<double> and
* LinearAlgebra::distributed::Vector<double>.
*
* Source and destination must not be the same vector.
*
* This function can be called with several different vector objects,
- * namely TrilinosWrappers::Vector, TrilinosWrappers::MPI::Vector as well
+ * namely TrilinosWrappers::VectorBase, TrilinosWrappers::MPI::Vector as well
* as deal.II's own vector classes Vector<double> and
* LinearAlgebra::distributed::Vector<double>.
*
* memory architecture, using the interface in the
* TrilinosWrappers::VectorBase class.
*
- * In case of a localized Vector (i.e., TrilinosWrappers::Vector or
+ * In case of a localized Vector (i.e., TrilinosWrappers::VectorBase or
* Vector<double>), this function will only work when running on one
* processor, since the matrix object is inherently distributed.
* Otherwise, and exception will be thrown.
* Source and destination must not be the same vector.
*
* This function can be called with several different vector objects,
- * namely TrilinosWrappers::Vector, TrilinosWrappers::MPI::Vector as well
+ * namely TrilinosWrappers::VectorBase, TrilinosWrappers::MPI::Vector as well
* as deal.II's own vector classes Vector<double> and
* LinearAlgebra::distributed::Vector<double>.
*
* memory architecture, using the interface in the
* TrilinosWrappers::VectorBase class.
*
- * In case of a localized Vector (i.e., TrilinosWrappers::Vector or
+ * In case of a localized Vector (i.e., TrilinosWrappers::VectorBase or
* Vector<double>), this function will only work when running on one
* processor, since the matrix object is inherently distributed.
* Otherwise, and exception will be thrown.
{
// we have to check after Insert/Add in any case to be consistent
// with the MPI communication model (see the comments in the
- // documentation of TrilinosWrappers::Vector), but we can save some
+ // documentation of TrilinosWrappers::VectorBase), but we can save some
// work if the addend is zero. However, these actions are done in case
// we pass on to the other function.
* code that may for example look like this:
*
* @code
- * TrilinosWrappers::Vector vector;
+ * TrilinosWrappers::VectorBase vector;
* // do some write operations on the vector
* for (size_type i=0; i<vector->size(); ++i)
* vector(i) = i;
* (but being distributed differently among the processors). A trivial
* application of this function is to generate a replication of a whole
* vector on each machine, when the calling vector is built according to
- * the localized vector class TrilinosWrappers::Vector, and <tt>v</tt>
+ * the localized vector class TrilinosWrappers::VectorBase, and <tt>v</tt>
* is a distributed vector. In this case, the variable
* <tt>omit_zeroing_entries</tt> needs to be set to <tt>false</tt>,
* since it does not make sense to exchange data between differently
* object) already is of the same size as the right hand side vector.
* Otherwise, an exception will be thrown.
*/
- Vector &operator= (const ::dealii::TrilinosWrappers::Vector &v);
+ Vector &operator= (const ::dealii::TrilinosWrappers::VectorBase &v);
/**
* Another copy function. This one takes a deal.II vector and copies it
#endif /* DOXYGEN */
} /* end of namespace MPI */
-
-
-
- /**
- * This class is a specialization of a Trilinos vector to a localized
- * version. The purpose of this class is to provide a copy interface from
- * the possibly parallel Vector class to a local vector on each processor,
- * in order to be able to access all elements in the vector or to apply
- * certain deal.II functions.
- *
- * This class is deprecated, use TrilinosWrappers::MPI::Vector instead.
- *
- * @ingroup TrilinosWrappers
- * @ingroup Vectors
- * @author Martin Kronbichler, 2008
- */
- class Vector : public VectorBase
- {
- public:
- /**
- * Declare type for container size.
- */
- typedef dealii::types::global_dof_index size_type;
-
- /**
- * Reinit function that resizes the vector to the size specified by
- * <tt>n</tt>. The flag <tt>omit_zeroing_entries</tt> specifies whether
- * the vector entries should be initialized to zero (false). If it is set
- * to <tt>true</tt>, the vector entries are in an unspecified state and
- * the user has to set all elements. In the current implementation, this
- * method still sets the entries to zero, but this might change between
- * releases without notification.
- */
- void reinit (const size_type n,
- const bool omit_zeroing_entries = false);
-
- /**
- * Initialization with an Epetra_Map. Similar to the call in the other
- * class MPI::Vector, with the difference that now a copy on all processes
- * is generated. This initialization function is appropriate when the data
- * in the localized vector should be imported from a distributed vector
- * that has been initialized with the same communicator. The variable
- * <tt>omit_zeroing_entries</tt> determines whether the vector should be
- * filled with zero (false). If it is set to <tt>true</tt>, the vector
- * entries are in an unspecified state and the user has to set all
- * elements. In the current implementation, this method still sets the
- * entries to zero, but this might change between releases without
- * notification.
- *
- * Which element of the @p input_map argument are set is in fact ignored,
- * the only thing that matters is the size of the index space described by
- * this argument.
- */
- void reinit (const Epetra_Map &input_map,
- const bool omit_zeroing_entries = false);
-
- /**
- * Initialization with an IndexSet. Similar to the call in the other class
- * MPI::Vector, with the difference that now a copy on all processes is
- * generated. This initialization function is appropriate in case the data
- * in the localized vector should be imported from a distributed vector
- * that has been initialized with the same communicator. The variable
- * <tt>omit_zeroing_entries</tt> determines whether the vector should be
- * filled with zero (false). If it is set to <tt>true</tt>, the vector
- * entries are in an unspecified state and the user has to set all
- * elements. In the current implementation, this method still sets the
- * entries to zero, but this might change between releases without
- * notification.
- *
- * Which element of the @p input_map argument are set is in fact ignored,
- * the only thing that matters is the size of the index space described by
- * this argument.
- */
- void reinit (const IndexSet &input_map,
- const MPI_Comm &communicator = MPI_COMM_WORLD,
- const bool omit_zeroing_entries = false);
-
- /**
- * Reinit function. Takes the information of a Vector and copies
- * everything to the calling vector, now also allowing different maps.
- *
- * If the optional flag <tt>omit_zeroing_entries</tt> is not
- * <tt>true</tt>, the elements in the vector are initialized with zero. If
- * it is set to <tt>true</tt>, the vector entries are in an unspecified
- * state and the user has to set all elements. In the current
- * implementation, this method does not touch the vector entries in case
- * the vector layout is unchanged from before, otherwise entries are set
- * to zero. Note that this behavior might change between releases without
- * notification.
- */
- void reinit (const VectorBase &V,
- const bool omit_zeroing_entries = false,
- const bool allow_different_maps = false);
-
- /**
- * Set all components of the vector to the given number @p s. Simply pass
- * this down to the base class, but we still need to declare this function
- * to make the example given in the discussion about making the
- * constructor explicit work.
- */
- Vector &operator= (const TrilinosScalar s);
-
- /**
- * Set the left hand argument to the (parallel) Trilinos Vector.
- * Equivalent to the @p reinit function.
- */
- Vector &operator= (const MPI::Vector &v);
-
- /**
- * Set the left hand argument to the deal.II vector.
- */
- template <typename Number>
- Vector &operator= (const ::dealii::Vector<Number> &v);
-
- /**
- * Copy operator. Copies both the dimension and the content in the right
- * hand argument.
- */
- Vector &operator= (const Vector &v);
-
- /**
- * This function does nothing but is there for compatibility with the @p
- * PETScWrappers::Vector class.
- *
- * For the PETSc vector wrapper class, this function updates the ghost
- * values of the PETSc vector. This is necessary after any modification
- * before reading ghost values.
- *
- * However, for the implementation of this class, it is immaterial and
- * thus an empty function.
- */
- void update_ghost_values () const;
- };
-
-
-// ------------------- inline and template functions --------------
-
-
- /**
- * Global function @p swap which overloads the default implementation of the
- * C++ standard library which uses a temporary object. The function simply
- * exchanges the data of the two vectors.
- *
- * @relates TrilinosWrappers::Vector
- * @author Martin Kronbichler, Wolfgang Bangerth, 2008
- */
- inline
- void swap (Vector &u, Vector &v)
- {
- u.swap (v);
- }
-
-
-#ifndef DOXYGEN
-
- inline
- Vector &
- Vector::operator= (const TrilinosScalar s)
- {
- VectorBase::operator= (s);
-
- return *this;
- }
-
-
-
- template <typename Number>
- Vector &
- Vector::operator= (const ::dealii::Vector<Number> &v)
- {
- if (size() != v.size())
- {
- vector.reset();
-
- Epetra_LocalMap map ((TrilinosWrappers::types::int_type)v.size(), 0,
- Utilities::Trilinos::comm_self());
- vector.reset (new Epetra_FEVector(map));
- owned_elements = v.locally_owned_elements();
- }
-
- const Epetra_Map &map = vector_partitioner();
- const TrilinosWrappers::types::int_type size = map.NumMyElements();
-
- Assert (map.MaxLID() == size-1,
- ExcDimensionMismatch(map.MaxLID(), size-1));
-
- // Need to copy out values, since the
- // deal.II might not use doubles, so
- // that a direct access is not possible.
- for (TrilinosWrappers::types::int_type i=0; i<size; ++i)
- (*vector)[0][i] = v(i);
-
- return *this;
- }
-
-
-
- inline
- void
- Vector::update_ghost_values () const
- {}
-
-
-#endif
-
-} /* namespace TrilinosWrappers */
+} /* end of namespace TrilinosWrappers */
/*@}*/
/**
* A helper class used internally in linear_operator.h. Specialization for
- * TrilinosWrappers::Vector.
+ * TrilinosWrappers::VectorBase.
*/
template<>
- class ReinitHelper<TrilinosWrappers::Vector>
+ class ReinitHelper<TrilinosWrappers::VectorBase>
{
public:
template <typename Matrix>
static
void reinit_range_vector (const Matrix &matrix,
- TrilinosWrappers::Vector &v,
+ TrilinosWrappers::VectorBase &v,
bool omit_zeroing_entries)
{
v.reinit(matrix.locally_owned_range_indices(),
template <typename Matrix>
static
void reinit_domain_vector(const Matrix &matrix,
- TrilinosWrappers::Vector &v,
+ TrilinosWrappers::VectorBase &v,
bool omit_zeroing_entries)
{
v.reinit(matrix.locally_owned_domain_indices(),
/**
- * Declare dealii::TrilinosWrappers::Vector as serial vector.
+ * Declare dealii::TrilinosWrappers::VectorBase as serial vector.
*
* @author Uwe Koecher, 2017
*/
template <>
-struct is_serial_vector< TrilinosWrappers::Vector > : std::true_type
+struct is_serial_vector< TrilinosWrappers::VectorBase > : std::true_type
{
};
{
// forward declaration
class VectorBase;
+ namespace MPI
+ {
+ class Vector;
+ }
/**
* @cond internal
/**
- * Base class for the two types of Trilinos vectors, the distributed memory
- * vector MPI::Vector and a localized vector Vector. The latter is designed
- * for use in either serial implementations or as a localized copy on each
- * processor. The implementation of this class is based on the Trilinos
- * vector class Epetra_FEVector, the (parallel) partitioning of which is
- * governed by an Epetra_Map. This means that the vector type is generic and
- * can be done in this base class, while the definition of the partition map
- * (and hence, the constructor and reinit function) will have to be done in
- * the derived classes. The Epetra_FEVector is precisely the kind of vector
+ * Base class for the the distributed memory vector MPI::Vector that is
+ * designed for use in either serial implementations or as a localized copy
+ * on each processor. The implementation of this class is based on the
+ * Trilinos vector class Epetra_FEVector, the (parallel) partitioning of which
+ * is governed by an Epetra_Map. This means that the vector type is generic
+ * and can be done in this base class, while the definition of the partition
+ * map (and hence, the constructor and reinit function) will have to be done
+ * in the derived classes. The Epetra_FEVector is precisely the kind of vector
* we deal with all the time - we probably get it from some assembly
* process, where also entries not locally owned might need to written and
* hence need to be forwarded to the owner. The only requirement for this
{
class Vector;
}
- class Vector;
+ class VectorBase;
}
#endif
* wrapper vector. This copy constructor is only available if Trilinos was
* detected during configuration time.
*/
- explicit Vector (const TrilinosWrappers::Vector &v);
+ explicit Vector (const TrilinosWrappers::VectorBase &v);
#endif
/**
* during configuration time.
*/
Vector<Number> &
- operator= (const TrilinosWrappers::Vector &v);
+ operator= (const TrilinosWrappers::VectorBase &v);
#endif
/**
// be a better solution than
// this, but it has not yet been
// found.
- TrilinosWrappers::Vector localized_vector;
+ TrilinosWrappers::MPI::Vector localized_vector;
+ localized_vector.reinit(complete_index_set(vec_size));
localized_vector.reinit (v, false, true);
// get a representation of the vector
template <typename Number>
-Vector<Number>::Vector (const TrilinosWrappers::Vector &v)
+Vector<Number>::Vector (const TrilinosWrappers::VectorBase &v)
:
Subscriptor(),
vec_size(v.size()),
// of the Trilinos vectors and
// then call the other =
// operator.
- TrilinosWrappers::Vector localized_vector;
+ TrilinosWrappers::MPI::Vector localized_vector;
+ localized_vector.reinit(complete_index_set(v.size()));
localized_vector.reinit(v, false, true);
- *this = localized_vector;
+ *this = static_cast<TrilinosWrappers::VectorBase>(localized_vector);
return *this;
}
template <typename Number>
Vector<Number> &
-Vector<Number>::operator= (const TrilinosWrappers::Vector &v)
+Vector<Number>::operator= (const TrilinosWrappers::VectorBase &v)
{
if (v.size() != vec_size)
reinit (v.size(), true);
#endif
template <>
- struct MatrixSelector<dealii::TrilinosWrappers::Vector>
+ struct MatrixSelector<dealii::TrilinosWrappers::VectorBase>
{
typedef ::dealii::TrilinosWrappers::SparsityPattern Sparsity;
typedef ::dealii::TrilinosWrappers::SparseMatrix Matrix;
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/base/geometry_info.h>
#include <deal.II/dofs/dof_handler.h>
# include <deal.II/lac/trilinos_sparse_matrix.h>
# include <deal.II/lac/trilinos_vector.h>
# include <deal.II/lac/trilinos_block_sparse_matrix.h>
-# include <deal.II/lac/trilinos_block_vector.h>
+# include <deal.II/lac/trilinos_parallel_block_vector.h>
#endif
#include <algorithm>
namespace TrilinosWrappers
{
class SparseMatrix;
- class Vector;
class BlockSparseMatrix;
- class BlockVector;
+ class VectorBase;
namespace MPI
{
class Vector;
void
apply_boundary_values (const std::map<types::global_dof_index,TrilinosScalar> &boundary_values,
TrilinosWrappers::SparseMatrix &matrix,
- TrilinosWrappers::Vector &solution,
- TrilinosWrappers::Vector &right_hand_side,
+ TrilinosWrappers::VectorBase &solution,
+ TrilinosWrappers::VectorBase &right_hand_side,
const bool eliminate_columns = true);
- /**
- * This function does the same as the one above, except now working on block
- * structures.
- */
- void
- apply_boundary_values (const std::map<types::global_dof_index,TrilinosScalar> &boundary_values,
- TrilinosWrappers::BlockSparseMatrix &matrix,
- TrilinosWrappers::BlockVector &solution,
- TrilinosWrappers::BlockVector &right_hand_side,
- const bool eliminate_columns = true);
-
/**
* Same as above, but for parallel matrices and vectors.
*
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/sparse_matrix.h>
#include <deal.II/lac/dynamic_sparsity_pattern.h>
#include <deal.II/lac/precondition.h>
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
DEAL_II_NAMESPACE_OPEN
# include <Epetra_MpiComm.h>
# include <deal.II/lac/vector_memory.h>
# include <deal.II/lac/trilinos_vector.h>
-# include <deal.II/lac/trilinos_block_vector.h>
+# include <deal.II/lac/trilinos_parallel_block_vector.h>
# endif
#endif
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
DEAL_II_NAMESPACE_OPEN
template class EmbeddedExplicitRungeKutta<LinearAlgebra::distributed::V<S> >;
}
-for (V : EXTERNAL_SEQUENTIAL_VECTORS)
-{
- template class RungeKutta<V>;
- template class ExplicitRungeKutta<V>;
- template class ImplicitRungeKutta<V>;
- template class EmbeddedExplicitRungeKutta<V>;
-}
-
for (V : EXTERNAL_PARALLEL_VECTORS)
{
template class RungeKutta<V>;
# include <Epetra_MpiComm.h>
# include <deal.II/lac/vector_memory.h>
# include <deal.II/lac/trilinos_vector.h>
-# include <deal.II/lac/trilinos_block_vector.h>
+# include <deal.II/lac/trilinos_parallel_block_vector.h>
# endif
# include "Teuchos_RCP.hpp"
# include "Epetra_SerialComm.h"
#include <deal.II/lac/vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#ifdef DEAL_II_WITH_P4EST
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/distributed/solution_transfer.h>
#include <deal.II/distributed/tria.h>
#endif
#ifdef DEAL_II_WITH_TRILINOS
- template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::Vector, DoFHandler<deal_II_dimension,deal_II_space_dimension> >;
-
- template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::BlockVector, DoFHandler<deal_II_dimension,deal_II_space_dimension> >;
+ template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::VectorBase, DoFHandler<deal_II_dimension,deal_II_space_dimension> >;
template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::Vector, DoFHandler<deal_II_dimension,deal_II_space_dimension> >;
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/sparse_matrix.h>
#include <deal.II/dofs/dof_accessor.h>
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/sparse_matrix.h>
#include <deal.II/dofs/dof_accessor.h>
-for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; VEC : SERIAL_VECTORS)
+for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; VEC : REAL_SERIAL_VECTORS)
{
namespace FETools
\{
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_boundary.h>
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/tria_boundary.h>
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/lac/block_vector_base.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/grid/grid_refinement.h>
#include <deal.II/grid/tria_accessor.h>
#ifdef DEAL_II_WITH_TRILINOS
inline
TrilinosScalar
- max_element (const TrilinosWrappers::Vector &criteria)
+ max_element (const TrilinosWrappers::VectorBase &criteria)
{
TrilinosScalar m = 0;
criteria.trilinos_vector().MaxValue(&m);
inline
TrilinosScalar
- min_element (const TrilinosWrappers::Vector &criteria)
+ min_element (const TrilinosWrappers::VectorBase &criteria)
{
TrilinosScalar m = 0;
criteria.trilinos_vector().MinValue(&m);
#include <deal.II/lac/block_matrix_array.h>
#include <deal.II/lac/vector.h>
#include <deal.II/lac/block_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/petsc_parallel_sparse_matrix.h>
#include <deal.II/lac/petsc_parallel_block_sparse_matrix.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/trilinos_sparse_matrix.h>
#include <deal.II/lac/trilinos_block_sparse_matrix.h>
#include <deal.II/lac/matrix_block.h>
#ifdef DEAL_II_WITH_TRILINOS
MATRIX_FUNCTIONS(TrilinosWrappers::SparseMatrix);
BLOCK_MATRIX_FUNCTIONS(TrilinosWrappers::BlockSparseMatrix);
-MATRIX_VECTOR_FUNCTIONS(TrilinosWrappers::SparseMatrix, TrilinosWrappers::Vector);
-BLOCK_MATRIX_VECTOR_FUNCTIONS(TrilinosWrappers::BlockSparseMatrix, TrilinosWrappers::BlockVector);
+MATRIX_VECTOR_FUNCTIONS(TrilinosWrappers::SparseMatrix, TrilinosWrappers::VectorBase);
MATRIX_VECTOR_FUNCTIONS(TrilinosWrappers::SparseMatrix, TrilinosWrappers::MPI::Vector);
BLOCK_MATRIX_VECTOR_FUNCTIONS(TrilinosWrappers::BlockSparseMatrix, TrilinosWrappers::MPI::BlockVector);
#endif
}
-for (V: EXTERNAL_SEQUENTIAL_VECTORS)
-{
- template void ConstraintMatrix::condense<V >(const V&, V&) const;
- template void ConstraintMatrix::condense<V >(V&vec) const;
- template void ConstraintMatrix::distribute_local_to_global<V > (
- const Vector<V::value_type>&, const std::vector<types::global_dof_index> &, V&, const FullMatrix<V::value_type>&) const;
- template void ConstraintMatrix::distribute_local_to_global<V > (
- const Vector<V::value_type>&, const std::vector<types::global_dof_index> &, const std::vector<types::global_dof_index> &, V&, const FullMatrix<V::value_type>&, bool) const;
- template void ConstraintMatrix::set_zero<V >(V&) const;
-}
-
-
for (V: EXTERNAL_PARALLEL_VECTORS)
{
template void ConstraintMatrix::set_zero<V >(V&) const;
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
// TODO: In the following we
// use the same code as just
- // above six more times. Use
+ // above three more times. Use
// templates.
- TrilinosScalar
- BlockSparseMatrix::residual (BlockVector &dst,
- const BlockVector &x,
- const BlockVector &b) const
- {
- vmult (dst, x);
- dst -= b;
- dst *= -1.;
-
- return dst.l2_norm();
- }
-
-
-
TrilinosScalar
BlockSparseMatrix::residual (MPI::BlockVector &dst,
const MPI::Vector &x,
- TrilinosScalar
- BlockSparseMatrix::residual (BlockVector &dst,
- const Vector &x,
- const BlockVector &b) const
- {
- vmult (dst, x);
- dst -= b;
- dst *= -1.;
-
- return dst.l2_norm();
- }
-
-
-
TrilinosScalar
BlockSparseMatrix::residual (MPI::Vector &dst,
const MPI::BlockVector &x,
- TrilinosScalar
- BlockSparseMatrix::residual (Vector &dst,
- const BlockVector &x,
- const Vector &b) const
- {
- vmult (dst, x);
- dst -= b;
- dst *= -1.;
-
- return dst.l2_norm();
- }
-
-
-
TrilinosScalar
BlockSparseMatrix::residual (VectorBase &dst,
const VectorBase &x,
//
// ---------------------------------------------------------------------
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#ifdef DEAL_II_WITH_TRILINOS
- BlockVector &
- BlockVector::operator = (const ::dealii::TrilinosWrappers::BlockVector &v)
- {
- Assert (n_blocks() == v.n_blocks(),
- ExcDimensionMismatch(n_blocks(),v.n_blocks()));
-
- for (size_type i=0; i<this->n_blocks(); ++i)
- this->components[i] = v.block(i);
-
- return *this;
- }
-
-
BlockVector::~BlockVector ()
{}
}
} /* end of namespace MPI */
-
-
-
-
-
-
- BlockVector &
- BlockVector::operator = (const value_type s)
- {
- BaseClass::operator = (s);
- return *this;
- }
-
-
-
- void
- BlockVector::reinit (const std::vector<Epetra_Map> &input_maps,
- const bool omit_zeroing_entries)
- {
- size_type no_blocks = input_maps.size();
- std::vector<size_type> block_sizes (no_blocks);
-
- for (size_type i=0; i<no_blocks; ++i)
- block_sizes[i] = TrilinosWrappers::n_global_elements(input_maps[i]);
-
-
- this->block_indices.reinit (block_sizes);
- if (components.size() != n_blocks())
- components.resize(n_blocks());
-
- for (size_type i=0; i<n_blocks(); ++i)
- components[i].reinit(input_maps[i], omit_zeroing_entries);
-
- collect_sizes();
- }
-
-
-
- void
- BlockVector::reinit (const std::vector<IndexSet> &partitioning,
- const MPI_Comm &communicator,
- const bool omit_zeroing_entries)
- {
- size_type no_blocks = partitioning.size();
- std::vector<size_type> block_sizes (no_blocks);
-
- for (size_type i=0; i<no_blocks; ++i)
- block_sizes[i] = partitioning[i].size();
-
-
- this->block_indices.reinit (block_sizes);
- if (components.size() != n_blocks())
- components.resize(n_blocks());
-
- for (size_type i=0; i<n_blocks(); ++i)
- components[i].reinit(partitioning[i], communicator, omit_zeroing_entries);
-
- collect_sizes();
- }
-
-
-
- void
- BlockVector::reinit (const std::vector<size_type> &block_sizes,
- const bool omit_zeroing_entries)
- {
- this->block_indices.reinit (block_sizes);
- if (components.size() != n_blocks())
- components.resize(n_blocks());
-
- for (size_type i=0; i<n_blocks(); ++i)
- components[i].reinit(block_sizes[i], omit_zeroing_entries);
-
- collect_sizes();
- }
-
-
-
- void
- BlockVector::reinit (const MPI::BlockVector &v)
- {
- block_indices = v.get_block_indices();
- if (components.size() != n_blocks())
- components.resize(n_blocks());
-
- for (size_type i=0; i<n_blocks(); ++i)
- components[i] = v.block(i);
- }
-
-
-
- void
- BlockVector::reinit (const size_type num_blocks)
- {
- std::vector<size_type> block_sizes (num_blocks, 0);
- block_indices.reinit (block_sizes);
- if (components.size() != n_blocks())
- components.resize(n_blocks());
-
- for (size_type i=0; i<n_blocks(); ++i)
- block(i).clear();
-
- collect_sizes();
- }
-
-
-
- void
- BlockVector::reinit (const BlockVector &v,
- const bool omit_zeroing_entries)
- {
- block_indices = v.get_block_indices();
- if (components.size() != n_blocks())
- components.resize(n_blocks());
-
- for (size_type i=0; i<n_blocks(); ++i)
- components[i].reinit(v.block(i), omit_zeroing_entries);
-
- collect_sizes();
- }
-
-
-
- BlockVector &
- BlockVector::operator = (const MPI::BlockVector &v)
- {
- reinit (v);
-
- return *this;
- }
-
-
-
- BlockVector &
- BlockVector::operator = (const BlockVector &v)
- {
- if (n_blocks() != v.n_blocks())
- {
- std::vector<size_type> block_sizes (v.n_blocks(), 0);
- block_indices.reinit (block_sizes);
- if (components.size() != n_blocks())
- components.resize(n_blocks());
- }
-
- for (size_type i=0; i<this->n_blocks(); ++i)
- this->components[i] = v.block(i);
-
- collect_sizes();
-
- return *this;
- }
-
-
-
- void BlockVector::print (std::ostream &out,
- const unsigned int precision,
- const bool scientific,
- const bool across) const
- {
- for (size_type i=0; i<this->n_blocks(); ++i)
- {
- if (across)
- out << 'C' << i << ':';
- else
- out << "Component " << i << std::endl;
- this->components[i].print(out, precision, scientific, across);
- }
- }
-
-}
+} /* end of namespace TrilinosWrappers */
DEAL_II_NAMESPACE_CLOSE
// Reinit a temporary vector with fast argument set, which does not
// overwrite the content (to save time). However, the
- // TrilinosWrappers::Vector classes do not support this, so create a
+ // TrilinosWrappers::VectorBase classes do not support this, so create a
// deal.II local vector that has this fast setting. It will be accepted in
// vmult because it only checks the local size.
dealii::Vector<TrilinosScalar> temp_vector;
// Reinit a temporary vector with fast argument set, which does not
// overwrite the content (to save time). However, the
- // TrilinosWrappers::Vector classes do not support this, so create a
+ // TrilinosWrappers::VectorBase classes do not support this, so create a
// deal.II local vector that has this fast setting. It will be accepted in
// vmult because it only checks the local size.
dealii::Vector<TrilinosScalar> temp_vector;
SparseMatrix::vmult (VectorBase &,
const VectorBase &) const;
template void
- SparseMatrix::vmult (Vector &,
- const Vector &) const;
- template void
SparseMatrix::vmult (MPI::Vector &,
const MPI::Vector &) const;
template void
SparseMatrix::Tvmult (VectorBase &,
const VectorBase &) const;
template void
- SparseMatrix::Tvmult (Vector &,
- const Vector &) const;
- template void
SparseMatrix::Tvmult (MPI::Vector &,
const MPI::Vector &) const;
template void
SparseMatrix::vmult_add (VectorBase &,
const VectorBase &) const;
template void
- SparseMatrix::vmult_add (Vector &,
- const Vector &) const;
- template void
SparseMatrix::vmult_add (MPI::Vector &,
const MPI::Vector &) const;
template void
SparseMatrix::Tvmult_add (VectorBase &,
const VectorBase &) const;
template void
- SparseMatrix::Tvmult_add (Vector &,
- const Vector &) const;
- template void
SparseMatrix::Tvmult_add (MPI::Vector &,
const MPI::Vector &) const;
template void
#ifdef DEAL_II_WITH_TRILINOS
# include <deal.II/base/mpi.h>
-# include <deal.II/lac/trilinos_block_vector.h>
+# include <deal.II/lac/trilinos_parallel_block_vector.h>
# include <deal.II/lac/trilinos_index_access.h>
# include <deal.II/lac/trilinos_sparse_matrix.h>
void
- Vector::reinit (const BlockVector &v,
+ Vector::reinit (const MPI::BlockVector &v,
const bool import_data)
{
nonlocal_vector.reset();
Vector &
- Vector::operator = (const TrilinosWrappers::Vector &v)
+ Vector::operator = (const TrilinosWrappers::VectorBase &v)
{
nonlocal_vector.reset();
}
} /* end of namespace MPI */
-
-
-
- void
- Vector::reinit (const size_type n,
- const bool /*omit_zeroing_entries*/)
- {
- owned_elements = complete_index_set(n);
- Epetra_LocalMap map ((TrilinosWrappers::types::int_type)n, 0,
- Utilities::Trilinos::comm_self());
- vector.reset (new Epetra_FEVector (map));
-
- last_action = Zero;
- }
-
-
-
- void
- Vector::reinit (const Epetra_Map &input_map,
- const bool /*omit_zeroing_entries*/)
- {
- Epetra_LocalMap map (TrilinosWrappers::n_global_elements(input_map),
- input_map.IndexBase(),
- input_map.Comm());
- vector.reset (new Epetra_FEVector(map));
- owned_elements = complete_index_set(TrilinosWrappers::n_global_elements(input_map));
-
- last_action = Zero;
- }
-
-
-
- void
- Vector::reinit (const IndexSet &partitioning,
- const MPI_Comm &communicator,
- const bool /*omit_zeroing_entries*/)
- {
- Epetra_LocalMap map (static_cast<TrilinosWrappers::types::int_type>(partitioning.size()),
- 0,
-#ifdef DEAL_II_WITH_MPI
- Epetra_MpiComm(communicator));
-#else
- Epetra_SerialComm());
- (void)communicator;
-#endif
- vector.reset (new Epetra_FEVector(map));
-
- last_action = Zero;
- owned_elements = partitioning;
- }
-
-
-
- void
- Vector::reinit (const VectorBase &v,
- const bool omit_zeroing_entries,
- const bool allow_different_maps)
- {
- // In case we do not allow to
- // have different maps, this
- // call means that we have to
- // reset the vector. So clear
- // the vector, initialize our
- // map with the map in v, and
- // generate the vector.
- if (allow_different_maps == false)
- {
- // check equality for MPI communicators
-#ifdef DEAL_II_WITH_MPI
- const Epetra_MpiComm *my_comm = dynamic_cast<const Epetra_MpiComm *>(&vector->Comm());
- const Epetra_MpiComm *v_comm = dynamic_cast<const Epetra_MpiComm *>(&v.vector->Comm());
- const bool same_communicators = my_comm != nullptr && v_comm != nullptr &&
- my_comm->DataPtr() == v_comm->DataPtr();
-#else
- const bool same_communicators = true;
-#endif
- if (!same_communicators || local_range() != v.local_range())
- {
- Epetra_LocalMap map (TrilinosWrappers::global_length(*(v.vector)),
- v.vector->Map().IndexBase(),
- v.vector->Comm());
- vector.reset (new Epetra_FEVector(map));
- owned_elements = v.owned_elements;
- }
- else if (omit_zeroing_entries)
- {
- int ierr;
- Assert (vector->Map().SameAs(v.vector->Map()) == true,
- ExcMessage ("The Epetra maps in the assignment operator ="
- " do not match, even though the local_range "
- " seems to be the same. Check vector setup!"));
-
- ierr = vector->GlobalAssemble(last_action);
- (void)ierr;
- Assert (ierr == 0, ExcTrilinosError(ierr));
-
- ierr = vector->PutScalar(0.0);
- Assert (ierr == 0, ExcTrilinosError(ierr));
- }
- last_action = Zero;
- }
-
- // Otherwise, we have to check
- // that the two vectors are
- // already of the same size,
- // create an object for the data
- // exchange and then insert all
- // the data.
- else
- {
- Assert (omit_zeroing_entries == false,
- ExcMessage ("It is not possible to exchange data with the "
- "option 'omit_zeroing_entries' set, which would not write "
- "elements."));
-
- AssertThrow (size() == v.size(),
- ExcDimensionMismatch (size(), v.size()));
-
- Epetra_Import data_exchange (vector->Map(), v.vector->Map());
-
- const int ierr = vector->Import(*v.vector, data_exchange, Insert);
- AssertThrow (ierr == 0, ExcTrilinosError(ierr));
-
- last_action = Insert;
- }
-
- }
-
-
-
- Vector &
- Vector::operator = (const MPI::Vector &v)
- {
- if (size() != v.size())
- {
- Epetra_LocalMap map (TrilinosWrappers::n_global_elements(v.vector->Map()),
- v.vector->Map().IndexBase(),
- v.vector->Comm());
- vector.reset (new Epetra_FEVector(map));
- }
-
- reinit (v, false, true);
- return *this;
- }
-
-
-
- Vector &
- Vector::operator = (const Vector &v)
- {
- if (size() != v.size())
- {
- Epetra_LocalMap map (TrilinosWrappers::n_global_elements(v.vector->Map()),
- v.vector->Map().IndexBase(),
- v.vector->Comm());
- vector.reset (new Epetra_FEVector(map));
- owned_elements = v.owned_elements;
- }
-
- const int ierr = vector->Update(1.0, *v.vector, 0.0);
- Assert (ierr == 0, ExcTrilinosError(ierr));
- (void)ierr;
-
- return *this;
- }
-
-}
+} /* end of namespace TrilinosWrappers */
DEAL_II_NAMESPACE_CLOSE
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/vector_memory.templates.h>
#include <deal.II/lac/vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/meshworker/dof_info.templates.h>
#include <deal.II/meshworker/integration_info.templates.h>
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/meshworker/vector_selector.templates.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/multigrid/mg_base.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/fe/fe.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/sparse_matrix.h>
#include <deal.II/lac/block_sparse_matrix.h>
#include <deal.II/lac/dynamic_sparsity_pattern.h>
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/sparse_matrix.h>
#include <deal.II/lac/block_sparse_matrix.h>
#include <deal.II/multigrid/mg_transfer.h>
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/vector_element_access.h>
#include <deal.II/numerics/data_out.h>
#include <deal.II/numerics/data_out_dof_data.h>
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/grid_tools.h>
#include <deal.II/grid/filtered_iterator.h>
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
DEAL_II_NAMESPACE_OPEN
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/base/geometry_info.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
DEAL_II_NAMESPACE_OPEN
# include <deal.II/lac/trilinos_sparse_matrix.h>
# include <deal.II/lac/trilinos_vector.h>
# include <deal.II/lac/trilinos_block_sparse_matrix.h>
-# include <deal.II/lac/trilinos_block_vector.h>
+# include <deal.II/lac/trilinos_parallel_block_vector.h>
#endif
#include <algorithm>
# include <deal.II/lac/trilinos_sparse_matrix.h>
# include <deal.II/lac/trilinos_vector.h>
# include <deal.II/lac/trilinos_block_sparse_matrix.h>
-# include <deal.II/lac/trilinos_block_vector.h>
+# include <deal.II/lac/trilinos_parallel_block_vector.h>
#endif
#include <algorithm>
void
apply_boundary_values (const std::map<types::global_dof_index,TrilinosScalar> &boundary_values,
TrilinosWrappers::SparseMatrix &matrix,
- TrilinosWrappers::Vector &solution,
- TrilinosWrappers::Vector &right_hand_side,
+ TrilinosWrappers::VectorBase &solution,
+ TrilinosWrappers::VectorBase &right_hand_side,
const bool eliminate_columns)
{
// simply redirect to the generic function
- void
- apply_boundary_values (const std::map<types::global_dof_index,TrilinosScalar> &boundary_values,
- TrilinosWrappers::BlockSparseMatrix &matrix,
- TrilinosWrappers::BlockVector &solution,
- TrilinosWrappers::BlockVector &right_hand_side,
- const bool eliminate_columns)
- {
- internal::TrilinosWrappers::apply_block_boundary_values (boundary_values, matrix,
- solution, right_hand_side,
- eliminate_columns);
- }
-
-
-
void
apply_boundary_values (const std::map<types::global_dof_index,TrilinosScalar> &boundary_values,
TrilinosWrappers::BlockSparseMatrix &matrix,
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/vector_element_access.h>
#include <deal.II/numerics/vector_tools.h>
#include <deal.II/lac/trilinos_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
-#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/numerics/solution_transfer.h>
DEAL_II_NAMESPACE_OPEN