16 #ifndef dealii__petsc_block_vector_h 17 #define dealii__petsc_block_vector_h 20 #include <deal.II/base/config.h> 22 #ifdef DEAL_II_WITH_PETSC 24 # include <deal.II/lac/petsc_vector.h> 25 # include <deal.II/lac/petsc_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
72 typedef BaseClass::pointer pointer;
73 typedef BaseClass::const_pointer const_pointer;
74 typedef BaseClass::reference reference;
75 typedef BaseClass::const_reference const_reference;
76 typedef BaseClass::size_type size_type;
90 explicit BlockVector (
const unsigned int num_blocks = 0,
91 const size_type block_size = 0);
125 template <
typename InputIterator>
127 const InputIterator first,
128 const InputIterator
end);
165 void reinit (
const unsigned int num_blocks,
166 const size_type block_size,
167 const bool omit_zeroing_entries =
false);
187 void reinit (
const std::vector<size_type> &N,
188 const bool omit_zeroing_entries=
false);
205 const bool omit_zeroing_entries=
false);
213 void reinit (
const unsigned int num_blocks);
236 void print (std::ostream &out,
237 const unsigned int precision = 3,
238 const bool scientific =
true,
239 const bool across =
true)
const;
251 } DEAL_II_DEPRECATED;
261 const size_type block_size)
283 for (
unsigned int i=0; i<this->
n_blocks(); ++i)
297 for (
unsigned int i=0; i<this->
n_blocks(); ++i)
303 template <
typename InputIterator>
305 const InputIterator first,
306 const InputIterator end)
313 InputIterator start = first;
314 for (
unsigned int b=0; b<n.size(); ++b)
316 InputIterator
end = start;
317 std::advance (
end, static_cast<signed int>(n[b]));
319 for (size_type i=0; i<n[b]; ++i, ++start)
320 this->
block(b)(i) = *start;
365 const size_type bl_sz,
366 const bool omit_zeroing_entries)
368 std::vector<size_type> n(n_bl, bl_sz);
369 reinit(n, omit_zeroing_entries);
377 const bool omit_zeroing_entries)
383 for (
unsigned int i=0; i<this->
n_blocks(); ++i)
391 const bool omit_zeroing_entries)
397 for (
unsigned int i=0; i<this->
n_blocks(); ++i)
407 reinit (num_blocks, 0,
true);
419 for (
unsigned int i=0; i<this->
n_blocks(); ++i)
429 const unsigned int precision,
430 const bool scientific,
431 const bool across)
const 433 for (
unsigned int i=0; i<this->
n_blocks(); ++i)
436 out <<
'C' << i <<
':';
438 out <<
"Component " << i << std::endl;
439 this->
components[i].print(out, precision, scientific, across);
468 template <
typename>
class ReinitHelper;
478 template <
typename Matrix>
482 bool omit_zeroing_entries)
484 v.
reinit(matrix.locally_owned_range_sizes(), omit_zeroing_entries);
487 template <
typename Matrix>
491 bool omit_zeroing_entries)
493 v.
reinit(matrix.locally_owned_domain_sizes(), omit_zeroing_entries);
512 DEAL_II_NAMESPACE_CLOSE
514 #endif // DEAL_II_WITH_PETSC
static void reinit_domain_vector(const Matrix &matrix, Vector &v, bool omit_zeroing_entries)
BlockVector & operator=(const value_type s)
BaseClass::value_type value_type
BlockIndices block_indices
BlockVectorBase< Vector > BaseClass
BlockVector(const unsigned int num_blocks=0, const size_type block_size=0)
const BlockIndices & get_block_indices() const
#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)
#define DeclException0(Exception0)
std::vector< Vector > components
static void reinit_range_vector(const Matrix &matrix, Vector &v, bool omit_zeroing_entries)
void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const
BaseClass::BlockType BlockType
void swap(BlockVector &u, BlockVector &v)
void reinit(const unsigned int num_blocks, const size_type block_size, const bool omit_zeroing_entries=false)
unsigned int n_blocks() const
virtual void reinit(const size_type N, const bool omit_zeroing_entries=false)
static ::ExceptionBase & ExcIteratorRangeDoesNotMatchVectorSize()
unsigned int size() const
BlockType & block(const unsigned int i)
BlockVectorBase & operator=(const value_type s)
void swap(BlockVector &v)