Allow different ElementMapper types in ElementIndexScatterHandle.

This is needed to support dune-fem where the local mapper might
be
`MultipleCodimMultipleGeomTypeMapper<GridView<GridPart2GridViewTraits<AdaptiveLeafGridPart<CpGrid, (PartitionIteratorType)4,
false> > >, Dune::Impl::MCMGFailLayout>`
as opposed to the global one being
`MultipleCodimMultipleGeomTypeMapper<GridView<DefaultLeafGridViewTraits<CpGrid>>, Dune::Impl::MCMGFailLayout>`.

Closes #2095.
This commit is contained in:
Markus Blatt
2019-10-22 14:49:55 +02:00
parent 5267f3cf17
commit 608b317ecc

View File

@@ -207,11 +207,11 @@ public:
}; };
/// \brief Communication handle to scatter the global index /// \brief Communication handle to scatter the global index
template<class Mapper> template<class EquilMapper, class Mapper>
class ElementIndexScatterHandle class ElementIndexScatterHandle
{ {
public: 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) : sendMapper_(sendMapper), recvMapper_(recvMapper), elementIndices_(elementIndices)
{} {}
using DataType = int; using DataType = int;
@@ -241,7 +241,8 @@ public:
return dim==3 && codim==0; return dim==3 && codim==0;
} }
private: private:
const Mapper& sendMapper_, recvMapper_; const EquilMapper& sendMapper_;
const Mapper& recvMapper_;
std::vector<int>& elementIndices_; std::vector<int>& elementIndices_;
}; };
@@ -333,7 +334,7 @@ public:
#endif #endif
// Scatter the global index to local index for lookup during restart // 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); vanguard.grid().scatterData(handle);
// loop over all elements (global grid) and store Cartesian index // loop over all elements (global grid) and store Cartesian index
@@ -356,7 +357,10 @@ public:
send.insert(ioRank); send.insert(ioRank);
// Scatter the global index to local index for lookup during restart // 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); vanguard.grid().scatterData(handle);
} }