| 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_SCHURCOUPLER_H |
| 11 |
#define NOX_EPETRA_SCHURCOUPLER_H |
| 12 |
|
| 13 |
#include "NOX_Epetra.H" |
| 14 |
#include "Problem_Manager.H" |
| 15 |
#include "NOX_Epetra_SchurInterface.H" |
| 16 |
#include "NOX_Epetra_SchurOperator.H" |
| 17 |
|
| 18 |
//----------------------------------------------------------------------------- |
| 19 |
|
| 20 |
// This is a new class that may evantually get moved into NOX::Epetra. For now, |
| 21 |
// this is simply used as a testbed for driving new coupling algorithms - RWH 10/23/2006 |
| 22 |
|
| 23 |
namespace NOX { |
| 24 |
|
| 25 |
namespace Epetra { |
| 26 |
|
| 27 |
class SchurCoupler : public Epetra_Operator, |
| 28 |
public NOX::Epetra::SchurInterface |
| 29 |
{ |
| 30 |
public: |
| 31 |
|
| 32 |
SchurCoupler( Problem_Manager & ); |
| 33 |
|
| 34 |
virtual ~SchurCoupler(); |
| 35 |
|
| 36 |
|
| 37 |
// Inherited methods from Epetra_Operator |
| 38 |
|
| 39 |
//! @name Attribute set methods |
| 40 |
//@{ |
| 41 |
|
| 42 |
//! If set true, transpose of this operator will be applied. |
| 43 |
/*! This flag allows the transpose of the given operator to be used implicitly. Setting this flag |
| 44 |
affects only the Apply() and ApplyInverse() methods. If the implementation of this interface |
| 45 |
does not support transpose use, this method should return a value of -1. |
| 46 |
|
| 47 |
\param In |
| 48 |
UseTranspose -If true, multiply by the transpose of operator, otherwise just use operator. |
| 49 |
|
| 50 |
\return Integer error code, set to 0 if successful. Set to -1 if this implementation does not support transpose. |
| 51 |
*/ |
| 52 |
virtual int SetUseTranspose(bool UseTranspose); |
| 53 |
//@} |
| 54 |
|
| 55 |
//! @name Mathematical functions |
| 56 |
//@{ |
| 57 |
|
| 58 |
//! Returns the result of a Epetra_Operator applied to a Epetra_MultiVector X in Y. |
| 59 |
/*! |
| 60 |
\param In |
| 61 |
X - A Epetra_MultiVector of dimension NumVectors to multiply with matrix. |
| 62 |
\param Out |
| 63 |
Y -A Epetra_MultiVector of dimension NumVectors containing result. |
| 64 |
|
| 65 |
\return Integer error code, set to 0 if successful. |
| 66 |
*/ |
| 67 |
virtual int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; |
| 68 |
|
| 69 |
//! Returns the result of a Epetra_Operator inverse applied to an Epetra_MultiVector X in Y. |
| 70 |
/*! |
| 71 |
\param In |
| 72 |
X - A Epetra_MultiVector of dimension NumVectors to solve for. |
| 73 |
\param Out |
| 74 |
Y -A Epetra_MultiVector of dimension NumVectors containing result. |
| 75 |
|
| 76 |
\return Integer error code, set to 0 if successful. |
| 77 |
|
| 78 |
\warning In order to work with AztecOO, any implementation of this method must |
| 79 |
support the case where X and Y are the same object. |
| 80 |
*/ |
| 81 |
virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; |
| 82 |
|
| 83 |
//! Returns the infinity norm of the global matrix. |
| 84 |
/* Returns the quantity \f$ \| A \|_\infty\f$ such that |
| 85 |
\f[\| A \|_\infty = \max_{1\lei\lem} \sum_{j=1}^n |a_{ij}| \f]. |
| 86 |
|
| 87 |
\warning This method must not be called unless HasNormInf() returns true. |
| 88 |
*/ |
| 89 |
virtual double NormInf() const; |
| 90 |
//@} |
| 91 |
|
| 92 |
//! @name Attribute access functions |
| 93 |
//@{ |
| 94 |
|
| 95 |
//! Returns a character std::string describing the operator |
| 96 |
virtual const char * Label() const; |
| 97 |
|
| 98 |
//! Returns the current UseTranspose setting. |
| 99 |
virtual bool UseTranspose() const; |
| 100 |
|
| 101 |
//! Returns true if the \e this object can provide an approximate Inf-norm, false otherwise. |
| 102 |
virtual bool HasNormInf() const; |
| 103 |
|
| 104 |
//! Returns a pointer to the Epetra_Comm communicator associated with this operator. |
| 105 |
virtual const Epetra_Comm & Comm() const; |
| 106 |
|
| 107 |
//! Returns the Epetra_Map object associated with the domain of this operator. |
| 108 |
virtual const Epetra_Map & OperatorDomainMap() const; |
| 109 |
|
| 110 |
//! Returns the Epetra_Map object associated with the range of this operator. |
| 111 |
virtual const Epetra_Map & OperatorRangeMap() const; |
| 112 |
//@} |
| 113 |
|
| 114 |
// Inherited methods from NOX::Epetra::SchurInterface |
| 115 |
|
| 116 |
//! Apply the action of a matrix block on a vector |
| 117 |
virtual bool applyBlockAction( int rowBlock, int colBlock, const Epetra_Vector & x, Epetra_Vector & result ); |
| 118 |
|
| 119 |
//! Apply the action of a matrix block inverse on a vector |
| 120 |
virtual bool applyBlockInverseAction( int rowBlock, int colBlock, const Epetra_Vector & x, Epetra_Vector & result ); |
| 121 |
|
| 122 |
//! Get the communicator |
| 123 |
virtual const Epetra_Comm & getComm() |
| 124 |
{ return problemManager.getComm(); } |
| 125 |
|
| 126 |
//! Query availability of explicit operator |
| 127 |
virtual bool hasExplicitOperator( int rowBlock, int colBlock ); |
| 128 |
|
| 129 |
//! Access explicit operator |
| 130 |
virtual Teuchos::RCP<Epetra_Operator> getExplicitOperator( int rowBlock, int colBlock ); |
| 131 |
|
| 132 |
//! Access to our Schur Operators |
| 133 |
virtual Teuchos::RCP<NOX::Epetra::SchurOp> getSchurOperator( int rowBlock, int colBlock ); |
| 134 |
|
| 135 |
//! @name Schur-based modifying methods |
| 136 |
//@{ |
| 137 |
|
| 138 |
//! Modifies the RHS vector using block operations |
| 139 |
//virtual void modifyRHS( Teuchos::RCP<Epetra_Vector> &, Teuchos::RCP<Epetra_Vector> & ); |
| 140 |
//@} |
| 141 |
|
| 142 |
protected: |
| 143 |
|
| 144 |
// Methods |
| 145 |
|
| 146 |
// Data |
| 147 |
|
| 148 |
//! The collection of coupled problems with which we interact |
| 149 |
Problem_Manager & problemManager ; |
| 150 |
|
| 151 |
//! Container of SchurOps |
| 152 |
map<int, Teuchos::RCP<NOX::Epetra::SchurOp> > schurOperators; |
| 153 |
|
| 154 |
//! Label for operator |
| 155 |
std::string label; |
| 156 |
|
| 157 |
}; |
| 158 |
} // Epetra |
| 159 |
} // NOX |
| 160 |
|
| 161 |
#endif |