17 #ifndef __deal2__block_vector_templates_h 18 #define __deal2__block_vector_templates_h 21 #include <deal.II/base/config.h> 22 #include <deal.II/lac/block_vector.h> 23 #include <deal.II/lac/trilinos_block_vector.h> 29 template <
typename Number>
31 const size_type block_size)
33 reinit (n_blocks, block_size);
38 template <
typename Number>
45 template <
typename Number>
52 template <
typename Number>
60 for (size_type i=0; i<this->
n_blocks(); ++i)
65 #ifndef DEAL_II_EXPLICIT_CONSTRUCTOR_BUG 67 template <
typename Number>
68 template <
typename OtherNumber>
78 #ifdef DEAL_II_WITH_TRILINOS 80 template <
typename Number>
84 this->components.resize(this->n_blocks());
86 for (size_type i=0; i<this->n_blocks(); ++i)
87 this->components[i] = v.
block(i);
89 BaseClass::collect_sizes();
95 template <
typename Number>
97 const size_type bl_sz,
100 std::vector<size_type> n(n_bl, bl_sz);
105 template <
typename Number>
109 this->block_indices.reinit (n);
110 if (this->components.size() != this->n_blocks())
111 this->components.resize(this->n_blocks());
113 for (size_type i=0; i<this->n_blocks(); ++i)
114 this->components[i].reinit(n[i], fast);
118 template <
typename Number>
123 this->block_indices = n;
124 if (this->components.size() != this->n_blocks())
125 this->components.resize(this->n_blocks());
127 for (size_type i=0; i<this->n_blocks(); ++i)
128 this->components[i].reinit(n.
block_size(i), fast);
132 template <
typename Number>
133 template <
typename Number2>
138 if (this->components.size() != this->n_blocks())
139 this->components.resize(this->n_blocks());
141 for (size_type i=0; i<this->n_blocks(); ++i)
146 template <
typename Number>
151 #ifdef DEAL_II_WITH_TRILINOS 152 template <
typename Number>
157 BaseClass::operator = (v);
163 template <
typename Number>
169 for (size_type i=0; i<this->n_blocks(); ++i)
176 template <
typename Number>
178 const unsigned int precision,
179 const bool scientific,
180 const bool across)
const 182 for (size_type i=0; i<this->n_blocks(); ++i)
185 out <<
'C' << i <<
':';
187 out <<
"Component " << i << std::endl;
188 this->components[i].print(out, precision, scientific, across);
194 template <
typename Number>
197 for (size_type i=0; i<this->n_blocks(); ++i)
198 this->components[i].block_write(out);
203 template <
typename Number>
206 for (size_type i=0; i<this->n_blocks(); ++i)
207 this->components[i].block_read(in);
212 DEAL_II_NAMESPACE_CLOSE
BlockVector & operator=(const value_type s)
void block_write(std::ostream &out) const
Auxiliary class aiding in the handling of block structures like in BlockVector or FESystem...
unsigned int n_blocks() const
void swap(BlockVector< Number > &u, BlockVector< Number > &v)
void reinit(const unsigned int num_blocks, const size_type block_size=0, const bool fast=false)
BlockIndices block_indices
#define Assert(cond, exc)
const BlockIndices & get_block_indices() const
void reinit(const unsigned int n_blocks, const size_type n_elements_per_block)
std::vector< Vector< Number > > components
size_type block_size(const unsigned int i) const
void swap(BlockVector< Number > &v)
BlockVector(const unsigned int num_blocks=0, const size_type block_size=0)
::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
BlockType & block(const unsigned int i)
void print(const char *format=0) const
void block_read(std::istream &in)