IFPACK Development
Loading...
Searching...
No Matches
Ifpack_DropFilter.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_DROPFILTER_H
44#define IFPACK_DROPFILTER_H
45
46#include "Ifpack_ConfigDefs.h"
47#include "Epetra_RowMatrix.h"
48#include "Teuchos_RefCountPtr.hpp"
49
50class Epetra_Comm;
51class Epetra_Map;
53class Epetra_Import;
54class Epetra_BlockMap;
55
57
81class Ifpack_DropFilter : public virtual Epetra_RowMatrix {
82
83public:
85 Ifpack_DropFilter(const Teuchos::RefCountPtr<Epetra_RowMatrix>& Matrix,
86 double DropTol);
87
89 virtual ~Ifpack_DropFilter() {};
90
92 virtual inline int NumMyRowEntries(int MyRow, int & NumEntries) const
93 {
94 NumEntries = NumEntries_[MyRow];
95 return(0);
96 }
97
99 virtual int MaxNumEntries() const
100 {
101 return(MaxNumEntries_);
102 }
103
104 virtual int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const;
105
106 virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const;
107
108 virtual int Multiply(bool TransA, const Epetra_MultiVector& X,
109 Epetra_MultiVector& Y) const;
110
111 virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal,
112 const Epetra_MultiVector& X,
113 Epetra_MultiVector& Y) const;
114
115 virtual int Apply(const Epetra_MultiVector& X,
116 Epetra_MultiVector& Y) const;
117
118 virtual int ApplyInverse(const Epetra_MultiVector& X,
119 Epetra_MultiVector& Y) const;
120
121 virtual int InvRowSums(Epetra_Vector& x) const;
122
123 virtual int LeftScale(const Epetra_Vector& x)
124 {
125 return(A_->LeftScale(x));
126 }
127
128 virtual int InvColSums(Epetra_Vector& x) const;
129
130 virtual int RightScale(const Epetra_Vector& x)
131 {
132 return(A_->RightScale(x));
133 }
134
135 virtual bool Filled() const
136 {
137 return(A_->Filled());
138 }
139
140 virtual double NormInf() const
141 {
142 return(-1.0);
143 }
144
145 virtual double NormOne() const
146 {
147 return(-1.0);
148 }
149
150#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
151 virtual int NumGlobalNonzeros() const
152 {
153 return(NumNonzeros_);
154 }
155
156 virtual int NumGlobalRows() const
157 {
158 return(NumRows_);
159 }
160
161 virtual int NumGlobalCols() const
162 {
163 return(NumRows_);
164 }
165
166 virtual int NumGlobalDiagonals() const
167 {
168 return(NumRows_);
169 }
170#endif
171
172 virtual long long NumGlobalNonzeros64() const
173 {
174 return(NumNonzeros_);
175 }
176
177 virtual long long NumGlobalRows64() const
178 {
179 return(NumRows_);
180 }
181
182 virtual long long NumGlobalCols64() const
183 {
184 return(NumRows_);
185 }
186
187 virtual long long NumGlobalDiagonals64() const
188 {
189 return(NumRows_);
190 }
191
192 virtual int NumMyNonzeros() const
193 {
194 return(NumNonzeros_);
195 }
196
197 virtual int NumMyRows() const
198 {
199 return(NumRows_);
200 }
201
202 virtual int NumMyCols() const
203 {
204 return(NumRows_);
205 }
206
207 virtual int NumMyDiagonals() const
208 {
209 return(NumRows_);
210 }
211
212 virtual bool LowerTriangular() const
213 {
214 return(false);
215 }
216
217 virtual bool UpperTriangular() const
218 {
219 return(false);
220 }
221
222 virtual const Epetra_Map & RowMatrixRowMap() const
223 {
224 return(A_->RowMatrixRowMap());
225 }
226
227 virtual const Epetra_Map & RowMatrixColMap() const
228 {
229 return(A_->RowMatrixColMap());
230 }
231
232 virtual const Epetra_Import * RowMatrixImporter() const
233 {
234 return(A_->RowMatrixImporter());
235 }
236
237 int SetUseTranspose(bool useTranspose)
238 {
239 return(A_->SetUseTranspose(useTranspose));
240 }
241
242 bool UseTranspose() const
243 {
244 return(A_->UseTranspose());
245 }
246
247 bool HasNormInf() const
248 {
249 return(false);
250 }
251
252 const Epetra_Comm & Comm() const
253 {
254 return(A_->Comm());
255 }
256
257 const Epetra_Map & OperatorDomainMap() const
258 {
259 return(A_->OperatorDomainMap());
260 }
261
262 const Epetra_Map & OperatorRangeMap() const
263 {
264 return(A_->OperatorRangeMap());
265 }
266
267 const Epetra_BlockMap& Map() const
268 {
269 return(A_->Map());
270 }
271
272 const char* Label() const{
273 return(Label_);
274 }
275
276private:
277
279 Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
281 double DropTol_;
283 int MaxNumEntries_;
284 int MaxNumEntriesA_;
285 int NumRows_;
286
288 int NumNonzeros_;
289
291 mutable std::vector<int> Indices_;
293 mutable std::vector<double> Values_;
295 char Label_[80];
296 std::vector<int> NumEntries_;
297
298};
299
300
301#endif /* IFPACK_DROPFILTER_H */
Ifpack_DropFilter: Filter based on matrix entries.
virtual ~Ifpack_DropFilter()
Destructor.
virtual int NumMyRowEntries(int MyRow, int &NumEntries) const
Returns the number of entries in MyRow.
virtual int MaxNumEntries() const
Returns the maximum number of entries.