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