13#ifndef ISTLINTERFACE_HH
14#define ISTLINTERFACE_HH
19#include <boost/fusion/algorithm.hpp>
20#include <boost/fusion/sequence.hpp>
22#include <dune/istl/operators.hh>
23#include "dune/istl/preconditioners.hh"
44 namespace IstlInterfaceDetail {
47 typename T::iterator begin(T& t)
53 typename T::const_iterator begin(T
const& t)
58 template <
class Scalar>
59 typename std::vector<Scalar>::iterator begin(std::vector<Scalar>& vec) {
return vec.begin(); }
61 template <
class Scalar>
62 typename std::vector<Scalar>::const_iterator begin(std::vector<Scalar>
const& vec) {
return vec.begin(); }
78 template <
class ElementType,
class SparseIdx,
int r
id,
int c
id,
bool sym,
bool trans>
81 static int const rowId = rid;
82 static int const colId = cid;
83 static bool const symmetric = sym;
84 static bool const transposed = trans;
86 typedef ElementType BlockType;
87 using SparseIndex = SparseIdx;
88 typedef typename BlockType::field_type Scalar;
89 typedef NumaBCRSMatrix<typename Transpose<BlockType,transposed>::type,SparseIndex> Matrix;
92 typedef NumaBCRSMatrix<BlockType,SparseIndex> TMatrix;
94 explicit Block(std::shared_ptr<Matrix const>
const& m): matrix(m) {}
96 std::shared_ptr<Matrix const> matrix;
97 std::shared_ptr<TMatrix> threadedMatrix;
108 template <
class MBlock>
109 auto operator()(MBlock
const& mb)
const {
110 typedef std::remove_reference_t<MBlock> MB;
111 typedef Block<typename MB::BlockType,typename MB::SparseIndex,MB::rowId,MB::colId,MB::symmetric,false> type;
112 return type(mb.globalMatrixPointer());
118 template <
class MB>
struct apply {
typedef boost::mpl::bool_<MB::rowId>=0> type; };
124 template <
class T>
struct result {};
126 template <
class MBlock>
127 struct result<Mirror(MBlock)> {
128 typedef typename std::remove_reference<MBlock>::type MB;
130 typedef Block<ElementType,
typename MB::SparseIndex,
131 MB::mirror?MB::colId:-1, MB::rowId, MB::symmetric,
true> type;
135 typename result<Mirror(MB)>::type operator()(MB
const& mb)
const {
136 return typename result<Mirror(MB)>::type(mb.globalMatrixPointer());
145 typedef typename result_of::transform<typename GOP::MatrixBlockArray const,Copy>::type CopiedBlocks;
146 typedef typename result_of::transform<typename GOP::MatrixBlockArray const,Mirror>::type MirroredBlocks;
147 typedef typename result_of::join<CopiedBlocks const,MirroredBlocks const>::type JointBlocks;
151 typedef typename result_of::filter_if<JointBlocks const,Cleanup>::type
const A;
152 typedef typename result_of::as_vector<A>::type result;
154 static result apply(GOP
const& op) {
155 return filter_if<Cleanup>(join(transform(op.getMatrix(),Copy()),transform(op.getMatrix(),Mirror())));
162 template <
int firstRow,
int lastRow,
int firstCol,
int lastCol>
163 struct RangeBlockSelector
165 template <
class Block>
struct apply
167 typedef boost::mpl::bool_<firstRow<=Block::rowId && Block::rowId<lastRow && firstCol<=Block::colId && Block::colId<lastCol> type;
172 template <
int firstRow,
int firstCol>
177 Translate(
int nThreads_=1): nThreads(nThreads_)
181 template <
class T>
struct result {};
184 struct result<Translate(Blk)> {
185 typedef typename std::remove_reference<Blk>::type Bl;
186 typedef Block<
typename Bl::BlockType,
typename Bl::SparseIndex,Bl::rowId-firstRow,Bl::colId-firstCol,Bl::symmetric,Bl::transposed> type;
190 auto operator()(Bl
const& bl)
const
192 Block<
typename Bl::BlockType,
typename Bl::SparseIndex,Bl::rowId-firstRow,Bl::colId-firstCol,Bl::symmetric,Bl::transposed> blk(bl.matrix);
193 blk.threadedMatrix.reset(
new typename Bl::TMatrix(*blk.matrix,bl.symmetric,bl.transposed,
false));
205 template <
class FSElement,
class Vector>
206 typename std::enable_if<!std::is_same<FSElement,Vector>::value,
void>::type
207 toVector(FSElement
const& x,
Vector& coefficients)
209 coefficients.resize(x.dim());
214 template <
class FSElement,
class Vector>
215 typename std::enable_if<std::is_same<FSElement,Vector>::value,
void>::type
216 toVector(FSElement
const& x,
Vector& coefficients)
225 template <
class FSElement,
class Vector>
226 typename std::enable_if<!std::is_same<FSElement,Vector>::value,
void>::type
227 fromVector(
Vector const& coefficients, FSElement& x)
229 assert(coefficients.size()>=x.dim());
234 template <
class FSElement,
class Vector>
235 typename std::enable_if<std::is_same<FSElement,Vector>::value,
void>::type
236 fromVector(
Vector const& coefficients, FSElement& x)
243 void toFile(std::vector<T>
const& v, std::string
const& filename,
size_t precision = 10)
246 os.precision(precision);
249 for(T t : v) os << t <<
"\t";
257 template <
int firstRow_,
int lastRow_,
int firstCol_,
int lastCol_>
260 static int const firstRow = firstRow_;
261 static int const lastRow = lastRow_;
262 static int const firstCol = firstCol_;
263 static int const lastCol = lastCol_;
312 template <
class Scalar_,
class SparseInt,
class Domain_,
class Range_>
314 :
public Dune::LinearOperator<Domain_,Range_>
335 template <
class OtherMatrix=Matrix>
336 typename std::enable_if<std::is_same<Matrix,OtherMatrix>::value,
Matrix const&>::type get()
const {
return A; }
344 template <
class OtherMatrix>
345 typename std::enable_if<!std::is_same<Matrix,OtherMatrix>::value, OtherMatrix>::type get()
const {
return OtherMatrix(A); }
350 std::vector<Scalar> tmpx, tmpb(A.nrows(),0.0);
351 domainToVector(x,tmpx);
355 vectorToRange(tmpb,b);
360 std::vector<Scalar> tmpx, tmpb(A.ncols(),0.0);
361 domainToVector(x,tmpx);
365 vectorToRange(tmpb,b);
369 template <
class OtherMatrix=Matrix>
370 typename std::enable_if<std::is_same<OtherMatrix,Matrix>::value,std::unique_ptr<Matrix> >::type getPointer()
const
372 return std::unique_ptr<Matrix>(
new Matrix(A));
376 template <
class OtherMatrix>
377 typename std::enable_if<std::is_same<OtherMatrix,Dune::BCRSMatrix<Dune::FieldMatrix<Scalar,1,1> > >::value,std::unique_ptr<OtherMatrix> >::type getPointer()
const
386 std::vector<Scalar> tmpx, tmpb;
387 domainToVector(x,tmpx);
388 rangeToVector(b,tmpb);
390 A.usmv(alpha,tmpx, tmpb);
392 vectorToRange(tmpb,b);
398 std::vector<Scalar> tmpx, tmpb;
399 domainToVector(x,tmpx);
400 rangeToVector(b,tmpb);
402 A.usmtv(alpha,tmpx, tmpb);
404 vectorToRange(tmpb,b);
415 template <
class Vector>
418 IstlInterfaceDetail::toVector(y,coefficients);
430 template <
class Vector>
433 IstlInterfaceDetail::toVector(x, coefficients);
445 template <
class Vector>
448 IstlInterfaceDetail::fromVector(coefficients, x);
460 template <
class Vector>
463 IstlInterfaceDetail::fromVector(coefficients, x);
475 A *= alpha;
return *
this;
480 A /= alpha;
return *
this;
485 A += B;
return *
this;
490 A += B;
return *
this;
495 A -= B;
return *
this;
500 A -= B;
return *
this;
508 virtual Dune::SolverCategory::Category
category()
const override
510 return Dune::SolverCategory::sequential;
517 template <
class MatrixBlock,
class Allocator,
class Domain_,
class Range_>
519 :
public Dune::LinearOperator<Domain_,Range_>
522 typedef Dune::BCRSMatrix<MatrixBlock,Allocator>
Matrix;
539 template <
class OtherMatrix=Matrix>
540 typename std::enable_if<std::is_same<Matrix,OtherMatrix>::value,
Matrix const&>::type get()
const {
return A; }
548 template <
class OtherMatrix>
549 typename std::enable_if<!std::is_same<Matrix,OtherMatrix>::value, OtherMatrix>::type get()
const {
return OtherMatrix(A); }
563 template <
class OtherMatrix=Matrix>
564 typename std::enable_if<std::is_same<OtherMatrix,Matrix>::value,std::unique_ptr<Matrix> >::type getPointer()
const
566 return std::unique_ptr<Matrix>(
new Matrix(A));
570 template <
class OtherMatrix>
571 typename std::enable_if<std::is_same<OtherMatrix,Dune::BCRSMatrix<Dune::FieldMatrix<Scalar,1,1> > >::value,std::unique_ptr<OtherMatrix> >::type getPointer()
const
598 IstlInterfaceDetail::toVector(y,coefficients);
612 IstlInterfaceDetail::toVector(x, coefficients);
624 template <
class Vector>
627 IstlInterfaceDetail::fromVector(coefficients, x);
639 template <
class Vector>
642 IstlInterfaceDetail::fromVector(coefficients, x);
654 A *= alpha;
return *
this;
659 A /= alpha;
return *
this;
664 A += B;
return *
this;
669 A += B;
return *
this;
674 A -= B;
return *
this;
679 A -= B;
return *
this;
687 virtual Dune::SolverCategory::Category
category()
const override
689 return Dune::SolverCategory::sequential;
699 namespace IstlInterfaceDetail
705 template <
class Assembler,
706 int firstRow,
int lastRow,
707 int firstCol,
int lastCol,
708 bool symmetric=
false>
711 typedef typename Assembler::AnsatzVariableSetDescription::template CoefficientVectorRepresentation<firstCol,lastCol>::type Domain;
712 typedef typename Assembler::TestVariableSetDescription::template CoefficientVectorRepresentation<firstRow,lastRow>::type Range;
714 static bool const inferredSymmetry
716 && firstRow==firstCol && lastRow==lastCol)
717 || (firstRow+1==lastRow && firstCol+1==lastCol &&
false);
719 using type = std::conditional_t<symmetric,
720 SymmetricLinearOperator<Domain,Range>,
721 Dune::LinearOperator<Domain,Range>>;
751 template <
class Assembler_,
752 int firstRow=0,
int lastRow=Assembler_::TestVariableSetDescription::noOfVariables,
753 int firstCol=0,
int lastCol=Assembler_::AnsatzVariableSetDescription::noOfVariables,
754 class BlockFilter=IstlInterfaceDetail::RangeBlockSelector<firstRow,lastRow,firstCol,lastCol>,
755 bool symmetric=IstlInterfaceDetail::Base<Assembler_,firstRow,lastRow,firstCol,lastCol>::inferredSymmetry>
757 :
public IstlInterfaceDetail::Base<Assembler_,firstRow,lastRow,firstCol,lastCol,symmetric>::type
760 typedef typename IstlInterfaceDetail::Base<Assembler_,firstRow,lastRow,firstCol,lastCol,symmetric>::type
Base;
762 using Domain =
typename Assembler::AnsatzVariableSetDescription::template CoefficientVector<firstCol,lastCol>;
763 using Range =
typename Assembler::TestVariableSetDescription::template CoefficientVector<firstRow,lastRow>;
764 typedef typename Assembler::Scalar
Scalar;
766 typedef IstlInterfaceDetail::BlockInfo<firstRow,lastRow,firstCol,lastCol>
BlockInfo;
776 bool onlyLowerTriangle_=
false,
int nThreads_=0):
780 IstlInterfaceDetail::Translate<firstRow,firstCol>(nThreads_))),
790 blocks = transform(filter_if<BlockFilter>(IstlInterfaceDetail::AllBlocks<Assembler>::apply(
assembler)),
791 IstlInterfaceDetail::Translate<firstRow,firstCol>(
nThreads));
798 {
return get<MatrixAsTriplet<Scalar>>(); }
813 template <
class Matrix>
814 Matrix
get(
int rowFirst=0,
int rowLast=lastRow-firstRow,
int colFirst=0,
int colLast=lastCol-firstCol)
const
820 template <
class Matrix>
844 IstlInterfaceDetail::toVector(y, coefficients);
857 template <
class Vector>
860 IstlInterfaceDetail::toVector(x, coefficients);
872 template <
class Vector>
875 IstlInterfaceDetail::fromVector(coefficients, x);
887 template <
class Vector>
890 IstlInterfaceDetail::fromVector(coefficients, x);
901 assert(
static_cast<void const*
>(&x) !=
static_cast<void const*
>(&b));
910 assert(
static_cast<void const*
>(&x) !=
static_cast<void const*
>(&b));
921 assert(
static_cast<void const*
>(&x) !=
static_cast<void const*
>(&b));
924 return symmetric?
dp: 0;
929 std::cerr <<
"AssembledGalerkinOperator::dp not yet implemented!\n"; abort();
940 assert(
static_cast<void const*
>(&x) !=
static_cast<void const*
>(&b));
951 assert(
static_cast<void const*
>(&x) !=
static_cast<void const*
>(&b));
973 static_assert(0<=i && i<lastCol-firstCol,
"ansatz variable index out of range");
974 int const varIdx = i-firstCol;
975 int const spaceIdx = Assembler::AnsatzVariableSetDescription::template spaceIndex<i>;
976 return *boost::fusion::at_c<spaceIdx>(
assembler.spaces());
986 virtual Dune::SolverCategory::Category
category()
const override
988 return Dune::SolverCategory::sequential;
992 typedef typename boost::fusion::result_of::as_vector<
993 typename IstlInterfaceDetail::AllBlocks<Assembler>::result
996 typedef typename boost::fusion::result_of::as_vector<
997 typename boost::fusion::result_of::filter_if<allblocks,BlockFilter>::type
1003 typename boost::fusion::result_of::as_vector<
1004 typename boost::fusion::result_of::transform<
filtered,
1005 IstlInterfaceDetail::Translate<firstRow,firstCol>>::type
1022 , dp(dp_? dp_: &dummy)
1024 for (
int i=0; i<lastRow; ++i)
1029 template <
class Block>
1034 auto const& xi = component<Block::colId>(x);
1035 auto & yi = component<Block::rowId>(y);
1036 if (!b.threadedMatrix.get())
1039 if (doInit[Block::rowId])
1041 *dp += b.threadedMatrix->mv(xi,yi);
1042 doInit[Block::rowId] =
false;
1045 *dp += b.threadedMatrix->usmv(a,xi,yi);
1054 mutable bool doInit[lastRow];
1066 for (
int i=0; i<lastCol; ++i)
1071 template <
class Block>
1075 typename result_of::at_c<typename Range::Functions const,Block::rowId>::type xi = at_c<Block::rowId>(x.data);
1076 typename result_of::at_c<typename Domain::Functions,Block::colId>::type yi = at_c<Block::colId>(y.data);
1077 if (!b.threadedMatrix.get())
1080 if (doInit[Block::colId])
1082 *dp += b.threadedMatrix->mv(xi,yi);
1083 doInit[Block::colId] =
false;
1086 *dp += b.threadedMatrix->usmv(a,xi,yi);
1097 mutable bool doInit[lastCol];
1107 template <
class Assembler,
1108 int firstRow=0,
int lastRow=Assembler::TestVariableSetDescription::noOfVariables,
1109 int firstCol=0,
int lastCol=Assembler::AnsatzVariableSetDescription::noOfVariables>
1123 template <
class NormalStepAssembler,
class TangentialStepAssembler,
int stateId=1,
int controlId=0,
int adjo
intId=2>
1124 class LagrangeOperator:
public Dune::LinearOperator<typename NormalStepAssembler::AnsatzVariableSetDescription::template CoefficientVectorRepresentation<>::type,typename NormalStepAssembler::TestVariableSetDescription::template CoefficientVectorRepresentation<>::type>
1126 typedef typename NormalStepAssembler::AnsatzVariableSetDescription::template CoefficientVectorRepresentation<>::type Domain;
1127 typedef typename NormalStepAssembler::TestVariableSetDescription::template CoefficientVectorRepresentation<>::type Range;
1128 static constexpr int firstRow = 0;
1129 static constexpr int firstCol = 0;
1130 static constexpr int lastRow = NormalStepAssembler::TestVariableSetDescription::noOfVariables;
1131 static constexpr int lastCol = NormalStepAssembler::AnsatzVariableSetDescription::noOfVariables;
1132 typedef IstlInterfaceDetail::RangeBlockSelector<firstRow,lastRow,firstCol,lastCol> NormalStepBlockFilter;
1133 typedef IstlInterfaceDetail::RangeBlockSelector<firstRow,adjointId,firstCol,adjointId> TangentialStepBlockFilter;
1136 typedef typename NormalStepAssembler::Scalar
Scalar;
1139 typedef IstlInterfaceDetail::BlockInfo<firstRow,lastRow,firstCol,lastCol>
BlockInfo;
1141 static int const category = Dune::SolverCategory::sequential;
1148 LagrangeOperator(NormalStepAssembler
const& normalStepAssembler_, TangentialStepAssembler
const& tangentialStepAssembler_,
bool onlyLowerTriangle_=
false,
int nThreads_=0):
1168 std::vector<size_t> offset(3,0);
1170 for(
size_t i=0; i<3; ++i)
1172 for(
size_t j=0; j<3; ++j)
1180 if(j==0) offset[1] = tmp.
nrows();
1181 if(j==1) offset[2] = tmp.
nrows();
1217 IstlInterfaceDetail::toVector(y, coefficients);
1231 IstlInterfaceDetail::toVector(x, coefficients);
1243 template <
class Vector>
1246 IstlInterfaceDetail::fromVector(coefficients, x);
1258 template <
class Vector>
1261 IstlInterfaceDetail::fromVector(coefficients, x);
1265 virtual void apply(Domain
const& x, Range& b)
const
1267 assert(
static_cast<void const*
>(&x) !=
static_cast<void const*
>(&b));
1279 assert(
static_cast<void const*
>(&x) !=
static_cast<void const*
>(&b));
1280 std::cerr <<
"AssembledGalerkinOperator::dp not yet implemented!\n"; abort();
1284 virtual Scalar dp(Domain
const& x, Range
const& y)
const
1286 std::cerr <<
"AssembledGalerkinOperator::dp not yet implemented!\n"; abort();
1296 assert(
static_cast<void const*
>(&x) !=
static_cast<void const*
>(&b));
1322 typedef typename boost::fusion::result_of::as_vector<typename boost::fusion::result_of::transform<FilteredNormalStepBlocks,IstlInterfaceDetail::Translate<firstRow,firstCol>>::type>::type
NormalBlocks;
1323 typedef typename boost::fusion::result_of::as_vector<typename boost::fusion::result_of::transform<FilteredTangentialStepBlocks,IstlInterfaceDetail::Translate<0,0>>::type>::type
TangentialBlocks;
1344 for (
int i=0; i<lastRow; ++i)
1349 template <
class Block>
1351 if( ( (Block::rowId==stateId && Block::colId==stateId) || (Block::rowId==stateId && Block::colId==controlId) || (Block::colId==stateId && Block::rowId==controlId) ) )
return;
1355 typename result_of::at_c<typename Domain::Functions const,Block::colId>::type xi = at_c<Block::colId>(x.data);
1356 typename result_of::at_c<typename Range::Functions,Block::rowId>::type yi = at_c<Block::rowId>(y.data);
1357 if (!b.threadedMatrix.get())
1360 if (doInit[Block::rowId])
1362 *dp += b.threadedMatrix->mv(xi,yi);
1363 doInit[Block::rowId] =
false;
1366 *dp += b.threadedMatrix->usmv(a,xi,yi);
1377 mutable bool doInit[lastRow];
1390 for (
int i=0; i<lastRow; ++i)
1395 template <
class Block>
1397 if( !( (Block::rowId==stateId && Block::colId==stateId) || (Block::rowId==stateId && Block::colId==controlId) || (Block::colId==stateId && Block::rowId==controlId) ) )
return;
1400 typename result_of::at_c<typename Domain::Functions const,Block::colId>::type xi = at_c<Block::colId>(x.data);
1401 typename result_of::at_c<typename Range::Functions,Block::rowId>::type yi = at_c<Block::rowId>(y.data);
1402 if (!b.threadedMatrix.get())
1405 if (doInit[Block::rowId])
1407 *dp += b.threadedMatrix->mv(xi,yi);
1408 doInit[Block::rowId] =
false;
1411 *dp += b.threadedMatrix->usmv(a,xi,yi);
1422 mutable bool doInit[lastRow];
1429 template <
class Operator>
1430 class TransposedOperator :
public Dune::LinearOperator<typename Operator::Range,typename Operator::Domain>
1435 typedef typename Operator::Domain
Range;
1449 A.applyscaleadd(alpha,x,b);
An adaptor presenting a Dune::LinearOperator <domain_type,range_type> interface to a contiguous sub-b...
std::unique_ptr< Matrix > getPointer() const
Access matrix via unique_ptr. Use if Matrix does not support move-semantics.
MatrixAsTriplet< Scalar > getmat() const __attribute__((deprecated))
DEPRECATED. Use get<MatrixAsTriplet<Scalar>>() instead.
IstlInterfaceDetail::Base< Assembler_, firstRow, lastRow, firstCol, lastCol, symmetric >::type Base
boost::fusion::result_of::as_vector< typenameboost::fusion::result_of::filter_if< allblocks, BlockFilter >::type >::type filtered
Assembler const & assembler
boost::fusion::result_of::as_vector< typenameboost::fusion::result_of::transform< filtered, IstlInterfaceDetail::Translate< firstRow, firstCol > >::type >::type blocks
virtual void applyscaleaddTransposed(Scalar alpha, Range const &x, Domain &b) const
Compute .
AssembledGalerkinOperator(Assembler const &assembler_, bool onlyLowerTriangle_=false, int nThreads_=0)
Constructor.
auto const & ansatzSpace() const
Returns a reference to the FE space of the i-th variable in this GOP.
virtual void apply(Domain const &x, Range &b) const
compute
virtual Scalar dp(Domain const &x, Range const &y) const
void applyTransposed(Range const &x, Domain &b) const
compute
typename Assembler::AnsatzVariableSetDescription::template CoefficientVector< firstCol, lastCol > Domain
boost::fusion::result_of::as_vector< typenameIstlInterfaceDetail::AllBlocks< Assembler >::result >::type allblocks
IstlInterfaceDetail::BlockInfo< firstRow, lastRow, firstCol, lastCol > BlockInfo
AssembledGalerkinOperator< Assembler, firstRow, lastRow, firstCol, lastCol > makeAssembledGalerkinOperator(Assembler const &assembler)
Convenience routine for creating assembled operators.
void vectorToRange(Vector const &coefficients, Range &x) const
Get from coefficient vector Apply to : .
Matrix get(int rowFirst=0, int rowLast=lastRow-firstRow, int colFirst=0, int colLast=lastCol-firstCol) const
Access matrix (or a submatrix).
virtual void applyscaleadd(Scalar alpha, Domain const &x, Range &b) const
Compute .
void update()
update operator if grid has changed or assemble(...) has been called.
virtual ~AssembledGalerkinOperator()
virtual Dune::SolverCategory::Category category() const override
returns the category of the operator
typename Assembler::TestVariableSetDescription::template CoefficientVector< firstRow, lastRow > Range
virtual MatrixAsTriplet< Scalar > getTriplet() const __attribute__((deprecated))
DEPRECATED. Use get<MatrixAsTriplet<Scalar>>() instead.
virtual Scalar applyDp(Domain const &x, Range &b) const
Computes and, in case is symmetric, also .
void rangeToVector(Range const &y, Vector &coefficients) const
Get coefficient vector from .
void vectorToDomain(Vector const &coefficients, Domain &x) const
Get from coefficients vector .
bool getOnlyLowerTriangle() const
Assembler const & getAssembler() const
Provides access to the underlying assembler.
void domainToVector(Domain const &x, Vector &coefficients) const
Get coefficients vector from .
boost::fusion::result_of::filter_if< AllTangentialStepBlocksSeq, TangentialStepBlockFilter >::type FilteredTangentialStepBlocksSeq
void domainToVector(Domain const &x, Vector &coefficients) const
Get coefficients vector from .
virtual void applyscaleadd(Scalar alpha, Domain const &x, Range &b) const
Compute Note that x and b must not refer to the same memory locations (in case Domain==Range).
IstlInterfaceDetail::AllBlocks< NormalStepAssembler >::result AllNormalStepBlocksSeq
Provides access to the underlying assembler.
boost::fusion::result_of::as_vector< typenameboost::fusion::result_of::transform< FilteredNormalStepBlocks, IstlInterfaceDetail::Translate< firstRow, firstCol > >::type >::type NormalBlocks
virtual Scalar applyDp(Domain const &x, Range &b) const
Computes and, in case is symmetric, also .
virtual void apply(Domain const &x, Range &b) const
compute
void rangeToVector(Range const &y, Vector &coefficients) const
returns a reference to the matrix
MatrixAsTriplet< Scalar > Triplet
NormalBlocks normalStepBlocks
boost::fusion::result_of::as_vector< AllTangentialStepBlocksSeq >::type AllTangentialStepBlocks
NormalStepAssembler::Scalar Scalar
virtual Scalar dp(Domain const &x, Range const &y) const
static int const category
NormalStepAssembler const & normalStepAssembler
LagrangeOperator(NormalStepAssembler const &normalStepAssembler_, TangentialStepAssembler const &tangentialStepAssembler_, bool onlyLowerTriangle_=false, int nThreads_=0)
IstlInterfaceDetail::AllBlocks< TangentialStepAssembler >::result AllTangentialStepBlocksSeq
virtual MatrixAsTriplet< Scalar > getTriplet() const
IstlInterfaceDetail::BlockInfo< firstRow, lastRow, firstCol, lastCol > BlockInfo
virtual ~LagrangeOperator()
void vectorToRange(Vector const &coefficients, Range &x) const
Get from coefficient vector Apply to : .
TangentialBlocks tangentialStepBlocks
void vectorToDomain(Vector const &coefficients, Domain &x) const
Get from coefficients vector .
boost::fusion::result_of::as_vector< typenameboost::fusion::result_of::transform< FilteredTangentialStepBlocks, IstlInterfaceDetail::Translate< 0, 0 > >::type >::type TangentialBlocks
TangentialStepAssembler const & tangentialStepAssembler
boost::fusion::result_of::as_vector< FilteredNormalStepBlocksSeq >::type FilteredNormalStepBlocks
void update()
update operator if grid has changed or assemble(...) has been called.
boost::fusion::result_of::filter_if< AllNormalStepBlocksSeq, NormalStepBlockFilter >::type FilteredNormalStepBlocksSeq
boost::fusion::result_of::as_vector< FilteredTangentialStepBlocksSeq >::type FilteredTangentialStepBlocks
boost::fusion::result_of::as_vector< AllNormalStepBlocksSeq >::type AllNormalStepBlocks
SparseIndexInt nrows() const
Returns number of rows (computes them, if not known)
void shiftIndices(SparseIndexInt row, SparseIndexInt col)
Shifts matrix indices. Can be used together with += to concatenate sparese matrices.
void applyscaleadd(Scalar alpha, Domain const &x, Range &b) const
compute
MatrixRepresentedOperator(Matrix &&A_)
void vectorToRange(Vector const &coefficients, Range &x) const
Get from coefficient vector .
void vectorToDomain(Vector const &coefficients, Domain &x) const
Get from coefficients vector .
MatrixRepresentedOperator(Matrix const &A_)
Dune::BCRSMatrix< MatrixBlock, Allocator > Matrix
void domainToVector(Domain const &x, Vector &coefficients) const
Get coefficients vector from .
void applyTransposed(Range const &x, Domain &b) const
MatrixAsTriplet< Scalar > getTriplet() const
void applyscaleaddTransposed(Scalar alpha, Range const &x, Domain &b) const
MatrixRepresentedOperator()=default
MatrixRepresentedOperator & operator=(Matrix const &B)
virtual Dune::SolverCategory::Category category() const override
returns the category of the operator
void apply(Domain const &x, Range &b) const
compute
GetScalar< Domain >::type Scalar
void rangeToVector(Range const &y, Vector &coefficients) const
Get coefficient vector from .
MatrixRepresentedOperator & operator=(MatrixRepresentedOperator const &other)=default
virtual Dune::SolverCategory::Category category() const override
returns the category of the operator
void applyscaleaddTransposed(Scalar alpha, Range const &x, Domain &b) const
void vectorToRange(Vector const &coefficients, Range &x) const
Get from coefficient vector .
MatrixAsTriplet< Scalar_, SparseInt > Matrix
MatrixRepresentedOperator & operator=(MatrixRepresentedOperator const &other)=default
MatrixRepresentedOperator(Matrix &&A_)
void domainToVector(Domain const &x, Vector &coefficients) const
Get coefficients vector from .
void rangeToVector(Range const &y, Vector &coefficients) const
Get coefficient vector from .
void applyTransposed(Range const &x, Domain &b) const
void applyscaleadd(Scalar alpha, Domain const &x, Range &b) const
compute
MatrixRepresentedOperator & operator=(Matrix const &B)
void apply(Domain const &x, Range &b) const
compute
MatrixRepresentedOperator()=default
MatrixRepresentedOperator(Matrix const &A_)
void vectorToDomain(Vector const &coefficients, Domain &x) const
Get from coefficients vector .
MatrixAsTriplet< Scalar, SparseInt > getTriplet() const
Operator with matrix-representation and coordinate mappings.
MatrixAsTriplet< Scalar > getTriplet() const
TransposedOperator(Operator const &A_)
virtual ~TransposedOperator()
virtual void apply(Domain const &x, Range &b) const
Operator::Assembler Assembler
virtual void applyscaleadd(Scalar alpha, Domain const &x, Range &b) const
Documentation of the concept of a quadratic variational functionalThe variational functional concept ...
This file contains various utility functions that augment the basic functionality of Dune.
FEFunctionSpace and FunctionSpaceElement and the like.
Dune::FieldVector< Scalar, dim > Vector
OutIter vectorToSequence(double x, OutIter iter)
InIter vectorFromSequence(FunctionSpaceElement< Space, m > &v, InIter in)
A block filter specifying which subblocks of a stiffness matrix or right hand side shall be assembled...
void operator()(Block const &b) const
ApplyScaleAdd(Assembler const &as, Scalar a_, Domain const &x_, Range &y_, bool init, Scalar *dp_=0)
Assembler const & assembler
Assembler const & assembler
void operator()(Block const &b) const
TransposedApplyScaleAdd(Assembler const &as, Scalar a_, Range const &x_, Domain &y_, bool init, Scalar *dp_=0)
!std ::is_same< decltype(hasFieldType< Type >(0)), TypeNotFound >::value ::type type
NormalStepApplyScaleAdd(NormalStepAssembler const &as, Scalar a_, Domain const &x_, Range &y_, bool init, Scalar *dp_=0)
NormalStepAssembler const & assembler
void operator()(Block const &b) const
TangentialStepApplyScaleAdd(TangentialStepAssembler const &as, Scalar a_, Domain const &x_, Range &y_, bool init, Scalar *dp_=0)
void operator()(Block const &b) const
TangentialStepAssembler const & assembler
Returns the matrix type or its transposed type, depending on the given transpose flag.