IFPACK
Development
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Ifpack_HIPS.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_HIPS_H
44
#define IFPACK_HIPS_H
45
46
#include "Ifpack_ConfigDefs.h"
47
#ifdef HAVE_IFPACK_HIPS
48
49
50
#include "Ifpack_Preconditioner.h"
51
#include "Ifpack_Condest.h"
52
#include "
Ifpack_ScalingType.h
"
53
#include "Epetra_CompObject.h"
54
#include "Epetra_MultiVector.h"
55
#include "Epetra_Vector.h"
56
#include "Epetra_CrsGraph.h"
57
#include "Epetra_CrsMatrix.h"
58
#include "Epetra_BlockMap.h"
59
#include "Epetra_Map.h"
60
#include "Epetra_Object.h"
61
#include "Epetra_Comm.h"
62
#include "Epetra_CrsMatrix.h"
63
#include "Epetra_Time.h"
64
#include "Teuchos_RefCountPtr.hpp"
65
66
67
namespace
Teuchos {
68
class
ParameterList;
69
}
70
72
79
80
class
Ifpack_HIPS:
public
Ifpack_Preconditioner
{
81
82
public
:
83
// @{ Constructors and destructors.
85
Ifpack_HIPS(Epetra_RowMatrix* A);
86
88
~Ifpack_HIPS()
89
{
90
Destroy();
91
}
92
93
// @}
94
// @{ Construction methods
95
97
int
Initialize();
98
100
bool
IsInitialized()
const
101
{
102
return
(IsInitialized_);
103
}
104
106
108
int
Compute();
109
111
bool
IsComputed()
const
112
{
113
return
(IsComputed_);
114
}
115
117
/* This method is only available if the Teuchos package is enabled.
118
This method recognizes four parameter names: relax_value,
119
absolute_threshold, relative_threshold and overlap_mode. These names are
120
case insensitive, and in each case except overlap_mode, the ParameterEntry
121
must have type double. For overlap_mode, the ParameterEntry must have
122
type Epetra_CombineMode.
123
*/
124
int
SetParameters(Teuchos::ParameterList& parameterlist);
125
127
136
int
SetUseTranspose(
bool
UseTranspose_in) {UseTranspose_ = UseTranspose_in;
return
(0);};
137
// @}
138
139
// @{ Mathematical functions.
140
// Applies the matrix to X, returns the result in Y.
141
int
Apply(
const
Epetra_MultiVector& X,
142
Epetra_MultiVector& Y)
const
143
{
144
return
(Multiply(
false
,X,Y));
145
}
146
147
int
Multiply(
bool
Trans,
const
Epetra_MultiVector& X,
148
Epetra_MultiVector& Y)
const
{
return
A_->Multiply(Trans,X,Y);}
149
151
164
int
ApplyInverse(
const
Epetra_MultiVector& X, Epetra_MultiVector& Y)
const
;
165
167
double
Condest(
const
Ifpack_CondestType CT = Ifpack_Cheap,
168
const
int
MaxIters = 1550,
169
const
double
Tol = 1e-9,
170
Epetra_RowMatrix* Matrix_in = 0);
171
173
double
Condest()
const
174
{
175
return
(Condest_);
176
}
177
178
// @}
179
// @{ Query methods
180
182
const
char
* Label()
const
{
return
(Label_);}
183
185
int
SetLabel(
const
char
* Label_in)
186
{
187
strcpy(Label_,Label_in);
188
return
(0);
189
}
190
191
193
double
NormInf()
const
{
return
(0.0);};
194
196
bool
HasNormInf()
const
{
return
(
false
);};
197
199
bool
UseTranspose()
const
{
return
(UseTranspose_);};
200
202
const
Epetra_Map & OperatorDomainMap()
const
{
return
(A_->OperatorDomainMap());};
203
205
const
Epetra_Map & OperatorRangeMap()
const
{
return
(A_->OperatorRangeMap());};
206
208
const
Epetra_Comm & Comm()
const
{
return
(A_->Comm());};
209
211
const
Epetra_RowMatrix& Matrix()
const
212
{
213
return
(*A_);
214
}
215
217
virtual
std::ostream& Print(std::ostream& os)
const
;
218
220
virtual
int
NumInitialize()
const
221
{
222
return
(NumInitialize_);
223
}
224
226
virtual
int
NumCompute()
const
227
{
228
return
(NumCompute_);
229
}
230
232
virtual
int
NumApplyInverse()
const
233
{
234
return
(NumApplyInverse_);
235
}
236
238
virtual
double
InitializeTime()
const
239
{
240
return
(InitializeTime_);
241
}
242
244
virtual
double
ComputeTime()
const
245
{
246
return
(ComputeTime_);
247
}
248
250
virtual
double
ApplyInverseTime()
const
251
{
252
return
(ApplyInverseTime_);
253
}
254
256
virtual
double
InitializeFlops()
const
257
{
258
return
(0.0);
259
}
260
261
virtual
double
ComputeFlops()
const
262
{
263
return
(ComputeFlops_);
264
}
265
266
virtual
double
ApplyInverseFlops()
const
267
{
268
return
(ApplyInverseFlops_);
269
}
270
271
private
:
272
273
// @}
274
// @{ Private methods
275
277
Ifpack_HIPS(
const
Ifpack_HIPS& RHS) :
278
Time_(RHS.Comm())
279
{}
280
282
Ifpack_HIPS& operator=(
const
Ifpack_HIPS& RHS)
283
{
284
return
(*
this
);
285
}
286
288
void
Destroy();
289
291
301
int
Solve(
bool
Trans,
const
Epetra_MultiVector& X, Epetra_MultiVector& Y)
const
;
302
303
305
int
NumGlobalRows()
const
{
return
(A_->NumGlobalRows());};
306
308
int
NumGlobalCols()
const
{
return
(A_->NumGlobalCols());};
309
311
int
NumMyRows()
const
{
return
(A_->NumMyRows());};
312
314
int
NumMyCols()
const
{
return
(A_->NumMyCols());};
315
317
/* Epetra_RowMatrix& Matrix()
318
{
319
return(*A_);
320
}*/
321
322
// @}
323
// @{ Internal data
324
326
Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
327
Teuchos::ParameterList List_;
328
Teuchos::RefCountPtr<Epetra_Map> RowMap0_;
329
Teuchos::RefCountPtr<Epetra_Map> ColMap0_;
330
331
332
int
HIPS_id;
333
334
bool
UseTranspose_;
335
bool
Allocated_;
336
bool
ValuesInitialized_;
337
bool
Factored_;
338
339
double
Condest_;
340
341
bool
IsParallel_;
343
bool
IsInitialized_;
345
bool
IsComputed_;
347
char
Label_[160];
349
int
NumInitialize_;
351
int
NumCompute_;
352
354
mutable
int
NumApplyInverse_;
356
double
InitializeTime_;
358
double
ComputeTime_;
360
mutable
double
ApplyInverseTime_;
362
double
ComputeFlops_;
364
mutable
double
ApplyInverseFlops_;
366
mutable
Epetra_Time Time_;
367
368
};
369
370
#endif
371
#endif
/* IFPACK_HIPS_H */
Ifpack_ScalingType.h
Ifpack_ScalingType enumerable type.
Ifpack_Preconditioner
Ifpack_Preconditioner: basic class for preconditioning in Ifpack.
Definition
Ifpack_Preconditioner.h:136
Generated by
1.18.0