mortar_evaluator.hpp
Go to the documentation of this file.
1 //==============================================================================
11 //==============================================================================
12 #ifndef MORTAR_EVALUATOR_HPP_
13 #define MORTAR_EVALUATOR_HPP_
14 
15 #include <dune/istl/matrixmatrix.hh>
16 #include <dune/istl/solvers.hh>
19 
20 namespace Opm {
21 namespace Elasticity {
22 
27 class MortarEvaluator : public Dune::LinearOperator<Vector, Vector> {
28  public:
29  // define the category
30  enum {
32  category=Dune::SolverCategory::sequential
33  };
34 
39  const Matrix& B_) :
40  A(A_), B(B_)
41  {
42  }
43 
47  void apply(const Vector& x, Vector& y) const
48  {
49  Vector lambda, l2;
50 
51  MortarUtils::extractBlock(lambda, x, B.M(), A.N());
52  A.mv(x, y);
53  B.umv(lambda, y);
54  l2.resize(lambda.size());
55  B.mtv(x, l2);
56  MortarUtils::injectBlock(y, l2, B.M(), A.N());
57  }
58 
63  void applyscaleadd(field_type alpha, const Vector& x, Vector& y) const
64  {
65  Vector lambda, l2;
66 
67  A.usmv(alpha, x, y);
68  MortarUtils::extractBlock(lambda, x, B.M(), A.N());
69  B.umv(lambda, y);
70  l2.resize(lambda.size());
71  B.mtv(x, l2);
72  for (size_t i=A.N(); i < y.size(); ++i)
73  y[i] += alpha*l2[i-A.N()];
74  }
75  protected:
76  const Matrix& A;
77  const Matrix& B;
78 };
79 
80 }
81 }
82 
83 #endif
static void injectBlock(Vector &x, const Vector &y, int len, int start=0)
Inject a range of indices into a vector.
Definition: mortar_utils.hpp:36
Definition: applier.hpp:18
Definition: mortar_evaluator.hpp:27
MortarEvaluator(const Matrix &A_, const Matrix &B_)
Constructor.
Definition: mortar_evaluator.hpp:38
The category the preconditioner is part of.
Definition: mortar_evaluator.hpp:32
Mortar helper class.
Dune::BCRSMatrix< Dune::FieldMatrix< double, 1, 1 > > Matrix
A sparse matrix holding our operator.
Definition: matrixops.hpp:23
Helper class with some matrix operations.
void apply(const Vector &x, Vector &y) const
Apply the multiplier block.
Definition: mortar_evaluator.hpp:47
Dune::BlockVector< Dune::FieldVector< double, 1 > > Vector
A vector holding our RHS.
Definition: matrixops.hpp:29
const Matrix & B
Reference to the mortar coupling matrix.
Definition: mortar_evaluator.hpp:77
static void extractBlock(Vector &x, const Vector &y, int len, int start=0)
Extract a range of indices from a vector.
Definition: mortar_utils.hpp:25
void applyscaleadd(field_type alpha, const Vector &x, Vector &y) const
Apply the multiplier block with an embedded axpy.
Definition: mortar_evaluator.hpp:63
const Matrix & A
Reference to A matrix.
Definition: mortar_evaluator.hpp:76