IFPACK  Development
 All Classes Namespaces Files Functions Variables Enumerations Friends Pages
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 */
int SetUseTranspose(bool UseTranspose_in)
Sets the use of the transpose.
virtual int NumGlobalRows() const
Returns the number of global rows.
virtual const Epetra_Map & RowMatrixRowMap() const
Returns the row matrix of the non-reordered matrix.
bool UseTranspose() const
Returns true if the transpose of this matrix is used.
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Applies the reordered matrix to multi-vector X, returns the result in Y.
virtual bool LowerTriangular() const
Returns true is the reordered matrix is lower triangular.
virtual bool UpperTriangular() const
Returns true is the reordered matrix is upper triangular.
virtual long long NumGlobalDiagonals64() const
Returns the number of global diagonals.
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.
virtual int NumMyRowEntries(int MyRow, int &NumEntries) const
Returns the number of local row entries.
virtual int NumMyCols() const
Returns the number of local columns.
virtual int InvColSums(Epetra_Vector &) const
Inverse of column sums (not implemented).
virtual int MaxNumEntries() const
Returns maximum num entries.
virtual const Epetra_Import * RowMatrixImporter() const
Returns the importer of the non-reordered matrix.
Ifpack_ReorderFilter & operator=(const Ifpack_ReorderFilter &RHS)
Operator assignment.
virtual int LeftScale(const Epetra_Vector &)
Left scale of the matrix (not implemented).
const Epetra_BlockMap & Map() const
Returns the map of the non-reordered matrix.
virtual bool Filled() const
Returns true is the matrix called FillComplete().
virtual int ApplyInverse(const Epetra_MultiVector &, Epetra_MultiVector &) const
Applies the inverse of this operator (not implemented).
virtual const Epetra_Map & RowMatrixColMap() const
Returns the column matrix of the non-reordered matrix.
virtual int NumGlobalNonzeros() const
Returns the number of global nonzero elements.
virtual double NormInf() const
Returns the infinite-norm.
const char * Label() const
Returns the label of this object.
Ifpack_Reordering: basic class for reordering for a Ifpack_Graph object.
virtual int NumMyDiagonals() const
Returns the number of local diagonals.
virtual long long NumGlobalCols64() const
Returns the number of global columns.
virtual int NumMyNonzeros() const
Returns the number of local nonzero elements.
virtual int NumGlobalDiagonals() const
Returns the number of global diagonals.
virtual long long NumGlobalNonzeros64() const
Returns the number of global nonzero elements.
virtual double NormOne() const
Returns the 1-norm.
virtual int NumMyRows() const
Returns the number of local rows.
virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Solve, not implemented.
Teuchos::RefCountPtr< Epetra_RowMatrix > Matrix() const
Returns a reference-counted pointer to the internally stored pointer to Epetra_RowMatrix.
virtual int InvRowSums(Epetra_Vector &) const
Inverse of row sums (not implemented).
const Epetra_Comm & Comm() const
Returns the communicator.
bool HasNormInf() const
Returns true if this matrix has the infinite norm.
Teuchos::RefCountPtr< Ifpack_Reordering > Reordering() const
Returns a reference-counted pointer to the internally stored pointer to Ifpack_Reordering..
virtual long long NumGlobalRows64() const
Returns the number of global rows.
virtual int RightScale(const Epetra_Vector &)
Right scale of the matrix (not implemented).
const Epetra_Map & OperatorDomainMap() const
Returns the operator domain map of the non-reordered matrix.
virtual int NumGlobalCols() const
Returns the number of global columns.
virtual ~Ifpack_ReorderFilter()
Destructor.
const Epetra_Map & OperatorRangeMap() const
Returns the operator domain range of the non-reordered matrix.
Ifpack_ReorderFilter: a class for light-weight reorder of local rows and columns of an Epetra_RowMatr...
virtual int ExtractDiagonalCopy(Epetra_Vector &Diagonal) const
Extracts a copy of the diagonal of the reordered matrix.