17 #ifndef __deal2__trilinos_block_vector_h
18 #define __deal2__trilinos_block_vector_h
21 #include <deal.II/base/config.h>
23 #ifdef DEAL_II_WITH_TRILINOS
25 # include <deal.II/lac/trilinos_vector.h>
26 # include <deal.II/lac/trilinos_parallel_block_vector.h>
27 # include <deal.II/lac/block_indices.h>
28 # include <deal.II/lac/block_vector_base.h>
29 # include <deal.II/lac/exceptions.h>
90 typedef BaseClass::pointer pointer;
91 typedef BaseClass::const_pointer const_pointer;
92 typedef BaseClass::reference reference;
93 typedef BaseClass::const_reference const_reference;
94 typedef BaseClass::size_type size_type;
113 explicit BlockVector (
const std::vector<Epetra_Map> &partitioner);
124 explicit BlockVector (
const std::vector<IndexSet> &partitioner,
125 const MPI_Comm &communicator = MPI_COMM_WORLD);
164 explicit BlockVector (
const std::vector<size_type> &N);
184 template <
typename InputIterator>
186 const InputIterator first,
187 const InputIterator
end);
254 template <
typename Number>
278 void reinit (
const std::vector<Epetra_Map> &partitioning,
279 const bool fast =
false);
300 void reinit (
const std::vector<IndexSet> &partitioning,
301 const MPI_Comm &communicator = MPI_COMM_WORLD,
302 const bool fast =
false);
316 void reinit (
const std::vector<size_type> &N,
317 const bool fast=
false);
353 const bool fast =
false);
366 void reinit (
const size_type num_blocks);
403 void print (std::ostream &out,
404 const unsigned int precision = 3,
405 const bool scientific =
true,
406 const bool across =
true)
const;
423 <<
"For the generation of a localized vector the map has "
424 <<
"to assign all elements to all vectors! "
425 <<
"local_size = global_size is a necessary condition, but"
426 << arg1 <<
" != " << arg2 <<
" was given!");
452 const MPI_Comm &communicator)
454 reinit (partitioning, communicator);
467 template <
typename InputIterator>
469 const InputIterator first,
470 const InputIterator end)
476 InputIterator start = first;
477 for (size_type b=0; b<n.size(); ++b)
479 InputIterator end = start;
480 std::advance (end, static_cast<size_type>(n[b]));
482 for (size_type i=0; i<n[b]; ++i, ++start)
483 this->
block(b)(i) = *start;
485 Assert (start == end, ExcIteratorRangeDoesNotMatchVectorSize());
520 for (size_type i=0; i<this->
n_blocks(); ++i)
529 if (last_action == Add)
530 this->
compress(::VectorOperation::add);
531 else if (last_action == Insert)
532 this->
compress(::VectorOperation::insert);
545 for (
unsigned int row=0; row<
n_blocks(); ++row)
550 template <
typename Number>
556 std::vector<size_type> block_sizes (v.n_blocks(), 0);
562 for (size_type i=0; i<this->
n_blocks(); ++i)
590 DEAL_II_NAMESPACE_CLOSE
592 #endif // DEAL_II_WITH_TRILINOS
BlockIndices block_indices
void swap(BlockVector &v)
#define AssertThrow(cond, exc)
virtual void swap(Vector< Number > &v)
BlockVector & operator=(const value_type s)
void reinit(const std::vector< Epetra_Map > &partitioning, const bool fast=false)
DeclException0(ExcIteratorRangeDoesNotMatchVectorSize)
#define Assert(cond, exc)
void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const
void reinit(const unsigned int n_blocks, const size_type n_elements_per_block)
BaseClass::value_type value_type
BlockType & block(const unsigned int i)
BlockCompressedSparsityPattern CompressedBlockSparsityPattern DEAL_II_DEPRECATED
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!")
void swap(BlockVector &u, BlockVector &v)
unsigned int n_blocks() const
BaseClass::BlockType BlockType
::ExceptionBase & ExcNotImplemented()
::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
std::vector< Vector > components
BlockVectorBase< Vector > BaseClass
void compress() DEAL_II_DEPRECATED