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#include "Ifpack_ConfigDefs.h"
47#include "Ifpack_CondestType.h"
48#include "Ifpack_ScalingType.h"
49#include "Ifpack_Preconditioner.h"
50#include "Epetra_Vector.h"
51#include "Epetra_CrsMatrix.h"
52#include "Epetra_Time.h"
53#include "Teuchos_RefCountPtr.hpp"
54
57class Epetra_Comm;
58class Epetra_Map;
60
61namespace Teuchos {
62 class ParameterList;
63}
64
66
84
85 public:
87
95
97 virtual ~Ifpack_ICT();
98
100 /* This method is only available if the Teuchos package is enabled.
101 This method recognizes five parameter names: level_fill, drop_tolerance,
102 absolute_threshold, relative_threshold and overlap_mode. These names are
103 case insensitive. For level_fill the ParameterEntry must have type int, the
104 threshold entries must have type double and overlap_mode must have type
105 Epetra_CombineMode.
106 */
107 int SetParameters(Teuchos::ParameterList& parameterlis);
108
111 {
112 return(A_);
113 }
114
116 bool IsInitialized() const
117 {
118 return(IsInitialized_);
119 }
120
122
128 int Initialize();
129
131
139 int Compute();
140
142 bool IsComputed() const {return(IsComputed_);};
143
144 // Mathematical functions.
145
147
157 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
158
159 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
160
162
170 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
171 const int MaxIters = 1550,
172 const double Tol = 1e-9,
173 Epetra_RowMatrix* Matrix_in = 0);
174
175 double Condest() const
176 {
177 return(Condest_);
178 }
179
180 // Attribute access functions
181
183#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
184 int NumGlobalNonzeros() const {return(H().NumGlobalNonzeros());};
185#endif
186 long long NumGlobalNonzeros64() const {return(H().NumGlobalNonzeros64());};
187
189 int NumMyNonzeros() const {return(H().NumMyNonzeros());};
190
192 const Epetra_CrsMatrix& H() const {return(*H_);};
193
195
197
206 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
207
209 double NormInf() const {return(0.0);};
210
212 bool HasNormInf() const {return(false);};
213
215 bool UseTranspose() const {return(UseTranspose_);};
216
218 const Epetra_Map& OperatorDomainMap() const {return(A_.OperatorDomainMap());};
219
221 const Epetra_Map& OperatorRangeMap() const{return(A_.OperatorRangeMap());};
222
224 const Epetra_Comm& Comm() const{return(Comm_);};
226
227 const char* Label() const
228 {
229 return(Label_.c_str());
230 }
231
232 int SetLabel(const char* Label_in)
233 {
234 Label_ = Label_in;
235 return(0);
236 }
237
239 virtual std::ostream& Print(std::ostream& os) const;
240
242 virtual int NumInitialize() const
243 {
244 return(NumInitialize_);
245 }
246
248 virtual int NumCompute() const
249 {
250 return(NumCompute_);
251 }
252
254 virtual int NumApplyInverse() const
255 {
256 return(NumApplyInverse_);
257 }
258
260 virtual double InitializeTime() const
261 {
262 return(InitializeTime_);
263 }
264
266 virtual double ComputeTime() const
267 {
268 return(ComputeTime_);
269 }
270
272 virtual double ApplyInverseTime() const
273 {
274 return(ApplyInverseTime_);
275 }
276
278 virtual double InitializeFlops() const
279 {
280 return(0.0);
281 }
282
284 virtual double ComputeFlops() const
285 {
286 return(ComputeFlops_);
287 }
288
290 virtual double ApplyInverseFlops() const
291 {
292 return(ApplyInverseFlops_);
293 }
294
296
299 inline double LevelOfFill() const
300 {
301 return(LevelOfFill_);
302 }
303
305 inline double AbsoluteThreshold() const
306 {
307 return(Athresh_);
308 }
309
311 inline double RelativeThreshold() const
312 {
313 return(Rthresh_);
314 }
315
317 inline double RelaxValue() const
318 {
319 return(Relax_);
320 }
321
323 inline double DropTolerance() const
324 {
325 return(DropTolerance_);
326 }
327
328private:
329
331 Ifpack_ICT(const Ifpack_ICT& rhs) :
332 A_(rhs.Matrix()),
333 Comm_(Comm()),
334 Time_(Comm())
335 {}
336
338 Ifpack_ICT& operator=(const Ifpack_ICT& /* rhs */)
339 {
340 return(*this);
341 }
342
344 void Destroy();
345
347 const Epetra_RowMatrix& A_;
349 const Epetra_Comm& Comm_;
351 Teuchos::RefCountPtr<Epetra_CrsMatrix> H_;
353 double Condest_;
355 double Athresh_;
357 double Rthresh_;
359 double LevelOfFill_;
361 double DropTolerance_;
363 double Relax_;
365 std::string Label_;
367 bool IsInitialized_;
369 bool IsComputed_;
371 bool UseTranspose_;
373 int NumMyRows_;
375 int NumInitialize_;
377 int NumCompute_;
379 mutable int NumApplyInverse_;
381 double InitializeTime_;
383 double ComputeTime_;
385 mutable double ApplyInverseTime_;
387 double ComputeFlops_;
389 mutable double ApplyInverseFlops_;
391 mutable Epetra_Time Time_;
393 long long GlobalNonzeros_;
394 Teuchos::RefCountPtr<Epetra_SerialComm> SerialComm_;
395 Teuchos::RefCountPtr<Epetra_Map> SerialMap_;
396
397 template<typename int_type>
398 int TCompute();
399};
400
401#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:83
const Epetra_Comm & Comm() const
Returns the Epetra_BlockMap object associated with the range of this matrix operator.
Definition Ifpack_ICT.h:224
double LevelOfFill() const
Returns the level-of-fill.
Definition Ifpack_ICT.h:299
int NumGlobalNonzeros() const
Returns the number of nonzero entries in the global graph.
Definition Ifpack_ICT.h:184
double RelaxValue() const
Returns the relaxation value.
Definition Ifpack_ICT.h:317
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:206
int NumMyNonzeros() const
Returns the number of nonzero entries in the local graph.
Definition Ifpack_ICT.h:189
virtual int NumCompute() const
Returns the number of calls to Compute().
Definition Ifpack_ICT.h:248
virtual double InitializeTime() const
Returns the time spent in Initialize().
Definition Ifpack_ICT.h:260
virtual std::ostream & Print(std::ostream &os) const
Prints basic information on iostream. This function is used by operator<<.
Ifpack_ICT(const Epetra_RowMatrix *A)
Ifpack_ICT constuctor with variable number of indices per row.
bool UseTranspose() const
Returns the current UseTranspose setting.
Definition Ifpack_ICT.h:215
double DropTolerance() const
Returns the drop threshold.
Definition Ifpack_ICT.h:323
virtual double ApplyInverseTime() const
Returns the time spent in ApplyInverse().
Definition Ifpack_ICT.h:272
double Condest() const
Returns the computed condition number estimate, or -1.0 if not computed.
Definition Ifpack_ICT.h:175
virtual double ComputeTime() const
Returns the time spent in Compute().
Definition Ifpack_ICT.h:266
bool HasNormInf() const
Returns false because this class cannot compute an Inf-norm.
Definition Ifpack_ICT.h:212
const Epetra_CrsMatrix & H() const
Returns the address of the D factor associated with this factored matrix.
Definition Ifpack_ICT.h:192
virtual double InitializeFlops() const
Returns the number of flops in the initialization phase.
Definition Ifpack_ICT.h:278
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
Definition Ifpack_ICT.h:218
double RelativeThreshold() const
Returns the relative threshold.
Definition Ifpack_ICT.h:311
virtual int NumApplyInverse() const
Returns the number of calls to ApplyInverse().
Definition Ifpack_ICT.h:254
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:142
double AbsoluteThreshold() const
Returns the absolute threshold.
Definition Ifpack_ICT.h:305
virtual double ApplyInverseFlops() const
Returns the number of flops in all applications of ApplyInverse().
Definition Ifpack_ICT.h:290
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:116
virtual double ComputeFlops() const
Returns the number of flops in all applications of Compute().
Definition Ifpack_ICT.h:284
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:221
virtual int NumInitialize() const
Returns the number of calls to Initialize().
Definition Ifpack_ICT.h:242
double NormInf() const
Returns 0.0 because this class cannot compute Inf-norm.
Definition Ifpack_ICT.h:209
const Epetra_RowMatrix & Matrix() const
Returns a reference to the matrix to be preconditioned.
Definition Ifpack_ICT.h:110
Ifpack_Preconditioner: basic class for preconditioning in Ifpack.