10#ifndef MUELU_AMGXOPERATOR_DEF_HPP
11#define MUELU_AMGXOPERATOR_DEF_HPP
13#if defined(HAVE_MUELU_AMGX)
19Teuchos::RCP<const Tpetra::Map<int, int, Node> >
31 Tpetra::MultiVector<double, int, int, Node>& Y,
32 Teuchos::ETransp mode,
double alpha,
double beta)
const {
33 RCP<const Teuchos::Comm<int> > comm = Y.getMap()->getComm();
35 ArrayRCP<const double> mueluXdata, amgxXdata;
36 ArrayRCP<double> mueluYdata, amgxYdata;
39 for (
int i = 0; i < (int)Y.getNumVectors(); i++) {
43 mueluXdata = X.getData(i);
44 mueluYdata = Y.getDataNonConst(i);
46 if (comm->getSize() == 1) {
47 amgxXdata = mueluXdata;
48 amgxYdata = mueluYdata;
51 int n = mueluXdata.size();
56 ArrayRCP<double> amgxXdata_nonConst = Teuchos::arcp_const_cast<double>(amgxXdata);
57 for (
int j = 0; j < n; j++) {
63 AMGX_vector_upload(
X_,
N_, 1, &amgxXdata[0]);
64 AMGX_vector_upload(
Y_,
N_, 1, &amgxYdata[0]);
79 AMGX_vector_download(
Y_, &amgxYdata[0]);
81 if (comm->getSize() > 1) {
82 int n = mueluYdata.size();
84 for (
int j = 0; j < n; j++)
93 }
catch (std::exception& e) {
94 std::string errMsg = std::string(
"Caught an exception in MueLu::AMGXOperator::Apply():\n") + e.what() +
"\n";
AMGX_solver_handle Solver_
RCP< Teuchos::Time > vectorTimer1_
RCP< const Map > domainMap_
std::vector< int > muelu2amgx_
RCP< const Map > rangeMap_
RCP< Teuchos::Time > solverTimer_
RCP< Teuchos::Time > vectorTimer2_
void apply(const MultiVector &X, MultiVector &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Returns a solution for the linear system AX=Y in the Tpetra::MultiVector X.
Teuchos::RCP< const Map > getRangeMap() const
Returns the Tpetra::Map object associated with the range of this operator.
bool hasTransposeApply() const
Indicates whether this operator supports applying the adjoint operator.
Teuchos::RCP< const Map > getDomainMap() const
Returns the Tpetra::Map object associated with the domain of this operator.
Exception throws to report errors in the internal logical of the program.
Namespace for MueLu classes and methods.