| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// NOX: An Object-Oriented Nonlinear Solver Package |
| 4 |
// |
| 5 |
// Copyright 2002 NTESS and the NOX contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
#ifndef NOX_EPETRA_SCHUROPERATOR_H |
| 11 |
#define NOX_EPETRA_SCHUROPERATOR_H |
| 12 |
|
| 13 |
#include "NOX_Epetra.H" |
| 14 |
#include "NOX_Epetra_SchurInterface.H" |
| 15 |
|
| 16 |
//----------------------------------------------------------------------------- |
| 17 |
|
| 18 |
// This is a new class that may eventually get moved into NOX::Epetra. For now, |
| 19 |
// this is simply used as a testbed for driving new coupling algorithms - RWH 10/23/2006 |
| 20 |
|
| 21 |
namespace NOX { |
| 22 |
|
| 23 |
namespace Epetra { |
| 24 |
|
| 25 |
class SchurOp : public Epetra_Operator |
| 26 |
{ |
| 27 |
public: |
| 28 |
|
| 29 |
SchurOp( int probId, int depId, SchurInterface & ); |
| 30 |
|
| 31 |
virtual ~SchurOp(); |
| 32 |
|
| 33 |
|
| 34 |
// Inherited methods from Epetra_Operator |
| 35 |
|
| 36 |
//! @name Attribute set methods |
| 37 |
//@{ |
| 38 |
|
| 39 |
//! If set true, transpose of this operator will be applied. |
| 40 |
/*! This flag allows the transpose of the given operator to be used implicitly. Setting this flag |
| 41 |
affects only the Apply() and ApplyInverse() methods. If the implementation of this interface |
| 42 |
does not support transpose use, this method should return a value of -1. |
| 43 |
|
| 44 |
\param In |
| 45 |
UseTranspose -If true, multiply by the transpose of operator, otherwise just use operator. |
| 46 |
|
| 47 |
\return Integer error code, set to 0 if successful. Set to -1 if this implementation does not support transpose. |
| 48 |
*/ |
| 49 |
virtual int SetUseTranspose(bool UseTranspose); |
| 50 |
//@} |
| 51 |
|
| 52 |
//! @name Mathematical functions |
| 53 |
//@{ |
| 54 |
|
| 55 |
//! Returns the result of a Epetra_Operator applied to a Epetra_MultiVector X in Y. |
| 56 |
/*! |
| 57 |
\param In |
| 58 |
X - A Epetra_MultiVector of dimension NumVectors to multiply with matrix. |
| 59 |
\param Out |
| 60 |
Y -A Epetra_MultiVector of dimension NumVectors containing result. |
| 61 |
|
| 62 |
\return Integer error code, set to 0 if successful. |
| 63 |
*/ |
| 64 |
virtual int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; |
| 65 |
|
| 66 |
//! Returns the result of a Epetra_Operator inverse applied to an Epetra_MultiVector X in Y. |
| 67 |
/*! |
| 68 |
\param In |
| 69 |
X - A Epetra_MultiVector of dimension NumVectors to solve for. |
| 70 |
\param Out |
| 71 |
Y -A Epetra_MultiVector of dimension NumVectors containing result. |
| 72 |
|
| 73 |
\return Integer error code, set to 0 if successful. |
| 74 |
|
| 75 |
\warning In order to work with AztecOO, any implementation of this method must |
| 76 |
support the case where X and Y are the same object. |
| 77 |
*/ |
| 78 |
virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; |
| 79 |
|
| 80 |
//! Returns the infinity norm of the global matrix. |
| 81 |
/* Returns the quantity \f$ \| A \|_\infty\f$ such that |
| 82 |
\f[\| A \|_\infty = \max_{1\lei\lem} \sum_{j=1}^n |a_{ij}| \f]. |
| 83 |
|
| 84 |
\warning This method must not be called unless HasNormInf() returns true. |
| 85 |
*/ |
| 86 |
virtual double NormInf() const; |
| 87 |
//@} |
| 88 |
|
| 89 |
//! @name Attribute access functions |
| 90 |
//@{ |
| 91 |
|
| 92 |
//! Returns a character std::string describing the operator |
| 93 |
virtual const char * Label() const; |
| 94 |
|
| 95 |
//! Returns the current UseTranspose setting. |
| 96 |
virtual bool UseTranspose() const; |
| 97 |
|
| 98 |
//! Returns true if the \e this object can provide an approximate Inf-norm, false otherwise. |
| 99 |
virtual bool HasNormInf() const; |
| 100 |
|
| 101 |
//! Returns a pointer to the Epetra_Comm communicator associated with this operator. |
| 102 |
virtual const Epetra_Comm & Comm() const; |
| 103 |
|
| 104 |
//! Returns the Epetra_Map object associated with the domain of this operator. |
| 105 |
virtual const Epetra_Map & OperatorDomainMap() const; |
| 106 |
|
| 107 |
//! Returns the Epetra_Map object associated with the range of this operator. |
| 108 |
virtual const Epetra_Map & OperatorRangeMap() const; |
| 109 |
//@} |
| 110 |
|
| 111 |
//! @name Schur-based modifying methods |
| 112 |
//@{ |
| 113 |
|
| 114 |
//! Modifies the RHS vector using block operations |
| 115 |
virtual void modifyRHS( Teuchos::RCP<Epetra_Vector> &, Teuchos::RCP<Epetra_Vector> & ); |
| 116 |
//@} |
| 117 |
|
| 118 |
protected: |
| 119 |
|
| 120 |
// Methods |
| 121 |
|
| 122 |
// Data |
| 123 |
|
| 124 |
//! The interface to the action of matrix blocks |
| 125 |
SchurInterface & schurInterface ; |
| 126 |
|
| 127 |
//! Matrix row block identifier |
| 128 |
int probId; |
| 129 |
|
| 130 |
//! Matrix column block identifier |
| 131 |
int depId; |
| 132 |
|
| 133 |
//! Label for operator |
| 134 |
std::string label; |
| 135 |
|
| 136 |
}; |
| 137 |
} // Epetra |
| 138 |
} // NOX |
| 139 |
|
| 140 |
#endif |