10#ifndef MUELU_FLATOPERATOR_DECL_HPP
11#define MUELU_FLATOPERATOR_DECL_HPP
13#include "MueLu_Constraint.hpp"
14#include "Teuchos_RCP.hpp"
15#include "Xpetra_Map.hpp"
16#include "Xpetra_MapFactory.hpp"
17#include "Xpetra_MatrixMatrix.hpp"
18#include "Xpetra_MultiVector.hpp"
19#include "Xpetra_Operator.hpp"
40 class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
42 :
public Xpetra::Operator<Scalar, LocalOrdinal, GlobalOrdinal, Node>,
48 virtual const Teuchos::RCP<const Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node>>
getDomainMap()
const {
53 virtual const Teuchos::RCP<const Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node>>
getRangeMap()
const {
64 apply(
const Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &X,
65 Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &Y,
66 Teuchos::ETransp mode = Teuchos::NO_TRANS,
67 Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
68 Scalar beta = Teuchos::ScalarTraits<Scalar>::zero())
const;
82 return mat_->description();
86 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const {
87 mat_->describe(out, verbLevel);
98 FlatOperator(
const Teuchos::RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> mat,
107 tempMat_ = Xpetra::MatrixFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Build(pattern);
113 void residual(
const Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &X,
114 const Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &B,
115 Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &R)
const {
116 const auto one = Teuchos::ScalarTraits<Scalar>::one();
117 const auto zero = Teuchos::ScalarTraits<Scalar>::zero();
119 apply(X, R, Teuchos::NO_TRANS, one, zero);
120 R.update(one, B, -one);
126 RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
mat_;
127 RCP<MueLu::Constraint<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
constraint_;
128 RCP<Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node>>
map_;
129 mutable RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
tempMat_;
135#define MUELU_FLATOPERATOR_SHORT
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Constraint space information for the potential prolongator.
Interprets a matrix as an operator that acts on a vector of nonzeros via SpGEMM.
virtual void apply(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Computes the operator-multivector application.
RCP< Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > map_
std::string description() const
A simple one-line description of this object.
virtual const Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
The Map associated with the domain of this operator, which must be compatible with X....
RCP< MueLu::Constraint< Scalar, LocalOrdinal, GlobalOrdinal, Node > > constraint_
virtual bool hasTransposeApply() const
Whether this operator supports applying the transpose or conjugate transpose.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with the given verbosity level to a FancyOStream.
virtual const Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
The Map associated with the range of this operator, which must be compatible with Y....
RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > mat_
void AllocateTemporaryMatrix() const
void residual(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R) const
Compute a residual R = B - (*this) * X.
RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > tempMat_
Verbose class for MueLu classes.
Namespace for MueLu classes and methods.