10 #ifndef BELOS_MUELU_ADAPTER_HPP
11 #define BELOS_MUELU_ADAPTER_HPP
15 #ifdef HAVE_XPETRA_EPETRA
16 #include <Epetra_config.h>
17 #include <BelosOperator.hpp>
24 #ifdef HAVE_MUELU_AMGX
28 #include <BelosOperatorT.hpp>
31 #include "MueLu_Hierarchy.hpp"
35 using Teuchos::rcpFromRef;
47 : BelosError(what_arg) {}
64 class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
65 class MueLuOp :
public OperatorT<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
66 #ifdef HAVE_XPETRA_TPETRA
68 public OperatorT<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
78 #ifdef HAVE_MUELU_AMGX
96 "Belos::MueLuOp::Apply, transpose mode != NOTRANS not supported by MueLu preconditionners.");
101 #ifdef HAVE_MUELU_AMGX
106 AMGX_->apply(tX, tY);
114 #ifdef HAVE_XPETRA_TPETRA
123 "Belos::MueLuOp::Apply, transpose mode != NOTRANS not supported by MueLu preconditionners.");
128 #ifdef HAVE_MUELU_AMGX
145 #ifdef HAVE_MUELU_AMGX
150 #ifdef HAVE_XPETRA_EPETRA
151 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
164 class MueLuOp<double, int, int, Xpetra::
EpetraNode> :
public OperatorT<Xpetra::MultiVector<double, int, int, Xpetra::EpetraNode> >
165 #ifdef HAVE_XPETRA_TPETRA
167 #if ((defined(EPETRA_HAVE_OMP) && (defined(HAVE_TPETRA_INST_OPENMP) && defined(HAVE_TPETRA_INST_INT_INT))) || \
168 (!defined(EPETRA_HAVE_OMP) && (defined(HAVE_TPETRA_INST_SERIAL) && defined(HAVE_TPETRA_INST_INT_INT))))
170 public OperatorT<Tpetra::MultiVector<double, int, int, Xpetra::EpetraNode> >
173 #ifdef HAVE_XPETRA_EPETRA
175 public OperatorT<Epetra_MultiVector>,
176 public Belos::Operator<double>
187 #ifdef HAVE_MUELU_AMGX
195 "Belos::MueLuOp::Apply, transpose mode != NOTRANS not supported by MueLu preconditionners.");
200 #ifdef HAVE_MUELU_AMGX
205 AMGX_->apply(tX, tY);
212 #ifdef HAVE_XPETRA_TPETRA
213 #if ((defined(EPETRA_HAVE_OMP) && (defined(HAVE_TPETRA_INST_OPENMP) && defined(HAVE_TPETRA_INST_INT_INT))) || \
214 (!defined(EPETRA_HAVE_OMP) && (defined(HAVE_TPETRA_INST_SERIAL) && defined(HAVE_TPETRA_INST_INT_INT))))
217 "Belos::MueLuOp::Apply, transpose mode != NOTRANS not supported by MueLu preconditionners.");
222 #ifdef HAVE_MUELU_AMGX
241 #ifdef HAVE_XPETRA_EPETRA
250 "Belos::MueLuOp::Apply, transpose mode != NOTRANS not supported by MueLu preconditionners.");
268 void Apply(
const Belos::MultiVec<double>& x, Belos::MultiVec<double>& y, ETrans trans = NOTRANS)
const {
273 "Belos::MueLuOp::Apply, x and/or y cannot be dynamic cast to an Epetra_MultiVector.");
275 Apply(*vec_x, *vec_y, trans);
280 RCP<MueLu::Hierarchy<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Hierarchy_;
281 #ifdef HAVE_MUELU_AMGX
282 RCP<MueLu::AMGXOperator<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
AMGX_;
285 #endif // !EPETRA_NO_32BIT_GLOBAL_INDICES
286 #endif // HAVE_XPETRA_EPETRA
288 #ifdef HAVE_XPETRA_EPETRA
289 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
302 class MueLuOp<double, int, long long, Xpetra::
EpetraNode> :
public OperatorT<Xpetra::MultiVector<double, int, long long, Xpetra::EpetraNode> >
303 #ifdef HAVE_XPETRA_TPETRA
305 #if ((defined(EPETRA_HAVE_OMP) && (defined(HAVE_TPETRA_INST_OPENMP) && defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
306 (!defined(EPETRA_HAVE_OMP) && (defined(HAVE_TPETRA_INST_SERIAL) && defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
308 public OperatorT<Tpetra::MultiVector<double, int, long long, Xpetra::EpetraNode> >
311 #ifdef HAVE_XPETRA_EPETRA
313 public OperatorT<Epetra_MultiVector>,
314 public Belos::Operator<double>
325 #ifdef HAVE_MUELU_AMGX
333 "Belos::MueLuOp::Apply, transpose mode != NOTRANS not supported by MueLu preconditionners.");
338 #ifdef HAVE_MUELU_AMGX
343 AMGX_->apply(tX, tY);
350 #ifdef HAVE_XPETRA_TPETRA
351 #if ((defined(EPETRA_HAVE_OMP) && (defined(HAVE_TPETRA_INST_OPENMP) && defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
352 (!defined(EPETRA_HAVE_OMP) && (defined(HAVE_TPETRA_INST_SERIAL) && defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
355 "Belos::MueLuOp::Apply, transpose mode != NOTRANS not supported by MueLu preconditionners.");
360 #ifdef HAVE_MUELU_AMGX
379 #ifdef HAVE_XPETRA_EPETRA
388 "Belos::MueLuOp::Apply, transpose mode != NOTRANS not supported by MueLu preconditionners.");
406 void Apply(
const Belos::MultiVec<double>& x, Belos::MultiVec<double>& y, ETrans trans = NOTRANS)
const {
411 "Belos::MueLuOp::Apply, x and/or y cannot be dynamic cast to an Epetra_MultiVector.");
413 Apply(*vec_x, *vec_y, trans);
418 RCP<MueLu::Hierarchy<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Hierarchy_;
419 #ifdef HAVE_MUELU_AMGX
420 RCP<MueLu::AMGXOperator<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
AMGX_;
423 #endif // !EPETRA_NO_64BIT_GLOBAL_INDICES
424 #endif // HAVE_XPETRA_EPETRA
427 #endif // BELOS_MUELU_ADAPTER_HPP
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLuOpFailure is thrown when a return value from an MueLu call on an Xpetra::Operator or MueLu::Hier...
void putScalar(const Scalar &value)
MueLuOp derives from Belos::OperatorT and administrates a MueLu::Hierarchy. It implements the apply c...
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual void putScalar(const Scalar &value)=0
void Apply(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x, Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &y, ETrans trans=NOTRANS) const
This routine takes the Xpetra::MultiVector x and applies the operator to it resulting in the Xpetra::...
RCP< MueLu::AMGXOperator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > AMGX_
MueLuOpFailure(const std::string &what_arg)
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
RCP< MueLu::Hierarchy< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Hierarchy_
MueLuOp(const RCP< MueLu::Hierarchy< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &H)
Default constructor.
virtual ~MueLuOp()
Destructor.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
MueLuOp(const RCP< MueLu::AMGXOperator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &A)
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
Adapter for AmgX library from Nvidia.