| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// Belos: Block Linear Solvers Package |
| 4 |
// |
| 5 |
// Copyright 2004-2016 NTESS and the Belos contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
/*! \file BelosEpetraOperator.h |
| 11 |
\brief This file provides an Epetra_Operator interface so Belos can be integrated into |
| 12 |
other codes as an abstract operator. |
| 13 |
*/ |
| 14 |
|
| 15 |
#ifndef BELOS_EPETRA_OPERATOR_H |
| 16 |
#define BELOS_EPETRA_OPERATOR_H |
| 17 |
|
| 18 |
#include "Epetra_MultiVector.h" |
| 19 |
#include "Epetra_Operator.h" |
| 20 |
#include "Epetra_Map.h" |
| 21 |
#include "Epetra_LocalMap.h" |
| 22 |
|
| 23 |
#include "BelosLinearProblem.hpp" |
| 24 |
#include "BelosStatusTest.hpp" |
| 25 |
#include "BelosOutputManager.hpp" |
| 26 |
#include "BelosEpetraAdapter.hpp" |
| 27 |
#include "BelosBlockGmresSolMgr.hpp" |
| 28 |
#include "BelosPseudoBlockGmresSolMgr.hpp" |
| 29 |
#include "BelosBlockCGSolMgr.hpp" |
| 30 |
#include "BelosPseudoBlockCGSolMgr.hpp" |
| 31 |
|
| 32 |
#include "Teuchos_ParameterList.hpp" |
| 33 |
|
| 34 |
/*! \class Belos::EpetraOperator |
| 35 |
\brief This class provides and interface to the Epetra_Operator class, so Belos can be |
| 36 |
integrated into other codes as an abstract operator. |
| 37 |
*/ |
| 38 |
|
| 39 |
namespace Belos { |
| 40 |
|
| 41 |
/////////////////////////////////////////////////////////////// |
| 42 |
//-------- class BelosEpetraOperator -------------------- |
| 43 |
// |
| 44 |
// This class will allow Belos to be called as an Epetra_Operator. |
| 45 |
// Thus, it can use itself as a preconditioner if need be. It can |
| 46 |
// also be used as the inner iteration of Anasazi :) |
| 47 |
// |
| 48 |
/////////////////////////////////////////////////////////////// |
| 49 |
|
| 50 |
class EpetraOperator : public virtual Epetra_Operator { |
| 51 |
public: |
| 52 |
//! @name Constructor / Destructor |
| 53 |
//@{ |
| 54 |
|
| 55 |
//! Constructor |
| 56 |
EpetraOperator( const Teuchos::RCP<LinearProblem<double,Epetra_MultiVector,Epetra_Operator> >& lp, |
| 57 |
const Teuchos::RCP<Teuchos::ParameterList>& plist, |
| 58 |
bool initSolnVec = false ); |
| 59 |
|
| 60 |
//! Destructor |
| 61 |
virtual ~EpetraOperator() {} |
| 62 |
//@} |
| 63 |
|
| 64 |
//! @name Attribute methods |
| 65 |
//@{ |
| 66 |
|
| 67 |
//! Set whether the operator or its inverse should be applied. [ This option is not implemented ] |
| 68 |
int SetUseTranspose( bool /* UseTranspose_in */ ) { return(-1); }; |
| 69 |
//@} |
| 70 |
|
| 71 |
//! @name Operator application methods |
| 72 |
//@{ |
| 73 |
|
| 74 |
//! Apply the operator. |
| 75 |
int Apply( const Epetra_MultiVector &X, Epetra_MultiVector &Y ) const; |
| 76 |
|
| 77 |
//! Apply the operator's inverse. |
| 78 |
int ApplyInverse( const Epetra_MultiVector &X, Epetra_MultiVector &Y ) const; |
| 79 |
//@} |
| 80 |
|
| 81 |
//! @name Norm methods |
| 82 |
//@{ |
| 83 |
|
| 84 |
//! Compute the infinity norm of the operator. [ This option is not implemented ] |
| 85 |
double NormInf() const { return(0.0); }; |
| 86 |
//@} |
| 87 |
|
| 88 |
//! @name Attribute access functions |
| 89 |
//@{ |
| 90 |
|
| 91 |
//! Return the label of the operator. |
| 92 |
const char* Label() const { return(&Solver[0]); }; |
| 93 |
|
| 94 |
//! Return whether the operator is using the transpose. |
| 95 |
bool UseTranspose() const { return(false); }; |
| 96 |
|
| 97 |
//! Return whether the infinity norm is available for this operator. |
| 98 |
bool HasNormInf() const { return(false); }; |
| 99 |
|
| 100 |
//! Return the communicator for this operator. |
| 101 |
const Epetra_Comm& Comm() const; |
| 102 |
|
| 103 |
//! Return the domain map for this operator. |
| 104 |
const Epetra_Map& OperatorDomainMap() const; |
| 105 |
|
| 106 |
//! Return the range map for this operator. |
| 107 |
const Epetra_Map& OperatorRangeMap() const; |
| 108 |
//@} |
| 109 |
private: |
| 110 |
|
| 111 |
Teuchos::RCP<SolverManager<double,Epetra_MultiVector,Epetra_Operator> > solver_; |
| 112 |
Teuchos::RCP<LinearProblem<double,Epetra_MultiVector,Epetra_Operator> > lp_; |
| 113 |
Teuchos::RCP<Teuchos::ParameterList> plist_; |
| 114 |
|
| 115 |
std::vector<char> Solver; |
| 116 |
bool initSolnVec_; |
| 117 |
}; |
| 118 |
|
| 119 |
} //end namespace Belos |
| 120 |
|
| 121 |
// end of file BELOS_EPETRA_OPERATOR_H |
| 122 |
#endif |