MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_CoarseMapFactory_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_COARSEMAPFACTORY_DECL_HPP_
11 #define MUELU_COARSEMAPFACTORY_DECL_HPP_
12 
14 
15 #include "MueLu_ConfigDefs.hpp"
18 
19 #include "MueLu_Level_fwd.hpp"
20 #include "MueLu_Aggregates_fwd.hpp"
21 #include "MueLu_Exceptions.hpp"
22 
23 namespace MueLu {
24 
73 template <class Scalar = DefaultScalar,
76  class Node = DefaultNode>
78 #undef MUELU_COARSEMAPFACTORY_SHORT
79 #include "MueLu_UseShortNames.hpp"
80 
81  public:
83 
85 
87 
88 
90 
97  void DeclareInput(Level& currentLevel) const override;
98 
100 
102 
103 
105  void Build(Level& currentLevel) const override;
106 
108 
115  virtual size_t getFixedBlockSize() const {
116  // sum up size of all strided blocks (= number of dofs per node)
117  size_t blkSize = 0;
118  std::vector<size_t>::const_iterator it;
119  for (it = stridingInfo_.begin(); it != stridingInfo_.end(); ++it) {
120  blkSize += *it;
121  }
122  return blkSize;
123  }
124 
126 
131  virtual std::vector<size_t> getStridingData() const { return stridingInfo_; }
132 
137  virtual void setStridingData(std::vector<size_t> stridingInfo);
138 
143  virtual LocalOrdinal getStridedBlockId() const {
144  const ParameterList& pL = GetParameterList();
145  return pL.get<LocalOrdinal>("Strided block id");
146  }
147 
152  virtual void setStridedBlockId(LocalOrdinal stridedBlockId) {
153  SetParameter("Strided block id", ParameterEntry(stridedBlockId));
154  }
155 
157 
158  protected:
160  virtual void BuildCoarseMap(Level& currentLevel, const GlobalOrdinal domainGIDOffset) const;
161 
163  virtual GlobalOrdinal GetDomainGIDOffset(Level& currentLevel) const;
164 
165  private:
167  LocalOrdinal stridedBlockId, const size_t nullspaceDimension) const;
168 
170  mutable std::vector<size_t> stridingInfo_;
171 
172 }; // class CoarseMapFactory
173 
174 } // namespace MueLu
175 
176 #define MUELU_COARSEMAPFACTORY_SHORT
177 #endif /* MUELU_COARSEMAPFACTORY_DECL_HPP_ */
virtual const Teuchos::ParameterList & GetParameterList() const
MueLu::DefaultLocalOrdinal LocalOrdinal
Factory for generating coarse level map. Used by TentativePFactory.
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
T & get(const std::string &name, T def_value)
virtual void BuildCoarseMap(Level &currentLevel, const GlobalOrdinal domainGIDOffset) const
Build the coarse map using the domain GID offset.
RCP< const ParameterList > GetValidParameterList() const override
Return a const parameter list of valid parameters that setParameterList() will accept.
MueLu::DefaultNode Node
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 GlobalOrdinal GetDomainGIDOffset(Level &currentLevel) const
Extract domain GID offset from user data.
void SetParameter(const std::string &name, const ParameterEntry &entry)
Set a parameter directly as a ParameterEntry.
virtual void CheckForConsistentStridingInformation(LocalOrdinal stridedBlockId, const size_t nullspaceDimension) const
std::vector< size_t > stridingInfo_
Vector with size of strided blocks (dofs)
void Build(Level &currentLevel) const override
Build an object with this factory.
virtual LocalOrdinal getStridedBlockId() const
getStridedBlockId returns strided block id for the domain DOF map of Ptent (= coarse map) or -1 if fu...
virtual void setStridingData(std::vector< size_t > stridingInfo)
setStridingData set striding vector for the domain DOF map (= coarse map), e.g. (2,1) for 2 velocity dofs and 1 pressure dof
virtual size_t getFixedBlockSize() const
Get information on the fixed block size.
void DeclareInput(Level &currentLevel) const override
Specifies the data that this class needs, and the factories that generate that data.
virtual std::vector< size_t > getStridingData() const
getStridingData returns vector with size of striding blocks in the domain DOF map (= coarse map)...
Base class for factories that use one level (currentLevel).
virtual void setStridedBlockId(LocalOrdinal stridedBlockId)
setStridedBlockId set strided block id for the domain DOF map of Ptent (= coarse map) or -1 if full s...