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