Merge pull request #2476 from blattms/rely-on-persistent-local-id

Rely on local ids being persistent across grid modifications
This commit is contained in:
Bård Skaflestad 2020-03-18 22:51:06 +01:00 committed by GitHub
commit 3b67bee169
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,7 +149,7 @@ public:
std::size_t counter{};
const auto& id = idSet.id(element);
auto index = elemMapper.index(element);
auto data = rcvdElementData_.find(id);
auto data = elementData_.find(id);
assert(data != elementData_.end());
for(const auto& intKey : m_intKeys)
@ -198,7 +198,7 @@ public:
void scatter(BufferType& buffer, const EntityType& e, std::size_t n)
{
assert(n == m_no_data);
auto& array = rcvdElementData_[m_grid.localIdSet().id(e)];
auto& array = elementData_[m_grid.localIdSet().id(e)];
array.resize(n);
for(auto& data: array)
{
@ -217,12 +217,6 @@ private:
std::vector<std::string> m_doubleKeys;
/// \brief The data per element as a vector mapped from the local id.
std::unordered_map<typename LocalIdSet::IdType, std::vector<double> > elementData_;
/*! \brief The data received per element as a vector mapped from the local id.
*
* Needed because CpGrid is in violation of the requirement that local ids
* need to be persistent across grid modifications
*/
std::unordered_map<typename LocalIdSet::IdType, std::vector<double> > rcvdElementData_;
/// \brief The cell centroids of the distributed grid.
std::vector<double>& m_centroids;
/// \brief The amount of data to send for each element