17 #ifndef __deal2__schur_matrix_h
18 #define __deal2__schur_matrix_h
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/subscriptor.h>
22 #include <deal.II/base/smartpointer.h>
23 #include <deal.II/base/logstream.h>
24 #include <deal.II/lac/vector_memory.h>
25 #include <deal.II/lac/block_vector.h>
97 template <
class MA_inverse,
class MB,
class MDt,
class MC>
120 const std::vector<unsigned int> &
signature = std::vector<unsigned int>(0));
223 template <
class MA_inverse,
class MB,
class MDt,
class MC>
230 const std::vector<unsigned int> &signature)
231 : Ainv(&Ainv), B(&B), Dt(&Dt), C(&C),
233 signature(signature),
239 template <
class MA_inverse,
class MB,
class MDt,
class MC>
248 template <
class MA_inverse,
class MB,
class MDt,
class MC>
253 deallog.
push(
"Schur");
255 deallog <<
"src:" << src.
l2_norm() << std::endl;
259 deallog <<
"C:" << dst.
l2_norm() << std::endl;
262 if (signature.size()>0)
265 h1->
reinit(B->n_block_cols(), src.
block(0).size());
268 deallog <<
"Dt:" << h1->
l2_norm() << std::endl;
272 Ainv->vmult(*h2, *h1);
274 deallog <<
"Ainverse:" << h2->
l2_norm() << std::endl;
277 B->vmult_add(dst, *h2);
279 deallog <<
"dst:" << dst.
l2_norm() << std::endl;
286 template <
class MA_inverse,
class MB,
class MDt,
class MC>
299 template <
class MA_inverse,
class MB,
class MDt,
class MC>
309 deallog.
push(
"Schur-prepare");
311 deallog <<
"src:" << src.
l2_norm() << std::endl;
313 if (signature.size()>0)
316 h1->
reinit(B->n_block_cols(), src.
block(0).size());
317 Ainv->vmult(*h1, src);
319 deallog <<
"Ainverse:" << h1->
l2_norm() << std::endl;
320 B->vmult_add(dst, *h1);
322 deallog <<
"dst:" << dst.
l2_norm() << std::endl;
328 template <
class MA_inverse,
class MB,
class MDt,
class MC>
341 deallog.
push(
"Schur-post");
343 deallog <<
"src:" << src.
l2_norm() << std::endl;
345 if (signature.size()>0)
348 h1->
reinit(B->n_block_cols(), src.
block(0).size());
349 Dt->Tvmult(*h1, src);
351 deallog <<
"Dt:" << h1->
l2_norm() << std::endl;
353 Ainv->vmult(dst,*h1);
355 deallog <<
"dst:" << dst.
l2_norm() << std::endl;
361 DEAL_II_NAMESPACE_CLOSE
void vmult(BlockVector< double > &dst, const BlockVector< double > &src) const
std::vector< types::global_dof_index > signature
void postprocess(BlockVector< double > &dst, const BlockVector< double > &src, const BlockVector< double > &rhs) const
void prepare_rhs(BlockVector< double > &dst, const BlockVector< double > &src) const
double residual(BlockVector< double > &dst, const BlockVector< double > &src, const BlockVector< double > &rhs) const
SchurMatrix(const MA_inverse &Ainv, const MB &B, const MDt &Dt, const MC &C, VectorMemory< BlockVector< double > > &mem, const std::vector< unsigned int > &signature=std::vector< unsigned int >(0))
const SmartPointer< const MB, SchurMatrix< MA_inverse, MB, MDt, MC > > B
unsigned int n_blocks() const
void reinit(const unsigned int num_blocks, const size_type block_size=0, const bool fast=false)
void debug_level(unsigned int l)
VectorMemory< BlockVector< double > > & mem
SchurMatrix & operator=(const SchurMatrix< MA_inverse, MB, MDt, MC > &)
const SmartPointer< const MA_inverse, SchurMatrix< MA_inverse, MB, MDt, MC > > Ainv
#define Assert(cond, exc)
const SmartPointer< const MDt, SchurMatrix< MA_inverse, MB, MDt, MC > > Dt
void sadd(const value_type s, const BlockVectorBase &V)
void push(const std::string &text)
real_type l2_norm() const
::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
void scale(const value_type factor) DEAL_II_DEPRECATED
BlockType & block(const unsigned int i)
const SmartPointer< const MC, SchurMatrix< MA_inverse, MB, MDt, MC > > C