16 #ifndef dealii_block_vector_h 17 #define dealii_block_vector_h 20 #include <deal.II/base/config.h> 21 #include <deal.II/base/exceptions.h> 22 #include <deal.II/lac/block_indices.h> 23 #include <deal.II/lac/block_vector_base.h> 24 #include <deal.II/lac/vector_operation.h> 25 #include <deal.II/lac/vector_type_traits.h> 30 DEAL_II_NAMESPACE_OPEN
33 #ifdef DEAL_II_WITH_TRILINOS 65 template <
typename Number>
84 typedef typename BaseClass::pointer pointer;
85 typedef typename BaseClass::const_pointer const_pointer;
86 typedef typename BaseClass::reference reference;
87 typedef typename BaseClass::const_reference const_reference;
88 typedef typename BaseClass::size_type size_type;
103 const size_type block_size = 0);
130 template <typename OtherNumber>
134 #ifdef DEAL_II_WITH_TRILINOS 146 BlockVector (
const std::vector<size_type> &block_sizes);
163 template <
typename InputIterator>
164 BlockVector (
const std::vector<size_type> &block_sizes,
165 const InputIterator first,
166 const InputIterator
end);
209 template <
class Number2>
219 #ifdef DEAL_II_WITH_TRILINOS 241 const size_type block_size = 0,
242 const bool omit_zeroing_entries =
false);
260 void reinit (
const std::vector<size_type> &block_sizes,
261 const bool omit_zeroing_entries=
false);
273 const bool omit_zeroing_entries=
false);
288 template <
typename Number2>
290 const bool omit_zeroing_entries=
false);
296 template <
class BlockVector2>
297 void scale (
const BlockVector2 &v);
315 void print (std::ostream &out,
316 const unsigned int precision = 3,
317 const bool scientific =
true,
318 const bool across =
true)
const;
359 template <
typename Number>
360 template <
typename InputIterator>
362 const InputIterator first,
363 const InputIterator end)
369 reinit (block_sizes,
true);
370 InputIterator start = first;
371 for (size_type b=0; b<block_sizes.size(); ++b)
373 InputIterator end = start;
374 std::advance (end, static_cast<signed int>(block_sizes[b]));
375 std::copy (start, end, this->block(b).begin());
378 Assert (start == end, ExcIteratorRangeDoesNotMatchVectorSize());
383 template <
typename Number>
391 BaseClass::operator= (s);
397 template <
typename Number>
403 BaseClass::operator= (v);
409 template <
typename Number>
414 BaseClass::operator= (v);
420 template <
typename Number>
421 template <
typename Number2>
427 BaseClass::operator= (v);
431 template <
typename Number>
435 for (size_type i=0; i<this->n_blocks(); ++i)
436 this->components[i].compress(operation);
441 template <
typename Number>
442 template <
class BlockVector2>
445 BaseClass::scale (v);
459 template <
typename Number>
470 namespace LinearOperatorImplementation
478 template <
typename number>
482 template <
typename Matrix>
486 bool omit_zeroing_entries)
488 v.
reinit(matrix.get_row_indices(), omit_zeroing_entries);
491 template <
typename Matrix>
495 bool omit_zeroing_entries)
497 v.
reinit(matrix.get_column_indices(), omit_zeroing_entries);
510 template <
typename Number>
515 DEAL_II_NAMESPACE_CLOSE
BaseClass::value_type value_type
BlockVector & operator=(const value_type s)
void block_write(std::ostream &out) const
void scale(const BlockVector2 &v)
static void reinit_range_vector(const Matrix &matrix, Vector &v, bool omit_zeroing_entries)
void swap(BlockVector< Number > &u, BlockVector< Number > &v)
BlockVectorBase< Vector< Number > > BaseClass
static void reinit_domain_vector(const Matrix &matrix, Vector &v, bool omit_zeroing_entries)
BlockIndices block_indices
static ::ExceptionBase & ExcIteratorRangeDoesNotMatchVectorSize()
#define Assert(cond, exc)
BlockType::real_type real_type
void compress(::VectorOperation::values operation=::VectorOperation::unknown)
#define DeclException0(Exception0)
void reinit(const unsigned int n_blocks, const size_type block_size=0, const bool omit_zeroing_entries=false)
void swap(BlockVector< Number > &v)
unsigned int n_blocks() const
BlockVector(const unsigned int n_blocks=0, const size_type block_size=0)
void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const
BaseClass::BlockType BlockType
#define AssertIsFinite(number)
void block_read(std::istream &in)