Merge pull request #2098 from blattms/make-elementIndexScatterer-work-with-two-mappers

Allow different ElementMapper types in ElementIndexScatterHandle.
This commit is contained in:
Atgeirr Flø Rasmussen 2019-10-24 15:16:08 +02:00 committed by GitHub
commit 0e02c32929
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -207,11 +207,11 @@ public:
};
/// \brief Communication handle to scatter the global index
template<class Mapper>
template<class EquilMapper, class Mapper>
class ElementIndexScatterHandle
{
public:
ElementIndexScatterHandle(const Mapper& sendMapper, const Mapper& recvMapper, std::vector<int>& elementIndices)
ElementIndexScatterHandle(const EquilMapper& sendMapper, const Mapper& recvMapper, std::vector<int>& elementIndices)
: sendMapper_(sendMapper), recvMapper_(recvMapper), elementIndices_(elementIndices)
{}
using DataType = int;
@ -241,7 +241,8 @@ public:
return dim==3 && codim==0;
}
private:
const Mapper& sendMapper_, recvMapper_;
const EquilMapper& sendMapper_;
const Mapper& recvMapper_;
std::vector<int>& elementIndices_;
};
@ -333,7 +334,7 @@ public:
#endif
// Scatter the global index to local index for lookup during restart
ElementIndexScatterHandle<EquilElementMapper> handle(equilElemMapper, elemMapper, localIdxToGlobalIdx_);
ElementIndexScatterHandle<EquilElementMapper,ElementMapper> handle(equilElemMapper, elemMapper, localIdxToGlobalIdx_);
vanguard.grid().scatterData(handle);
// loop over all elements (global grid) and store Cartesian index
@ -356,7 +357,10 @@ public:
send.insert(ioRank);
// Scatter the global index to local index for lookup during restart
ElementIndexScatterHandle<ElementMapper> handle(elemMapper, elemMapper, localIdxToGlobalIdx_);
// This is a bit hacky since the type differs from the iorank.
// But should work since we only receive, i.e. use the second parameter.
ElementIndexScatterHandle<ElementMapper, ElementMapper> handle(elemMapper, elemMapper,
localIdxToGlobalIdx_);
vanguard.grid().scatterData(handle);
}