MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_RebalanceBlockAcFactory_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_REBALANCEBLOCKACFACTORY_DEF_HPP_
48#define MUELU_REBALANCEBLOCKACFACTORY_DEF_HPP_
49
50#include <Xpetra_Matrix.hpp>
51#include <Xpetra_CrsMatrix.hpp>
52#include <Xpetra_CrsMatrixWrap.hpp>
53#include <Xpetra_MatrixFactory.hpp>
54#include <Xpetra_MapExtractor.hpp>
55#include <Xpetra_MapExtractorFactory.hpp>
56#include <Xpetra_StridedMap.hpp>
57#include <Xpetra_StridedMapFactory.hpp>
58#include <Xpetra_BlockedCrsMatrix.hpp>
59
60#include <Xpetra_VectorFactory.hpp>
61
63
65#include "MueLu_HierarchyUtils.hpp"
66#include "MueLu_MasterList.hpp"
67#include "MueLu_Monitor.hpp"
68#include "MueLu_PerfUtils.hpp"
69
70namespace MueLu {
71
72 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
74 RCP<ParameterList> validParamList = rcp(new ParameterList());
75
76#define SET_VALID_ENTRY(name) validParamList->setEntry(name, MasterList::getEntry(name))
77 SET_VALID_ENTRY("repartition: use subcommunicators");
78#undef SET_VALID_ENTRY
79
80 validParamList->set<RCP<const FactoryBase> >("A", Teuchos::null, "Generating factory of the matrix A for rebalancing");
81 validParamList->set<RCP<const FactoryBase> >("Importer", Teuchos::null, "Generating factory of the matrix Importer for rebalancing");
82 validParamList->set<RCP<const FactoryBase> >("SubImporters", Teuchos::null, "Generating factory of the matrix sub-Importers for rebalancing");
83
84 return validParamList;
85 }
86
87 template <class Scalar,class LocalOrdinal, class GlobalOrdinal, class Node>
89 FactManager_.push_back(FactManager);
90 }
91
92 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
94 Input(coarseLevel, "A");
95
96 std::vector<Teuchos::RCP<const FactoryManagerBase> >::const_iterator it;
97 for(it = FactManager_.begin(); it!=FactManager_.end(); ++it) {
98 SetFactoryManager fineSFM (rcpFromRef(fineLevel), *it);
99 SetFactoryManager coarseSFM(rcpFromRef(coarseLevel), *it);
100
101 coarseLevel.DeclareInput("Importer",(*it)->GetFactory("Importer").get(), this);
102 }
103
104 // Use the non-manager path if the maps / importers are generated in one place
105 if(FactManager_.size() == 0) {
106 Input(coarseLevel,"SubImporters");
107 }
108
109 }
110
111 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
113 FactoryMonitor m(*this, "Computing blocked Ac", coarseLevel);
114
115 RCP<Teuchos::FancyOStream> out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout));
116
117 RCP<Matrix> originalAc = Get< RCP<Matrix> >(coarseLevel, "A");
118
119 RCP<Xpetra::BlockedCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > bA = Teuchos::rcp_dynamic_cast<Xpetra::BlockedCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >(originalAc);
120 TEUCHOS_TEST_FOR_EXCEPTION(bA==Teuchos::null, Exceptions::BadCast, "MueLu::RebalanceBlockAcFactory::Build: input matrix A is not of type BlockedCrsMatrix! error.");
121 TEUCHOS_TEST_FOR_EXCEPTION(bA->Rows() != bA->Cols(), Exceptions::RuntimeError, "MueLu::RebalanceBlockAcFactory::Build: Blocked operator has " << bA->Rows() << " and " << bA->Cols() << ". We only support square matrices (with same number of blocks and columns).");
122
123 // Variables to set up map extractors for blocked operators
124 std::vector<GO> fullRangeMapVector;
125 std::vector<GO> fullDomainMapVector;
126 std::vector<RCP<const Map> > subBlockARangeMaps;
127 std::vector<RCP<const Map> > subBlockADomainMaps;
128 subBlockARangeMaps.reserve(bA->Rows());
129 subBlockADomainMaps.reserve(bA->Cols());
130
131 // store map extractors
132 RCP<const MapExtractor> rangeMapExtractor = bA->getRangeMapExtractor();
133 RCP<const MapExtractor> domainMapExtractor = bA->getDomainMapExtractor();
134
135 // check if GIDs for full maps have to be sorted:
136 // For the Thyra mode ordering they do not have to be sorted since the GIDs are
137 // numbered as 0...n1,0...,n2 (starting with zero for each subblock). The MapExtractor
138 // generates unique GIDs during the construction.
139 // For Xpetra style, the GIDs have to be reordered. Such that one obtains a ordered
140 // list of GIDs in an increasing ordering. In Xpetra, the GIDs are all unique through
141 // out all submaps.
142 bool bThyraRangeGIDs = rangeMapExtractor->getThyraMode();
143 bool bThyraDomainGIDs = domainMapExtractor->getThyraMode();
144
145 // vector containing rebalanced blocks (for final output)
146 std::vector<RCP<Matrix> > subBlockRebA =
147 std::vector<RCP<Matrix> >(bA->Cols() * bA->Rows(), Teuchos::null);
148
149 // vector with Import objects from the different
150 // RepartitionFactory instances
151 std::vector<RCP<const Import> > importers = std::vector<RCP<const Import> >(bA->Rows(), Teuchos::null);
152 std::vector<Teuchos::RCP<const FactoryManagerBase> >::const_iterator it;
153 size_t idx = 0;
154 for(it = FactManager_.begin(); it!=FactManager_.end(); ++it) {
155 SetFactoryManager fineSFM (rcpFromRef(fineLevel), *it);
156 SetFactoryManager coarseSFM(rcpFromRef(coarseLevel), *it);
157
158 RCP<const Import> rebalanceImporter = coarseLevel.Get<RCP<const Import> >("Importer", (*it)->GetFactory("Importer").get());
159 importers[idx] = rebalanceImporter;
160 idx++;
161 }
162 if(FactManager_.size() == 0) {
163 importers = Get<std::vector<RCP<const Import> > >(coarseLevel,"SubImporters");
164 }
165
166
167 // restrict communicator?
168 bool bRestrictComm = false;
169 const ParameterList& pL = GetParameterList();
170 if (pL.get<bool>("repartition: use subcommunicators") == true)
171 bRestrictComm = true;
172
173 RCP<ParameterList> XpetraList = Teuchos::rcp(new ParameterList());
174 if(bRestrictComm)
175 XpetraList->set("Restrict Communicator",true);
176 else
177 XpetraList->set("Restrict Communicator",false);
178
179 // communicator for final (rebalanced) operator.
180 // If communicator is not restricted it should be identical to the communicator in bA
181 RCP<const Teuchos::Comm<int> > rebalancedComm = Teuchos::null;
182
183 // loop through all blocks and rebalance blocks
184 // Note: so far we do not support rebalancing of nested operators
185 // TODO add a check for this
186 for(size_t i=0; i<bA->Rows(); i++) {
187 for(size_t j=0; j<bA->Cols(); j++) {
188 // extract matrix block
189 RCP<Matrix> Aij = bA->getMatrix(i, j);
190
191 std::stringstream ss; ss << "Rebalancing matrix block A(" << i << "," << j << ")";
192 SubFactoryMonitor subM(*this, ss.str(), coarseLevel);
193
194 RCP<Matrix> rebAij = Teuchos::null;
195 // General rebalancing
196 if( importers[i] != Teuchos::null &&
197 importers[j] != Teuchos::null &&
198 Aij != Teuchos::null) {
199 RCP<const Map> targetRangeMap = importers[i]->getTargetMap();
200 RCP<const Map> targetDomainMap = importers[j]->getTargetMap();
201
202 // Copy the block Aij
203 // TAW: Do we need a copy or can we do in-place rebalancing?
204 // If we do in-place rebalancing the original distribution is lost
205 // We don't really need it any more, though.
206 //RCP<Matrix> cAij = MatrixFactory::BuildCopy(Aij);
207 RCP<Matrix> cAij = Aij; // do not copy the matrix data (just an rcp pointer)
208
209 // create a new importer for column map needed for rebalanced Aij
210 Teuchos::RCP<const Import> rebAijImport = ImportFactory::Build(importers[j]->getTargetMap(),cAij->getColMap());
211 TEUCHOS_TEST_FOR_EXCEPTION(rebAijImport.is_null() == true,Exceptions::RuntimeError, "MueLu::RebalanceBlockAcFactory::Build: Importer associated with block " << j << " is null.");
212
213 Teuchos::RCP<const CrsMatrixWrap> cAwij = Teuchos::rcp_dynamic_cast<const CrsMatrixWrap>(cAij);
214 TEUCHOS_TEST_FOR_EXCEPTION(cAwij.is_null() == true,Exceptions::RuntimeError, "MueLu::RebalanceBlockAcFactory::Build: Block (" << i << "," << j << ") is not of type CrsMatrix. We cannot rebalanced (nested) operators.");
215 Teuchos::RCP<CrsMatrix> cAmij = cAwij->getCrsMatrix();
216
217 // change domain map to rebalanced domain map (in-place). Update the importer to represent the column map
218 //cAmij->replaceDomainMapAndImporter(importers[j]->getTargetMap(),rebAijImport);
219
220 // rebalance rows of matrix block. Don't change the domain map (-> Teuchos::null)
221 // NOTE: If the communicator is restricted away, Build returns Teuchos::null.
222 rebAij = MatrixFactory::Build(cAij, *(importers[i]), *(importers[j]), targetDomainMap, targetRangeMap, XpetraList);
223 } // rebalance matrix block A(i,i)
224 else {
225 rebAij = Aij; // no rebalancing or empty block!
226 }
227
228 // store new block in output
229 subBlockRebA[i*bA->Cols() + j] = rebAij;
230
231 if (!rebAij.is_null()) {
232 // store communicator
233 if(rebalancedComm.is_null()) rebalancedComm = rebAij->getRowMap()->getComm();
234
235 // printout rebalancing information
236 RCP<ParameterList> params = rcp(new ParameterList());
237 params->set("printLoadBalancingInfo", true);
238 std::stringstream ss2; ss2 << "A(" << i << "," << j << ") rebalanced:";
239 GetOStream(Statistics0) << PerfUtils::PrintMatrixInfo(*rebAij, ss2.str(), params);
240 }
241 } // loop over columns j
242
243 // fix striding information of diagonal blocks
244 // Note: we do not care about the off-diagonal blocks. We just make sure, that the
245 // diagonal blocks have the corresponding striding information from the map extractors
246 // Note: the diagonal block never should be zero.
247 // TODO what if a diagonal block is Teuchos::null?
248 if ( subBlockRebA[i*bA->Cols() + i].is_null() == false ) {
249 RCP<Matrix> rebAii = subBlockRebA[i*bA->Cols() + i];
250 Teuchos::RCP<const StridedMap> orig_stridedRgMap = Teuchos::rcp_dynamic_cast<const StridedMap>(rangeMapExtractor->getMap(i,rangeMapExtractor->getThyraMode()));
251 Teuchos::RCP<const Map> stridedRgMap = Teuchos::null;
252 if(orig_stridedRgMap != Teuchos::null) {
253 std::vector<size_t> stridingData = orig_stridedRgMap->getStridingData();
254 Teuchos::ArrayView< const GlobalOrdinal > nodeRangeMapii = rebAii->getRangeMap()->getLocalElementList();
255 stridedRgMap = StridedMapFactory::Build(
256 bA->getRangeMap()->lib(),
257 Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid(),
258 nodeRangeMapii,
259 rebAii->getRangeMap()->getIndexBase(),
260 stridingData,
261 rebalancedComm,
262 orig_stridedRgMap->getStridedBlockId(),
263 orig_stridedRgMap->getOffset());
264 }
265 Teuchos::RCP<const StridedMap> orig_stridedDoMap = Teuchos::rcp_dynamic_cast<const StridedMap>(domainMapExtractor->getMap(i,domainMapExtractor->getThyraMode()));
266 Teuchos::RCP<const Map> stridedDoMap = Teuchos::null;
267 if(orig_stridedDoMap != Teuchos::null) {
268 std::vector<size_t> stridingData = orig_stridedDoMap->getStridingData();
269 Teuchos::ArrayView< const GlobalOrdinal > nodeDomainMapii = rebAii->getDomainMap()->getLocalElementList();
270 stridedDoMap = StridedMapFactory::Build(
271 bA->getDomainMap()->lib(),
272 Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid(),
273 nodeDomainMapii,
274 rebAii->getDomainMap()->getIndexBase(),
275 stridingData,
276 rebalancedComm,
277 orig_stridedDoMap->getStridedBlockId(),
278 orig_stridedDoMap->getOffset());
279 }
280
281 if(bRestrictComm) {
282 stridedRgMap->removeEmptyProcesses();
283 stridedDoMap->removeEmptyProcesses();
284 }
285
286 TEUCHOS_TEST_FOR_EXCEPTION(stridedRgMap == Teuchos::null,Exceptions::RuntimeError, "MueLu::RebalanceBlockAcFactory::Build: failed to generate striding information. error.");
287 TEUCHOS_TEST_FOR_EXCEPTION(stridedDoMap == Teuchos::null,Exceptions::RuntimeError, "MueLu::RebalanceBlockAcFactory::Build: failed to generate striding information. error.");
288
289 // replace stridedMaps view in diagonal sub block
290 if(rebAii->IsView("stridedMaps")) rebAii->RemoveView("stridedMaps");
291 rebAii->CreateView("stridedMaps", stridedRgMap, stridedDoMap);
292 // collect Xpetra-based global row ids for map extractors
293 subBlockARangeMaps.push_back(rebAii->getRowMap("stridedMaps"));
294 Teuchos::ArrayView< const GlobalOrdinal > nodeRangeMap = rebAii->getRangeMap()->getLocalElementList();
295 // append the GIDs in the end. Do not sort if we have Thyra style GIDs
296 fullRangeMapVector.insert(fullRangeMapVector.end(), nodeRangeMap.begin(), nodeRangeMap.end());
297 if(bThyraRangeGIDs == false)
298 sort(fullRangeMapVector.begin(), fullRangeMapVector.end());
299
300 subBlockADomainMaps.push_back(rebAii->getColMap("stridedMaps"));
301 Teuchos::ArrayView< const GlobalOrdinal > nodeDomainMap = rebAii->getDomainMap()->getLocalElementList();
302 // append the GIDs in the end. Do not sort if we have Thyra style GIDs
303 fullDomainMapVector.insert(fullDomainMapVector.end(), nodeDomainMap.begin(), nodeDomainMap.end());
304 if(bThyraDomainGIDs == false)
305 sort(fullDomainMapVector.begin(), fullDomainMapVector.end());
306 } // end if rebAii != Teuchos::null
307 } // loop over rows i
308
309 // all sub blocks are rebalanced (if available)
310
311 // Short cut if this processor is not in the list of active processors
312 if (rebalancedComm == Teuchos::null) {
313 GetOStream(Debug,-1) << "RebalanceBlockedAc: deactivate proc " << originalAc->getRowMap()->getComm()->getRank() << std::endl;
314 // TAW: it is important that we create a dummy object of type BlockedCrsMatrix (even if we set it to Teuchos::null)
315 Teuchos::RCP<BlockedCrsMatrix> reb_bA = Teuchos::null;
316 coarseLevel.Set("A", Teuchos::rcp_dynamic_cast<Matrix>(reb_bA), this);
317 return;
318 }
319
320 // now, subBlockRebA contains all rebalanced matrix blocks
321 // extract map index base from maps of blocked A
322 GO rangeIndexBase = bA->getRangeMap()->getIndexBase();
323 GO domainIndexBase = bA->getDomainMap()->getIndexBase();
324
325 Teuchos::ArrayView<GO> fullRangeMapGIDs(fullRangeMapVector.size() ? &fullRangeMapVector[0] : 0,fullRangeMapVector.size());
326 Teuchos::RCP<const StridedMap> stridedRgFullMap = Teuchos::rcp_dynamic_cast<const StridedMap>(rangeMapExtractor->getFullMap());
327 Teuchos::RCP<const Map > fullRangeMap = Teuchos::null;
328 if(stridedRgFullMap != Teuchos::null) {
329 std::vector<size_t> stridedData = stridedRgFullMap->getStridingData();
330 fullRangeMap =
331 StridedMapFactory::Build(
332 bA->getRangeMap()->lib(),
333 Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid(),
334 fullRangeMapGIDs,
335 rangeIndexBase,
336 stridedData,
337 rebalancedComm,
338 stridedRgFullMap->getStridedBlockId(),
339 stridedRgFullMap->getOffset());
340 } else {
341 fullRangeMap =
342 MapFactory::Build(
343 bA->getRangeMap()->lib(),
344 Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid(),
345 fullRangeMapGIDs,
346 rangeIndexBase,
347 rebalancedComm);
348 }
349 Teuchos::ArrayView<GO> fullDomainMapGIDs(fullDomainMapVector.size() ? &fullDomainMapVector[0] : 0,fullDomainMapVector.size());
350
351 Teuchos::RCP<const StridedMap> stridedDoFullMap = Teuchos::rcp_dynamic_cast<const StridedMap>(domainMapExtractor->getFullMap());
352 Teuchos::RCP<const Map > fullDomainMap = Teuchos::null;
353 if(stridedDoFullMap != Teuchos::null) {
354 TEUCHOS_TEST_FOR_EXCEPTION(stridedDoFullMap==Teuchos::null, Exceptions::BadCast, "MueLu::RebalanceBlockedAc::Build: full map in domain map extractor has no striding information! error.");
355 std::vector<size_t> stridedData2 = stridedDoFullMap->getStridingData();
356 fullDomainMap =
357 StridedMapFactory::Build(
358 bA->getDomainMap()->lib(),
359 Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid(),
360 fullDomainMapGIDs,
361 domainIndexBase,
362 stridedData2,
363 rebalancedComm,
364 stridedDoFullMap->getStridedBlockId(),
365 stridedDoFullMap->getOffset());
366 } else {
367
368 fullDomainMap =
369 MapFactory::Build(
370 bA->getDomainMap()->lib(),
371 Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid(),
372 fullDomainMapGIDs,
373 domainIndexBase,
374 rebalancedComm);
375 }
376
377 if(bRestrictComm) {
378 fullRangeMap->removeEmptyProcesses();
379 fullDomainMap->removeEmptyProcesses();
380 }
381
382 // build map extractors
383 RCP<const MapExtractor> rebRangeMapExtractor = MapExtractorFactory::Build(fullRangeMap, subBlockARangeMaps, bThyraRangeGIDs);
384 RCP<const MapExtractor> rebDomainMapExtractor = MapExtractorFactory::Build(fullDomainMap, subBlockADomainMaps, bThyraDomainGIDs);
385
386 TEUCHOS_TEST_FOR_EXCEPTION(rangeMapExtractor->NumMaps() != rebRangeMapExtractor->NumMaps(), Exceptions::RuntimeError,
387 "MueLu::RebalanceBlockedAc::Build: Rebalanced RangeMapExtractor has " << rebRangeMapExtractor->NumMaps()
388 << " sub maps. Original RangeMapExtractor has " << rangeMapExtractor->NumMaps() << ". They must match!");
389 TEUCHOS_TEST_FOR_EXCEPTION(domainMapExtractor->NumMaps() != rebDomainMapExtractor->NumMaps(), Exceptions::RuntimeError,
390 "MueLu::RebalanceBlockedAc::Build: Rebalanced DomainMapExtractor has " << rebDomainMapExtractor->NumMaps()
391 << " sub maps. Original DomainMapExtractor has " << domainMapExtractor->NumMaps() << ". They must match!");
392
393 Teuchos::RCP<BlockedCrsMatrix> reb_bA = Teuchos::rcp(new BlockedCrsMatrix(rebRangeMapExtractor,rebDomainMapExtractor,10));
394 for(size_t i=0; i<bA->Rows(); i++) {
395 for(size_t j=0; j<bA->Cols(); j++) {
396 reb_bA->setMatrix(i,j,subBlockRebA[i*bA->Cols() + j]);
397 }
398 }
399
400 reb_bA->fillComplete();
401
402 coarseLevel.Set("A", Teuchos::rcp_dynamic_cast<Matrix>(reb_bA), this);
403 // rebalance additional data:
404 // be aware, that we just call the rebalance factories without switching to local
405 // factory managers, i.e. the rebalance factories have to be defined with the appropriate
406 // factories by the user!
407 if (rebalanceFacts_.begin() != rebalanceFacts_.end()) {
408 SubFactoryMonitor m2(*this, "Rebalance additional data", coarseLevel);
409
410 // call Build of all user-given transfer factories
411 for (std::vector<RCP<const FactoryBase> >::const_iterator it2 = rebalanceFacts_.begin(); it2 != rebalanceFacts_.end(); ++it2) {
412 GetOStream(Runtime0) << "RebalanceBlockedAc: call rebalance factory " << (*it2).get() << ": " << (*it2)->description() << std::endl;
413 (*it2)->CallBuild(coarseLevel);
414 }
415 }
416 } //Build()
417
418 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
420 rebalanceFacts_.push_back(factory);
421 } //AddRebalanceFactory()
422
423} //namespace MueLu
424
425#endif /* MUELU_REBALANCEBLOCKACFACTORY_DEF_HPP_ */
#define SET_VALID_ENTRY(name)
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.
void Input(Level &level, const std::string &varName) const
T Get(Level &level, const std::string &varName) const
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)....
void Set(const std::string &ename, const T &entry, const FactoryBase *factory=NoFactory::get())
virtual const Teuchos::ParameterList & GetParameterList() const
static std::string PrintMatrixInfo(const Matrix &A, const std::string &msgTag, RCP< const Teuchos::ParameterList > params=Teuchos::null)
void AddFactoryManager(RCP< const FactoryManagerBase > FactManager)
Add a factory manager.
std::vector< RCP< const FactoryBase > > rebalanceFacts_
list of user-defined rebalancing Factories
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
void DeclareInput(Level &fineLevel, Level &coarseLevel) const
Input.
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.
void AddRebalanceFactory(const RCP< const FactoryBase > &factory)
Add rebalancing factory in the end of list of rebalancing factories in RebalanceAcFactory.
std::vector< Teuchos::RCP< const FactoryManagerBase > > FactManager_
Input factories.
An exception safe way to call the method 'Level::SetFactoryManager()'.
Timer to be used in factories. Similar to SubMonitor but adds a timer level by level.
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.
@ Debug
Print additional debugging information.
@ Runtime0
One-liner description of what is happening.
@ Statistics0
Print statistics that do not involve significant additional computation.