Ifpack Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Ifpack_ReorderFilter.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_REORDERFILTER_H
44 #define IFPACK_REORDERFILTER_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 class Ifpack_Reordering;
62 
64 
87 class Ifpack_ReorderFilter : public virtual Epetra_RowMatrix {
88 
89 public:
90  // Constructor.
91  Ifpack_ReorderFilter(const Teuchos::RefCountPtr<Epetra_RowMatrix>& Matrix_in,
92  const Teuchos::RefCountPtr<Ifpack_Reordering>& Reordering_in);
93 
96 
98  virtual ~Ifpack_ReorderFilter() {};
99 
102 
104  virtual inline int NumMyRowEntries(int MyRow, int & NumEntries) const
105  {
106  return(Matrix()->NumMyRowEntries(MyRow, NumEntries));
107  }
108 
110  virtual int MaxNumEntries() const
111  {
112  return(MaxNumEntries_);
113  }
114 
115  // Extracts a copy of the given row for the reordered matrix.
116  virtual int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const;
117 
119  virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const;
120 
122  virtual int Multiply(bool TransA, const Epetra_MultiVector& X,
123  Epetra_MultiVector& Y) const;
124 
126  virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal,
127  const Epetra_MultiVector& X,
128  Epetra_MultiVector& Y) const;
129 
131  virtual int Apply(const Epetra_MultiVector& X,
132  Epetra_MultiVector& Y) const;
133 
135  virtual int ApplyInverse(const Epetra_MultiVector& /* X */,
136  Epetra_MultiVector& /* Y */) const
137  {
138  return(-1);
139  }
140 
142  virtual int InvRowSums(Epetra_Vector& /* x */) const
143  {
144  return(-1);
145  }
146 
148  virtual int LeftScale(const Epetra_Vector& /* x */)
149  {
150  return(-1);
151  }
152 
154  virtual int InvColSums(Epetra_Vector& /* x */) const
155  {
156  return(-1);
157  }
158 
160  virtual int RightScale(const Epetra_Vector& /* x */)
161  {
162  return(-1);
163  }
164 
166  virtual bool Filled() const
167  {
168  return(Matrix()->Filled());
169  }
170 
172  virtual double NormInf() const
173  {
174  return(-1.0);
175  }
176 
178  virtual double NormOne() const
179  {
180  return(-1.0);
181  }
182 
183 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
184 
186  virtual int NumGlobalNonzeros() const
187  {
188  return(Matrix()->NumGlobalNonzeros());
189  }
190 
192  virtual int NumGlobalRows() const
193  {
194  return(Matrix()->NumGlobalRows());
195  }
196 
198  virtual int NumGlobalCols() const
199  {
200  return(Matrix()->NumGlobalCols());
201  }
202 
204  virtual int NumGlobalDiagonals() const
205  {
206  return(Matrix()->NumGlobalDiagonals());
207  }
208 #endif
209 
211  virtual long long NumGlobalNonzeros64() const
212  {
213  return(Matrix()->NumGlobalNonzeros64());
214  }
215 
217  virtual long long NumGlobalRows64() const
218  {
219  return(Matrix()->NumGlobalRows64());
220  }
221 
223  virtual long long NumGlobalCols64() const
224  {
225  return(Matrix()->NumGlobalCols64());
226  }
227 
229  virtual long long NumGlobalDiagonals64() const
230  {
231  return(Matrix()->NumGlobalDiagonals64());
232  }
233 
235  virtual int NumMyNonzeros() const
236  {
237  return(Matrix()->NumMyNonzeros());
238  }
239 
241  virtual int NumMyRows() const
242  {
243  return(Matrix()->NumMyRows());
244  }
245 
247  virtual int NumMyCols() const
248  {
249  return(Matrix()->NumMyCols());
250  }
251 
253  virtual int NumMyDiagonals() const
254  {
255  return(Matrix()->NumMyDiagonals());
256  }
257 
259  virtual bool LowerTriangular() const
260  {
261  return(false);
262  }
263 
265  virtual bool UpperTriangular() const
266  {
267  return(false);
268  }
269 
271  virtual const Epetra_Map & RowMatrixRowMap() const
272  {
273  return(Matrix()->RowMatrixRowMap());
274  }
275 
277  virtual const Epetra_Map & RowMatrixColMap() const
278  {
279  return(Matrix()->RowMatrixColMap());
280  }
281 
283  virtual const Epetra_Import * RowMatrixImporter() const
284  {
285  return(Matrix()->RowMatrixImporter());
286  }
287 
289  int SetUseTranspose(bool UseTranspose_in)
290  {
291  return(Matrix()->SetUseTranspose(UseTranspose_in));
292  }
293 
295  bool UseTranspose() const
296  {
297  return(Matrix()->UseTranspose());
298  }
299 
301  bool HasNormInf() const
302  {
303  return(true);
304  }
305 
307  const Epetra_Comm & Comm() const
308  {
309  return(Matrix()->Comm());
310  }
311 
313  const Epetra_Map & OperatorDomainMap() const
314  {
315  return(Matrix()->OperatorDomainMap());
316  }
317 
319  const Epetra_Map & OperatorRangeMap() const
320  {
321  return(Matrix()->OperatorRangeMap());
322  }
323 
325  const Epetra_BlockMap& Map() const
326  {
327  return(Matrix()->Map());
328  }
329 
331  const char* Label() const{
332  return(Label_);
333  }
334 
336  inline Teuchos::RefCountPtr<Epetra_RowMatrix> Matrix() const {
337  return(A_);
338  }
339 
341  inline Teuchos::RefCountPtr<Ifpack_Reordering> Reordering() const {
342  return(Reordering_);
343  }
344 
345 private:
346 
348  Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
350  Teuchos::RefCountPtr<Ifpack_Reordering> Reordering_;
351 
357  char Label_[80];
358 
359 };
360 
361 
362 #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.
int NumMyRows_
Number of local rows of A_.
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.
char Label_[80]
Label for this object.
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.
int MaxNumEntries_
Maximum number of entries in A_.
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.
Ifpack_ReorderFilter(const Teuchos::RefCountPtr< Epetra_RowMatrix > &Matrix_in, const Teuchos::RefCountPtr< Ifpack_Reordering > &Reordering_in)
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.
Teuchos::RefCountPtr< Epetra_RowMatrix > A_
Pointer to the matrix to be preconditioned.
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.
virtual int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const
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...
Teuchos::RefCountPtr< Ifpack_Reordering > Reordering_
Pointer to the reordering to be used (already constructed).
virtual int ExtractDiagonalCopy(Epetra_Vector &Diagonal) const
Extracts a copy of the diagonal of the reordered matrix.
#define RHS(a)
Definition: MatGenFD.c:60