46 #ifndef MUELU_AMALGAMATIONFACTORY_DEF_HPP
47 #define MUELU_AMALGAMATIONFACTORY_DEF_HPP
51 #include "MueLu_AmalgamationFactory.hpp"
54 #include "MueLu_AmalgamationInfo.hpp"
59 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
63 return validParamList;
66 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
68 Input(currentLevel,
"A");
71 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
76 RCP<Matrix> A = Get< RCP<Matrix> >(currentLevel,
"A");
81 LO nStridedOffset = 0;
82 LO stridedblocksize = fullblocksize;
87 if (A->IsView(
"stridedMaps") && Teuchos::rcp_dynamic_cast<const StridedMap>(A->getRowMap(
"stridedMaps")) != Teuchos::null) {
91 fullblocksize = stridedRowMap->getFixedBlockSize();
92 offset = stridedRowMap->getOffset();
93 blockid = stridedRowMap->getStridedBlockId();
96 std::vector<size_t> stridingInfo = stridedRowMap->getStridingData();
97 for (
size_t j = 0; j < Teuchos::as<size_t>(blockid); j++)
98 nStridedOffset += stridingInfo[j];
99 stridedblocksize = Teuchos::as<LocalOrdinal>(stridingInfo[blockid]);
102 stridedblocksize = fullblocksize;
104 oldView = A->SwitchToView(oldView);
105 GetOStream(
Runtime1) <<
"AmalagamationFactory::Build():" <<
" found fullblocksize=" << fullblocksize <<
" and stridedblocksize=" << stridedblocksize <<
" from strided maps. offset=" << offset << std::endl;
108 GetOStream(
Warnings0) <<
"AmalagamationFactory::Build(): no striding information available. Use blockdim=1 with offset=0" << std::endl;
120 if (fullblocksize > 1) {
128 AmalgamateMap(*(A->getRowMap()), *A, uniqueMap, *theRowTranslation);
129 AmalgamateMap(*(A->getColMap()), *A, nonUniqueMap, *theColTranslation);
155 Set(currentLevel,
"UnAmalgamationInfo", amalgamationData);
158 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
161 typedef std::map<GO,size_type> container;
163 GO indexBase = sourceMap.getIndexBase();
165 size_type numElements = elementAList.
size();
169 LO blkSize = A.GetFixedBlockSize();
170 if (A.IsView(
"stridedMaps") ==
true) {
174 offset = strMap->getOffset();
175 blkSize = Teuchos::as<const LO>(strMap->getFixedBlockSize());
179 translation.
resize(numElements);
181 size_type numRows = 0;
182 for (size_type
id = 0;
id < numElements;
id++) {
183 GO dofID = elementAList[id];
186 typename container::iterator it = filter.find(nodeID);
187 if (it == filter.end()) {
188 filter[nodeID] = numRows;
190 translation[id] = numRows;
191 elementList[numRows] = nodeID;
196 translation[id] = it->second;
199 elementList.
resize(numRows);
205 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
208 GlobalOrdinal globalblockid = ((GlobalOrdinal) gid - offset - indexBase) / blockSize + indexBase;
209 return globalblockid;