16 #ifndef dealii__trilinos_block_vector_h 17 #define dealii__trilinos_block_vector_h 20 #include <deal.II/base/config.h> 22 #ifdef DEAL_II_WITH_TRILINOS 24 # include <deal.II/lac/trilinos_vector.h> 25 # include <deal.II/lac/trilinos_parallel_block_vector.h> 26 # include <deal.II/lac/block_indices.h> 27 # include <deal.II/lac/block_vector_base.h> 28 # include <deal.II/lac/exceptions.h> 29 # include <deal.II/lac/vector_type_traits.h> 31 DEAL_II_NAMESPACE_OPEN
87 typedef BaseClass::pointer pointer;
88 typedef BaseClass::const_pointer const_pointer;
89 typedef BaseClass::reference reference;
90 typedef BaseClass::const_reference const_reference;
91 typedef BaseClass::size_type size_type;
105 explicit BlockVector (
const std::vector<Epetra_Map> &partitioner) DEAL_II_DEPRECATED;
112 explicit BlockVector (
const std::vector<IndexSet> &partitioner,
113 const MPI_Comm &communicator = MPI_COMM_WORLD) DEAL_II_DEPRECATED;
132 explicit BlockVector (
const size_type num_blocks) DEAL_II_DEPRECATED;
140 explicit BlockVector (
const std::vector<size_type> &N) DEAL_II_DEPRECATED;
150 template <
typename InputIterator>
152 const InputIterator first,
153 const InputIterator
end) DEAL_II_DEPRECATED;
189 template <
typename Number>
205 void reinit (
const std::vector<Epetra_Map> &partitioning,
206 const bool omit_zeroing_entries =
false);
219 void reinit (
const std::vector<IndexSet> &partitioning,
220 const MPI_Comm &communicator = MPI_COMM_WORLD,
221 const bool omit_zeroing_entries =
false);
231 void reinit (
const std::vector<size_type> &N,
232 const bool omit_zeroing_entries=
false);
255 const bool omit_zeroing_entries =
false);
263 void reinit (
const size_type num_blocks);
286 void print (std::ostream &out,
287 const unsigned int precision = 3,
288 const bool scientific =
true,
289 const bool across =
true)
const;
306 <<
"For the generation of a localized vector the map has " 307 <<
"to assign all elements to all vectors! " 308 <<
"local_size = global_size is a necessary condition, but" 309 << arg1 <<
" != " << arg2 <<
" was given!");
335 const MPI_Comm &communicator)
337 reinit (partitioning, communicator);
350 template <
typename InputIterator>
352 const InputIterator first,
353 const InputIterator end)
360 InputIterator start = first;
361 for (size_type b=0; b<n.size(); ++b)
363 InputIterator
end = start;
364 std::advance (
end, static_cast<size_type>(n[b]));
366 for (size_type i=0; i<n[b]; ++i, ++start)
367 this->
block(b)(i) = *start;
404 for (size_type i=0; i<this->
n_blocks(); ++i)
416 for (
unsigned int row=0; row<
n_blocks(); ++row)
421 template <
typename Number>
427 std::vector<size_type> block_sizes (v.n_blocks(), 0);
433 for (size_type i=0; i<this->
n_blocks(); ++i)
466 template <
typename>
class ReinitHelper;
476 template <
typename Matrix>
480 bool omit_zeroing_entries)
482 v.
reinit(matrix.range_partitioner(), omit_zeroing_entries);
485 template <
typename Matrix>
489 bool omit_zeroing_entries)
491 v.
reinit(matrix.domain_partitioner(), omit_zeroing_entries);
521 DEAL_II_NAMESPACE_CLOSE
523 #endif // DEAL_II_WITH_TRILINOS #define DeclException2(Exception2, type1, type2, outsequence)
static ::ExceptionBase & ExcNonMatchingBlockVectors()
void swap(BlockVector &v)
static void reinit_domain_vector(const Matrix &matrix, Vector &v, bool omit_zeroing_entries)
static ::ExceptionBase & ExcNonLocalizedMap(int arg1, int arg2)
BlockIndices block_indices
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
void reinit(const unsigned int n_blocks, const size_type n_elements_per_block)
BaseClass::value_type value_type
#define DeclException0(Exception0)
BlockVector & operator=(const value_type s)
std::vector< Vector > components
static void reinit_range_vector(const Matrix &matrix, Vector &v, bool omit_zeroing_entries)
virtual void swap(Vector< Number > &v)
void swap(BlockVector &u, BlockVector &v)
unsigned int n_blocks() const
void reinit(const std::vector< Epetra_Map > &partitioning, const bool omit_zeroing_entries=false)
BaseClass::BlockType BlockType
BlockVectorBase< Vector > BaseClass
BlockType & block(const unsigned int i)
static ::ExceptionBase & ExcIteratorRangeDoesNotMatchVectorSize()
void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const