MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_BlockedRAPFactory_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // MueLu: A package for multigrid based preconditioning
4 //
5 // Copyright 2012 NTESS and the MueLu contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef MUELU_BLOCKEDRAPFACTORY_DECL_HPP
11 #define MUELU_BLOCKEDRAPFACTORY_DECL_HPP
12 
13 #include <Xpetra_Matrix_fwd.hpp>
14 #include <Xpetra_CrsMatrix_fwd.hpp>
17 
18 #include "MueLu_ConfigDefs.hpp"
19 #include "MueLu_RAPFactory_fwd.hpp"
20 
21 #include "MueLu_Level_fwd.hpp"
23 #include "MueLu_PerfUtils_fwd.hpp"
25 
26 namespace MueLu {
31 template <class Scalar = DefaultScalar,
34  class Node = DefaultNode>
36 #undef MUELU_BLOCKEDRAPFACTORY_SHORT
37 #include "MueLu_UseShortNames.hpp"
38 
39  public:
41 
42 
44 
45  virtual ~BlockedRAPFactory() = default;
47 
49 
50 
52 
53  void DeclareInput(Level &fineLevel, Level &coarseLevel) const override;
54 
56 
58 
59  void Build(Level &fineLevel, Level &coarseLevel) const override;
61 
63 
64 
66  void SetRepairZeroDiagonal(bool const &repair) {
67  repairZeroDiagonals_ = repair;
68  if (repair) checkAc_ = true; // make sure that plausibility check is performed. Otherwise SetRepairZeroDiagonal(true) has no effect.
69  }
70 
72  void SetPlausibilityCheck(bool const &check) {
73  checkAc_ = check;
74  }
75 
77 
82  void AddTransferFactory(const RCP<const FactoryBase> &factory);
83 
84  // TODO add a function to remove a specific transfer factory?
85 
87  size_t NumTransferFactories() const { return transferFacts_.size(); }
88 
90 
91  private:
94  static void CheckMainDiagonal(RCP<BlockedCrsMatrix> &bAc, bool repairZeroDiagonals = false);
95 
98  bool checkAc_;
99 
104 
106 
108  std::vector<RCP<const FactoryBase> > transferFacts_;
109 
111 
112 }; // class BlockedRAPFactory
113 
114 } // namespace MueLu
115 
116 #define MUELU_BLOCKEDRAPFACTORY_SHORT
117 #endif // MUELU_BLOCKEDRAPFACTORY_DECL_HPP
void SetPlausibilityCheck(bool const &check)
Indicate that a simple plausibility check shall be done for Ac after building RAP.
MueLu::DefaultLocalOrdinal LocalOrdinal
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
Factory for building coarse matrices.
Base class for factories that use two levels (fineLevel and coarseLevel).
MueLu::DefaultNode Node
RCP< const ParameterList > GetValidParameterList() const override
Return a const parameter list of valid parameters that setParameterList() will accept.
MueLu::DefaultScalar Scalar
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Class that holds all level-specific information.
Definition: MueLu_Level.hpp:63
virtual ~BlockedRAPFactory()=default
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 void CheckMainDiagonal(RCP< BlockedCrsMatrix > &bAc, bool repairZeroDiagonals=false)
std::vector< RCP< const FactoryBase > > transferFacts_
list of user-defined transfer Factories
void SetRepairZeroDiagonal(bool const &repair)
Indicate that zero entries on the diagonal of Ac shall be repaired (i.e. if A(i,i) == 0...
size_t NumTransferFactories() const
Returns number of transfer factories.
void DeclareInput(Level &fineLevel, Level &coarseLevel) const override
Input.