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