Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_MLPrecOp.hpp
Go to the documentation of this file.
1 // $Id$
2 // $Source$
3 // @HEADER
4 // ***********************************************************************
5 //
6 // Stokhos Package
7 // Copyright (2009) Sandia Corporation
8 //
9 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
10 // license for use of this work by or on behalf of the U.S. Government.
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are
14 // met:
15 //
16 // 1. Redistributions of source code must retain the above copyright
17 // notice, this list of conditions and the following disclaimer.
18 //
19 // 2. Redistributions in binary form must reproduce the above copyright
20 // notice, this list of conditions and the following disclaimer in the
21 // documentation and/or other materials provided with the distribution.
22 //
23 // 3. Neither the name of the Corporation nor the names of the
24 // contributors may be used to endorse or promote products derived from
25 // this software without specific prior written permission.
26 //
27 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
28 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
31 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
34 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 //
39 // Questions? Contact Eric T. Phipps (etphipp@sandia.gov).
40 //
41 // ***********************************************************************
42 // @HEADER
43 
69 /* ******************************************************************** */
70 /* See the file COPYRIGHT for a complete copyright notice, contact */
71 /* person and disclaimer. */
72 /* ******************************************************************** */
73 
74 #ifndef STOKHOS_MLPRECOP_HPP
75 #define STOKHOS_MLPRECOP_HPP
76 
77 #include "Stokhos_ConfigDefs.h"
78 
79 #ifdef HAVE_STOKHOS_ML
80 
81 #include "Epetra_ConfigDefs.h"
82 #ifdef HAVE_MPI
83 #include <mpi.h>
84 #include "Epetra_MpiComm.h"
85 #else
86 #include "Epetra_SerialComm.h"
87 #endif
88 #include "Epetra_Map.h"
89 #include "Epetra_Vector.h"
90 #include "Epetra_CrsMatrix.h"
92 #include "Epetra_MultiVector.h"
93 #include "ml_include.h"
94 #include "ml_MultiLevelPreconditioner.h"
95 //#include "Epetra_LinearProblem.h"
96 //#include "Epetra_Object.h"
97 
98 #include "Teuchos_Array.hpp"
99 
100 
102 
107 namespace Stokhos{
108 
109 class MLPrecOp: public virtual Epetra_Operator {
110 
111  public:
112 
114  MLPrecOp(const Epetra_CrsMatrix& mean_op, const Teuchos::Array<double>& norms, const Epetra_Comm& Comm, const Epetra_Map& DMap, const Epetra_Map& RMap);
116  ~MLPrecOp(){}
119 
120 
122 
133  int SetUseTranspose (bool /* UseTheTranspose */) { return -1; }
135 
137 
139 
144  int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const {return -1;};
145 
147 
155 // int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y, int iBlockSize = WKC) const;
156  int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
157 
158  //int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
159 
161  /* Returns the quantity \f$ \| A \|_\infty\f$ such that
162  \f[\| A \|_\infty = \max_{1\lei\lem} \sum_{j=1}^n |a_{ij}| \f].
163 
164  \warning This method must not be called unless HasNormInf() returns true.
165  */
166  double NormInf() const {return(0.0);};
168 
170 
172  const char * Label() const{return(Label_);};
173 
175  bool UseTranspose() const {return(false);};
176 
178  bool HasNormInf() const{return(false);};
179 
181  const Epetra_Comm & Comm() const{return(Comm_);};
182 
184  const Epetra_Map & OperatorDomainMap() const {return(DomainMap_);};
186  const Epetra_Map & OperatorRangeMap() const {return(RangeMap_);};
188 
189  private:
191  //StochGalerkinFiniteDiffSystem(const StochGalerkinFiniteDiffSystem& RHS) :
192  // Comm_(RHS.Comm()),
193  // DomainMap_(RHS.OperatorDomainMap()),
194  // RangeMap_(RHS.OperatorRangeMap())
195  //{ }
196 
198  MLPrecOp& operator=(const MLPrecOp&)
199  {
200  return(*this);
201  }
202 
204  const Epetra_Comm& Comm_;
205  const char * Label_;
207  const Epetra_Map& DomainMap_;
209  const Epetra_Map& RangeMap_;
210 
211  const Teuchos::Array<double>& norms_;
212 
213  ML_Epetra::MultiLevelPreconditioner* MLPrec;
214 
215 };
216 }
217 
218 #endif // HAVE_STOKHOS_ML
219 
220 #endif /* SACADO_STOCHGAL_DIFF_H*/
221