EpetraExt Package Browser (Single Doxygen Collection)  Development
LL/Poisson2dOperator.h
Go to the documentation of this file.
1 
2 //@HEADER
3 // ***********************************************************************
4 //
5 // EpetraExt: Epetra Extended - 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 #ifndef _POISSON2DOPERATOR_H_
44 #define _POISSON2DOPERATOR_H_
45 
46 class Epetra_MultiVector;
47 class Epetra_CrsMatrix;
48 class Epetra_Map;
49 class Epetra_Import;
50 class Epetra_BlockMap;
51 class Epetra_Comm;
52 #include "Epetra_Operator.h"
53 
55 
59 class Poisson2dOperator: public virtual Epetra_Operator {
60 
61  public:
62 
64 
69  Poisson2dOperator(int nx, int ny, const Epetra_Comm & comm);
74 
76 
78 
89 
91 
93 
101  int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
102 
104 
115  int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const {return(Apply(X,Y));};
116 
118  /* Returns the quantity \f$ \| A \|_\infty\f$ such that
119  \f[\| A \|_\infty = \max_{1\lei\lem} \sum_{j=1}^n |a_{ij}| \f].
120 
121  \warning This method must not be called unless HasNormInf() returns true.
122  */
123  double NormInf() const {return(8.0);};
125 
127 
129  const char * Label() const{return(Label_);};
130 
132  bool UseTranspose() const {return(useTranspose_);};
133 
135  bool HasNormInf() const{return(true);};
136 
138  const Epetra_Comm & Comm() const{return(comm_);};
139 
141  const Epetra_Map & OperatorDomainMap() const {return(*map_);};
142 
144  const Epetra_Map & OperatorRangeMap() const {return(*map_);};
146 
148 
152 
153 
154  int nx_, ny_, myny_;
155  bool useTranspose_;
156  const Epetra_Comm & comm_;
157  Epetra_Map * map_;
158  int numImports_;
159  long long * importIDs_;
162  mutable Epetra_MultiVector * importX_;
163  const char * Label_;
164 };
165 
166 #endif /* _POISSON2DOPERATOR_H_ */
Poisson2dOperator::OperatorDomainMap
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
Definition: LL/Poisson2dOperator.h:141
Poisson2dOperator::myny_
int myny_
Definition: Poisson2dOperator.h:155
Poisson2dOperator::Label_
const char * Label_
Definition: Poisson2dOperator.h:164
Poisson2dOperator::Label
const char * Label() const
Returns a character string describing the operator.
Definition: LL/Poisson2dOperator.h:129
Poisson2dOperator::importMap_
Epetra_Map * importMap_
Definition: Poisson2dOperator.h:161
Poisson2dOperator::numImports_
int numImports_
Definition: Poisson2dOperator.h:159
Poisson2dOperator::~Poisson2dOperator
~Poisson2dOperator()
Destructor.
Definition: Poisson2dOperator.cpp:107
Poisson2dOperator::Apply
int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Poisson2dOperator applied to a Epetra_MultiVector X in Y.
Definition: Poisson2dOperator.cpp:115
Poisson2dOperator::Comm
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
Definition: LL/Poisson2dOperator.h:138
Epetra_Comm
Poisson2dOperator::ApplyInverse
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Poisson2dOperator inverse applied to an Epetra_MultiVector X in Y.
Definition: LL/Poisson2dOperator.h:115
Poisson2dOperator::SetUseTranspose
int SetUseTranspose(bool UseTranspose)
If set true, transpose of this operator will be applied.
Definition: LL/Poisson2dOperator.h:87
Poisson2dOperator::OperatorRangeMap
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this operator.
Definition: LL/Poisson2dOperator.h:144
Epetra_CrsMatrix
Poisson2dOperator::comm_
const Epetra_Comm & comm_
Definition: Poisson2dOperator.h:157
Poisson2dOperator::useTranspose_
bool useTranspose_
Definition: Poisson2dOperator.h:156
Poisson2dOperator::importIDs_
long long * importIDs_
Definition: LL/Poisson2dOperator.h:159
Poisson2dOperator::UseTranspose
bool UseTranspose() const
Returns the current UseTranspose setting.
Definition: Poisson2dOperator.h:133
Epetra_BlockMap
Poisson2dOperator::map_
Epetra_Map * map_
Definition: Poisson2dOperator.h:158
Poisson2dOperator::importX_
Epetra_MultiVector * importX_
Definition: Poisson2dOperator.h:163
Poisson2dOperator::importer_
Epetra_Import * importer_
Definition: Poisson2dOperator.h:162
Epetra_MultiVector
Poisson2dOperator::nx_
int nx_
Definition: Poisson2dOperator.h:155
Poisson2dOperator::NormInf
double NormInf() const
Returns the infinity norm of the global matrix.
Definition: LL/Poisson2dOperator.h:123
Poisson2dOperator::Poisson2dOperator
Poisson2dOperator(int nx, int ny, const Epetra_Comm &comm)
Builds a 2 dimensional Poisson operator for a nx by ny grid, assuming zero Dirichlet BCs.
Definition: Poisson2dOperator.cpp:52
Poisson2dOperator::HasNormInf
bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
Definition: LL/Poisson2dOperator.h:135
Poisson2dOperator
Poisson2dOperator: A sample implementation of the Epetra_Operator class.
Definition: Poisson2dOperator.h:59
Epetra_Operator
Epetra_Map
Poisson2dOperator::GeneratePrecMatrix
Epetra_CrsMatrix * GeneratePrecMatrix() const
Generate a tridiagonal approximation to the 5-point Poisson as an Epetra_CrsMatrix.
Definition: Poisson2dOperator.cpp:195
Epetra_Operator.h
Epetra_Import
Poisson2dOperator::ny_
int ny_
Definition: Poisson2dOperator.h:155