Ifpack Package Browser (Single Doxygen Collection) Development
Loading...
Searching...
No Matches
Ifpack_ILUT.h
Go to the documentation of this file.
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_ILUT_H
44#define IFPACK_ILUT_H
45
46#include "Ifpack_ConfigDefs.h"
47#include "Ifpack_CondestType.h"
48#include "Ifpack_ScalingType.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
82
83public:
84 // @{ Constructors and Destructors
87
89 virtual ~Ifpack_ILUT();
90
91 // @}
92 // @{ Construction methods
94 /* This method is only available if the Teuchos package is enabled.
95 This method recognizes five parameter names: level_fill, drop_tolerance,
96 absolute_threshold, relative_threshold and overlap_mode. These names are
97 case insensitive. For level_fill the ParameterEntry must have type int, the
98 threshold entries must have type double and overlap_mode must have type
99 Epetra_CombineMode.
100 */
101 int SetParameters(Teuchos::ParameterList& parameterlis);
102
104
110 int Initialize();
111
113 bool IsInitialized() const
114 {
115 return(IsInitialized_);
116 }
117
119
127 int Compute();
128
130 bool IsComputed() const {return(IsComputed_);};
131
132 // Mathematical functions.
133
135
143 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
144
145 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
146
148 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
149 const int MaxIters = 1550,
150 const double Tol = 1e-9,
151 Epetra_RowMatrix* Matrix_in = 0);
152
154 double Condest() const
155 {
156 return(Condest_);
157 }
158
160
168 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
169
171 double NormInf() const {return(0.0);};
172
174 bool HasNormInf() const {return(false);};
175
177 bool UseTranspose() const {return(UseTranspose_);};
178
180 const Epetra_Map & OperatorDomainMap() const {return(A_.OperatorDomainMap());};
181
183 const Epetra_Map & OperatorRangeMap() const{return(A_.OperatorRangeMap());};
184
186 const Epetra_Comm & Comm() const{return(Comm_);};
187
190 {
191 return(A_);
192 }
193
195 const Epetra_CrsMatrix & L() const {return(*L_);};
196
198 const Epetra_CrsMatrix & U() const {return(*U_);};
199
201 const char* Label() const
202 {
203 return(Label_.c_str());
204 }
205
207 int SetLabel(const char* Label_in)
208 {
209 Label_ = Label_in;
210 return(0);
211 }
212
214 virtual std::ostream& Print(std::ostream& os) const;
215
217 virtual int NumInitialize() const
218 {
219 return(NumInitialize_);
220 }
221
223 virtual int NumCompute() const
224 {
225 return(NumCompute_);
226 }
227
229 virtual int NumApplyInverse() const
230 {
231 return(NumApplyInverse_);
232 }
233
235 virtual double InitializeTime() const
236 {
237 return(InitializeTime_);
238 }
239
241 virtual double ComputeTime() const
242 {
243 return(ComputeTime_);
244 }
245
247 virtual double ApplyInverseTime() const
248 {
249 return(ApplyInverseTime_);
250 }
251
253 virtual double InitializeFlops() const
254 {
255 return(0.0);
256 }
257
258 virtual double ComputeFlops() const
259 {
260 return(ComputeFlops_);
261 }
262
263 virtual double ApplyInverseFlops() const
264 {
265 return(ApplyInverseFlops_);
266 }
267
268 inline double LevelOfFill() const {
269 return(LevelOfFill_);
270 }
271
273 inline double RelaxValue() const {
274 return(Relax_);
275 }
276
278 inline double AbsoluteThreshold() const
279 {
280 return(Athresh_);
281 }
282
284 inline double RelativeThreshold() const
285 {
286 return(Rthresh_);
287 }
288
290 inline double DropTolerance() const
291 {
292 return(DropTolerance_);
293 }
294
296#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
297 int NumGlobalNonzeros() const {
298 // FIXME: diagonal of L_ should not be stored
299 return(L().NumGlobalNonzeros() + U().NumGlobalNonzeros() - L().NumGlobalRows());
300 }
301#endif
302 long long NumGlobalNonzeros64() const {
303 // FIXME: diagonal of L_ should not be stored
304 return(L().NumGlobalNonzeros64() + U().NumGlobalNonzeros64() - L().NumGlobalRows64());
305 }
306
308 int NumMyNonzeros() const {
309 return(L().NumMyNonzeros() + U().NumMyNonzeros());
310 }
311
312private:
313
314 // @}
315 // @{ Internal methods
316
319 A_(RHS.Matrix()),
320 Comm_(RHS.Comm()),
321 Time_(Comm())
322 {};
323
326 {
327 return(*this);
328 }
329
330 template<typename int_type>
331 int TCompute();
332
334 void Destroy();
335
336 // @}
337 // @{ Internal data
338
344 Teuchos::RefCountPtr<Epetra_CrsMatrix> L_;
346 Teuchos::RefCountPtr<Epetra_CrsMatrix> U_;
348 double Condest_;
350 double Relax_;
352 double Athresh_;
354 double Rthresh_;
360 std::string Label_;
374 mutable int NumApplyInverse_;
380 mutable double ApplyInverseTime_;
384 mutable double ApplyInverseFlops_;
389 Teuchos::RefCountPtr<Epetra_SerialComm> SerialComm_;
390 Teuchos::RefCountPtr<Epetra_Map> SerialMap_;
391}; // Ifpack_ILUT
392
393#endif /* IFPACK_ILUT_H */
Ifpack_CondestType
Ifpack_CondestType: enum to define the type of condition number estimate.
@ Ifpack_Cheap
cheap estimate
Ifpack_ScalingType enumerable type.
#define RHS(a)
Definition: MatGenFD.c:60
virtual const Epetra_Map & OperatorDomainMap() const=0
virtual const Epetra_Map & OperatorRangeMap() const=0
Ifpack_ILUT: A class for constructing and using an incomplete LU factorization of a given Epetra_RowM...
Definition: Ifpack_ILUT.h:81
int NumGlobalNonzeros() const
Returns the number of nonzero entries in the global graph.
Definition: Ifpack_ILUT.h:297
int Compute()
Compute IC factor U using the specified graph, diagonal perturbation thresholds and relaxation parame...
double RelativeThreshold() const
Get relative threshold value.
Definition: Ifpack_ILUT.h:284
int SetParameters(Teuchos::ParameterList &parameterlis)
Set parameters using a Teuchos::ParameterList object.
double LevelOfFill_
Level-of-fill.
Definition: Ifpack_ILUT.h:356
double Condest() const
Returns the computed estimated condition number, or -1.0 if no computed.
Definition: Ifpack_ILUT.h:154
bool IsInitialized_
true if this object has been initialized
Definition: Ifpack_ILUT.h:362
double Athresh_
Absolute threshold.
Definition: Ifpack_ILUT.h:352
int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
virtual double InitializeTime() const
Returns the time spent in Initialize().
Definition: Ifpack_ILUT.h:235
double DropTolerance() const
Gets the dropping tolerance.
Definition: Ifpack_ILUT.h:290
const Epetra_RowMatrix & A_
reference to the matrix to be preconditioned.
Definition: Ifpack_ILUT.h:340
int NumApplyInverse_
Contains the number of successful call to ApplyInverse().
Definition: Ifpack_ILUT.h:374
const Epetra_Comm & Comm_
Reference to the communicator object.
Definition: Ifpack_ILUT.h:342
double NormInf() const
Returns 0.0 because this class cannot compute Inf-norm.
Definition: Ifpack_ILUT.h:171
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Ifpack_ILUT forward/back solve on a Epetra_MultiVector X in Y.
int SetLabel(const char *Label_in)
Sets the label for this object.
Definition: Ifpack_ILUT.h:207
double RelaxValue() const
Set relative threshold value.
Definition: Ifpack_ILUT.h:273
Ifpack_ILUT(const Ifpack_ILUT &RHS)
Copy constructor (should never be used)
Definition: Ifpack_ILUT.h:318
virtual int NumCompute() const
Returns the number of calls to Compute().
Definition: Ifpack_ILUT.h:223
Teuchos::RefCountPtr< Epetra_Map > SerialMap_
Definition: Ifpack_ILUT.h:390
const Epetra_CrsMatrix & L() const
Returns a reference to the L factor.
Definition: Ifpack_ILUT.h:195
const Epetra_CrsMatrix & U() const
Returns a reference to the U factor.
Definition: Ifpack_ILUT.h:198
virtual int NumApplyInverse() const
Returns the number of calls to ApplyInverse().
Definition: Ifpack_ILUT.h:229
Teuchos::RefCountPtr< Epetra_SerialComm > SerialComm_
Definition: Ifpack_ILUT.h:389
double DropTolerance_
Discards all elements below this tolerance.
Definition: Ifpack_ILUT.h:358
double ApplyInverseFlops_
Contain sthe number of flops for ApplyInverse().
Definition: Ifpack_ILUT.h:384
virtual std::ostream & Print(std::ostream &os) const
Prints basic information on iostream. This function is used by operator<<.
bool IsInitialized() const
Returns true if the preconditioner has been successfully initialized.
Definition: Ifpack_ILUT.h:113
const char * Label() const
Returns the label of this object.
Definition: Ifpack_ILUT.h:201
bool HasNormInf() const
Returns false because this class cannot compute an Inf-norm.
Definition: Ifpack_ILUT.h:174
virtual double ComputeFlops() const
Returns the number of flops in the computation phase.
Definition: Ifpack_ILUT.h:258
Teuchos::RefCountPtr< Epetra_CrsMatrix > U_
U factor.
Definition: Ifpack_ILUT.h:346
long long NumGlobalNonzeros64() const
Definition: Ifpack_ILUT.h:302
double ComputeTime_
Contains the time for all successful calls to Compute().
Definition: Ifpack_ILUT.h:378
virtual int NumInitialize() const
Returns the number of calls to Initialize().
Definition: Ifpack_ILUT.h:217
int NumMyRows_
Number of local rows.
Definition: Ifpack_ILUT.h:368
double ApplyInverseTime_
Contains the time for all successful calls to ApplyInverse().
Definition: Ifpack_ILUT.h:380
int Initialize()
Initialize L and U with values from user matrix A.
virtual double ComputeTime() const
Returns the time spent in Compute().
Definition: Ifpack_ILUT.h:241
const Epetra_Comm & Comm() const
Returns the Epetra_BlockMap object associated with the range of this matrix operator.
Definition: Ifpack_ILUT.h:186
void Destroy()
Releases all allocated memory.
virtual ~Ifpack_ILUT()
Ifpack_ILUT Destructor.
Definition: Ifpack_ILUT.cpp:94
double ComputeFlops_
Contains the number of flops for Compute().
Definition: Ifpack_ILUT.h:382
double Relax_
relaxation value
Definition: Ifpack_ILUT.h:350
int SetUseTranspose(bool UseTranspose_in)
If set true, transpose of this operator will be applied.
Definition: Ifpack_ILUT.h:168
int NumInitialize_
Contains the number of successful calls to Initialize().
Definition: Ifpack_ILUT.h:370
virtual double ApplyInverseTime() const
Returns the time spent in ApplyInverse().
Definition: Ifpack_ILUT.h:247
double Condest_
Condition number estimate.
Definition: Ifpack_ILUT.h:348
double InitializeTime_
Contains the time for all successful calls to Initialize().
Definition: Ifpack_ILUT.h:376
Ifpack_ILUT & operator=(const Ifpack_ILUT &)
operator= (should never be used)
Definition: Ifpack_ILUT.h:325
int NumCompute_
Contains the number of successful call to Compute().
Definition: Ifpack_ILUT.h:372
int NumMyNonzeros() const
Returns the number of nonzero entries in the local graph.
Definition: Ifpack_ILUT.h:308
bool IsComputed() const
If factor is completed, this query returns true, otherwise it returns false.
Definition: Ifpack_ILUT.h:130
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this operator.
Definition: Ifpack_ILUT.h:183
long long GlobalNonzeros_
Global number of nonzeros in L and U factors.
Definition: Ifpack_ILUT.h:388
double LevelOfFill() const
Definition: Ifpack_ILUT.h:268
virtual double InitializeFlops() const
Returns the number of flops in the initialization phase.
Definition: Ifpack_ILUT.h:253
bool UseTranspose() const
Returns the current UseTranspose setting.
Definition: Ifpack_ILUT.h:177
Epetra_Time Time_
Used for timing purposed.
Definition: Ifpack_ILUT.h:386
double Rthresh_
Relative threshold.
Definition: Ifpack_ILUT.h:354
bool IsComputed_
true if this object has been computed
Definition: Ifpack_ILUT.h:364
virtual double ApplyInverseFlops() const
Returns the number of flops in the application of the preconditioner.
Definition: Ifpack_ILUT.h:263
Teuchos::RefCountPtr< Epetra_CrsMatrix > L_
L factor.
Definition: Ifpack_ILUT.h:344
const Epetra_RowMatrix & Matrix() const
Returns a reference to the matrix to be preconditioned.
Definition: Ifpack_ILUT.h:189
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
Definition: Ifpack_ILUT.h:180
bool UseTranspose_
true if transpose has to be used.
Definition: Ifpack_ILUT.h:366
std::string Label_
Label for this object.
Definition: Ifpack_ILUT.h:360
double AbsoluteThreshold() const
Get absolute threshold value.
Definition: Ifpack_ILUT.h:278
Ifpack_Preconditioner: basic class for preconditioning in Ifpack.