53 #ifndef MUELU_COARSEMAPFACTORY_DEF_HPP_
54 #define MUELU_COARSEMAPFACTORY_DEF_HPP_
63 #include "MueLu_Aggregates.hpp"
68 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
71 stridingInfo_.clear();
74 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
77 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
84 validParamList->
set< std::string >(
"Striding info",
"{}",
"Striding information");
85 validParamList->
set< LocalOrdinal >(
"Strided block id", -1,
"Strided block id");
95 validParamList->
set< std::string > (
"Domain GID offsets",
"{0}",
"vector with offsets for GIDs for each level. If no offset GID value is given for the level we use 0 as default.");
97 return validParamList;
100 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
102 Input(currentLevel,
"Aggregates");
103 Input(currentLevel,
"Nullspace");
106 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
109 stridingInfo_ = stridingInfo;
113 std::string strStridingInfo; strStridingInfo.clear();
117 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
121 RCP<Aggregates> aggregates = Get< RCP<Aggregates> >(currentLevel,
"Aggregates");
122 RCP<MultiVector> nullspace = Get< RCP<MultiVector> >(currentLevel,
"Nullspace");
125 const size_t NSDim = nullspace->getNumVectors();
129 GlobalOrdinal domainGidOffset = 0;
130 std::vector<GlobalOrdinal> domainGidOffsets;
131 domainGidOffsets.clear();
134 std::string strDomainGIDs = pL.
get<std::string>(
"Domain GID offsets");
135 if(strDomainGIDs.empty() ==
false) {
137 domainGidOffsets = Teuchos::createVector(arrayVal);
138 if(currentLevel.GetLevelID() < Teuchos::as<int>(domainGidOffsets.size()) ) {
139 domainGidOffset = domainGidOffsets[currentLevel.GetLevelID()];
144 LocalOrdinal stridedBlockId = pL.
get<LocalOrdinal>(
"Strided block id");
150 std::string strStridingInfo = pL.
get<std::string>(
"Striding info");
151 if(strStridingInfo.empty() ==
false) {
153 stridingInfo_ = Teuchos::createVector(arrayVal);
159 if (stridedBlockId== -1) {
162 stridingInfo_.clear();
163 stridingInfo_.push_back(NSDim);
169 size_t stridedBlockSize = stridingInfo_[stridedBlockId];
173 GetOStream(
Statistics2) <<
"domainGIDOffset: " << domainGidOffset <<
" block size: " << getFixedBlockSize() <<
" stridedBlockId: " << stridedBlockId << std::endl;
176 GlobalOrdinal nCoarseDofs = numAggs * getFixedBlockSize();
177 GlobalOrdinal indexBase = aggregates->
GetMap()->getIndexBase();
188 Set(currentLevel,
"CoarseMap", coarseMap);
CoarseMapFactory()
Constructor.
T & get(const std::string &name, T def_value)
void Build(Level ¤tLevel) const
Build an object with this factory.
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)
const RCP< const Map > GetMap() const
returns (overlapping) map of aggregate/node distribution
virtual ~CoarseMapFactory()
Destructor.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
Print even more statistics.
bool isParameter(const std::string &name) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void DeclareInput(Level ¤tLevel) const
Specifies the data that this class needs, and the factories that generate that data.
Class that holds all level-specific information.
LO GetNumAggregates() const
returns the number of aggregates of the current processor. Note: could/should be renamed to GetNumLoc...
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
Exception throws to report errors in the internal logical of the program.