46 #ifndef MUELU_AMALGAMATIONFACTORY_KOKKOS_DEF_HPP
47 #define MUELU_AMALGAMATIONFACTORY_KOKKOS_DEF_HPP
56 #include "MueLu_AmalgamationInfo_kokkos.hpp"
60 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
65 return validParamList;
68 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
71 Input(currentLevel,
"A");
74 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
80 RCP<Matrix> A = Get< RCP<Matrix> >(currentLevel,
"A");
102 LO nStridedOffset = 0;
103 LO stridedblocksize = fullblocksize;
104 LO storageblocksize = A->GetStorageBlockSize();
109 if (A->IsView(
"stridedMaps") && Teuchos::rcp_dynamic_cast<
const StridedMap>(A->getRowMap(
"stridedMaps")) != Teuchos::null) {
113 fullblocksize = stridedRowMap->getFixedBlockSize();
114 offset = stridedRowMap->getOffset();
115 blockid = stridedRowMap->getStridedBlockId();
118 std::vector<size_t> stridingInfo = stridedRowMap->getStridingData();
119 for (
size_t j = 0; j < Teuchos::as<size_t>(blockid); j++)
120 nStridedOffset += stridingInfo[j];
121 stridedblocksize = Teuchos::as<LocalOrdinal>(stridingInfo[blockid]);
124 stridedblocksize = fullblocksize;
128 TEUCHOS_TEST_FOR_EXCEPTION(fullblocksize % storageblocksize != 0,
Exceptions::RuntimeError,
"AmalgamationFactory::Build(): fullblocksize needs to be a multiple of A->GetStorageBlockSize()");
129 fullblocksize /= storageblocksize;
130 stridedblocksize /= storageblocksize;
132 oldView = A->SwitchToView(oldView);
133 GetOStream(
Runtime1) <<
"AmalagamationFactory::Build():" <<
" found fullblocksize=" << fullblocksize <<
" and stridedblocksize=" << stridedblocksize <<
" from strided maps. offset=" << offset << std::endl;
136 GetOStream(
Warnings0) <<
"AmalagamationFactory::Build(): no striding information available. Use blockdim=1 with offset=0" << std::endl;
148 if (fullblocksize > 1) {
156 AmalgamateMap(*(A->getRowMap()), *A, uniqueMap, *theRowTranslation);
157 AmalgamateMap(*(A->getColMap()), *A, nonUniqueMap, *theColTranslation);
183 Set(currentLevel,
"UnAmalgamationInfo", amalgamationData);
186 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
190 typedef std::map<GO,size_type> container;
192 GO indexBase = sourceMap.getIndexBase();
194 size_type numElements = elementAList.
size();
198 LO blkSize = A.GetFixedBlockSize() / A.GetStorageBlockSize();
199 if (A.IsView(
"stridedMaps") ==
true) {
203 offset = strMap->getOffset();
204 blkSize = Teuchos::as<const LO>(strMap->getFixedBlockSize());
208 translation.
resize(numElements);
210 size_type numRows = 0;
211 for (size_type
id = 0;
id < numElements;
id++) {
212 GO dofID = elementAList[id];
215 typename container::iterator it = filter.find(nodeID);
216 if (it == filter.end()) {
217 filter[nodeID] = numRows;
219 translation[id] = numRows;
220 elementList[numRows] = nodeID;
225 translation[id] = it->second;
228 elementList.
resize(numRows);
234 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
239 return globalblockid;
Important warning messages (one line)
Exception indicating invalid cast attempted.
MueLu::DefaultLocalOrdinal LocalOrdinal
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)
void DeclareInput(Level ¤tLevel) const
Input.
static const GlobalOrdinal DOFGid2NodeId(GlobalOrdinal gid, LocalOrdinal blockSize, const GlobalOrdinal offset, const GlobalOrdinal indexBase)
translate global (row/column) id to global amalgamation block id
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Class that holds all level-specific information.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
minimal container class for storing amalgamation information
void resize(size_type new_size, const value_type &x=value_type())
static void AmalgamateMap(const Map &sourceMap, const Matrix &A, RCP< const Map > &amalgamatedMap, Array< LO > &translation)
Method to create merged map for systems of PDEs.
Exception throws to report errors in the internal logical of the program.
Description of what is happening (more verbose)