IFPACK Development
Loading...
Searching...
No Matches
Ifpack_SparsityFilter.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_SPARSITYFILTER_H
44#define IFPACK_SPARSITYFILTER_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
56class Epetra_Comm;
57class Epetra_Map;
59class Epetra_Import;
60class Epetra_BlockMap;
61
63
65
66public:
67 Ifpack_SparsityFilter(const Teuchos::RefCountPtr<Epetra_RowMatrix>& Matrix,
68 int AllowedNumEntries,
69 int AllowedBandwidth = -1);
70
71 virtual ~Ifpack_SparsityFilter() {};
72
73 virtual inline int NumMyRowEntries(int MyRow, int & NumEntries) const
74 {
75 NumEntries = NumEntries_[MyRow];
76 return(0);
77 }
78
79 virtual int MaxNumEntries() const
80 {
81 return(MaxNumEntries_);
82 }
83
84 virtual int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const;
85
86 virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const;
87
88 virtual int Multiply(bool TransA, const Epetra_MultiVector& X,
89 Epetra_MultiVector& Y) const;
90
91 virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal,
92 const Epetra_MultiVector& X,
93 Epetra_MultiVector& Y) const;
94
95 virtual int Apply(const Epetra_MultiVector& X,
96 Epetra_MultiVector& Y) const;
97
98 virtual int ApplyInverse(const Epetra_MultiVector& X,
99 Epetra_MultiVector& Y) const;
100
101 virtual int InvRowSums(Epetra_Vector& /* x */) const
102 {
103 return(-98);
104 }
105
106 virtual int LeftScale(const Epetra_Vector& /* x */)
107 {
108 return(-98);
109 }
110
111 virtual int InvColSums(Epetra_Vector& /* x */) const
112 {
113 return(-98);
114 }
115
116 virtual int RightScale(const Epetra_Vector& x)
117 {
118 return(A_->RightScale(x));
119 }
120
121 virtual bool Filled() const
122 {
123 return(A_->Filled());
124 }
125
126 virtual double NormInf() const
127 {
128 return(-1.0);
129 }
130
131 virtual double NormOne() const
132 {
133 return(-1.0);
134 }
135
136#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
137 virtual int NumGlobalNonzeros() const
138 {
139 return(NumNonzeros_);
140 }
141
142 virtual int NumGlobalRows() const
143 {
144 return(NumRows_);
145 }
146
147 virtual int NumGlobalCols() const
148 {
149 return(NumRows_);
150 }
151
152 virtual int NumGlobalDiagonals() const
153 {
154 return(NumRows_);
155 }
156#endif
157
158 virtual long long NumGlobalNonzeros64() const
159 {
160 return(NumNonzeros_);
161 }
162
163 virtual long long NumGlobalRows64() const
164 {
165 return(NumRows_);
166 }
167
168 virtual long long NumGlobalCols64() const
169 {
170 return(NumRows_);
171 }
172
173 virtual long long NumGlobalDiagonals64() const
174 {
175 return(NumRows_);
176 }
177
178 virtual int NumMyNonzeros() const
179 {
180 return(NumNonzeros_);
181 }
182
183 virtual int NumMyRows() const
184 {
185 return(NumRows_);
186 }
187
188 virtual int NumMyCols() const
189 {
190 return(NumRows_);
191 }
192
193 virtual int NumMyDiagonals() const
194 {
195 return(NumRows_);
196 }
197
198 virtual bool LowerTriangular() const
199 {
200 return(false);
201 }
202
203 virtual bool UpperTriangular() const
204 {
205 return(false);
206 }
207
208 virtual const Epetra_Map & RowMatrixRowMap() const
209 {
210 return(A_->RowMatrixRowMap());
211 }
212
213 virtual const Epetra_Map & RowMatrixColMap() const
214 {
215 return(A_->RowMatrixColMap());
216 }
217
218 virtual const Epetra_Import * RowMatrixImporter() const
219 {
220 return(A_->RowMatrixImporter());
221 }
222
223 int SetUseTranspose(bool useTranspose)
224 {
225 return(A_->SetUseTranspose(useTranspose));
226 }
227
228 bool UseTranspose() const
229 {
230 return(A_->UseTranspose());
231 }
232
233 bool HasNormInf() const
234 {
235 return(false);
236 }
237
238 const Epetra_Comm & Comm() const
239 {
240 return(A_->Comm());
241 }
242
243 const Epetra_Map & OperatorDomainMap() const
244 {
245 return(A_->OperatorDomainMap());
246 }
247
248 const Epetra_Map & OperatorRangeMap() const
249 {
250 return(A_->OperatorRangeMap());
251 }
252
253 const Epetra_BlockMap& Map() const
254 {
255 return(A_->Map());
256 }
257
258 const char* Label() const{
259 return(Label_);
260 }
261
262private:
263
265 Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
267 int MaxNumEntries_;
268 int MaxNumEntriesA_;
269
271 int AllowedBandwidth_;
273 int AllowedEntries_;
274
276 int NumNonzeros_;
277
279 mutable std::vector<int> Indices_;
281 mutable std::vector<double> Values_;
283 char Label_[80];
284
285 int NumRows_;
286 std::vector<int> NumEntries_;
287
288};
289
290
291#endif /* IFPACK_SPARSITYFILTER_H */
Ifpack_SparsityFilter: a class to drop based on sparsity.