IFPACK Development
Loading...
Searching...
No Matches
Ifpack_IC.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_IC_H
44#define IFPACK_IC_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_CondestType.h"
54#include "Ifpack_ScalingType.h"
55#include "Ifpack_Preconditioner.h"
56#include "Epetra_Vector.h"
57#include "Epetra_CrsMatrix.h"
58#include "Epetra_RowMatrix.h"
59#include "Epetra_Time.h"
60#include "Teuchos_RefCountPtr.hpp"
61
62class Epetra_Comm;
63class Epetra_Map;
65namespace Teuchos {
66 class ParameterList;
67}
68
70
87
88 public:
90
98
100 virtual ~Ifpack_IC();
101
103 void SetAbsoluteThreshold( double Athresh) {Athresh_ = Athresh; return;}
104
106 void SetRelativeThreshold( double Rthresh) {Rthresh_ = Rthresh; return;}
107
109 /* This method is only available if the Teuchos package is enabled.
110 This method recognizes five parameter names: level_fill, drop_tolerance,
111 absolute_threshold, relative_threshold and overlap_mode. These names are
112 case insensitive. For level_fill the ParameterEntry must have type int, the
113 threshold entries must have type double and overlap_mode must have type
114 Epetra_CombineMode.
115 */
116 int SetParameters(Teuchos::ParameterList& parameterlis);
117
118 int SetParameter(const std::string /* Name */, const int /* Value */)
119 {
120 IFPACK_CHK_ERR(-98);
121 }
122 int SetParameter(const std::string /* Name */, const double /* Value */)
123 {
124 IFPACK_CHK_ERR(-98);
125 }
126
128 {
129 return(*A_);
130 }
131
133 {
134 return(*A_);
135 }
136
137 bool IsInitialized() const
138 {
139 return(IsInitialized_);
140 }
141
143
149 int Initialize();
150
152
160 int Compute();
161 int ComputeSetup();
162
164 bool IsComputed() const {return(IsComputed_);};
165
166 // Mathematical functions.
167
169
179 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
180
181 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
182
184
192 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
193 const int MaxIters = 1550,
194 const double Tol = 1e-9,
195 Epetra_RowMatrix* Matrix_in = 0);
196
197 double Condest() const
198 {
199 return(Condest_);
200 }
201
202 // Attribute access functions
203
205 double GetAbsoluteThreshold() {return Athresh_;}
206
208 double GetRelativeThreshold() {return Rthresh_;}
209
211#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
212 int NumGlobalNonzeros() const {return(U().NumGlobalNonzeros()+D().GlobalLength());};
213#endif
214 long long NumGlobalNonzeros64() const {return(U().NumGlobalNonzeros64()+D().GlobalLength64());};
215
217 int NumMyNonzeros() const {return(U().NumMyNonzeros()+D().MyLength());};
219 const Epetra_Vector & D() const {return(*D_);};
220
222 const Epetra_CrsMatrix & U() const {return(*U_);};
223
225
227
236 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
237
239 double NormInf() const {return(0.0);};
240
242 bool HasNormInf() const {return(false);};
243
245 bool UseTranspose() const {return(UseTranspose_);};
246
248 const Epetra_Map & OperatorDomainMap() const {return(A_->OperatorDomainMap());};
249
251 const Epetra_Map & OperatorRangeMap() const{return(A_->OperatorRangeMap());};
252
254 const Epetra_Comm & Comm() const{return(Comm_);};
256
257 const char* Label() const
258 {
259 return(Label_);
260 }
261
262 int SetLabel(const char* Label_in)
263 {
264 strcpy(Label_,Label_in);
265 return(0);
266 }
267
269 virtual std::ostream& Print(std::ostream& os) const;
270
272 virtual int NumInitialize() const
273 {
274 return(NumInitialize_);
275 }
276
278 virtual int NumCompute() const
279 {
280 return(NumCompute_);
281 }
282
284 virtual int NumApplyInverse() const
285 {
286 return(NumApplyInverse_);
287 }
288
290 virtual double InitializeTime() const
291 {
292 return(InitializeTime_);
293 }
294
296 virtual double ComputeTime() const
297 {
298 return(ComputeTime_);
299 }
300
302 virtual double ApplyInverseTime() const
303 {
304 return(ApplyInverseTime_);
305 }
306
308 virtual double InitializeFlops() const
309 {
310 return(0.0);
311 }
312
313 virtual double ComputeFlops() const
314 {
315 return(ComputeFlops_);
316 }
317
318 virtual double ApplyInverseFlops() const
319 {
320 return(ApplyInverseFlops_);
321 }
322
323
324 private:
325
326 double LevelOfFill() const
327 {
328 return(Lfil_);
329 }
330
331 double AbsoluteThreshold() const
332 {
333 return(Athresh_);
334 }
335
336 double RelativeThreshold() const
337 {
338 return(Rthresh_);
339 }
340
341 double DropTolerance() const
342 {
343 return(Droptol_);
344 }
345
346 Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
347 const Epetra_Comm & Comm_;
348 Teuchos::RefCountPtr<Epetra_CrsMatrix> U_;
349 Teuchos::RefCountPtr<Epetra_Vector> D_;
350 bool UseTranspose_;
351
352 double Condest_;
353 double Athresh_;
354 double Rthresh_;
355 double Droptol_;
356 double Lfil_;
357
358 void * Aict_;
359 void * Lict_;
360 double * Ldiag_;
361 char Label_[160];
362
363 bool IsInitialized_;
364 bool IsComputed_;
365
367 int NumInitialize_;
369 int NumCompute_;
371 mutable int NumApplyInverse_;
372
374 double InitializeTime_;
376 double ComputeTime_;
378 mutable double ApplyInverseTime_;
380 mutable Epetra_Time Time_;
381
383 double ComputeFlops_;
385 mutable double ApplyInverseFlops_;
386
387};
388
389#endif /* IFPACK_IC_H */
Ifpack_ScalingType enumerable type.
Ifpack_IC: A class for constructing and using an incomplete Cholesky factorization of a given Epetra_...
Definition Ifpack_IC.h:86
virtual double InitializeTime() const
Returns the time spent in Initialize().
Definition Ifpack_IC.h:290
virtual int NumApplyInverse() const
Returns the number of calls to ApplyInverse().
Definition Ifpack_IC.h:284
double GetRelativeThreshold()
Get relative threshold value.
Definition Ifpack_IC.h:208
bool IsInitialized() const
Returns true if the preconditioner has been successfully initialized, false otherwise.
Definition Ifpack_IC.h:137
int NumMyNonzeros() const
Returns the number of nonzero entries in the local graph.
Definition Ifpack_IC.h:217
int Initialize()
Initialize L and U with values from user matrix A.
int SetParameters(Teuchos::ParameterList &parameterlis)
Set parameters using a Teuchos::ParameterList object.
double NormInf() const
Returns 0.0 because this class cannot compute Inf-norm.
Definition Ifpack_IC.h:239
void SetAbsoluteThreshold(double Athresh)
Set absolute threshold value.
Definition Ifpack_IC.h:103
virtual int NumCompute() const
Returns the number of calls to Compute().
Definition Ifpack_IC.h:278
int Compute()
Compute IC factor U using the specified graph, diagonal perturbation thresholds and relaxation parame...
bool UseTranspose() const
Returns the current UseTranspose setting.
Definition Ifpack_IC.h:245
virtual double InitializeFlops() const
Returns the number of flops in the initialization phase.
Definition Ifpack_IC.h:308
virtual double ApplyInverseFlops() const
Returns the number of flops in the application of the preconditioner.
Definition Ifpack_IC.h:318
double Condest() const
Returns the computed condition number estimate, or -1.0 if not computed.
Definition Ifpack_IC.h:197
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Ifpack_IC forward/back solve on a Epetra_MultiVector X in Y.
void SetRelativeThreshold(double Rthresh)
Set relative threshold value.
Definition Ifpack_IC.h:106
virtual int NumInitialize() const
Returns the number of calls to Initialize().
Definition Ifpack_IC.h:272
int NumGlobalNonzeros() const
Returns the number of nonzero entries in the global graph.
Definition Ifpack_IC.h:212
int SetUseTranspose(bool UseTranspose_in)
If set true, transpose of this operator will be applied.
Definition Ifpack_IC.h:236
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this operator.
Definition Ifpack_IC.h:251
const Epetra_CrsMatrix & U() const
Returns the address of the U factor associated with this factored matrix.
Definition Ifpack_IC.h:222
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
Definition Ifpack_IC.h:248
bool IsComputed() const
If factor is completed, this query returns true, otherwise it returns false.
Definition Ifpack_IC.h:164
virtual ~Ifpack_IC()
Ifpack_IC Destructor.
Definition Ifpack_IC.cpp:90
const Epetra_RowMatrix & Matrix() const
Returns a pointer to the matrix to be preconditioned.
Definition Ifpack_IC.h:127
double GetAbsoluteThreshold()
Get absolute threshold value.
Definition Ifpack_IC.h:205
virtual double ComputeFlops() const
Returns the number of flops in the computation phase.
Definition Ifpack_IC.h:313
bool HasNormInf() const
Returns false because this class cannot compute an Inf-norm.
Definition Ifpack_IC.h:242
const Epetra_Comm & Comm() const
Returns the Epetra_BlockMap object associated with the range of this matrix operator.
Definition Ifpack_IC.h:254
virtual double ApplyInverseTime() const
Returns the time spent in ApplyInverse().
Definition Ifpack_IC.h:302
virtual std::ostream & Print(std::ostream &os) const
Prints basic information on iostream. This function is used by operator<<.
const Epetra_Vector & D() const
Returns the address of the D factor associated with this factored matrix.
Definition Ifpack_IC.h:219
virtual double ComputeTime() const
Returns the time spent in Compute().
Definition Ifpack_IC.h:296
Ifpack_Preconditioner: basic class for preconditioning in Ifpack.