IFPACK Development
Loading...
Searching...
No Matches
Ifpack_ICT.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_ICT_H
44#define IFPACK_ICT_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_Time.h"
59#include "Teuchos_RefCountPtr.hpp"
60
63class Epetra_Comm;
64class Epetra_Map;
66
67namespace Teuchos {
68 class ParameterList;
69}
70
72
90
91 public:
93
101
103 virtual ~Ifpack_ICT();
104
106 /* This method is only available if the Teuchos package is enabled.
107 This method recognizes five parameter names: level_fill, drop_tolerance,
108 absolute_threshold, relative_threshold and overlap_mode. These names are
109 case insensitive. For level_fill the ParameterEntry must have type int, the
110 threshold entries must have type double and overlap_mode must have type
111 Epetra_CombineMode.
112 */
113 int SetParameters(Teuchos::ParameterList& parameterlis);
114
117 {
118 return(A_);
119 }
120
122 bool IsInitialized() const
123 {
124 return(IsInitialized_);
125 }
126
128
134 int Initialize();
135
137
145 int Compute();
146
148 bool IsComputed() const {return(IsComputed_);};
149
150 // Mathematical functions.
151
153
163 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
164
165 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
166
168
176 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
177 const int MaxIters = 1550,
178 const double Tol = 1e-9,
179 Epetra_RowMatrix* Matrix_in = 0);
180
181 double Condest() const
182 {
183 return(Condest_);
184 }
185
186 // Attribute access functions
187
189#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
190 int NumGlobalNonzeros() const {return(H().NumGlobalNonzeros());};
191#endif
192 long long NumGlobalNonzeros64() const {return(H().NumGlobalNonzeros64());};
193
195 int NumMyNonzeros() const {return(H().NumMyNonzeros());};
196
198 const Epetra_CrsMatrix& H() const {return(*H_);};
199
201
203
212 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
213
215 double NormInf() const {return(0.0);};
216
218 bool HasNormInf() const {return(false);};
219
221 bool UseTranspose() const {return(UseTranspose_);};
222
224 const Epetra_Map& OperatorDomainMap() const {return(A_.OperatorDomainMap());};
225
227 const Epetra_Map& OperatorRangeMap() const{return(A_.OperatorRangeMap());};
228
230 const Epetra_Comm& Comm() const{return(Comm_);};
232
233 const char* Label() const
234 {
235 return(Label_.c_str());
236 }
237
238 int SetLabel(const char* Label_in)
239 {
240 Label_ = Label_in;
241 return(0);
242 }
243
245 virtual std::ostream& Print(std::ostream& os) const;
246
248 virtual int NumInitialize() const
249 {
250 return(NumInitialize_);
251 }
252
254 virtual int NumCompute() const
255 {
256 return(NumCompute_);
257 }
258
260 virtual int NumApplyInverse() const
261 {
262 return(NumApplyInverse_);
263 }
264
266 virtual double InitializeTime() const
267 {
268 return(InitializeTime_);
269 }
270
272 virtual double ComputeTime() const
273 {
274 return(ComputeTime_);
275 }
276
278 virtual double ApplyInverseTime() const
279 {
280 return(ApplyInverseTime_);
281 }
282
284 virtual double InitializeFlops() const
285 {
286 return(0.0);
287 }
288
290 virtual double ComputeFlops() const
291 {
292 return(ComputeFlops_);
293 }
294
296 virtual double ApplyInverseFlops() const
297 {
298 return(ApplyInverseFlops_);
299 }
300
302
305 inline double LevelOfFill() const
306 {
307 return(LevelOfFill_);
308 }
309
311 inline double AbsoluteThreshold() const
312 {
313 return(Athresh_);
314 }
315
317 inline double RelativeThreshold() const
318 {
319 return(Rthresh_);
320 }
321
323 inline double RelaxValue() const
324 {
325 return(Relax_);
326 }
327
329 inline double DropTolerance() const
330 {
331 return(DropTolerance_);
332 }
333
334private:
335
337 Ifpack_ICT(const Ifpack_ICT& rhs) :
338 A_(rhs.Matrix()),
339 Comm_(Comm()),
340 Time_(Comm())
341 {}
342
344 Ifpack_ICT& operator=(const Ifpack_ICT& /* rhs */)
345 {
346 return(*this);
347 }
348
350 void Destroy();
351
353 const Epetra_RowMatrix& A_;
355 const Epetra_Comm& Comm_;
357 Teuchos::RefCountPtr<Epetra_CrsMatrix> H_;
359 double Condest_;
361 double Athresh_;
363 double Rthresh_;
365 double LevelOfFill_;
367 double DropTolerance_;
369 double Relax_;
371 std::string Label_;
373 bool IsInitialized_;
375 bool IsComputed_;
377 bool UseTranspose_;
379 int NumMyRows_;
381 int NumInitialize_;
383 int NumCompute_;
385 mutable int NumApplyInverse_;
387 double InitializeTime_;
389 double ComputeTime_;
391 mutable double ApplyInverseTime_;
393 double ComputeFlops_;
395 mutable double ApplyInverseFlops_;
397 mutable Epetra_Time Time_;
399 long long GlobalNonzeros_;
400 Teuchos::RefCountPtr<Epetra_SerialComm> SerialComm_;
401 Teuchos::RefCountPtr<Epetra_Map> SerialMap_;
402
403 template<typename int_type>
404 int TCompute();
405};
406
407#endif /* IFPACK_ICT_H */
Ifpack_ScalingType enumerable type.
virtual const Epetra_Map & OperatorDomainMap() const=0
virtual const Epetra_Map & OperatorRangeMap() const=0
Ifpack_ICT: A class for constructing and using an incomplete Cholesky factorization of a given Epetra...
Definition Ifpack_ICT.h:89
const Epetra_Comm & Comm() const
Returns the Epetra_BlockMap object associated with the range of this matrix operator.
Definition Ifpack_ICT.h:230
double LevelOfFill() const
Returns the level-of-fill.
Definition Ifpack_ICT.h:305
int NumGlobalNonzeros() const
Returns the number of nonzero entries in the global graph.
Definition Ifpack_ICT.h:190
double RelaxValue() const
Returns the relaxation value.
Definition Ifpack_ICT.h:323
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Ifpack_ICT forward/back solve on a Epetra_MultiVector X in Y.
int SetUseTranspose(bool UseTranspose_in)
If set true, transpose of this operator will be applied.
Definition Ifpack_ICT.h:212
int NumMyNonzeros() const
Returns the number of nonzero entries in the local graph.
Definition Ifpack_ICT.h:195
virtual int NumCompute() const
Returns the number of calls to Compute().
Definition Ifpack_ICT.h:254
virtual double InitializeTime() const
Returns the time spent in Initialize().
Definition Ifpack_ICT.h:266
virtual std::ostream & Print(std::ostream &os) const
Prints basic information on iostream. This function is used by operator<<.
bool UseTranspose() const
Returns the current UseTranspose setting.
Definition Ifpack_ICT.h:221
double DropTolerance() const
Returns the drop threshold.
Definition Ifpack_ICT.h:329
virtual double ApplyInverseTime() const
Returns the time spent in ApplyInverse().
Definition Ifpack_ICT.h:278
double Condest() const
Returns the computed condition number estimate, or -1.0 if not computed.
Definition Ifpack_ICT.h:181
virtual double ComputeTime() const
Returns the time spent in Compute().
Definition Ifpack_ICT.h:272
bool HasNormInf() const
Returns false because this class cannot compute an Inf-norm.
Definition Ifpack_ICT.h:218
const Epetra_CrsMatrix & H() const
Returns the address of the D factor associated with this factored matrix.
Definition Ifpack_ICT.h:198
virtual double InitializeFlops() const
Returns the number of flops in the initialization phase.
Definition Ifpack_ICT.h:284
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
Definition Ifpack_ICT.h:224
double RelativeThreshold() const
Returns the relative threshold.
Definition Ifpack_ICT.h:317
virtual int NumApplyInverse() const
Returns the number of calls to ApplyInverse().
Definition Ifpack_ICT.h:260
int SetParameters(Teuchos::ParameterList &parameterlis)
Set parameters using a Teuchos::ParameterList object.
bool IsComputed() const
If factor is completed, this query returns true, otherwise it returns false.
Definition Ifpack_ICT.h:148
double AbsoluteThreshold() const
Returns the absolute threshold.
Definition Ifpack_ICT.h:311
virtual double ApplyInverseFlops() const
Returns the number of flops in all applications of ApplyInverse().
Definition Ifpack_ICT.h:296
int Initialize()
Initialize L and U with values from user matrix A.
virtual ~Ifpack_ICT()
Ifpack_ICT Destructor.
bool IsInitialized() const
Returns true is the preconditioner has been successfully initialized.
Definition Ifpack_ICT.h:122
virtual double ComputeFlops() const
Returns the number of flops in all applications of Compute().
Definition Ifpack_ICT.h:290
int Compute()
Compute IC factor U using the specified graph, diagonal perturbation thresholds and relaxation parame...
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this operator.
Definition Ifpack_ICT.h:227
virtual int NumInitialize() const
Returns the number of calls to Initialize().
Definition Ifpack_ICT.h:248
double NormInf() const
Returns 0.0 because this class cannot compute Inf-norm.
Definition Ifpack_ICT.h:215
const Epetra_RowMatrix & Matrix() const
Returns a reference to the matrix to be preconditioned.
Definition Ifpack_ICT.h:116
Ifpack_Preconditioner: basic class for preconditioning in Ifpack.