IFPACK Development
Loading...
Searching...
No Matches
Ifpack_Amesos.h
1/*@HEADER
2// ***********************************************************************
3//
4// Ifpack: Object-Oriented Algebraic Preconditioner Package
5// Copyright (2002) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38//
39// ***********************************************************************
40//@HEADER
41*/
42
43#ifndef IFPACK_AMESOS_H
44#define IFPACK_AMESOS_H
45
46#if defined(Ifpack_SHOW_DEPRECATED_WARNINGS)
47#ifdef __GNUC__
48#warning "The Ifpack package is deprecated"
49#endif
50#endif
51
52#include "Ifpack_ConfigDefs.h"
53#include "Ifpack_Preconditioner.h"
54#include "Epetra_Operator.h"
55#include "Teuchos_ParameterList.hpp"
56#include "Teuchos_RefCountPtr.hpp"
57
58class Epetra_Map;
59class Epetra_Time;
60class Epetra_Comm;
61class Amesos_BaseSolver;
64
66
88
89public:
90
92
95
97 Ifpack_Amesos(const Ifpack_Amesos& rhs);
98
101
103
104 virtual ~Ifpack_Amesos() {};
105
107
109
111
120 virtual int SetUseTranspose(bool UseTranspose_in);
122
124
126
134 virtual int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
135
137
148 virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
149
151 virtual double NormInf() const;
153
155
157 virtual const char * Label() const;
158
160 virtual bool UseTranspose() const;
161
163 virtual bool HasNormInf() const;
164
166 virtual const Epetra_Comm & Comm() const;
167
169 virtual const Epetra_Map & OperatorDomainMap() const;
170
172 virtual const Epetra_Map & OperatorRangeMap() const;
173
175
177
179 virtual bool IsInitialized() const
180 {
181 return(IsInitialized_);
182 }
183
185
188 virtual int Initialize();
189
191 virtual bool IsComputed() const
192 {
193 return(IsComputed_);
194 }
195
197
200 virtual int Compute();
201
203
210 virtual int SetParameters(Teuchos::ParameterList& List);
211
213
215
217 virtual const Epetra_RowMatrix& Matrix() const
218 {
219 return(*Matrix_);
220 }
221
223 virtual double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
224 const int MaxIters = 1550,
225 const double Tol = 1e-9,
226 Epetra_RowMatrix* Matrix_in= 0);
227
229 virtual double Condest() const
230 {
231 return(Condest_);
232 }
233
235 virtual int NumInitialize() const
236 {
237 return(NumInitialize_);
238 }
239
241 virtual int NumCompute() const
242 {
243 return(NumCompute_);
244 }
245
247 virtual int NumApplyInverse() const
248 {
249 return(NumApplyInverse_);
250 }
251
253 virtual double InitializeTime() const
254 {
255 return(InitializeTime_);
256 }
257
259 virtual double ComputeTime() const
260 {
261 return(ComputeTime_);
262 }
263
265 virtual double ApplyInverseTime() const
266 {
267 return(ApplyInverseTime_);
268 }
269
271 virtual double InitializeFlops() const
272 {
273 return(0.0);
274 }
275
277 virtual double ComputeFlops() const
278 {
279 return(ComputeFlops_);
280 }
281
283 virtual double ApplyInverseFlops() const
284 {
285 return(ApplyInverseFlops_);
286 }
287
288 // Returns a constant reference to the internally stored
289 virtual const Teuchos::ParameterList& List() const
290 {
291 return(List_);
292 }
293
295 virtual std::ostream& Print(std::ostream& os) const;
296
298
299protected:
300
302
304 inline void SetLabel(const char* Label_in)
305 {
306 Label_ = Label_in;
307 }
308
310 inline void SetIsInitialized(const bool IsInitialized_in)
311 {
312 IsInitialized_ = IsInitialized_in;
313 }
314
316 inline void SetIsComputed(const int IsComputed_in)
317 {
318 IsComputed_ = IsComputed_in;
319 }
320
322 inline void SetNumInitialize(const int NumInitialize_in)
323 {
324 NumInitialize_ = NumInitialize_in;
325 }
326
328 inline void SetNumCompute(const int NumCompute_in)
329 {
330 NumCompute_ = NumCompute_in;
331 }
332
334 inline void SetNumApplyInverse(const int NumApplyInverse_in)
335 {
336 NumApplyInverse_ = NumApplyInverse_in;
337 }
338
340 inline void SetInitializeTime(const double InitializeTime_in)
341 {
342 InitializeTime_ = InitializeTime_in;
343 }
344
346 inline void SetComputeTime(const double ComputeTime_in)
347 {
348 ComputeTime_ = ComputeTime_in;
349 }
350
352 inline void SetApplyInverseTime(const double ApplyInverseTime_in)
353 {
354 ApplyInverseTime_ = ApplyInverseTime_in;
355 }
356
358 inline void SetComputeFlops(const double ComputeFlops_in)
359 {
360 ComputeFlops_ = ComputeFlops_in;
361 }
362
364 inline void SetApplyInverseFlops(const double ApplyInverseFlops_in)
365 {
366 ApplyInverseFlops_ = ApplyInverseFlops_in;
367 }
368
370 inline void SetList(const Teuchos::ParameterList& List_in)
371 {
372 List_ = List_in;
373 }
375
376private:
377
379 Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
380
382 Teuchos::RefCountPtr<Epetra_LinearProblem> Problem_;
384 Teuchos::RefCountPtr<Amesos_BaseSolver> Solver_;
386 Teuchos::ParameterList List_;
387
389 std::string Label_;
391 bool IsEmpty_;
393 bool IsInitialized_;
395 bool IsComputed_;
397 bool UseTranspose_;
398
400 int NumInitialize_;
402 int NumCompute_;
404 mutable int NumApplyInverse_;
405
407 double InitializeTime_;
409 double ComputeTime_;
411 mutable double ApplyInverseTime_;
413 Teuchos::RefCountPtr<Epetra_Time> Time_;
414
416 double ComputeFlops_;
418 double ApplyInverseFlops_;
419
421 double Condest_;
422};
423
424#endif // IFPACK_AMESOS_H
Ifpack_Amesos: a class to use Amesos' factorizations as preconditioners.
void SetIsInitialized(const bool IsInitialized_in)
Sets IsInitialized_.
Ifpack_Amesos & operator=(const Ifpack_Amesos &rhs)
Operator=.
virtual bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Applies the matrix to an Epetra_MultiVector.
virtual double ComputeFlops() const
Returns the total number of flops to computate the preconditioner.
virtual int NumApplyInverse() const
Returns the number of calls to ApplyInverse().
void SetNumApplyInverse(const int NumApplyInverse_in)
Sets NumApplyInverse_.
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
void SetList(const Teuchos::ParameterList &List_in)
Set List_.
void SetLabel(const char *Label_in)
Sets the label.
virtual double InitializeTime() const
Returns the total time spent in Initialize().
virtual const char * Label() const
Returns a character string describing the operator.
virtual double InitializeFlops() const
Returns the number of flops in the initialization phase.
virtual int Initialize()
Initializes the preconditioners.
void SetApplyInverseFlops(const double ApplyInverseFlops_in)
Sets ComputeFlops_.
virtual int Compute()
Computes the preconditioners.
virtual double ApplyInverseFlops() const
Returns the total number of flops to apply the preconditioner.
virtual int NumCompute() const
Returns the number of calls to Compute().
void SetComputeFlops(const double ComputeFlops_in)
Sets ComputeFlops_.
void SetIsComputed(const int IsComputed_in)
Sets IsComputed_.
virtual int SetUseTranspose(bool UseTranspose_in)
If set true, transpose of this operator will be applied (not implemented).
virtual double ApplyInverseTime() const
Returns the total time spent in ApplyInverse().
void SetApplyInverseTime(const double ApplyInverseTime_in)
Sets ApplyInverseTime_.
virtual int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Applies the preconditioner to X, returns the result in Y.
virtual int SetParameters(Teuchos::ParameterList &List)
Sets all the parameters for the preconditioner.
virtual bool IsComputed() const
Returns true if the preconditioner has been successfully computed.
virtual int NumInitialize() const
Returns the number of calls to Initialize().
virtual double ComputeTime() const
Returns the total time spent in Compute().
virtual const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this operator.
virtual ~Ifpack_Amesos()
Destructor.
virtual double Condest() const
Returns the estimated condition number, never computes it.
virtual std::ostream & Print(std::ostream &os) const
Prints on ostream basic information about this object.
void SetNumCompute(const int NumCompute_in)
Sets NumCompute_.
virtual const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
virtual const Epetra_RowMatrix & Matrix() const
Returns a const reference to the internally stored matrix.
virtual double NormInf() const
Returns the infinity norm of the global matrix (not implemented)
virtual const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
void SetComputeTime(const double ComputeTime_in)
Sets ComputeTime_.
void SetInitializeTime(const double InitializeTime_in)
Sets InitializeTime_.
virtual bool IsInitialized() const
Returns true is the preconditioner has been successfully initialized.
void SetNumInitialize(const int NumInitialize_in)
Sets NumInitialize_.
Ifpack_Preconditioner: basic class for preconditioning in Ifpack.