IFPACK  Development
Ifpack_ReorderFilter.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_REORDERFILTER_H
44 #define IFPACK_REORDERFILTER_H
45 
46 #include "Ifpack_ConfigDefs.h"
47 #include "Epetra_RowMatrix.h"
48 #include "Teuchos_RefCountPtr.hpp"
49 
50 class Epetra_Comm;
51 class Epetra_Map;
52 class Epetra_MultiVector;
53 class Epetra_Import;
54 class Epetra_BlockMap;
55 class Ifpack_Reordering;
56 
58 
81 class Ifpack_ReorderFilter : public virtual Epetra_RowMatrix {
82 
83 public:
84  // Constructor.
85  Ifpack_ReorderFilter(const Teuchos::RefCountPtr<Epetra_RowMatrix>& Matrix_in,
86  const Teuchos::RefCountPtr<Ifpack_Reordering>& Reordering_in);
87 
90 
92  virtual ~Ifpack_ReorderFilter() {};
93 
96 
98  virtual inline int NumMyRowEntries(int MyRow, int & NumEntries) const
99  {
100  return(Matrix()->NumMyRowEntries(MyRow, NumEntries));
101  }
102 
104  virtual int MaxNumEntries() const
105  {
106  return(MaxNumEntries_);
107  }
108 
109  // Extracts a copy of the given row for the reordered matrix.
110  virtual int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const;
111 
113  virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const;
114 
116  virtual int Multiply(bool TransA, const Epetra_MultiVector& X,
117  Epetra_MultiVector& Y) const;
118 
120  virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal,
121  const Epetra_MultiVector& X,
122  Epetra_MultiVector& Y) const;
123 
125  virtual int Apply(const Epetra_MultiVector& X,
126  Epetra_MultiVector& Y) const;
127 
129  virtual int ApplyInverse(const Epetra_MultiVector& X,
130  Epetra_MultiVector& Y) const
131  {
132  return(-1);
133  }
134 
136  virtual int InvRowSums(Epetra_Vector& x) const
137  {
138  return(-1);
139  }
140 
142  virtual int LeftScale(const Epetra_Vector& x)
143  {
144  return(-1);
145  }
146 
148  virtual int InvColSums(Epetra_Vector& x) const
149  {
150  return(-1);
151  }
152 
154  virtual int RightScale(const Epetra_Vector& x)
155  {
156  return(-1);
157  }
158 
160  virtual bool Filled() const
161  {
162  return(Matrix()->Filled());
163  }
164 
166  virtual double NormInf() const
167  {
168  return(-1.0);
169  }
170 
172  virtual double NormOne() const
173  {
174  return(-1.0);
175  }
176 
177 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
178 
180  virtual int NumGlobalNonzeros() const
181  {
182  return(Matrix()->NumGlobalNonzeros());
183  }
184 
186  virtual int NumGlobalRows() const
187  {
188  return(Matrix()->NumGlobalRows());
189  }
190 
192  virtual int NumGlobalCols() const
193  {
194  return(Matrix()->NumGlobalCols());
195  }
196 
198  virtual int NumGlobalDiagonals() const
199  {
200  return(Matrix()->NumGlobalDiagonals());
201  }
202 #endif
203 
205  virtual long long NumGlobalNonzeros64() const
206  {
207  return(Matrix()->NumGlobalNonzeros64());
208  }
209 
211  virtual long long NumGlobalRows64() const
212  {
213  return(Matrix()->NumGlobalRows64());
214  }
215 
217  virtual long long NumGlobalCols64() const
218  {
219  return(Matrix()->NumGlobalCols64());
220  }
221 
223  virtual long long NumGlobalDiagonals64() const
224  {
225  return(Matrix()->NumGlobalDiagonals64());
226  }
227 
229  virtual int NumMyNonzeros() const
230  {
231  return(Matrix()->NumMyNonzeros());
232  }
233 
235  virtual int NumMyRows() const
236  {
237  return(Matrix()->NumMyRows());
238  }
239 
241  virtual int NumMyCols() const
242  {
243  return(Matrix()->NumMyCols());
244  }
245 
247  virtual int NumMyDiagonals() const
248  {
249  return(Matrix()->NumMyDiagonals());
250  }
251 
253  virtual bool LowerTriangular() const
254  {
255  return(false);
256  }
257 
259  virtual bool UpperTriangular() const
260  {
261  return(false);
262  }
263 
265  virtual const Epetra_Map & RowMatrixRowMap() const
266  {
267  return(Matrix()->RowMatrixRowMap());
268  }
269 
271  virtual const Epetra_Map & RowMatrixColMap() const
272  {
273  return(Matrix()->RowMatrixColMap());
274  }
275 
277  virtual const Epetra_Import * RowMatrixImporter() const
278  {
279  return(Matrix()->RowMatrixImporter());
280  }
281 
283  int SetUseTranspose(bool UseTranspose_in)
284  {
285  return(Matrix()->SetUseTranspose(UseTranspose_in));
286  }
287 
289  bool UseTranspose() const
290  {
291  return(Matrix()->UseTranspose());
292  }
293 
295  bool HasNormInf() const
296  {
297  return(true);
298  }
299 
301  const Epetra_Comm & Comm() const
302  {
303  return(Matrix()->Comm());
304  }
305 
307  const Epetra_Map & OperatorDomainMap() const
308  {
309  return(Matrix()->OperatorDomainMap());
310  }
311 
313  const Epetra_Map & OperatorRangeMap() const
314  {
315  return(Matrix()->OperatorRangeMap());
316  }
317 
319  const Epetra_BlockMap& Map() const
320  {
321  return(Matrix()->Map());
322  }
323 
325  const char* Label() const{
326  return(Label_);
327  }
328 
330  inline Teuchos::RefCountPtr<Epetra_RowMatrix> Matrix() const {
331  return(A_);
332  }
333 
335  inline Teuchos::RefCountPtr<Ifpack_Reordering> Reordering() const {
336  return(Reordering_);
337  }
338 
339 private:
340 
342  Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
344  Teuchos::RefCountPtr<Ifpack_Reordering> Reordering_;
345 
347  int NumMyRows_;
349  int MaxNumEntries_;
351  char Label_[80];
352 
353 };
354 
355 
356 #endif /* IFPACK_DROPFILTER_H */
Ifpack_ReorderFilter::NormOne
virtual double NormOne() const
Returns the 1-norm.
Definition: Ifpack_ReorderFilter.h:172
Ifpack_ReorderFilter::InvColSums
virtual int InvColSums(Epetra_Vector &x) const
Inverse of column sums (not implemented).
Definition: Ifpack_ReorderFilter.h:148
Ifpack_ReorderFilter::RowMatrixRowMap
virtual const Epetra_Map & RowMatrixRowMap() const
Returns the row matrix of the non-reordered matrix.
Definition: Ifpack_ReorderFilter.h:265
Ifpack_ReorderFilter::Reordering
Teuchos::RefCountPtr< Ifpack_Reordering > Reordering() const
Returns a reference-counted pointer to the internally stored pointer to Ifpack_Reordering....
Definition: Ifpack_ReorderFilter.h:335
Ifpack_ReorderFilter::RightScale
virtual int RightScale(const Epetra_Vector &x)
Right scale of the matrix (not implemented).
Definition: Ifpack_ReorderFilter.h:154
Ifpack_ReorderFilter::NumMyNonzeros
virtual int NumMyNonzeros() const
Returns the number of local nonzero elements.
Definition: Ifpack_ReorderFilter.h:229
Ifpack_ReorderFilter::NumMyCols
virtual int NumMyCols() const
Returns the number of local columns.
Definition: Ifpack_ReorderFilter.h:241
Ifpack_ReorderFilter::HasNormInf
bool HasNormInf() const
Returns true if this matrix has the infinite norm.
Definition: Ifpack_ReorderFilter.h:295
Ifpack_ReorderFilter::UseTranspose
bool UseTranspose() const
Returns true if the transpose of this matrix is used.
Definition: Ifpack_ReorderFilter.h:289
Ifpack_ReorderFilter::RowMatrixImporter
virtual const Epetra_Import * RowMatrixImporter() const
Returns the importer of the non-reordered matrix.
Definition: Ifpack_ReorderFilter.h:277
Ifpack_ReorderFilter::NumGlobalNonzeros
virtual int NumGlobalNonzeros() const
Returns the number of global nonzero elements.
Definition: Ifpack_ReorderFilter.h:180
Ifpack_ReorderFilter::OperatorDomainMap
const Epetra_Map & OperatorDomainMap() const
Returns the operator domain map of the non-reordered matrix.
Definition: Ifpack_ReorderFilter.h:307
Ifpack_ReorderFilter::UpperTriangular
virtual bool UpperTriangular() const
Returns true is the reordered matrix is upper triangular.
Definition: Ifpack_ReorderFilter.h:259
Ifpack_Reordering
Ifpack_Reordering: basic class for reordering for a Ifpack_Graph object.
Definition: Ifpack_Reordering.h:101
Ifpack_ReorderFilter::Solve
virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Solve, not implemented.
Definition: Ifpack_ReorderFilter.cpp:140
Epetra_Comm
Ifpack_ReorderFilter::NumGlobalRows64
virtual long long NumGlobalRows64() const
Returns the number of global rows.
Definition: Ifpack_ReorderFilter.h:211
Ifpack_ReorderFilter::NormInf
virtual double NormInf() const
Returns the infinite-norm.
Definition: Ifpack_ReorderFilter.h:166
Ifpack_ReorderFilter::RowMatrixColMap
virtual const Epetra_Map & RowMatrixColMap() const
Returns the column matrix of the non-reordered matrix.
Definition: Ifpack_ReorderFilter.h:271
Ifpack_ReorderFilter::NumMyDiagonals
virtual int NumMyDiagonals() const
Returns the number of local diagonals.
Definition: Ifpack_ReorderFilter.h:247
Epetra_RowMatrix
Ifpack_ReorderFilter::NumMyRows
virtual int NumMyRows() const
Returns the number of local rows.
Definition: Ifpack_ReorderFilter.h:235
Ifpack_ReorderFilter::MaxNumEntries
virtual int MaxNumEntries() const
Returns maximum num entries.
Definition: Ifpack_ReorderFilter.h:104
Ifpack_ReorderFilter::NumGlobalDiagonals64
virtual long long NumGlobalDiagonals64() const
Returns the number of global diagonals.
Definition: Ifpack_ReorderFilter.h:223
Ifpack_ReorderFilter::NumGlobalDiagonals
virtual int NumGlobalDiagonals() const
Returns the number of global diagonals.
Definition: Ifpack_ReorderFilter.h:198
Ifpack_ReorderFilter::Matrix
Teuchos::RefCountPtr< Epetra_RowMatrix > Matrix() const
Returns a reference-counted pointer to the internally stored pointer to Epetra_RowMatrix.
Definition: Ifpack_ReorderFilter.h:330
Ifpack_ReorderFilter::Apply
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Applies the reordered matrix to multi-vector X, returns the result in Y.
Definition: Ifpack_ReorderFilter.cpp:148
Ifpack_ReorderFilter::ExtractDiagonalCopy
virtual int ExtractDiagonalCopy(Epetra_Vector &Diagonal) const
Extracts a copy of the diagonal of the reordered matrix.
Definition: Ifpack_ReorderFilter.cpp:111
Ifpack_ReorderFilter::NumGlobalRows
virtual int NumGlobalRows() const
Returns the number of global rows.
Definition: Ifpack_ReorderFilter.h:186
Epetra_BlockMap
Epetra_Vector
Ifpack_ReorderFilter::NumGlobalCols
virtual int NumGlobalCols() const
Returns the number of global columns.
Definition: Ifpack_ReorderFilter.h:192
Ifpack_ReorderFilter::Comm
const Epetra_Comm & Comm() const
Returns the communicator.
Definition: Ifpack_ReorderFilter.h:301
Ifpack_ReorderFilter::Filled
virtual bool Filled() const
Returns true is the matrix called FillComplete().
Definition: Ifpack_ReorderFilter.h:160
Ifpack_ReorderFilter::SetUseTranspose
int SetUseTranspose(bool UseTranspose_in)
Sets the use of the transpose.
Definition: Ifpack_ReorderFilter.h:283
Ifpack_ReorderFilter::OperatorRangeMap
const Epetra_Map & OperatorRangeMap() const
Returns the operator domain range of the non-reordered matrix.
Definition: Ifpack_ReorderFilter.h:313
Ifpack_ReorderFilter
Ifpack_ReorderFilter: a class for light-weight reorder of local rows and columns of an Epetra_RowMatr...
Definition: Ifpack_ReorderFilter.h:81
Epetra_MultiVector
Ifpack_ReorderFilter::Label
const char * Label() const
Returns the label of this object.
Definition: Ifpack_ReorderFilter.h:325
Ifpack_ReorderFilter::NumGlobalNonzeros64
virtual long long NumGlobalNonzeros64() const
Returns the number of global nonzero elements.
Definition: Ifpack_ReorderFilter.h:205
Ifpack_ReorderFilter::~Ifpack_ReorderFilter
virtual ~Ifpack_ReorderFilter()
Destructor.
Definition: Ifpack_ReorderFilter.h:92
Ifpack_ReorderFilter::NumMyRowEntries
virtual int NumMyRowEntries(int MyRow, int &NumEntries) const
Returns the number of local row entries.
Definition: Ifpack_ReorderFilter.h:98
Ifpack_ReorderFilter::Multiply
virtual int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Multiplies multi-vector X with the reordered matrix, returns result in Y.
Definition: Ifpack_ReorderFilter.cpp:121
Ifpack_ReorderFilter::Map
const Epetra_BlockMap & Map() const
Returns the map of the non-reordered matrix.
Definition: Ifpack_ReorderFilter.h:319
Ifpack_ReorderFilter::LeftScale
virtual int LeftScale(const Epetra_Vector &x)
Left scale of the matrix (not implemented).
Definition: Ifpack_ReorderFilter.h:142
Ifpack_ReorderFilter::LowerTriangular
virtual bool LowerTriangular() const
Returns true is the reordered matrix is lower triangular.
Definition: Ifpack_ReorderFilter.h:253
Ifpack_ReorderFilter::NumGlobalCols64
virtual long long NumGlobalCols64() const
Returns the number of global columns.
Definition: Ifpack_ReorderFilter.h:217
Ifpack_ReorderFilter::ApplyInverse
virtual int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Applies the inverse of this operator (not implemented).
Definition: Ifpack_ReorderFilter.h:129
Epetra_Map
Epetra_Import
Ifpack_ReorderFilter::InvRowSums
virtual int InvRowSums(Epetra_Vector &x) const
Inverse of row sums (not implemented).
Definition: Ifpack_ReorderFilter.h:136
Ifpack_ReorderFilter::operator=
Ifpack_ReorderFilter & operator=(const Ifpack_ReorderFilter &RHS)
Operator assignment.
Definition: Ifpack_ReorderFilter.cpp:75