10 #ifndef IFPACK2_HYPRE_DEF_HPP
11 #define IFPACK2_HYPRE_DEF_HPP
13 #include "Ifpack2_Hypre_decl.hpp"
14 #if defined(HAVE_IFPACK2_HYPRE) && defined(HAVE_IFPACK2_MPI)
17 #include "Tpetra_Import.hpp"
21 #include "HYPRE_IJ_mv.h"
22 #include "HYPRE_parcsr_ls.h"
24 #include "_hypre_parcsr_mv.h"
25 #include "_hypre_IJ_mv.h"
26 #include "HYPRE_parcsr_mv.h"
32 using Teuchos::rcpFromRef;
37 template<
class LocalOrdinal,
class Node>
38 Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::
41 IsInitialized_(false),
42 IsComputed_(false), NumInitialize_(0),
53 IsSolverCreated_(false),
54 IsPrecondCreated_(false),
55 SolveOrPrec_(Hypre_Is_Solver),
59 UsePreconditioner_(false),
63 template<
class LocalOrdinal,
class Node>
64 Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::~Hypre() {
69 template<
class LocalOrdinal,
class Node>
70 void Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Destroy(){
72 IFPACK2_CHK_ERRV(HYPRE_IJMatrixDestroy(HypreA_));
73 IFPACK2_CHK_ERRV(HYPRE_IJVectorDestroy(XHypre_));
74 IFPACK2_CHK_ERRV(HYPRE_IJVectorDestroy(YHypre_));
77 IFPACK2_CHK_ERRV(SolverDestroyPtr_(Solver_));
79 if(IsPrecondCreated_){
80 IFPACK2_CHK_ERRV(PrecondDestroyPtr_(Preconditioner_));
85 IFPACK2_CHK_ERRV(HYPRE_IJMatrixDestroy(HypreG_));
88 IFPACK2_CHK_ERRV(HYPRE_IJVectorDestroy(xHypre_));
91 IFPACK2_CHK_ERRV(HYPRE_IJVectorDestroy(yHypre_));
94 IFPACK2_CHK_ERRV(HYPRE_IJVectorDestroy(zHypre_));
99 template<
class LocalOrdinal,
class Node>
100 void Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::initialize(){
101 const std::string timerName (
"Ifpack2::Hypre::initialize");
105 if(IsInitialized_)
return;
106 double startTime = timer->
wallTime();
110 MPI_Comm comm = * (Teuchos::rcp_dynamic_cast<
const Teuchos::MpiComm<int> >(A_->getRowMap()->getComm())->getRawMpiComm());
115 if (!A_->getRowMap()->isSameAs(*A_->getRangeMap())) {
116 IFPACK2_CHK_ERRV(-1);
119 if (A_->getRowMap()->isContiguous()) {
120 GloballyContiguousRowMap_ = A_->getRowMap();
121 GloballyContiguousColMap_ = A_->getColMap();
124 if(A_->getDomainMap()->isSameAs(*A_->getRowMap())) {
126 GloballyContiguousColMap_ = MakeContiguousColumnMap(Aconst);
127 GloballyContiguousRowMap_ =
rcp(
new map_type(A_->getRowMap()->getGlobalNumElements(),
128 A_->getRowMap()->getLocalNumElements(), 0, A_->getRowMap()->getComm()));
131 throw std::runtime_error(
"Ifpack_Hypre: Unsupported map configuration: Row/Domain maps do not match");
135 HYPRE_Int ilower = GloballyContiguousRowMap_->getMinGlobalIndex();
136 HYPRE_Int iupper = GloballyContiguousRowMap_->getMaxGlobalIndex();
138 IFPACK2_CHK_ERRV(HYPRE_IJVectorCreate(comm, ilower, iupper, &XHypre_));
139 IFPACK2_CHK_ERRV(HYPRE_IJVectorSetObjectType(XHypre_, HYPRE_PARCSR));
140 IFPACK2_CHK_ERRV(HYPRE_IJVectorInitialize(XHypre_));
141 IFPACK2_CHK_ERRV(HYPRE_IJVectorAssemble(XHypre_));
142 IFPACK2_CHK_ERRV(HYPRE_IJVectorGetObject(XHypre_, (
void**) &ParX_));
143 XVec_ =
Teuchos::rcp((hypre_ParVector *) hypre_IJVectorObject(((hypre_IJVector *) XHypre_)),
false);
146 IFPACK2_CHK_ERRV(HYPRE_IJVectorCreate(comm, ilower, iupper, &YHypre_));
147 IFPACK2_CHK_ERRV(HYPRE_IJVectorSetObjectType(YHypre_, HYPRE_PARCSR));
148 IFPACK2_CHK_ERRV(HYPRE_IJVectorInitialize(YHypre_));
149 IFPACK2_CHK_ERRV(HYPRE_IJVectorAssemble(YHypre_));
150 IFPACK2_CHK_ERRV(HYPRE_IJVectorGetObject(YHypre_, (
void**) &ParY_));
151 YVec_ =
Teuchos::rcp((hypre_ParVector *) hypre_IJVectorObject(((hypre_IJVector *) YHypre_)),
false);
154 VectorCache_.resize(A_->getRowMap()->getLocalNumElements());
160 InitializeTime_ += (timer->
wallTime() - startTime);
164 template<
class LocalOrdinal,
class Node>
165 void Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::setParameters(
const Teuchos::ParameterList& list){
167 std::map<std::string, Hypre_Solver> solverMap;
168 solverMap[
"BoomerAMG"] = BoomerAMG;
169 solverMap[
"ParaSails"] = ParaSails;
170 solverMap[
"Euclid"] = Euclid;
171 solverMap[
"AMS"] = AMS;
172 solverMap[
"Hybrid"] = Hybrid;
173 solverMap[
"PCG"] = PCG;
174 solverMap[
"GMRES"] =
GMRES;
175 solverMap[
"FlexGMRES"] = FlexGMRES;
176 solverMap[
"LGMRES"] = LGMRES;
177 solverMap[
"BiCGSTAB"] = BiCGSTAB;
179 std::map<std::string, Hypre_Chooser> chooserMap;
180 chooserMap[
"Solver"] = Hypre_Is_Solver;
181 chooserMap[
"Preconditioner"] = Hypre_Is_Preconditioner;
184 Hypre_Solver solType;
185 if (list.
isType<std::string>(
"hypre: Solver"))
186 solType = solverMap[list.
get<std::string>(
"hypre: Solver")];
188 solType = (Hypre_Solver) list.
get<
int>(
"hypre: Solver");
191 SolverType_ = solType;
192 Hypre_Solver precType;
193 if (list.
isType<std::string>(
"hypre: Preconditioner"))
194 precType = solverMap[list.
get<std::string>(
"hypre: Preconditioner")];
196 precType = (Hypre_Solver) list.
get<
int>(
"hypre: Preconditioner");
199 PrecondType_ = precType;
200 Hypre_Chooser chooser;
201 if (list.
isType<std::string>(
"hypre: SolveOrPrecondition"))
202 chooser = chooserMap[list.
get<std::string>(
"hypre: SolveOrPrecondition")];
203 else if(list.
isParameter(
"hypre: SolveOrPrecondition"))
204 chooser = (Hypre_Chooser) list.
get<
int>(
"hypre: SolveOrPrecondition");
206 chooser = Hypre_Is_Solver;
207 SolveOrPrec_ = chooser;
208 bool SetPrecond = list.
isParameter(
"hypre: SetPreconditioner") ? list.
get<
bool>(
"hypre: SetPreconditioner") :
false;
209 IFPACK2_CHK_ERR(SetParameter(SetPrecond));
210 int NumFunctions = list.
isParameter(
"hypre: NumFunctions") ? list.
get<
int>(
"hypre: NumFunctions") : 0;
213 if(NumFunctions > 0){
214 RCP<FunctionParameter>* params = list.
get<RCP<FunctionParameter>*>(
"hypre: Functions");
215 for(
int i = 0; i < NumFunctions; i++){
216 IFPACK2_CHK_ERR(AddFunToList(params[i]));
220 if (list.
isSublist(
"hypre: Solver functions")) {
222 for (
auto it = solverList.
begin(); it != solverList.
end(); ++it) {
223 std::string funct_name = it->first;
224 if (it->second.isType<HYPRE_Int>()) {
225 IFPACK2_CHK_ERR(AddFunToList(
rcp(
new FunctionParameter(Hypre_Is_Solver, funct_name , Teuchos::getValue<HYPRE_Int>(it->second)))));
226 }
else if (!std::is_same<HYPRE_Int,int>::value && it->second.isType<
int>()) {
227 IFPACK2_CHK_ERR(AddFunToList(
rcp(
new FunctionParameter(Hypre_Is_Solver, funct_name , Teuchos::as<HYPRE_Int>(Teuchos::getValue<int>(it->second))))));
228 }
else if (it->second.isType<HYPRE_Real>()) {
229 IFPACK2_CHK_ERR(AddFunToList(
rcp(
new FunctionParameter(Hypre_Is_Solver, funct_name , Teuchos::getValue<HYPRE_Real>(it->second)))));
236 if (list.
isSublist(
"hypre: Preconditioner functions")) {
238 for (
auto it = precList.
begin(); it != precList.
end(); ++it) {
239 std::string funct_name = it->first;
240 if (it->second.isType<HYPRE_Int>()) {
241 IFPACK2_CHK_ERR(AddFunToList(
rcp(
new FunctionParameter(Hypre_Is_Preconditioner, funct_name , Teuchos::getValue<HYPRE_Int>(it->second)))));
242 }
else if (!std::is_same<HYPRE_Int,int>::value && it->second.isType<
int>()) {
243 IFPACK2_CHK_ERR(AddFunToList(
rcp(
new FunctionParameter(Hypre_Is_Preconditioner, funct_name , Teuchos::as<HYPRE_Int>(Teuchos::getValue<int>(it->second))))));
244 }
else if (it->second.isType<HYPRE_Real>()) {
245 IFPACK2_CHK_ERR(AddFunToList(
rcp(
new FunctionParameter(Hypre_Is_Preconditioner, funct_name , Teuchos::getValue<HYPRE_Real>(it->second)))));
246 }
else if (it->second.isList()) {
248 if (FunctionParameter::isFuncIntInt(funct_name)) {
249 HYPRE_Int arg0 = pl.
get<HYPRE_Int>(
"arg 0");
250 HYPRE_Int arg1 = pl.
get<HYPRE_Int>(
"arg 1");
251 IFPACK2_CHK_ERR(AddFunToList(
rcp(
new FunctionParameter(Hypre_Is_Preconditioner, funct_name , arg0, arg1))));
252 }
else if (FunctionParameter::isFuncIntIntDoubleDouble(funct_name)) {
253 HYPRE_Int arg0 = pl.
get<HYPRE_Int>(
"arg 0");
254 HYPRE_Int arg1 = pl.
get<HYPRE_Int>(
"arg 1");
255 HYPRE_Real arg2 = pl.
get<HYPRE_Real>(
"arg 2");
256 HYPRE_Real arg3 = pl.
get<HYPRE_Real>(
"arg 3");
257 IFPACK2_CHK_ERR(AddFunToList(
rcp(
new FunctionParameter(Hypre_Is_Preconditioner, funct_name , arg0, arg1, arg2, arg3))));
258 }
else if (FunctionParameter::isFuncIntIntIntDoubleIntInt(funct_name)) {
259 HYPRE_Int arg0 = pl.
get<HYPRE_Int>(
"arg 0");
260 HYPRE_Int arg1 = pl.
get<HYPRE_Int>(
"arg 1");
261 HYPRE_Int arg2 = pl.
get<HYPRE_Int>(
"arg 2");
262 HYPRE_Real arg3 = pl.
get<HYPRE_Real>(
"arg 3");
263 HYPRE_Int arg4 = pl.
get<HYPRE_Int>(
"arg 4");
264 HYPRE_Int arg5 = pl.
get<HYPRE_Int>(
"arg 5");
265 IFPACK2_CHK_ERR(AddFunToList(
rcp(
new FunctionParameter(Hypre_Is_Preconditioner, funct_name , arg0, arg1, arg2, arg3, arg4, arg5))));
278 Dump_ = list.
isParameter(
"hypre: Dump") ? list.
get<
bool>(
"hypre: Dump") :
false;
282 template<
class LocalOrdinal,
class Node>
283 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::AddFunToList(RCP<FunctionParameter> NewFun){
284 NumFunsToCall_ = NumFunsToCall_+1;
285 FunsToCall_.resize(NumFunsToCall_);
286 FunsToCall_[NumFunsToCall_-1] = NewFun;
291 template<
class LocalOrdinal,
class Node>
292 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::SetParameter(Hypre_Chooser chooser, HYPRE_Int (*pt2Func)(HYPRE_Solver, HYPRE_Int), HYPRE_Int parameter){
293 RCP<FunctionParameter> temp =
rcp(
new FunctionParameter(chooser, pt2Func, parameter));
294 IFPACK2_CHK_ERR(AddFunToList(temp));
299 template<
class LocalOrdinal,
class Node>
300 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::SetParameter(Hypre_Chooser chooser, HYPRE_Int (*pt2Func)(HYPRE_Solver, HYPRE_Real), HYPRE_Real parameter){
301 RCP<FunctionParameter> temp =
rcp(
new FunctionParameter(chooser, pt2Func, parameter));
302 IFPACK2_CHK_ERR(AddFunToList(temp));
307 template<
class LocalOrdinal,
class Node>
308 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::SetParameter(Hypre_Chooser chooser, HYPRE_Int (*pt2Func)(HYPRE_Solver, HYPRE_Real, HYPRE_Int), HYPRE_Real parameter1, HYPRE_Int parameter2){
309 RCP<FunctionParameter> temp =
rcp(
new FunctionParameter(chooser, pt2Func, parameter1, parameter2));
310 IFPACK2_CHK_ERR(AddFunToList(temp));
315 template<
class LocalOrdinal,
class Node>
316 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::SetParameter(Hypre_Chooser chooser, HYPRE_Int (*pt2Func)(HYPRE_Solver, HYPRE_Int, HYPRE_Real), HYPRE_Int parameter1, HYPRE_Real parameter2){
317 RCP<FunctionParameter> temp =
rcp(
new FunctionParameter(chooser, pt2Func, parameter1, parameter2));
318 IFPACK2_CHK_ERR(AddFunToList(temp));
323 template<
class LocalOrdinal,
class Node>
324 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::SetParameter(Hypre_Chooser chooser, HYPRE_Int (*pt2Func)(HYPRE_Solver, HYPRE_Int, HYPRE_Int), HYPRE_Int parameter1, HYPRE_Int parameter2){
325 RCP<FunctionParameter> temp =
rcp(
new FunctionParameter(chooser, pt2Func, parameter1, parameter2));
326 IFPACK2_CHK_ERR(AddFunToList(temp));
331 template<
class LocalOrdinal,
class Node>
332 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::SetParameter(Hypre_Chooser chooser, HYPRE_Int (*pt2Func)(HYPRE_Solver, HYPRE_Real*), HYPRE_Real* parameter){
333 RCP<FunctionParameter> temp =
rcp(
new FunctionParameter(chooser, pt2Func, parameter));
334 IFPACK2_CHK_ERR(AddFunToList(temp));
339 template<
class LocalOrdinal,
class Node>
340 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::SetParameter(Hypre_Chooser chooser, HYPRE_Int (*pt2Func)(HYPRE_Solver, HYPRE_Int*), HYPRE_Int* parameter){
341 RCP<FunctionParameter> temp =
rcp(
new FunctionParameter(chooser, pt2Func, parameter));
342 IFPACK2_CHK_ERR(AddFunToList(temp));
347 template<
class LocalOrdinal,
class Node>
348 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::SetParameter(Hypre_Chooser chooser, HYPRE_Int (*pt2Func)(HYPRE_Solver, HYPRE_Int**), HYPRE_Int** parameter){
349 RCP<FunctionParameter> temp =
rcp(
new FunctionParameter(chooser, pt2Func, parameter));
350 IFPACK2_CHK_ERR(AddFunToList(temp));
355 template<
class LocalOrdinal,
class Node>
356 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::SetParameter(Hypre_Chooser chooser, Hypre_Solver solver){
357 if(chooser == Hypre_Is_Solver){
358 SolverType_ = solver;
360 PrecondType_ = solver;
366 template<
class LocalOrdinal,
class Node>
368 using LO = local_ordinal_type;
369 using GO = global_ordinal_type;
373 if(!A_->getRowMap()->isSameAs(*G->getRowMap()))
374 throw std::runtime_error(
"Hypre<Tpetra::RowMatrix<double, HYPRE_Int, long long, Node>: Edge map mismatch: A and discrete gradient");
377 GloballyContiguousNodeRowMap_ =
rcp(
new map_type(G->getDomainMap()->getGlobalNumElements(),
378 G->getDomainMap()->getLocalNumElements(), 0, A_->getRowMap()->getComm()));
379 GloballyContiguousNodeColMap_ = MakeContiguousColumnMap(G);
382 MPI_Comm comm = * (Teuchos::rcp_dynamic_cast<
const Teuchos::MpiComm<int> >(A_->getRowMap()->getComm())->getRawMpiComm());
383 GO ilower = GloballyContiguousRowMap_->getMinGlobalIndex();
384 GO iupper = GloballyContiguousRowMap_->getMaxGlobalIndex();
385 GO jlower = GloballyContiguousNodeRowMap_->getMinGlobalIndex();
386 GO jupper = GloballyContiguousNodeRowMap_->getMaxGlobalIndex();
387 IFPACK2_CHK_ERR(HYPRE_IJMatrixCreate(comm, ilower, iupper, jlower, jupper, &HypreG_));
388 IFPACK2_CHK_ERR(HYPRE_IJMatrixSetObjectType(HypreG_, HYPRE_PARCSR));
389 IFPACK2_CHK_ERR(HYPRE_IJMatrixInitialize(HypreG_));
391 std::vector<GO> new_indices(G->getLocalMaxNumRowEntries());
392 for(LO i = 0; i < (LO)G->getLocalNumRows(); i++){
393 typename crs_matrix_type::values_host_view_type values;
394 typename crs_matrix_type::local_inds_host_view_type indices;
395 G->getLocalRowView(i, indices, values);
396 for(LO j = 0; j < (LO) indices.extent(0); j++){
397 new_indices[j] = GloballyContiguousNodeColMap_->getGlobalElement(indices(j));
400 GO numEntries = (GO) indices.extent(0);
401 GlobalRow[0] = GloballyContiguousRowMap_->getGlobalElement(i);
402 IFPACK2_CHK_ERR(HYPRE_IJMatrixSetValues(HypreG_, 1, &numEntries, GlobalRow, new_indices.data(), values.data()));
404 IFPACK2_CHK_ERR(HYPRE_IJMatrixAssemble(HypreG_));
405 IFPACK2_CHK_ERR(HYPRE_IJMatrixGetObject(HypreG_, (
void**)&ParMatrixG_));
408 HYPRE_ParCSRMatrixPrint(ParMatrixG_,
"G.mat");
410 if(SolverType_ == AMS)
411 HYPRE_AMSSetDiscreteGradient(Solver_, ParMatrixG_);
412 if(PrecondType_ == AMS)
413 HYPRE_AMSSetDiscreteGradient(Preconditioner_, ParMatrixG_);
418 template<
class LocalOrdinal,
class Node>
421 if(!G_.is_null() && !G_->getDomainMap()->isSameAs(*coords->getMap()))
422 throw std::runtime_error(
"Hypre<Tpetra::RowMatrix<double, HYPRE_Int, long long, Node>: Node map mismatch: G->DomainMap() and coords");
424 if(SolverType_ != AMS && PrecondType_ != AMS)
427 scalar_type *xPtr = coords->getDataNonConst(0).
getRawPtr();
428 scalar_type *yPtr = coords->getDataNonConst(1).
getRawPtr();
429 scalar_type *zPtr = coords->getDataNonConst(2).
getRawPtr();
431 MPI_Comm comm = * (Teuchos::rcp_dynamic_cast<
const Teuchos::MpiComm<int> >(A_->getRowMap()->getComm())->getRawMpiComm());
432 local_ordinal_type NumEntries = coords->getLocalLength();
433 global_ordinal_type * indices =
const_cast<global_ordinal_type*
>(GloballyContiguousNodeRowMap_->getLocalElementList().getRawPtr());
435 global_ordinal_type ilower = GloballyContiguousNodeRowMap_->getMinGlobalIndex();
436 global_ordinal_type iupper = GloballyContiguousNodeRowMap_->getMaxGlobalIndex();
438 if( NumEntries != iupper-ilower+1) {
439 std::cout<<
"Ifpack2::Hypre::SetCoordinates(): Error on rank "<<A_->getRowMap()->getComm()->getRank()<<
": MyLength = "<<coords->getLocalLength()<<
" GID range = ["<<ilower<<
","<<iupper<<
"]"<<std::endl;
440 throw std::runtime_error(
"Hypre<Tpetra::RowMatrix<double, HYPRE_Int, long long, Node>: SetCoordinates: Length mismatch");
443 IFPACK2_CHK_ERR(HYPRE_IJVectorCreate(comm, ilower, iupper, &xHypre_));
444 IFPACK2_CHK_ERR(HYPRE_IJVectorSetObjectType(xHypre_, HYPRE_PARCSR));
445 IFPACK2_CHK_ERR(HYPRE_IJVectorInitialize(xHypre_));
446 IFPACK2_CHK_ERR(HYPRE_IJVectorSetValues(xHypre_,NumEntries,indices,xPtr));
447 IFPACK2_CHK_ERR(HYPRE_IJVectorAssemble(xHypre_));
448 IFPACK2_CHK_ERR(HYPRE_IJVectorGetObject(xHypre_, (
void**) &xPar_));
450 IFPACK2_CHK_ERR(HYPRE_IJVectorCreate(comm, ilower, iupper, &yHypre_));
451 IFPACK2_CHK_ERR(HYPRE_IJVectorSetObjectType(yHypre_, HYPRE_PARCSR));
452 IFPACK2_CHK_ERR(HYPRE_IJVectorInitialize(yHypre_));
453 IFPACK2_CHK_ERR(HYPRE_IJVectorSetValues(yHypre_,NumEntries,indices,yPtr));
454 IFPACK2_CHK_ERR(HYPRE_IJVectorAssemble(yHypre_));
455 IFPACK2_CHK_ERR(HYPRE_IJVectorGetObject(yHypre_, (
void**) &yPar_));
457 IFPACK2_CHK_ERR(HYPRE_IJVectorCreate(comm, ilower, iupper, &zHypre_));
458 IFPACK2_CHK_ERR(HYPRE_IJVectorSetObjectType(zHypre_, HYPRE_PARCSR));
459 IFPACK2_CHK_ERR(HYPRE_IJVectorInitialize(zHypre_));
460 IFPACK2_CHK_ERR(HYPRE_IJVectorSetValues(zHypre_,NumEntries,indices,zPtr));
461 IFPACK2_CHK_ERR(HYPRE_IJVectorAssemble(zHypre_));
462 IFPACK2_CHK_ERR(HYPRE_IJVectorGetObject(zHypre_, (
void**) &zPar_));
465 HYPRE_ParVectorPrint(xPar_,
"coordX.dat");
466 HYPRE_ParVectorPrint(yPar_,
"coordY.dat");
467 HYPRE_ParVectorPrint(zPar_,
"coordZ.dat");
470 if(SolverType_ == AMS)
471 HYPRE_AMSSetCoordinateVectors(Solver_, xPar_, yPar_, zPar_);
472 if(PrecondType_ == AMS)
473 HYPRE_AMSSetCoordinateVectors(Preconditioner_, xPar_, yPar_, zPar_);
480 template<
class LocalOrdinal,
class Node>
481 void Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::compute(){
482 const std::string timerName (
"Ifpack2::Hypre::compute");
485 double startTime = timer->
wallTime();
490 if(isInitialized() ==
false){
499 MPI_Comm comm = * (Teuchos::rcp_dynamic_cast<
const Teuchos::MpiComm<int> >(A_->getRowMap()->getComm())->getRawMpiComm());
500 global_ordinal_type ilower = GloballyContiguousRowMap_->getMinGlobalIndex();
501 global_ordinal_type iupper = GloballyContiguousRowMap_->getMaxGlobalIndex();
502 IFPACK2_CHK_ERR(HYPRE_IJMatrixCreate(comm, ilower, iupper, ilower, iupper, &HypreA_));
503 IFPACK2_CHK_ERR(HYPRE_IJMatrixSetObjectType(HypreA_, HYPRE_PARCSR));
504 IFPACK2_CHK_ERR(HYPRE_IJMatrixInitialize(HypreA_));
506 if(SolveOrPrec_ == Hypre_Is_Solver) {
507 IFPACK2_CHK_ERR(SetSolverType(SolverType_));
508 if (SolverPrecondPtr_ != NULL && UsePreconditioner_) {
510 IFPACK2_CHK_ERR(SetPrecondType(PrecondType_));
512 IFPACK2_CHK_ERR(SolverPrecondPtr_(Solver_, PrecondSolvePtr_, PrecondSetupPtr_, Preconditioner_));
517 IFPACK2_CHK_ERR(SetPrecondType(PrecondType_));
522 SetDiscreteGradient(G_);
525 if (!Coords_.is_null()) {
526 SetCoordinates(Coords_);
530 if(SolveOrPrec_ == Hypre_Is_Solver){
531 IFPACK2_CHK_ERR(SolverSetupPtr_(Solver_, ParMatrix_, ParX_, ParY_));
533 IFPACK2_CHK_ERR(PrecondSetupPtr_(Preconditioner_, ParMatrix_, ParX_, ParY_));
540 ComputeTime_ += (timer->
wallTime() - startTime);
544 template<
class LocalOrdinal,
class Node>
545 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::CallFunctions()
const{
546 for(
int i = 0; i < NumFunsToCall_; i++){
547 IFPACK2_CHK_ERR(FunsToCall_[i]->CallFunction(Solver_, Preconditioner_));
553 template<
class LocalOrdinal,
class Node>
554 void Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
555 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
558 scalar_type beta)
const {
559 using LO = local_ordinal_type;
560 using SC = scalar_type;
561 const std::string timerName (
"Ifpack2::Hypre::apply");
564 double startTime = timer->
wallTime();
569 if(isComputed() ==
false){
572 hypre_Vector *XLocal_ = hypre_ParVectorLocalVector(XVec_);
573 hypre_Vector *YLocal_ = hypre_ParVectorLocalVector(YVec_);
574 bool SameVectors =
false;
575 size_t NumVectors = X.getNumVectors();
576 if (NumVectors != Y.getNumVectors()) IFPACK2_CHK_ERR(-1);
585 for(
int VecNum = 0; VecNum < (int) NumVectors; VecNum++) {
588 SC * XValues =
const_cast<SC*
>(X.getData(VecNum).getRawPtr());
591 YValues =
const_cast<SC*
>(Y.getData(VecNum).getRawPtr());
593 YValues = VectorCache_.getRawPtr();
596 SC *XTemp = XLocal_->data;
598 XLocal_->data = XValues;
599 SC *YTemp = YLocal_->data;
600 YLocal_->data = YValues;
602 IFPACK2_CHK_ERR(HYPRE_ParVectorSetConstantValues(ParY_, 0.0));
603 if(SolveOrPrec_ == Hypre_Is_Solver){
605 IFPACK2_CHK_ERR(SolverSolvePtr_(Solver_, ParMatrix_, ParX_, ParY_));
608 IFPACK2_CHK_ERR(PrecondSolvePtr_(Preconditioner_, ParMatrix_, ParX_, ParY_));
613 LO NumEntries = Y.getLocalLength();
614 for(LO i = 0; i < NumEntries; i++)
617 XLocal_->
data = XTemp;
618 YLocal_->data = YTemp;
622 ApplyTime_ += (timer->
wallTime() - startTime);
627 template<
class LocalOrdinal,
class Node>
628 void Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::applyMat (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
629 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
635 template<
class LocalOrdinal,
class Node>
636 std::string Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::description()
const {
637 std::ostringstream out;
642 out <<
"\"Ifpack2::Hypre\": {";
643 out <<
"Initialized: " << (isInitialized () ?
"true" :
"false") <<
", "
644 <<
"Computed: " << (isComputed () ?
"true" :
"false") <<
", ";
647 out <<
"Matrix: null";
650 out <<
"Global matrix dimensions: ["
651 << A_->getGlobalNumRows () <<
", "
652 << A_->getGlobalNumCols () <<
"]"
653 <<
", Global nnz: " << A_->getGlobalNumEntries();
661 template<
class LocalOrdinal,
class Node>
665 os <<
"================================================================================" << endl;
666 os <<
"Ifpack2::Hypre: " << endl << endl;
667 os <<
"Using " << A_->getComm()->getSize() <<
" processors." << endl;
668 os <<
"Global number of rows = " << A_->getGlobalNumRows() << endl;
669 os <<
"Global number of nonzeros = " << A_->getGlobalNumEntries() << endl;
672 os <<
"Phase # calls Total Time (s)"<<endl;
673 os <<
"----- ------- --------------"<<endl;
674 os <<
"Initialize() " << std::setw(5) << NumInitialize_
675 <<
" " << std::setw(15) << InitializeTime_<<endl;
676 os <<
"Compute() " << std::setw(5) << NumCompute_
677 <<
" " << std::setw(15) << ComputeTime_ << endl;
678 os <<
"ApplyInverse() " << std::setw(5) << NumApply_
679 <<
" " << std::setw(15) << ApplyTime_ <<endl;
680 os <<
"================================================================================" << endl;
685 template<
class LocalOrdinal,
class Node>
686 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::SetSolverType(Hypre_Solver Solver){
689 if(IsSolverCreated_){
690 SolverDestroyPtr_(Solver_);
691 IsSolverCreated_ =
false;
693 SolverCreatePtr_ = &Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_BoomerAMGCreate;
694 SolverDestroyPtr_ = &HYPRE_BoomerAMGDestroy;
695 SolverSetupPtr_ = &HYPRE_BoomerAMGSetup;
696 SolverPrecondPtr_ = NULL;
697 SolverSolvePtr_ = &HYPRE_BoomerAMGSolve;
700 if(IsSolverCreated_){
701 SolverDestroyPtr_(Solver_);
702 IsSolverCreated_ =
false;
704 SolverCreatePtr_ = &Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_AMSCreate;
705 SolverDestroyPtr_ = &HYPRE_AMSDestroy;
706 SolverSetupPtr_ = &HYPRE_AMSSetup;
707 SolverSolvePtr_ = &HYPRE_AMSSolve;
708 SolverPrecondPtr_ = NULL;
711 if(IsSolverCreated_){
712 SolverDestroyPtr_(Solver_);
713 IsSolverCreated_ =
false;
715 SolverCreatePtr_ = &Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParCSRHybridCreate;
716 SolverDestroyPtr_ = &HYPRE_ParCSRHybridDestroy;
717 SolverSetupPtr_ = &HYPRE_ParCSRHybridSetup;
718 SolverSolvePtr_ = &HYPRE_ParCSRHybridSolve;
719 SolverPrecondPtr_ = &HYPRE_ParCSRHybridSetPrecond;
722 if(IsSolverCreated_){
723 SolverDestroyPtr_(Solver_);
724 IsSolverCreated_ =
false;
726 SolverCreatePtr_ = &Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParCSRPCGCreate;
727 SolverDestroyPtr_ = &HYPRE_ParCSRPCGDestroy;
728 SolverSetupPtr_ = &HYPRE_ParCSRPCGSetup;
729 SolverSolvePtr_ = &HYPRE_ParCSRPCGSolve;
730 SolverPrecondPtr_ = &HYPRE_ParCSRPCGSetPrecond;
733 if(IsSolverCreated_){
734 SolverDestroyPtr_(Solver_);
735 IsSolverCreated_ =
false;
737 SolverCreatePtr_ = &Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParCSRGMRESCreate;
738 SolverDestroyPtr_ = &HYPRE_ParCSRGMRESDestroy;
739 SolverSetupPtr_ = &HYPRE_ParCSRGMRESSetup;
740 SolverPrecondPtr_ = &HYPRE_ParCSRGMRESSetPrecond;
743 if(IsSolverCreated_){
744 SolverDestroyPtr_(Solver_);
745 IsSolverCreated_ =
false;
747 SolverCreatePtr_ = &Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParCSRFlexGMRESCreate;
748 SolverDestroyPtr_ = &HYPRE_ParCSRFlexGMRESDestroy;
749 SolverSetupPtr_ = &HYPRE_ParCSRFlexGMRESSetup;
750 SolverSolvePtr_ = &HYPRE_ParCSRFlexGMRESSolve;
751 SolverPrecondPtr_ = &HYPRE_ParCSRFlexGMRESSetPrecond;
754 if(IsSolverCreated_){
755 SolverDestroyPtr_(Solver_);
756 IsSolverCreated_ =
false;
758 SolverCreatePtr_ = &Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParCSRLGMRESCreate;
759 SolverDestroyPtr_ = &HYPRE_ParCSRLGMRESDestroy;
760 SolverSetupPtr_ = &HYPRE_ParCSRLGMRESSetup;
761 SolverSolvePtr_ = &HYPRE_ParCSRLGMRESSolve;
762 SolverPrecondPtr_ = &HYPRE_ParCSRLGMRESSetPrecond;
765 if(IsSolverCreated_){
766 SolverDestroyPtr_(Solver_);
767 IsSolverCreated_ =
false;
769 SolverCreatePtr_ = &Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParCSRBiCGSTABCreate;
770 SolverDestroyPtr_ = &HYPRE_ParCSRBiCGSTABDestroy;
771 SolverSetupPtr_ = &HYPRE_ParCSRBiCGSTABSetup;
772 SolverSolvePtr_ = &HYPRE_ParCSRBiCGSTABSolve;
773 SolverPrecondPtr_ = &HYPRE_ParCSRBiCGSTABSetPrecond;
783 template<
class LocalOrdinal,
class Node>
784 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::SetPrecondType(Hypre_Solver Precond){
787 if(IsPrecondCreated_){
788 PrecondDestroyPtr_(Preconditioner_);
789 IsPrecondCreated_ =
false;
791 PrecondCreatePtr_ = &Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_BoomerAMGCreate;
792 PrecondDestroyPtr_ = &HYPRE_BoomerAMGDestroy;
793 PrecondSetupPtr_ = &HYPRE_BoomerAMGSetup;
794 PrecondSolvePtr_ = &HYPRE_BoomerAMGSolve;
797 if(IsPrecondCreated_){
798 PrecondDestroyPtr_(Preconditioner_);
799 IsPrecondCreated_ =
false;
801 PrecondCreatePtr_ = &Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParaSailsCreate;
802 PrecondDestroyPtr_ = &HYPRE_ParaSailsDestroy;
803 PrecondSetupPtr_ = &HYPRE_ParaSailsSetup;
804 PrecondSolvePtr_ = &HYPRE_ParaSailsSolve;
807 if(IsPrecondCreated_){
808 PrecondDestroyPtr_(Preconditioner_);
809 IsPrecondCreated_ =
false;
811 PrecondCreatePtr_ = &Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_EuclidCreate;
812 PrecondDestroyPtr_ = &HYPRE_EuclidDestroy;
813 PrecondSetupPtr_ = &HYPRE_EuclidSetup;
814 PrecondSolvePtr_ = &HYPRE_EuclidSolve;
817 if(IsPrecondCreated_){
818 PrecondDestroyPtr_(Preconditioner_);
819 IsPrecondCreated_ =
false;
821 PrecondCreatePtr_ = &Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_AMSCreate;
822 PrecondDestroyPtr_ = &HYPRE_AMSDestroy;
823 PrecondSetupPtr_ = &HYPRE_AMSSetup;
824 PrecondSolvePtr_ = &HYPRE_AMSSolve;
835 template<
class LocalOrdinal,
class Node>
836 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::CreateSolver(){
838 HYPRE_ParCSRMatrixGetComm(ParMatrix_, &comm);
839 int ierr = (this->*SolverCreatePtr_)(comm, &Solver_);
840 IsSolverCreated_ =
true;
845 template<
class LocalOrdinal,
class Node>
846 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::CreatePrecond(){
848 HYPRE_ParCSRMatrixGetComm(ParMatrix_, &comm);
849 int ierr = (this->*PrecondCreatePtr_)(comm, &Preconditioner_);
850 IsPrecondCreated_ =
true;
856 template<
class LocalOrdinal,
class Node>
857 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::CopyTpetraToHypre(){
858 using LO = local_ordinal_type;
859 using GO = global_ordinal_type;
864 throw std::runtime_error(
"Hypre<Tpetra::RowMatrix<double, LocalOrdinal, HYPRE_Int, Node>: Unsupported matrix configuration: Tpetra::CrsMatrix required");
866 std::vector<HYPRE_Int> new_indices(Matrix->getLocalMaxNumRowEntries());
867 for(LO i = 0; i < (LO) Matrix->getLocalNumRows(); i++){
868 typename crs_matrix_type::values_host_view_type values;
869 typename crs_matrix_type::local_inds_host_view_type indices;
870 Matrix->getLocalRowView(i, indices, values);
871 for(LO j = 0; j < (LO)indices.extent(0); j++){
872 new_indices[j] = GloballyContiguousColMap_->getGlobalElement(indices(j));
874 HYPRE_Int GlobalRow[1];
875 HYPRE_Int numEntries = (GO) indices.extent(0);
876 GlobalRow[0] = GloballyContiguousRowMap_->getGlobalElement(i);
877 IFPACK2_CHK_ERR(HYPRE_IJMatrixSetValues(HypreA_, 1, &numEntries, GlobalRow, new_indices.data(), values.data()));
879 IFPACK2_CHK_ERR(HYPRE_IJMatrixAssemble(HypreA_));
880 IFPACK2_CHK_ERR(HYPRE_IJMatrixGetObject(HypreA_, (
void**)&ParMatrix_));
882 HYPRE_ParCSRMatrixPrint(ParMatrix_,
"A.mat");
887 template<
class LocalOrdinal,
class Node>
888 HYPRE_Int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_BoomerAMGCreate(MPI_Comm , HYPRE_Solver *solver)
889 {
return HYPRE_BoomerAMGCreate(solver);}
892 template<
class LocalOrdinal,
class Node>
893 HYPRE_Int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParaSailsCreate(MPI_Comm comm, HYPRE_Solver *solver)
894 {
return HYPRE_ParaSailsCreate(comm, solver);}
897 template<
class LocalOrdinal,
class Node>
898 HYPRE_Int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_EuclidCreate(MPI_Comm comm, HYPRE_Solver *solver)
899 {
return HYPRE_EuclidCreate(comm, solver);}
902 template<
class LocalOrdinal,
class Node>
903 HYPRE_Int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_AMSCreate(MPI_Comm , HYPRE_Solver *solver)
904 {
return HYPRE_AMSCreate(solver);}
907 template<
class LocalOrdinal,
class Node>
908 HYPRE_Int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParCSRHybridCreate(MPI_Comm , HYPRE_Solver *solver)
909 {
return HYPRE_ParCSRHybridCreate(solver);}
912 template<
class LocalOrdinal,
class Node>
913 HYPRE_Int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParCSRPCGCreate(MPI_Comm comm, HYPRE_Solver *solver)
914 {
return HYPRE_ParCSRPCGCreate(comm, solver);}
917 template<
class LocalOrdinal,
class Node>
918 HYPRE_Int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParCSRGMRESCreate(MPI_Comm comm, HYPRE_Solver *solver)
919 {
return HYPRE_ParCSRGMRESCreate(comm, solver);}
922 template<
class LocalOrdinal,
class Node>
923 HYPRE_Int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParCSRFlexGMRESCreate(MPI_Comm comm, HYPRE_Solver *solver)
924 {
return HYPRE_ParCSRFlexGMRESCreate(comm, solver);}
927 template<
class LocalOrdinal,
class Node>
928 HYPRE_Int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParCSRLGMRESCreate(MPI_Comm comm, HYPRE_Solver *solver)
929 {
return HYPRE_ParCSRLGMRESCreate(comm, solver);}
932 template<
class LocalOrdinal,
class Node>
933 HYPRE_Int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::Hypre_ParCSRBiCGSTABCreate(MPI_Comm comm, HYPRE_Solver *solver)
934 {
return HYPRE_ParCSRBiCGSTABCreate(comm, solver);}
937 template<
class LocalOrdinal,
class Node>
940 using import_type = Tpetra::Import<local_ordinal_type,global_ordinal_type,node_type>;
941 using go_vector_type = Tpetra::Vector<global_ordinal_type,local_ordinal_type,global_ordinal_type,node_type>;
948 throw std::runtime_error(
"Hypre<Tpetra::RowMatrix<HYPRE_Real, HYPRE_Int, long long, Node>: Unsupported matrix configuration: Tpetra::CrsMatrix required");
949 RCP<const map_type> DomainMap = Matrix->getDomainMap();
950 RCP<const map_type> ColumnMap = Matrix->getColMap();
951 RCP<const import_type> importer = Matrix->getGraph()->getImporter();
953 if(DomainMap->isContiguous() ) {
960 DomainMap->getLocalNumElements(), 0, DomainMap->getComm()));
963 go_vector_type MyGIDsHYPRE(DomainMap,ContiguousDomainMap->getLocalElementList());
966 go_vector_type ColGIDsHYPRE(ColumnMap);
967 ColGIDsHYPRE.doImport(MyGIDsHYPRE, *importer, Tpetra::INSERT);
970 return Teuchos::rcp(
new map_type(ColumnMap->getGlobalNumElements(),ColGIDsHYPRE.getDataNonConst()(),0, ColumnMap->getComm()));
974 return Teuchos::rcp(
new map_type(ColumnMap->getGlobalNumElements(),ContiguousDomainMap->getLocalElementList(), 0, ColumnMap->getComm()));
981 template<
class LocalOrdinal,
class Node>
982 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::getNumInitialize()
const {
983 return NumInitialize_;
987 template<
class LocalOrdinal,
class Node>
988 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::getNumCompute()
const {
993 template<
class LocalOrdinal,
class Node>
994 int Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::getNumApply()
const {
999 template<
class LocalOrdinal,
class Node>
1000 double Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::getInitializeTime()
const {
1001 return InitializeTime_;
1005 template<
class LocalOrdinal,
class Node>
1006 double Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::getComputeTime()
const {
1007 return ComputeTime_;
1011 template<
class LocalOrdinal,
class Node>
1012 double Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::getApplyTime()
const {
1016 template<
class LocalOrdinal,
class Node>
1018 Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::
1019 getDomainMap ()
const
1023 A.
is_null (), std::runtime_error,
"Ifpack2::Hypre::getDomainMap: The "
1024 "input matrix A is null. Please call setMatrix() with a nonnull input "
1025 "matrix before calling this method.");
1026 return A->getDomainMap ();
1030 template<
class LocalOrdinal,
class Node>
1032 Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::
1033 getRangeMap ()
const
1037 A.
is_null (), std::runtime_error,
"Ifpack2::Hypre::getRangeMap: The "
1038 "input matrix A is null. Please call setMatrix() with a nonnull input "
1039 "matrix before calling this method.");
1040 return A->getRangeMap ();
1044 template<
class LocalOrdinal,
class Node>
1047 if (A.
getRawPtr () != getMatrix().getRawPtr ()) {
1048 IsInitialized_ =
false;
1049 IsComputed_ =
false;
1055 template<
class LocalOrdinal,
class Node>
1057 Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::
1063 template<
class LocalOrdinal,
class Node>
1064 bool Hypre<Tpetra::RowMatrix<HYPRE_Real, LocalOrdinal, HYPRE_Int, Node> >::hasTransposeApply()
const {
1071 #define IFPACK2_HYPRE_INSTANT(S,LO,GO,N) \
1072 template class Ifpack2::Hypre< Tpetra::RowMatrix<S, LO, GO, N> >;
1075 #endif // HAVE_HYPRE && HAVE_MPI
1076 #endif // IFPACK2_HYPRE_DEF_HPP
ConstIterator end() const
T & get(const std::string &name, T def_value)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
bool isParameter(const std::string &name) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
bool isSublist(const std::string &name) const
ConstIterator begin() const
bool isType(const std::string &name) const
Uses AztecOO's GMRES.
Definition: Ifpack2_CondestType.hpp:20
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")