47 #ifndef MUELU_AMGXOPERATOR_DEF_HPP
48 #define MUELU_AMGXOPERATOR_DEF_HPP
51 #if defined (HAVE_MUELU_AMGX)
69 Tpetra::MultiVector<double,int,int,Node>& Y,
78 for (
int i = 0; i < (int)Y.getNumVectors(); i++) {
80 vectorTimer1_->start();
82 mueluXdata = X.getData(i);
83 mueluYdata = Y.getDataNonConst(i);
85 if (comm->getSize() == 1) {
86 amgxXdata = mueluXdata;
87 amgxYdata = mueluYdata;
90 int n = mueluXdata.
size();
95 ArrayRCP<double> amgxXdata_nonConst = Teuchos::arcp_const_cast<
double>(amgxXdata);
96 for (
int j = 0; j < n; j++) {
97 amgxXdata_nonConst[muelu2amgx_[j]] = mueluXdata[j];
98 amgxYdata [muelu2amgx_[j]] = mueluYdata[j];
102 AMGX_vector_upload(X_, N_, 1, &amgxXdata[0]);
103 AMGX_vector_upload(Y_, N_, 1, &amgxYdata[0]);
105 vectorTimer1_->stop();
106 vectorTimer1_->incrementNumCalls();
110 solverTimer_->start();
111 AMGX_solver_solve(Solver_, X_, Y_);
112 solverTimer_->stop();
113 solverTimer_->incrementNumCalls();
116 vectorTimer2_->start();
118 AMGX_vector_download(Y_, &amgxYdata[0]);
120 if (comm->getSize() > 1) {
121 int n = mueluYdata.
size();
123 for (
int j = 0; j < n; j++)
124 mueluYdata[j] = amgxYdata[muelu2amgx_[j]];
127 vectorTimer2_->stop();
128 vectorTimer2_->incrementNumCalls();
132 }
catch (std::exception& e) {
133 std::string errMsg = std::string(
"Caught an exception in MueLu::AMGXOperator::Apply():\n") + e.what() +
"\n";
144 #endif //if defined(HAVE_MUELU_AMGX)
146 #endif //ifdef MUELU_AMGXOPERATOR_DEF_HPP
Teuchos::RCP< const Map > getRangeMap() const
Returns the Tpetra::Map object associated with the range of this operator.
void resize(const size_type n, const T &val=T())
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 > 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.
bool hasTransposeApply() const
Indicates whether this operator supports applying the adjoint operator.