Ifpack Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Ifpack_DropFilter.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_DROPFILTER_H
44 #define IFPACK_DROPFILTER_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_RowMatrix.h"
54 #include "Teuchos_RefCountPtr.hpp"
55 
56 class Epetra_Comm;
57 class Epetra_Map;
58 class Epetra_MultiVector;
59 class Epetra_Import;
60 class Epetra_BlockMap;
61 
63 
87 class Ifpack_DropFilter : public virtual Epetra_RowMatrix {
88 
89 public:
91  Ifpack_DropFilter(const Teuchos::RefCountPtr<Epetra_RowMatrix>& Matrix,
92  double DropTol);
93 
95  virtual ~Ifpack_DropFilter() {};
96 
98  virtual inline int NumMyRowEntries(int MyRow, int & NumEntries) const
99  {
100  NumEntries = NumEntries_[MyRow];
101  return(0);
102  }
103 
105  virtual int MaxNumEntries() const
106  {
107  return(MaxNumEntries_);
108  }
109 
110  virtual int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const;
111 
112  virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const;
113 
114  virtual int Multiply(bool TransA, const Epetra_MultiVector& X,
115  Epetra_MultiVector& Y) const;
116 
117  virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal,
118  const Epetra_MultiVector& X,
119  Epetra_MultiVector& Y) const;
120 
121  virtual int Apply(const Epetra_MultiVector& X,
122  Epetra_MultiVector& Y) const;
123 
124  virtual int ApplyInverse(const Epetra_MultiVector& X,
125  Epetra_MultiVector& Y) const;
126 
127  virtual int InvRowSums(Epetra_Vector& x) const;
128 
129  virtual int LeftScale(const Epetra_Vector& x)
130  {
131  return(A_->LeftScale(x));
132  }
133 
134  virtual int InvColSums(Epetra_Vector& x) const;
135 
136  virtual int RightScale(const Epetra_Vector& x)
137  {
138  return(A_->RightScale(x));
139  }
140 
141  virtual bool Filled() const
142  {
143  return(A_->Filled());
144  }
145 
146  virtual double NormInf() const
147  {
148  return(-1.0);
149  }
150 
151  virtual double NormOne() const
152  {
153  return(-1.0);
154  }
155 
156 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
157  virtual int NumGlobalNonzeros() const
158  {
159  return(NumNonzeros_);
160  }
161 
162  virtual int NumGlobalRows() const
163  {
164  return(NumRows_);
165  }
166 
167  virtual int NumGlobalCols() const
168  {
169  return(NumRows_);
170  }
171 
172  virtual int NumGlobalDiagonals() const
173  {
174  return(NumRows_);
175  }
176 #endif
177 
178  virtual long long NumGlobalNonzeros64() const
179  {
180  return(NumNonzeros_);
181  }
182 
183  virtual long long NumGlobalRows64() const
184  {
185  return(NumRows_);
186  }
187 
188  virtual long long NumGlobalCols64() const
189  {
190  return(NumRows_);
191  }
192 
193  virtual long long NumGlobalDiagonals64() const
194  {
195  return(NumRows_);
196  }
197 
198  virtual int NumMyNonzeros() const
199  {
200  return(NumNonzeros_);
201  }
202 
203  virtual int NumMyRows() const
204  {
205  return(NumRows_);
206  }
207 
208  virtual int NumMyCols() const
209  {
210  return(NumRows_);
211  }
212 
213  virtual int NumMyDiagonals() const
214  {
215  return(NumRows_);
216  }
217 
218  virtual bool LowerTriangular() const
219  {
220  return(false);
221  }
222 
223  virtual bool UpperTriangular() const
224  {
225  return(false);
226  }
227 
228  virtual const Epetra_Map & RowMatrixRowMap() const
229  {
230  return(A_->RowMatrixRowMap());
231  }
232 
233  virtual const Epetra_Map & RowMatrixColMap() const
234  {
235  return(A_->RowMatrixColMap());
236  }
237 
238  virtual const Epetra_Import * RowMatrixImporter() const
239  {
240  return(A_->RowMatrixImporter());
241  }
242 
243  int SetUseTranspose(bool useTranspose)
244  {
245  return(A_->SetUseTranspose(useTranspose));
246  }
247 
248  bool UseTranspose() const
249  {
250  return(A_->UseTranspose());
251  }
252 
253  bool HasNormInf() const
254  {
255  return(false);
256  }
257 
258  const Epetra_Comm & Comm() const
259  {
260  return(A_->Comm());
261  }
262 
264  {
265  return(A_->OperatorDomainMap());
266  }
267 
268  const Epetra_Map & OperatorRangeMap() const
269  {
270  return(A_->OperatorRangeMap());
271  }
272 
273  const Epetra_BlockMap& Map() const
274  {
275  return(A_->Map());
276  }
277 
278  const char* Label() const{
279  return(Label_);
280  }
281 
282 private:
283 
285  Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
287  double DropTol_;
291  int NumRows_;
292 
295 
297  mutable std::vector<int> Indices_;
299  mutable std::vector<double> Values_;
301  char Label_[80];
302  std::vector<int> NumEntries_;
303 
304 };
305 
306 
307 #endif /* IFPACK_DROPFILTER_H */
virtual int InvColSums(Epetra_Vector &x) const
virtual bool Filled() const
virtual int NumMyDiagonals() const
virtual double NormInf() const
const Epetra_Map & OperatorRangeMap() const
virtual int MaxNumEntries() const
Returns the maximum number of entries.
const char * Label() const
const Epetra_BlockMap & Map() const
virtual int NumMyCols() const
virtual long long NumGlobalCols64() const
virtual const Epetra_Map & RowMatrixColMap() const
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
virtual int RightScale(const Epetra_Vector &x)
double DropTol_
Drop tolerance.
virtual bool LowerTriangular() const
Teuchos::RefCountPtr< Epetra_RowMatrix > A_
Pointer to the matrix to be preconditioned.
virtual int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const
virtual int NumGlobalCols() const
virtual const Epetra_Map & RowMatrixRowMap() const
Ifpack_DropFilter: Filter based on matrix entries.
virtual int NumMyNonzeros() const
virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
virtual int NumMyRowEntries(int MyRow, int &NumEntries) const
Returns the number of entries in MyRow.
virtual int NumGlobalNonzeros() const
virtual int LeftScale(const Epetra_Vector &x)
char Label_[80]
Label for this object.
virtual long long NumGlobalNonzeros64() const
virtual int NumMyRows() const
virtual int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
virtual double NormOne() const
virtual int InvRowSums(Epetra_Vector &x) const
int SetUseTranspose(bool useTranspose)
const Epetra_Comm & Comm() const
const Epetra_Map & OperatorDomainMap() const
int NumNonzeros_
Number of nonzeros for the dropped matrix.
bool HasNormInf() const
virtual int NumGlobalRows() const
int MaxNumEntries_
Maximum entries in each row.
std::vector< double > Values_
Used in ExtractMyRowCopy, to avoid allocation each time.
virtual long long NumGlobalRows64() const
virtual const Epetra_Import * RowMatrixImporter() const
virtual ~Ifpack_DropFilter()
Destructor.
virtual int NumGlobalDiagonals() const
virtual int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
virtual int ExtractDiagonalCopy(Epetra_Vector &Diagonal) const
virtual long long NumGlobalDiagonals64() const
std::vector< int > NumEntries_
virtual bool UpperTriangular() const
Ifpack_DropFilter(const Teuchos::RefCountPtr< Epetra_RowMatrix > &Matrix, double DropTol)
Constructor.
std::vector< int > Indices_
Used in ExtractMyRowCopy, to avoid allocation each time.
bool UseTranspose() const