MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_SimpleSmoother_def.hpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// MueLu: A package for multigrid based preconditioning
6// Copyright 2012 Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact
39// Jonathan Hu (jhu@sandia.gov)
40// Andrey Prokopenko (aprokop@sandia.gov)
41// Ray Tuminaro (rstumin@sandia.gov)
42//
43// ***********************************************************************
44//
45// @HEADER
46
47#ifndef MUELU_SIMPLESMOOTHER_DEF_HPP_
48#define MUELU_SIMPLESMOOTHER_DEF_HPP_
49
50#include "Teuchos_ArrayViewDecl.hpp"
51#include "Teuchos_ScalarTraits.hpp"
52
53#include "MueLu_ConfigDefs.hpp"
54
55#include <Xpetra_Matrix.hpp>
56#include <Xpetra_CrsMatrixWrap.hpp>
57#include <Xpetra_BlockedCrsMatrix.hpp>
58#include <Xpetra_MultiVectorFactory.hpp>
59#include <Xpetra_VectorFactory.hpp>
60#include <Xpetra_ReorderedBlockedCrsMatrix.hpp>
61
63#include "MueLu_Level.hpp"
64#include "MueLu_Utilities.hpp"
65#include "MueLu_Monitor.hpp"
66#include "MueLu_HierarchyUtils.hpp"
68
69// include files for default FactoryManager
70#include "MueLu_SchurComplementFactory.hpp"
71#include "MueLu_FactoryManager.hpp"
72
73namespace MueLu {
74
75 template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
78
79 template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
81
82 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
84 RCP<ParameterList> validParamList = rcp(new ParameterList());
85
86 validParamList->set<RCP<const FactoryBase>>("A", Teuchos::null, "Generating factory of the matrix A");
87 validParamList->set<Scalar>("Damping factor", 1.0, "Damping/Scaling factor in SIMPLE");
88 validParamList->set<LocalOrdinal>("Sweeps", 1, "Number of SIMPLE sweeps (default = 1)");
89 validParamList->set<bool>("UseSIMPLEC", false, "Use SIMPLEC instead of SIMPLE (default = false)");
90
91 return validParamList;
92 }
93
95 template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
96 void SimpleSmoother<Scalar, LocalOrdinal, GlobalOrdinal, Node>::AddFactoryManager(RCP<const FactoryManagerBase> FactManager, int pos) {
97 TEUCHOS_TEST_FOR_EXCEPTION(pos < 0, Exceptions::RuntimeError, "MueLu::SimpleSmoother::AddFactoryManager: parameter \'pos\' must not be negative! error.");
98
99 size_t myPos = Teuchos::as<size_t>(pos);
100
101 if (myPos < FactManager_.size()) {
102 // replace existing entris in FactManager_ vector
103 FactManager_.at(myPos) = FactManager;
104 } else if( myPos == FactManager_.size()) {
105 // add new Factory manager in the end of the vector
106 FactManager_.push_back(FactManager);
107 } else { // if(myPos > FactManager_.size())
108 RCP<Teuchos::FancyOStream> out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout));
109 *out << "Warning: cannot add new FactoryManager at proper position " << pos << ". The FactoryManager is just appended to the end. Check this!" << std::endl;
110
111 // add new Factory manager in the end of the vector
112 FactManager_.push_back(FactManager);
113 }
114
115 }
116
117
118 template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
120 AddFactoryManager(FactManager, 0); // overwrite factory manager for predicting the primary variable
121 }
122
123 template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
125 AddFactoryManager(FactManager, 1); // overwrite factory manager for SchurComplement
126 }
127
128 template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
130 currentLevel.DeclareInput("A",this->GetFactory("A").get());
131
132 TEUCHOS_TEST_FOR_EXCEPTION(FactManager_.size() != 2, Exceptions::RuntimeError,"MueLu::SimpleSmoother::DeclareInput: You have to declare two FactoryManagers with a \"Smoother\" object: One for predicting the primary variable and one for the SchurComplement system. The smoother for the SchurComplement system needs a SchurComplementFactory as input for variable \"A\". make sure that you use the same proper damping factors for omega both in the SchurComplementFactory and in the SIMPLE smoother!");
133
134 // loop over all factory managers for the subblocks of blocked operator A
135 std::vector<Teuchos::RCP<const FactoryManagerBase> >::const_iterator it;
136 for(it = FactManager_.begin(); it!=FactManager_.end(); ++it) {
137 SetFactoryManager currentSFM (rcpFromRef(currentLevel), *it);
138
139 // request "Smoother" for current subblock row.
140 currentLevel.DeclareInput("PreSmoother",(*it)->GetFactory("Smoother").get());
141 }
142 }
143
144 template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
146
147 FactoryMonitor m(*this, "Setup blocked SIMPLE Smoother", currentLevel);
148
149 if (SmootherPrototype::IsSetup() == true)
150 this->GetOStream(Warnings0) << "MueLu::SimpleSmoother::Setup(): Setup() has already been called";
151
152 // extract blocked operator A from current level
153 A_ = Factory::Get<RCP<Matrix> > (currentLevel, "A");
154
155 RCP<BlockedCrsMatrix> bA = Teuchos::rcp_dynamic_cast<BlockedCrsMatrix>(A_);
156 TEUCHOS_TEST_FOR_EXCEPTION(bA == Teuchos::null, Exceptions::BadCast, "MueLu::SimpleSmoother::Setup: input matrix A is not of type BlockedCrsMatrix! error.");
157
158 // store map extractors
159 rangeMapExtractor_ = bA->getRangeMapExtractor();
160 domainMapExtractor_ = bA->getDomainMapExtractor();
161
162 // Store the blocks in local member variables
163 F_ = bA->getMatrix(0, 0);
164 G_ = bA->getMatrix(0, 1);
165 D_ = bA->getMatrix(1, 0);
166 Z_ = bA->getMatrix(1, 1);
167
168 const ParameterList & pL = Factory::GetParameterList();
169 bool bSIMPLEC = pL.get<bool>("UseSIMPLEC");
170
171 // Create the inverse of the diagonal of F
172 // TODO add safety check for zeros on diagonal of F!
173 RCP<Vector> diagFVector = VectorFactory::Build(F_->getRowMap());
174 if(!bSIMPLEC) {
175 F_->getLocalDiagCopy(*diagFVector); // extract diagonal of F
176 } else {
177 /*const RCP<const Map> rowmap = F_->getRowMap();
178 size_t locSize = rowmap->getLocalNumElements();
179 Teuchos::ArrayRCP<SC> diag = diagFVector->getDataNonConst(0);
180 Teuchos::ArrayView<const LO> cols;
181 Teuchos::ArrayView<const SC> vals;
182 for (size_t i=0; i<locSize; ++i) { // loop over rows
183 F_->getLocalRowView(i,cols,vals);
184 Scalar absRowSum = Teuchos::ScalarTraits<Scalar>::zero();
185 for (LO j=0; j<cols.size(); ++j) { // loop over cols
186 absRowSum += Teuchos::ScalarTraits<Scalar>::magnitude(vals[j]);
187 }
188 diag[i] = absRowSum;
189 }*/
190 // TODO this does not work if F_ is nested!
192 }
193 diagFinv_ = Utilities::GetInverse(diagFVector);
194
195 // check whether diagFinv_ is a blocked vector with only 1 block
196 RCP<BlockedVector> bdiagFinv = Teuchos::rcp_dynamic_cast<BlockedVector>(diagFinv_);
197 if(bdiagFinv.is_null() == false && bdiagFinv->getBlockedMap()->getNumMaps() == 1) {
198 RCP<Vector> nestedVec = bdiagFinv->getMultiVector(0,bdiagFinv->getBlockedMap()->getThyraMode())->getVectorNonConst(0);
199 diagFinv_.swap(nestedVec);
200 }
201
202 // Set the Smoother
203 // carefully switch to the SubFactoryManagers (defined by the users)
204 {
205 RCP<const FactoryManagerBase> velpredictFactManager = FactManager_.at(0);
206 SetFactoryManager currentSFM (rcpFromRef(currentLevel), velpredictFactManager);
207 velPredictSmoo_ = currentLevel.Get< RCP<SmootherBase> >("PreSmoother",velpredictFactManager->GetFactory("Smoother").get());
208 }
209 {
210 RCP<const FactoryManagerBase> schurFactManager = FactManager_.at(1);
211 SetFactoryManager currentSFM (rcpFromRef(currentLevel), schurFactManager);
212 schurCompSmoo_ = currentLevel.Get< RCP<SmootherBase> >("PreSmoother", schurFactManager->GetFactory("Smoother").get());
213 }
214
216 }
217
218 template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
219 void SimpleSmoother<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Apply(MultiVector& X, const MultiVector& B, bool InitialGuessIsZero) const
220 {
221 TEUCHOS_TEST_FOR_EXCEPTION(SmootherPrototype::IsSetup() == false, Exceptions::RuntimeError,
222 "MueLu::SimpleSmoother::Apply(): Setup() has not been called");
223#if 0
224 // TODO simplify this debug check
225 RCP<MultiVector> rcpDebugX = Teuchos::rcpFromRef(X);
226 RCP<const MultiVector> rcpDebugB = Teuchos::rcpFromRef(B);
227 RCP<BlockedMultiVector> rcpBDebugX = Teuchos::rcp_dynamic_cast<BlockedMultiVector>(rcpDebugX);
228 RCP<const BlockedMultiVector> rcpBDebugB = Teuchos::rcp_dynamic_cast<const BlockedMultiVector>(rcpDebugB);
229 if(rcpBDebugB.is_null() == false) {
230 //TEUCHOS_TEST_FOR_EXCEPTION(A_->getRangeMap()->isSameAs(*(B.getMap())) == false, Exceptions::RuntimeError, "MueLu::SimpleSmoother::Apply(): The map of RHS vector B is not the same as range map of the blocked operator A. Please check the map of B and A.");
231 } else {
232 //TEUCHOS_TEST_FOR_EXCEPTION(bA->getFullRangeMap()->isSameAs(*(B.getMap())) == false, Exceptions::RuntimeError, "MueLu::SimpleSmoother::Apply(): The map of RHS vector B is not the same as range map of the blocked operator A. Please check the map of B and A.");
233 }
234 if(rcpBDebugX.is_null() == false) {
235 //TEUCHOS_TEST_FOR_EXCEPTION(A_->getDomainMap()->isSameAs(*(X.getMap())) == false, Exceptions::RuntimeError, "MueLu::SimpleSmoother::Apply(): The map of the solution vector X is not the same as domain map of the blocked operator A. Please check the map of X and A.");
236 } else {
237 //TEUCHOS_TEST_FOR_EXCEPTION(bA->getFullDomainMap()->isSameAs(*(X.getMap())) == false, Exceptions::RuntimeError, "MueLu::SimpleSmoother::Apply(): The map of the solution vector X is not the same as domain map of the blocked operator A. Please check the map of X and A.");
238 }
239#endif
240
241 const SC zero = Teuchos::ScalarTraits<SC>::zero();
242 const SC one = Teuchos::ScalarTraits<SC>::one();
243
244 // extract parameters from internal parameter list
245 const ParameterList & pL = Factory::GetParameterList();
246 LocalOrdinal nSweeps = pL.get<LocalOrdinal>("Sweeps");
247 Scalar omega = pL.get<Scalar>("Damping factor");
248
249 // The boolean flags check whether we use Thyra or Xpetra style GIDs
250 bool bRangeThyraMode = rangeMapExtractor_->getThyraMode(); // && (Teuchos::rcp_dynamic_cast<BlockedCrsMatrix>(F_) == Teuchos::null);
251 bool bDomainThyraMode = domainMapExtractor_->getThyraMode(); // && (Teuchos::rcp_dynamic_cast<BlockedCrsMatrix>(F_) == Teuchos::null);
252
253 //RCP<Teuchos::FancyOStream> fancy = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout));
254
255 // wrap current solution vector in RCP
256 RCP<MultiVector> rcpX = Teuchos::rcpFromRef(X);
257 RCP<const MultiVector> rcpB = Teuchos::rcpFromRef(B);
258
259 // make sure that both rcpX and rcpB are BlockedMultiVector objects
260 bool bCopyResultX = false;
261 bool bReorderX = false;
262 bool bReorderB = false;
263 RCP<BlockedCrsMatrix> bA = Teuchos::rcp_dynamic_cast<BlockedCrsMatrix>(A_);
264 MUELU_TEST_FOR_EXCEPTION(bA.is_null() == true, Exceptions::RuntimeError, "MueLu::BlockedGaussSeidelSmoother::Apply(): A_ must be a BlockedCrsMatrix");
265 RCP<BlockedMultiVector> bX = Teuchos::rcp_dynamic_cast<BlockedMultiVector>(rcpX);
266 RCP<const BlockedMultiVector> bB = Teuchos::rcp_dynamic_cast<const BlockedMultiVector>(rcpB);
267
268 // check the type of operator
269 RCP<Xpetra::ReorderedBlockedCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > rbA =
270 Teuchos::rcp_dynamic_cast<Xpetra::ReorderedBlockedCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >(bA);
271
272 if(rbA.is_null() == false) {
273 // A is a ReorderedBlockedCrsMatrix and thus uses nested maps, retrieve BlockedCrsMatrix and use plain blocked
274 // map for the construction of the blocked multivectors
275
276 // check type of X vector
277 if (bX.is_null() == true) {
278 RCP<MultiVector> vectorWithBlockedMap = Teuchos::rcp(new BlockedMultiVector(rbA->getBlockedCrsMatrix()->getBlockedDomainMap(), rcpX));
279 rcpX.swap(vectorWithBlockedMap);
280 bCopyResultX = true;
281 bReorderX = true;
282 }
283
284 // check type of B vector
285 if (bB.is_null() == true) {
286 RCP<const MultiVector> vectorWithBlockedMap = Teuchos::rcp(new BlockedMultiVector(rbA->getBlockedCrsMatrix()->getBlockedRangeMap(), rcpB));
287 rcpB.swap(vectorWithBlockedMap);
288 bReorderB = true;
289 }
290 }
291 else {
292 // A is a BlockedCrsMatrix and uses a plain blocked map
293 if (bX.is_null() == true) {
294 RCP<MultiVector> vectorWithBlockedMap = Teuchos::rcp(new BlockedMultiVector(bA->getBlockedDomainMap(), rcpX));
295 rcpX.swap(vectorWithBlockedMap);
296 bCopyResultX = true;
297 }
298
299 if(bB.is_null() == true) {
300 RCP<const MultiVector> vectorWithBlockedMap = Teuchos::rcp(new BlockedMultiVector(bA->getBlockedRangeMap(),rcpB));
301 rcpB.swap(vectorWithBlockedMap);
302 }
303 }
304
305 // we now can guarantee that X and B are blocked multi vectors
306 bX = Teuchos::rcp_dynamic_cast<BlockedMultiVector>(rcpX);
307 bB = Teuchos::rcp_dynamic_cast<const BlockedMultiVector>(rcpB);
308
309 // Finally we can do a reordering of the blocked multivectors if A is a ReorderedBlockedCrsMatrix
310 if(rbA.is_null() == false) {
311
312 Teuchos::RCP<const Xpetra::BlockReorderManager > brm = rbA->getBlockReorderManager();
313
314 // check type of X vector
315 if(bX->getBlockedMap()->getNumMaps() != bA->getDomainMapExtractor()->NumMaps() || bReorderX) {
316 // X is a blocked multi vector but incompatible to the reordered blocked operator A
317 Teuchos::RCP<MultiVector> reorderedBlockedVector = buildReorderedBlockedMultiVector(brm, bX);
318 rcpX.swap(reorderedBlockedVector);
319 }
320
321 if(bB->getBlockedMap()->getNumMaps() != bA->getRangeMapExtractor()->NumMaps() || bReorderB) {
322 // B is a blocked multi vector but incompatible to the reordered blocked operator A
323 Teuchos::RCP<const MultiVector> reorderedBlockedVector = buildReorderedBlockedMultiVector(brm, bB);
324 rcpB.swap(reorderedBlockedVector);
325 }
326 }
327
328 // Throughout the rest of the algorithm rcpX and rcpB are used for solution vector and RHS
329
330 // create residual vector
331 // contains current residual of current solution X with rhs B
332 RCP<MultiVector> residual = MultiVectorFactory::Build(rcpB->getMap(), rcpB->getNumVectors());
333 RCP<BlockedMultiVector> bresidual = Teuchos::rcp_dynamic_cast<BlockedMultiVector>(residual);
334 RCP<MultiVector> r1 = bresidual->getMultiVector(0,bRangeThyraMode);
335 RCP<MultiVector> r2 = bresidual->getMultiVector(1,bRangeThyraMode);
336
337 // helper vector 1
338 RCP<MultiVector> xtilde = MultiVectorFactory::Build(rcpX->getMap(), rcpX->getNumVectors());
339 RCP<BlockedMultiVector> bxtilde = Teuchos::rcp_dynamic_cast<BlockedMultiVector>(xtilde);
340 RCP<MultiVector> xtilde1 = bxtilde->getMultiVector(0, bDomainThyraMode);
341 RCP<MultiVector> xtilde2 = bxtilde->getMultiVector(1, bDomainThyraMode);
342
343 // helper vector 2
344 RCP<MultiVector> xhat = MultiVectorFactory::Build(rcpX->getMap(), rcpX->getNumVectors());
345 RCP<BlockedMultiVector> bxhat = Teuchos::rcp_dynamic_cast<BlockedMultiVector>(xhat);
346 RCP<MultiVector> xhat1 = bxhat->getMultiVector(0, bDomainThyraMode);
347 RCP<MultiVector> xhat2 = bxhat->getMultiVector(1, bDomainThyraMode);
348
349
350 // incrementally improve solution vector X
351 for (LocalOrdinal run = 0; run < nSweeps; ++run) {
352 // 1) calculate current residual
353 residual->update(one, *rcpB, zero); // residual = B
354 if(InitialGuessIsZero == false || run > 0)
355 A_->apply(*rcpX, *residual, Teuchos::NO_TRANS, -one, one);
356
357 // 2) solve F * \Delta \tilde{x}_1 = r_1
358 // start with zero guess \Delta \tilde{x}_1
359 xtilde1->putScalar(zero);
360 xtilde2->putScalar(zero);
361 velPredictSmoo_->Apply(*xtilde1, *r1);
362
363 // 3) calculate rhs for SchurComp equation
364 // r_2 - D \Delta \tilde{x}_1
365 RCP<MultiVector> schurCompRHS = rangeMapExtractor_->getVector(1, rcpB->getNumVectors(), bRangeThyraMode);
366 D_->apply(*xtilde1, *schurCompRHS);
367
368 schurCompRHS->update(one, *r2, -one);
369
370 // 4) solve SchurComp equation
371 // start with zero guess \Delta \tilde{x}_2
372 schurCompSmoo_->Apply(*xtilde2, *schurCompRHS);
373
374 // 5) scale xtilde2 with omega
375 // store this in xhat2
376 xhat2->update(omega, *xtilde2, zero);
377
378 // 6) calculate xhat1
379 RCP<MultiVector> xhat1_temp = domainMapExtractor_->getVector(0, rcpX->getNumVectors(), bDomainThyraMode);
380 G_->apply(*xhat2, *xhat1_temp); // store result temporarely in xtilde1_temp
381
382 xhat1->elementWiseMultiply(one/*/omega*/, *diagFinv_, *xhat1_temp, zero);
383 xhat1->update(one, *xtilde1, -one);
384
385 rcpX->update(one, *bxhat, one);
386 }
387
388 if (bCopyResultX == true) {
389 RCP<const MultiVector> Xmerged = bX->Merge();
390 X.update(one, *Xmerged, zero);
391 }
392
393 }
394
395 template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
396 RCP<MueLu::SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
400
401 template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
403 std::ostringstream out;
405 out << "{type = " << type_ << "}";
406 return out.str();
407 }
408
409 template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
410 void SimpleSmoother<Scalar, LocalOrdinal, GlobalOrdinal, Node>::print(Teuchos::FancyOStream &out, const VerbLevel verbLevel) const {
412
413 if (verbLevel & Parameters0) {
414 out0 << "Prec. type: " << type_ << /*" Sweeps: " << nSweeps_ << " damping: " << omega_ <<*/ std::endl;
415 }
416
417 if (verbLevel & Debug) {
418 out0 << "IsSetup: " << Teuchos::toString(SmootherPrototype::IsSetup()) << std::endl;
419 }
420 }
421
422 template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
424 // FIXME: This is a placeholder
425 return Teuchos::OrdinalTraits<size_t>::invalid();
426 }
427
428
429} // namespace MueLu
430
431
432#endif /* MUELU_SIMPLESMOOTHER_DEF_HPP_ */
#define MUELU_DESCRIBE
Helper macro for implementing Describable::describe() for BaseClass objects.
#define MUELU_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
virtual std::string description() const
Return a simple one-line description of this object.
Exception indicating invalid cast attempted.
Exception throws to report errors in the internal logical of the program.
Timer to be used in factories. Similar to Monitor but with additional timers.
T Get(Level &level, const std::string &varName) const
const RCP< const FactoryBase > GetFactory(const std::string &varName) const
Default implementation of FactoryAcceptor::GetFactory().
Class that holds all level-specific information.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput().
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access)....
virtual const Teuchos::ParameterList & GetParameterList() const =0
An exception safe way to call the method 'Level::SetFactoryManager()'.
RCP< Matrix > A_
Internal blocked operator "A" generated by AFact_.
void SetVelocityPredictionFactoryManager(RCP< FactoryManager > FactManager)
void Setup(Level &currentLevel)
Setup routine.
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the object with some verbosity level to an FancyOStream object.
std::string description() const
Return a simple one-line description of this object.
void DeclareInput(Level &currentLevel) const
Input.
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
Teuchos::RCP< Matrix > Z_
Pressure stabilization term or null block.
RCP< const ParameterList > GetValidParameterList() const
Input.
std::vector< Teuchos::RCP< const FactoryManagerBase > > FactManager_
Vector of internal factory managers.
Teuchos::RCP< Matrix > D_
Divergence operator.
std::string type_
smoother type
virtual ~SimpleSmoother()
Destructor.
RCP< SmootherPrototype > Copy() const
void AddFactoryManager(RCP< const FactoryManagerBase > FactManager, int pos)
Add a factory manager at a specific position.
Teuchos::RCP< SmootherBase > schurCompSmoo_
Smoother for SchurComplement equation.
void Apply(MultiVector &X, MultiVector const &B, bool InitialGuessIsZero=false) const
Apply the Braess Sarazin smoother.
Teuchos::RCP< Matrix > G_
Pressure gradient operator.
Teuchos::RCP< SmootherBase > velPredictSmoo_
Smoother for velocity prediction.
RCP< const MapExtractorClass > rangeMapExtractor_
Range map extractor (from A_ generated by AFact).
Teuchos::RCP< Matrix > F_
Fluid operator.
Teuchos::RCP< Vector > diagFinv_
Inverse diagonal of fluid operator (vector).
void SetSchurCompFactoryManager(RCP< FactoryManager > FactManager)
RCP< const MapExtractorClass > domainMapExtractor_
Domain map extractor (from A_ generated by AFact).
bool IsSetup() const
Get the state of a smoother prototype.
static Teuchos::RCP< Vector > GetInverse(Teuchos::RCP< const Vector > v, Magnitude tol=Teuchos::ScalarTraits< Scalar >::eps() *100, Scalar valReplacement=Teuchos::ScalarTraits< Scalar >::zero())
static Teuchos::RCP< Vector > GetLumpedMatrixDiagonal(Matrix const &A, const bool doReciprocal=false, Magnitude tol=Teuchos::ScalarTraits< Scalar >::magnitude(Teuchos::ScalarTraits< Scalar >::zero()), Scalar valReplacement=Teuchos::ScalarTraits< Scalar >::zero(), const bool replaceSingleEntryRowWithZero=false, const bool useAverageAbsDiagVal=false)
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
Namespace for MueLu classes and methods.
@ Warnings0
Important warning messages (one line).
@ Debug
Print additional debugging information.
@ Parameters0
Print class parameters.