10 #ifndef MUELU_BLOCKEDRAPFACTORY_DEF_HPP 
   11 #define MUELU_BLOCKEDRAPFACTORY_DEF_HPP 
   22 #include "MueLu_PerfUtils.hpp" 
   27 template <
class Scalar, 
class LocalOrdinal, 
class GlobalOrdinal, 
class Node>
 
   30   , repairZeroDiagonals_(false) {}
 
   32 template <
class Scalar, 
class LocalOrdinal, 
class GlobalOrdinal, 
class Node>
 
   36 #define SET_VALID_ENTRY(name) validParamList->setEntry(name, MasterList::getEntry(name)) 
   38 #undef SET_VALID_ENTRY 
   39   validParamList->
set<
RCP<const FactoryBase> >(
"A", null, 
"Generating factory of the matrix A used during the prolongator smoothing process");
 
   43   return validParamList;
 
   46 template <
class Scalar, 
class LocalOrdinal, 
class GlobalOrdinal, 
class Node>
 
   49   if (pL.
get<
bool>(
"transpose: use implicit") == 
false)
 
   50     Input(coarseLevel, 
"R");
 
   52   Input(fineLevel, 
"A");
 
   53   Input(coarseLevel, 
"P");
 
   56   for (std::vector<
RCP<const FactoryBase> >::const_iterator it = transferFacts_.begin(); it != transferFacts_.end(); ++it)
 
   57     (*it)->CallDeclareInput(coarseLevel);
 
   60 template <
class Scalar, 
class LocalOrdinal, 
class GlobalOrdinal, 
class Node>
 
   67   RCP<Matrix> P = Get<RCP<Matrix> >(coarseLevel, 
"P");
 
   80                                "Block matrix dimensions do not match: " 
   82                                    << bA->Rows() << 
"x" << bA->Cols() << 
"P is " << bP->Rows() << 
"x" << bP->Cols());
 
   84     bAP = MatrixMatrix::TwoMatrixMultiplyBlock(*bA, 
false, *bP, 
false, GetOStream(
Statistics2), 
true, 
true);
 
   89   bool doOptimizeStorage = !checkAc_;
 
   91   const bool doTranspose    = 
true;
 
   92   const bool doFillComplete = 
true;
 
   93   if (pL.
get<
bool>(
"transpose: use implicit") == 
true) {
 
   95     bAc = MatrixMatrix::TwoMatrixMultiplyBlock(*bP, doTranspose, *bAP, !doTranspose, GetOStream(
Statistics2), doFillComplete, doOptimizeStorage);
 
   98     RCP<Matrix> R            = Get<RCP<Matrix> >(coarseLevel, 
"R");
 
  103                                "Block matrix dimensions do not match: " 
  105                                    << bR->Rows() << 
"x" << bR->Cols() << 
"A is " << bA->Rows() << 
"x" << bA->Cols());
 
  108     bAc = MatrixMatrix::TwoMatrixMultiplyBlock(*bR, !doTranspose, *bAP, !doTranspose, GetOStream(
Statistics2), doFillComplete, doOptimizeStorage);
 
  112     CheckMainDiagonal(bAc);
 
  116   Set<RCP<Matrix> >(coarseLevel, 
"A", bAc);
 
  118   if (transferFacts_.begin() != transferFacts_.end()) {
 
  122     for (std::vector<
RCP<const FactoryBase> >::const_iterator it = transferFacts_.begin(); it != transferFacts_.end(); ++it) {
 
  125       GetOStream(
Runtime0) << 
"BlockRAPFactory: call transfer factory: " << fac->
description() << std::endl;
 
  131       coarseLevel.Release(*fac);
 
  136 template <
class Scalar, 
class LocalOrdinal, 
class GlobalOrdinal, 
class Node>
 
  139   RCP<Matrix> Aout = MatrixFactory::Build(c00->getRowMap(), c00->getGlobalMaxNumRowEntries());
 
  141   RCP<Vector> diagVec = VectorFactory::Build(c00->getRowMap());
 
  142   c00->getLocalDiagCopy(*diagVec);
 
  146   for (
size_t row = 0; row < c00->getLocalNumRows(); row++) {
 
  148     GO grid = c00->getRowMap()->getGlobalElement(row);  
 
  152     c00->getLocalRowView(row, indices, vals);
 
  159     for (
size_t i = 0; i < as<size_t>(indices.
size()); i++) {
 
  160       GO gcid   = c00->getColMap()->getGlobalElement(indices[i]);  
 
  165     Aout->insertGlobalValues(grid, indout.view(0, indout.size()), valout.view(0, valout.size()));
 
  168       Aout->insertGlobalValues(grid, Teuchos::tuple<GO>(grid), Teuchos::tuple<SC>(1.0));
 
  172   Aout->fillComplete(c00->getDomainMap(), c00->getRangeMap());
 
  174   bAc->setMatrix(0, 0, Aout);
 
  177 template <
class Scalar, 
class LocalOrdinal, 
class GlobalOrdinal, 
class Node>
 
  181                              "Transfer factory is not derived from TwoLevelFactoryBase. This is very strange. " 
  182                              "(Note: you can remove this exception if there's a good reason for)");
 
  183   transferFacts_.push_back(factory);
 
  188 #define MUELU_BLOCKEDRAPFACTORY_SHORT 
  189 #endif  // MUELU_BLOCKEDRAPFACTORY_DEF_HPP 
Exception indicating invalid cast attempted. 
virtual void CallBuild(Level &requestedLevel) const =0
T & get(const std::string &name, T def_value)
Timer to be used in factories. Similar to Monitor but with additional timers. 
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
One-liner description of what is happening. 
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
RCP< const ParameterList > GetValidParameterList() const override
Return a const parameter list of valid parameters that setParameterList() will accept. 
Print even more statistics. 
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information. 
Timer to be used in factories. Similar to SubMonitor but adds a timer level by level. 
void Build(Level &fineLevel, Level &coarseLevel) const override
Build an object with this factory. 
void AddTransferFactory(const RCP< const FactoryBase > &factory)
Add transfer factory in the end of list of transfer factories in RepartitionAcFactory. 
static std::string PrintMatrixInfo(const Matrix &A, const std::string &msgTag, RCP< const Teuchos::ParameterList > params=Teuchos::null)
static void CheckMainDiagonal(RCP< BlockedCrsMatrix > &bAc, bool repairZeroDiagonals=false)
#define SET_VALID_ENTRY(name)
void DeclareInput(Level &fineLevel, Level &coarseLevel) const override
Input. 
virtual std::string description() const 
Return a simple one-line description of this object.