MueLu  Version of the Day
MueLu_EpetraOperator.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // MueLu: A package for multigrid based preconditioning
6 // Copyright 2012 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
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef MUELU_EPETRAOPERATOR_HPP
47 #define MUELU_EPETRAOPERATOR_HPP
48 
50 
51 #include <Epetra_Operator.h>
52 #include "MueLu_Hierarchy.hpp"
53 //TODO: Kokkos headers
54 
55 namespace MueLu {
56 
61  class EpetraOperator : public Epetra_Operator {
62  typedef double SC;
63  typedef int LO;
64  typedef int GO;
65  typedef KokkosClassic::DefaultNode::DefaultNodeType NO;
66 
67  typedef Xpetra::Matrix<SC,LO,GO,NO> Matrix;
70 
71  public:
72 
74 
75 
77  EpetraOperator(const RCP<Hierarchy>& H) : Hierarchy_(H) { }
78 
80  virtual ~EpetraOperator() { }
81 
83 
84  int SetUseTranspose(bool UseTransposeBool) { return -1; }
85 
87 
88 
90 
98  int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const { return -1; }
99 
101 
112  int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
113 
115  /* Returns the quantity \f$ \| A \|_\infty\f$ such that
116  \f[\| A \|_\infty = \max_{1\lei\lem} \sum_{j=1}^n |a_{ij}| \f].
117 
118  \warning This method must not be called unless HasNormInf() returns true.
119  */
120  double NormInf() const { return 0; }
122 
124 
125 
127  const char * Label() const { return "MueLu::Hierarchy"; }
128 
130  bool UseTranspose() const { return false; }
131 
133  bool HasNormInf() const { return 0; }
134 
136  const Epetra_Comm & Comm() const;
137 
139  const Epetra_Map & OperatorDomainMap() const;
140 
142  const Epetra_Map & OperatorRangeMap() const;
143 
145 
147 
148 
150  RCP<Hierarchy> GetHierarchy() const { return Hierarchy_; }
151 
153 
154 
155  private:
156 
157  RCP<Hierarchy> Hierarchy_;
158 
159  };
160 
161 } // namespace
162 
163 #endif // MUELU_EPETRAOPERATOR_HPP
bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
int SetUseTranspose(bool UseTransposeBool)
virtual ~EpetraOperator()
Destructor.
double NormInf() const
Returns the infinity norm of the global matrix.
EpetraOperator(const RCP< Hierarchy > &H)
Constructor.
const char * Label() const
Returns a character string describing the operator.
MueLu::Hierarchy< SC, LO, GO, NO > Hierarchy
MueLu utility class.
Namespace for MueLu classes and methods.
MueLu::Utils< SC, LO, GO, NO > Utils
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this operator.
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_Operator inverse applied to an Epetra_MultiVector X in Y...
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
Turns a MueLu::Hierarchy into a Epetra_Operator. It allows MueLu to be used as a preconditioner for A...
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
KokkosClassic::DefaultNode::DefaultNodeType NO
Xpetra::Matrix< SC, LO, GO, NO > Matrix
bool UseTranspose() const
Returns the current UseTranspose setting.
RCP< Hierarchy > GetHierarchy() const
Direct access to the underlying MueLu::Hierarchy.
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_Operator applied to a Epetra_MultiVector X in Y.