IFPACK Development
Loading...
Searching...
No Matches
Ifpack_DiagonalFilter.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_DIAGONALFILTER_H
44#define IFPACK_DIAGONALFILTER_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 "Epetra_ConfigDefs.h"
54#include "Epetra_RowMatrix.h"
55#include "Epetra_Time.h"
56#include "Teuchos_RefCountPtr.hpp"
57
58class Epetra_Comm;
59class Epetra_Map;
61class Epetra_Import;
62class Epetra_BlockMap;
63
65
87
88public:
90 Ifpack_DiagonalFilter(const Teuchos::RefCountPtr<Epetra_RowMatrix>& Matrix,
91 double AbsoluteThreshold,
92 double RelativeThreshold);
93
96
98 virtual int NumMyRowEntries(int MyRow, int& NumEntries) const
99 {
100 return(A_->NumMyRowEntries(MyRow, NumEntries));
101 }
102
104 virtual int MaxNumEntries() const
105 {
106 return(A_->MaxNumEntries());
107 }
108
109 inline virtual int ExtractMyRowCopy(int MyRow, int Length, int& NumEntries,
110 double* Values, int* Indices) const;
111
112 virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const
113 {
114 int ierr = A_->ExtractDiagonalCopy(Diagonal);
115 IFPACK_RETURN(ierr);
116 }
117
118 virtual int Multiply(bool TransA, const Epetra_MultiVector& X,
119 Epetra_MultiVector& Y) const;
120
121 virtual int Solve(bool /* Upper */, bool /* Trans */, bool /* UnitDiagonal */,
122 const Epetra_MultiVector& /* X */,
123 Epetra_MultiVector& /* Y */) const
124 {
125 IFPACK_CHK_ERR(-1);
126 }
127
128 virtual int Apply(const Epetra_MultiVector& X,
129 Epetra_MultiVector& Y) const
130 {
131 int ierr = Multiply(UseTranspose(),X,Y);
132 IFPACK_RETURN(ierr);
133 }
134
135 virtual int ApplyInverse(const Epetra_MultiVector& /* X */,
136 Epetra_MultiVector& /* Y */) const
137 {
138 IFPACK_CHK_ERR(-1);
139 }
140
141 virtual int InvRowSums(Epetra_Vector& /* x */) const
142 {
143 IFPACK_CHK_ERR(-1);
144 }
145
146 virtual int LeftScale(const Epetra_Vector& x)
147 {
148 return(A_->LeftScale(x));
149 }
150
151 virtual int InvColSums(Epetra_Vector& /* x */) const
152 {
153 IFPACK_CHK_ERR(-1);;
154 }
155
156 virtual int RightScale(const Epetra_Vector& x)
157 {
158 return(A_->RightScale(x));
159 }
160
161 virtual bool Filled() const
162 {
163 return(A_->Filled());
164 }
165
167 virtual double NormInf() const
168 {
169 return(-1.0);
170 }
171
173 virtual double NormOne() const
174 {
175 return(-1.0);
176 }
177
178#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
179 virtual int NumGlobalNonzeros() const
180 {
181 return(A_->NumGlobalNonzeros());
182 }
183
184 virtual int NumGlobalRows() const
185 {
186 return(A_->NumGlobalRows());
187 }
188
189 virtual int NumGlobalCols() const
190 {
191 return(A_->NumGlobalCols());
192 }
193
194 virtual int NumGlobalDiagonals() const
195 {
196 return(A_->NumGlobalDiagonals());
197 }
198#endif
199
200 virtual long long NumGlobalNonzeros64() const
201 {
202 return(A_->NumGlobalNonzeros64());
203 }
204
205 virtual long long NumGlobalRows64() const
206 {
207 return(A_->NumGlobalRows64());
208 }
209
210 virtual long long NumGlobalCols64() const
211 {
212 return(A_->NumGlobalCols64());
213 }
214
215 virtual long long NumGlobalDiagonals64() const
216 {
217 return(A_->NumGlobalDiagonals64());
218 }
219
220 virtual int NumMyNonzeros() const
221 {
222 return(A_->NumMyNonzeros());
223 }
224
225 virtual int NumMyRows() const
226 {
227 return(A_->NumMyRows());
228 }
229
230 virtual int NumMyCols() const
231 {
232 return(A_->NumMyCols());
233 }
234
235 virtual int NumMyDiagonals() const
236 {
237 return(A_->NumMyDiagonals());
238 }
239
240 virtual bool LowerTriangular() const
241 {
242 return(A_->LowerTriangular());
243 }
244
245 virtual bool UpperTriangular() const
246 {
247 return(A_->UpperTriangular());
248 }
249
250 virtual const Epetra_Map& RowMatrixRowMap() const
251 {
252 return(A_->RowMatrixRowMap());
253 }
254
255 virtual const Epetra_Map& RowMatrixColMap() const
256 {
257 return(A_->RowMatrixColMap());
258 }
259
260 virtual const Epetra_Import* RowMatrixImporter() const
261 {
262 return(A_->RowMatrixImporter());
263 }
264
265 int SetUseTranspose(bool UseTranspose_in)
266 {
267 return(A_->SetUseTranspose(UseTranspose_in));
268 }
269
270 bool UseTranspose() const
271 {
272 return(A_->UseTranspose());
273 }
274
276 bool HasNormInf() const
277 {
278 return(false);
279 }
280
281 const Epetra_Comm& Comm() const
282 {
283 return(A_->Comm());
284 }
285
286 const Epetra_Map& OperatorDomainMap() const
287 {
288 return(A_->OperatorDomainMap());
289 }
290
291 const Epetra_Map& OperatorRangeMap() const
292 {
293 return(A_->OperatorRangeMap());
294 }
295
296 const Epetra_BlockMap& Map() const
297 {
298 return(A_->Map());
299 }
300
301 const char* Label() const{
302 return(A_->Label());
303 }
304
305private:
306
308 Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
310 double AbsoluteThreshold_;
312 double RelativeThreshold_;
314 std::vector<int> pos_;
316 std::vector<double> val_;
317
318};
319
320
321#endif /* IFPACK_DIAGONALFILTER_H */
Ifpack_DiagonalFilter: Filter to modify the diagonal entries of a given Epetra_RowMatrix.
virtual int NumMyRowEntries(int MyRow, int &NumEntries) const
Returns the number of entries in MyRow.
bool HasNormInf() const
Not implemented for efficiency reasons.
virtual double NormInf() const
Not implemented for efficiency reasons.
virtual ~Ifpack_DiagonalFilter()
Destructor.
virtual double NormOne() const
Not implemented for efficiency reasons.
virtual int MaxNumEntries() const
Returns the maximum number of entries.