Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_InvOperator.h
Go to the documentation of this file.
1 /*
2 //@HEADER
3 // ************************************************************************
4 //
5 // Epetra: Linear Algebra Services Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 */
43 
44 #ifndef EPETRA_INVOPERATOR_H
45 #define EPETRA_INVOPERATOR_H
46 
47 class Epetra_MultiVector;
48 class Epetra_BlockMap;
49 class Epetra_Comm;
50 #include <string>
51 #include "Epetra_Operator.h"
52 
54 
59 class Epetra_InvOperator: public virtual Epetra_Operator {
60 
61  public:
62 
64 
65 
70  operator_ = operatorIn;
71  Label_ = "Inverse of " + std::string(operatorIn->Label());
72  return;
73  }
75  virtual ~Epetra_InvOperator(){}
77 
79 
80 
82 
91  int SetUseTranspose(bool UseTranspose_in){EPETRA_CHK_ERR(operator_->SetUseTranspose(UseTranspose_in)); return(0);}
93 
95 
96 
98 
107 
109 
118 
120  /* Returns the quantity \f$ \| A \|_\infty\f$ such that
121  \f[\| A \|_\infty = \max_{1\lei\lem} \sum_{j=1}^n |a_{ij}| \f].
122 
123  \warning This method must not be called unless HasNormInf() returns true.
124  */
125  double NormInf() const {return(operator_->NormInf());}
126 
128 
129 
131  const char * Label() const {return(Label_.c_str());}
132 
134  Epetra_Operator * Operator() const {return(operator_);}
135 
136 
138  bool UseTranspose() const {return(operator_->UseTranspose());}
139 
141  bool HasNormInf() const {return(operator_->HasNormInf());};
142 
144  const Epetra_Comm & Comm() const {return(operator_->Comm());}
145 
148  {
149  if (!UseTranspose()) return(operator_->OperatorRangeMap());
150  else return(operator_->OperatorDomainMap());
151  }
152 
154  const Epetra_Map & OperatorRangeMap() const
155  {
156  if (!UseTranspose()) return(operator_->OperatorDomainMap());
157  else return(operator_->OperatorRangeMap());
158  }
160 
161  protected:
162 
164  std::string Label_;
165 };
166 
167 #endif /* EPETRA_INVOPERATOR_H */
168 
Epetra_MultiVector: A class for constructing and using dense multi-vectors, vectors and matrices in p...
Epetra_InvOperator(Epetra_Operator *operatorIn)
Uses an Epetra_Operator instance to implement the Epetra_Operator interface.
Epetra_Map: A class for partitioning vectors and matrices.
Definition: Epetra_Map.h:119
virtual int SetUseTranspose(bool UseTranspose)=0
If set true, transpose of this operator will be applied.
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_InvOperator inverse applied to an Epetra_MultiVector X in Y...
virtual int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
Returns the result of a Epetra_Operator inverse applied to an Epetra_MultiVector X in Y...
#define EPETRA_CHK_ERR(a)
virtual const Epetra_Map & OperatorDomainMap() const =0
Returns the Epetra_Map object associated with the domain of this operator.
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
virtual const char * Label() const =0
Returns a character string describing the operator.
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_BlockMap object associated with the range of this matrix operator.
Epetra_InvOperator: An implementation of the Epetra_Operator class that reverses the role of Apply() ...
int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_InvOperator applied to a Epetra_MultiVector X in Y.
bool UseTranspose() const
Returns the current UseTranspose setting.
Epetra_Operator * Operator() const
Returns a pointer to the Epetra_Operator operator object that was used to create this Epetra_InvOpera...
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
Returns the result of a Epetra_Operator applied to a Epetra_MultiVector X in Y.
virtual const Epetra_Map & OperatorRangeMap() const =0
Returns the Epetra_Map object associated with the range of this operator.
virtual const Epetra_Comm & Comm() const =0
Returns a pointer to the Epetra_Comm communicator associated with this operator.
Epetra_Comm: The Epetra Communication Abstract Base Class.
Definition: Epetra_Comm.h:73
virtual bool UseTranspose() const =0
Returns the current UseTranspose setting.
Epetra_Operator * operator_
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_BlockMap object associated with the domain of this matrix operator.
bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
const char * Label() const
Returns a character std::string describing the operator.
virtual bool HasNormInf() const =0
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
virtual ~Epetra_InvOperator()
Destructor.
double NormInf() const
Returns the infinity norm of the global matrix.
virtual double NormInf() const =0
Returns the infinity norm of the global matrix.
Epetra_Operator: A pure virtual class for using real-valued double-precision operators.
int SetUseTranspose(bool UseTranspose_in)
If set true, transpose of this operator will be applied.