From d5bc4d539c8c7d3b5cebc578d76205660b955dcd Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Tue, 15 Sep 2020 16:25:11 +0200 Subject: [PATCH 1/8] Distribute transmissibility calculator of the FieldPropsManager --- opm/simulators/utils/PropsCentroidsDataHandle.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/opm/simulators/utils/PropsCentroidsDataHandle.hpp b/opm/simulators/utils/PropsCentroidsDataHandle.hpp index fbbea7bb7..cb31b916a 100644 --- a/opm/simulators/utils/PropsCentroidsDataHandle.hpp +++ b/opm/simulators/utils/PropsCentroidsDataHandle.hpp @@ -81,6 +81,11 @@ public: int position = 0; Mpi::pack(m_intKeys, buffer, position, comm); Mpi::pack(m_doubleKeys, buffer, position, comm); + { + std::vector tran_buffer = globalProps.serialize_tran(); + position += tran_buffer.size(); + buffer.insert(buffer.end(), std::make_move_iterator(tran_buffer.begin()), std::make_move_iterator(tran_buffer.end())); + } comm.broadcast(&position, 1, 0); comm.broadcast(buffer.data(), position, 0); @@ -121,6 +126,7 @@ public: int position{}; Mpi::unpack(m_intKeys, buffer, position, comm); Mpi::unpack(m_doubleKeys, buffer, position, comm); + m_distributed_fieldProps.deserialize_tran( std::vector(buffer.begin() + position, buffer.end()) ); m_no_data = m_intKeys.size() + m_doubleKeys.size() + Grid::dimensionworld; } From 9b997aea8c024ffaeb7cbb0a6167711d016214be Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Thu, 17 Sep 2020 12:12:14 +0200 Subject: [PATCH 2/8] Use FieldData in ParallelEclipseState. We will need the values_status for the TranCalculator in parallel. --- opm/simulators/utils/ParallelEclipseState.cpp | 22 +++++---- opm/simulators/utils/ParallelEclipseState.hpp | 4 +- .../utils/PropsCentroidsDataHandle.hpp | 46 +++++++++++++++---- 3 files changed, 50 insertions(+), 22 deletions(-) diff --git a/opm/simulators/utils/ParallelEclipseState.cpp b/opm/simulators/utils/ParallelEclipseState.cpp index d11a57235..d82255d38 100644 --- a/opm/simulators/utils/ParallelEclipseState.cpp +++ b/opm/simulators/utils/ParallelEclipseState.cpp @@ -68,17 +68,18 @@ const std::vector& ParallelFieldPropsManager::get_int(const std::string& ke // Some of the keywords might be defaulted. // We will let rank 0 create them and distribute them using get_global_int auto data = get_global_int(keyword); - auto& local_data = const_cast>&>(m_intProps)[keyword]; - local_data.resize(m_activeSize()); + auto& local_data = const_cast>&>(m_intProps)[keyword]; + local_data.data.resize(m_activeSize()); + local_data.value_status.resize(m_activeSize()); for (int i = 0; i < m_activeSize(); ++i) { - local_data[i] = data[m_local2Global(i)]; + local_data.data[i] = data[m_local2Global(i)]; } - return local_data; + return local_data.data; } - return it->second; + return it->second.data; } std::vector ParallelFieldPropsManager::get_global_int(const std::string& keyword) const @@ -121,16 +122,17 @@ const std::vector& ParallelFieldPropsManager::get_double(const std::stri // Some of the keywords might be defaulted. // We will let rank 0 create them and distribute them using get_global_int auto data = get_global_double(keyword); - auto& local_data = const_cast>&>(m_doubleProps)[keyword]; - local_data.resize(m_activeSize()); + auto& local_data = const_cast>&>(m_doubleProps)[keyword]; + local_data.data.resize(m_activeSize()); + local_data.value_status.resize(m_activeSize()); for (int i = 0; i < m_activeSize(); ++i) { - local_data[i] = data[m_local2Global(i)]; + local_data.data[i] = data[m_local2Global(i)]; } - return local_data; + return local_data.data; } - return it->second; + return it->second.data; } diff --git a/opm/simulators/utils/ParallelEclipseState.hpp b/opm/simulators/utils/ParallelEclipseState.hpp index 60a189ce1..07f494b4f 100644 --- a/opm/simulators/utils/ParallelEclipseState.hpp +++ b/opm/simulators/utils/ParallelEclipseState.hpp @@ -96,8 +96,8 @@ public: std::placeholders::_1); } protected: - std::map> m_intProps; //!< Map of integer properties in process-local compressed indices. - std::map> m_doubleProps; //!< Map of double properties in process-local compressed indices. + std::map> m_intProps; //!< Map of integer properties in process-local compressed indices. + std::map> m_doubleProps; //!< Map of double properties in process-local compressed indices. FieldPropsManager& m_manager; //!< Underlying field property manager (only used on root process). Dune::CollectiveCommunication m_comm; //!< Collective communication handler. std::function m_activeSize; //!< active size function of the grid diff --git a/opm/simulators/utils/PropsCentroidsDataHandle.hpp b/opm/simulators/utils/PropsCentroidsDataHandle.hpp index cb31b916a..3ae6aac6d 100644 --- a/opm/simulators/utils/PropsCentroidsDataHandle.hpp +++ b/opm/simulators/utils/PropsCentroidsDataHandle.hpp @@ -50,7 +50,7 @@ class PropsCentroidsDataHandle { public: //! \brief the data type we send (ints are converted to double) - using DataType = double; + using DataType = std::pair; //! \brief Constructor //! \param grid The grid where the loadbalancing is happening. @@ -106,15 +106,23 @@ public: data.reserve(m_no_data); for (const auto& intKey : m_intKeys) - data.push_back(globalProps.get_int(intKey)[index]); + { + const auto& fieldData = globalProps.get_int_field_data(intKey); + data.push_back(std::make_pair(fieldData.data[index], + static_cast(fieldData.value_status[index]))); + } for (const auto& doubleKey : m_doubleKeys) - data.push_back(globalProps.get_double(doubleKey)[index]); + { + const auto& fieldData = globalProps.get_double_field_data(doubleKey); + data.push_back(std::make_pair(fieldData.data[index], + static_cast(fieldData.value_status[index]))); + } auto cartIndex = cartMapper.cartesianIndex(index); const auto& center = eclGridOnRoot->getCellCenter(cartIndex); for (int dim = 0; dim < Grid::dimensionworld; ++dim) - data.push_back(center[dim]); + data.push_back(std::make_pair(center[dim], '1')); // write garbage for value_status } } else @@ -136,10 +144,16 @@ public: { // distributed grid is now correctly set up. for(const auto& intKey : m_intKeys) - m_distributed_fieldProps.m_intProps[intKey].resize(m_grid.size(0)); + { + m_distributed_fieldProps.m_intProps[intKey].data.resize(m_grid.size(0)); + m_distributed_fieldProps.m_intProps[intKey].value_status.resize(m_grid.size(0)); + } for(const auto& doubleKey : m_doubleKeys) - m_distributed_fieldProps.m_doubleProps[doubleKey].resize(m_grid.size(0)); + { + m_distributed_fieldProps.m_doubleProps[doubleKey].data.resize(m_grid.size(0)); + m_distributed_fieldProps.m_doubleProps[doubleKey].value_status.resize(m_grid.size(0)); + } m_centroids.resize(m_grid.size(0) * Grid::dimensionworld); @@ -159,15 +173,23 @@ public: assert(data != elementData_.end()); for(const auto& intKey : m_intKeys) - m_distributed_fieldProps.m_intProps[intKey][index] = static_cast(data->second[counter++]); + { + const auto& pair = data->second[counter++]; + m_distributed_fieldProps.m_intProps[intKey].data[index] = static_cast(pair.first); + m_distributed_fieldProps.m_intProps[intKey].value_status[index] = static_cast(pair.second); + } for(const auto& doubleKey : m_doubleKeys) - m_distributed_fieldProps.m_doubleProps[doubleKey][index] = data->second[counter++]; + { + const auto& pair = data->second[counter++]; + m_distributed_fieldProps.m_doubleProps[doubleKey].data[index] = pair.first; + m_distributed_fieldProps.m_doubleProps[doubleKey].value_status[index] = static_cast(pair.second); + } auto centroidIter = m_centroids.begin() + Grid::dimensionworld * index; auto centroidIterEnd = centroidIter + Grid::dimensionworld; for ( ; centroidIter != centroidIterEnd; ++centroidIter ) - *centroidIter = data->second[counter++]; + *centroidIter = data->second[counter++].first; // value_status discarded } } @@ -197,7 +219,9 @@ public: auto iter = elementData_.find(m_grid.localIdSet().id(e)); assert(iter != elementData_.end()); for(const auto& data : iter->second) + { buffer.write(data); + } } template @@ -222,7 +246,9 @@ private: //! \brief The names of the keys of the double fields. std::vector m_doubleKeys; /// \brief The data per element as a vector mapped from the local id. - std::unordered_map > elementData_; + /// + /// each entry is a pair of data and value_status. + std::unordered_map > > elementData_; /// \brief The cell centroids of the distributed grid. std::vector& m_centroids; /// \brief The amount of data to send for each element From 5987eae7d5e1d0e3833b6e26dc8b21025dbeac90 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Thu, 17 Sep 2020 12:16:21 +0200 Subject: [PATCH 3/8] Add TranCalculator functionality to ParallelFieldPropsManager --- opm/simulators/utils/ParallelEclipseState.cpp | 15 +++++++++++++++ opm/simulators/utils/ParallelEclipseState.hpp | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/opm/simulators/utils/ParallelEclipseState.cpp b/opm/simulators/utils/ParallelEclipseState.cpp index d82255d38..c864fb262 100644 --- a/opm/simulators/utils/ParallelEclipseState.cpp +++ b/opm/simulators/utils/ParallelEclipseState.cpp @@ -167,6 +167,17 @@ std::vector ParallelFieldPropsManager::get_global_double(const std::stri return result; } +bool ParallelFieldPropsManager::tran_active(const std::string& keyword) const +{ + auto calculator = m_tran.find(keyword); + return calculator != m_tran.end() && calculator->second.size(); +} + +void ParallelFieldPropsManager::apply_tran(const std::string& keyword, + std::vector& data) const +{ + Opm::apply_tran(m_tran, m_doubleProps, m_activeSize(), keyword, data); +} bool ParallelFieldPropsManager::has_int(const std::string& keyword) const { @@ -174,6 +185,10 @@ bool ParallelFieldPropsManager::has_int(const std::string& keyword) const return it != m_intProps.end(); } +void ParallelFieldPropsManager::deserialize_tran(const std::vector& buffer) +{ + Opm::deserialize_tran(m_tran, buffer); +} bool ParallelFieldPropsManager::has_double(const std::string& keyword) const { diff --git a/opm/simulators/utils/ParallelEclipseState.hpp b/opm/simulators/utils/ParallelEclipseState.hpp index 07f494b4f..b57bfdf30 100644 --- a/opm/simulators/utils/ParallelEclipseState.hpp +++ b/opm/simulators/utils/ParallelEclipseState.hpp @@ -20,6 +20,7 @@ #define PARALLEL_ECLIPSE_STATE_HPP #include +#include #include #include @@ -95,6 +96,12 @@ public: m_local2Global = std::bind(&T::cartesianIndex, mapper, std::placeholders::_1); } + + bool tran_active(const std::string& keyword) const override; + + void apply_tran(const std::string& keyword, std::vector& trans) const override; + + void deserialize_tran(const std::vector& buffer) override; protected: std::map> m_intProps; //!< Map of integer properties in process-local compressed indices. std::map> m_doubleProps; //!< Map of double properties in process-local compressed indices. @@ -102,6 +109,7 @@ protected: Dune::CollectiveCommunication m_comm; //!< Collective communication handler. std::function m_activeSize; //!< active size function of the grid std::function m_local2Global; //!< mapping from local to global cartesian indices + std::unordered_map m_tran; //!< calculators map }; From 6d8621e4dfceade71438b65230f73c216d1e16cd Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Thu, 17 Sep 2020 12:18:07 +0200 Subject: [PATCH 4/8] Use TranCalculator to update transmissibilities. --- ebos/ecltransmissibility.hh | 153 +++++++++++++++++++++++++++++------- 1 file changed, 124 insertions(+), 29 deletions(-) diff --git a/ebos/ecltransmissibility.hh b/ebos/ecltransmissibility.hh index 70241cbcf..93699e921 100644 --- a/ebos/ecltransmissibility.hh +++ b/ebos/ecltransmissibility.hh @@ -390,7 +390,7 @@ public: } // potentially overwrite and/or modify transmissibilities based on input from deck - updateFromEclState_(); + updateFromEclState_(global); // Create mapping from global to local index const size_t cartesianSize = cartMapper.cartesianSize(); @@ -513,20 +513,48 @@ private: } } - void updateFromEclState_() + void updateFromEclState_(bool global) + { + const FieldPropsManager* fp = + (global) ? &(vanguard_.eclState().fieldProps()) : + &(vanguard_.eclState().globalFieldProps()); + + std::array is_tran {fp->tran_active("TRANX"), + fp->tran_active("TRANY"), + fp->tran_active("TRANZ")}; + + if( !(is_tran[0] ||is_tran[1] || is_tran[2]) ) + { + // Skip unneeded expensive traversals + return; + } + + std::array keywords {"TRANX", "TRANY", "TRANZ"}; + std::array,3> trans = createTransmissibilityArrays(is_tran); + auto key = keywords.begin(); + auto perform = is_tran.begin(); + + for (auto it = trans.begin(); it != trans.end(); ++it, ++key, ++perform) + { + if(perform) + fp->apply_tran(*key, *it); + } + + resetTransmissibilityFromArrays(is_tran, trans); + } + + /// \brief overwrites calculated transmissibilities + /// + /// \param is_tran Whether TRAN{XYZ} have been modified. + /// \param trans Arrays with modified transmissibilities TRAN{XYZ} + void resetTransmissibilityFromArrays(const std::array& is_tran, + const std::array,3>& trans) { const auto& gridView = vanguard_.gridView(); const auto& cartMapper = vanguard_.cartesianIndexMapper(); const auto& cartDims = cartMapper.cartesianDimensions(); ElementMapper elemMapper(gridView, Dune::mcmgElementLayout()); - const auto& fp = vanguard_.eclState().fieldProps(); - const auto& inputTranxData = fp.get_double("TRANX"); - const auto& inputTranyData = fp.get_double("TRANY"); - const auto& inputTranzData = fp.get_double("TRANZ"); - bool tranx_deckAssigned = false; // Ohh my .... - bool trany_deckAssigned = false; - bool tranz_deckAssigned = false; // compute the transmissibilities for all intersections auto elemIt = gridView.template begin(); const auto& elemEndIt = gridView.template end(); @@ -541,46 +569,113 @@ private: if (!intersection.neighbor()) continue; // intersection is on the domain boundary + // In the EclState TRANX[c1] is transmissibility in X+ + // direction. Ordering of compressed (c1,c2) and cartesian index + // (gc1, gc2) is coherent (c1 < c2 <=> gc1 < gc2). This also + // holds for the global grid. While distributing changes the + // order of the local indices, the transmissibilities are still + // stored at the cell with the lower global cartesian index as + // the fieldprops are communicated by the grid. unsigned c1 = elemMapper.index(intersection.inside()); unsigned c2 = elemMapper.index(intersection.outside()); - - if (c1 > c2) + int gc1 = cartMapper.cartesianIndex(c1); + int gc2 = cartMapper.cartesianIndex(c2); + if (gc1 > gc2) continue; // we only need to handle each connection once, thank you. auto isId = isId_(c1, c2); - int gc1 = std::min(cartMapper.cartesianIndex(c1), cartMapper.cartesianIndex(c2)); - int gc2 = std::max(cartMapper.cartesianIndex(c1), cartMapper.cartesianIndex(c2)); - if (gc2 - gc1 == 1 && cartDims[0] > 1) { - if (tranx_deckAssigned) + if (is_tran[0]) // set simulator internal transmissibilities to values from inputTranx - trans_[isId] = inputTranxData[c1]; - else - // Scale transmissibilities with scale factor from inputTranx - trans_[isId] *= inputTranxData[c1]; + trans_[isId] = trans[0][c1]; } else if (gc2 - gc1 == cartDims[0] && cartDims[1] > 1) { - if (trany_deckAssigned) + if (is_tran[1]) // set simulator internal transmissibilities to values from inputTrany - trans_[isId] = inputTranyData[c1]; - else - // Scale transmissibilities with scale factor from inputTrany - trans_[isId] *= inputTranyData[c1]; + trans_[isId] = trans[1][c1]; } else if (gc2 - gc1 == cartDims[0]*cartDims[1]) { - if (tranz_deckAssigned) + if (is_tran[2]) // set simulator internal transmissibilities to values from inputTranz - trans_[isId] = inputTranzData[c1]; - else - // Scale transmissibilities with scale factor from inputTranz - trans_[isId] *= inputTranzData[c1]; + trans_[isId] = trans[2][c1]; } //else.. We don't support modification of NNC at the moment. } } } + /// \brief Creates TRANS{XYZ} arrays for modification by FieldProps data + /// + /// \param is_tran Whether TRAN{XYZ} will be modified. If entry is false the array will be empty + /// \returns an array of vector (TRANX, TRANY, TRANZ} + std::array,3> + createTransmissibilityArrays(const std::array& is_tran) + { + const auto& gridView = vanguard_.gridView(); + const auto& cartMapper = vanguard_.cartesianIndexMapper(); + const auto& cartDims = cartMapper.cartesianDimensions(); + ElementMapper elemMapper(gridView, Dune::mcmgElementLayout()); + + auto numElem = vanguard_.gridView().size(/*codim=*/0); + std::array,3> trans = + { std::vector(is_tran[0] ? numElem : 0, 0), + std::vector(is_tran[1] ? numElem : 0, 0), + std::vector(is_tran[2] ? numElem : 0, 0)}; + + // compute the transmissibilities for all intersections + auto elemIt = gridView.template begin(); + const auto& elemEndIt = gridView.template end(); + + for (; elemIt != elemEndIt; ++elemIt) { + const auto& elem = *elemIt; + auto isIt = gridView.ibegin(elem); + const auto& isEndIt = gridView.iend(elem); + for (; isIt != isEndIt; ++ isIt) { + // store intersection, this might be costly + const auto& intersection = *isIt; + if (!intersection.neighbor()) + continue; // intersection is on the domain boundary + + // In the EclState TRANX[c1] is transmissibility in X+ + // direction. Ordering of compressed (c1,c2) and cartesian index + // (gc1, gc2) is coherent (c1 < c2 <=> gc1 < gc2). This also + // holds for the global grid. While distributing changes the + // order of the local indices, the transmissibilities are still + // stored at the cell with the lower global cartesian index as + // the fieldprops are communicated by the grid. + unsigned c1 = elemMapper.index(intersection.inside()); + unsigned c2 = elemMapper.index(intersection.outside()); + int gc1 = cartMapper.cartesianIndex(c1); + int gc2 = cartMapper.cartesianIndex(c2); + + if (gc1 > gc2) + continue; // we only need to handle each connection once, thank you. + + auto isId = isId_(c1, c2); + + if (gc2 - gc1 == 1 && cartDims[0] > 1) { + if (is_tran[0]) + // set simulator internal transmissibilities to values from inputTranx + trans[0][c1] = trans_[isId]; + } + else if (gc2 - gc1 == cartDims[0] && cartDims[1] > 1) { + if (is_tran[1]) + // set simulator internal transmissibilities to values from inputTrany + trans[1][c1] = trans_[isId]; + } + else if (gc2 - gc1 == cartDims[0]*cartDims[1]) { + if (is_tran[2]) + // set simulator internal transmissibilities to values from inputTranz + trans[2][c1] = trans_[isId]; + } + //else.. We don't support modification of NNC at the moment. + } + } + + return trans; + } + template void computeFaceProperties(const Intersection& intersection, From fd2a0d8a7d0b6a3eb50fa3142c27d98d0028c8d6 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Thu, 17 Sep 2020 14:18:10 +0200 Subject: [PATCH 5/8] Deserialize TranCalculator also on master --- opm/simulators/utils/PropsCentroidsDataHandle.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opm/simulators/utils/PropsCentroidsDataHandle.hpp b/opm/simulators/utils/PropsCentroidsDataHandle.hpp index 3ae6aac6d..7ffb7ddb3 100644 --- a/opm/simulators/utils/PropsCentroidsDataHandle.hpp +++ b/opm/simulators/utils/PropsCentroidsDataHandle.hpp @@ -81,6 +81,7 @@ public: int position = 0; Mpi::pack(m_intKeys, buffer, position, comm); Mpi::pack(m_doubleKeys, buffer, position, comm); + int calcStart = position; { std::vector tran_buffer = globalProps.serialize_tran(); position += tran_buffer.size(); @@ -89,6 +90,9 @@ public: comm.broadcast(&position, 1, 0); comm.broadcast(buffer.data(), position, 0); + // Unpack Calculator as we need it here, too. + m_distributed_fieldProps.deserialize_tran( std::vector(buffer.begin() + calcStart, buffer.end()) ); + // copy data to persistent map based on local id m_no_data = m_intKeys.size() + m_doubleKeys.size() + Grid::dimensionworld; From abff765c1d507fe684a9cb385131454d6e5f6beb Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Thu, 17 Sep 2020 22:23:04 +0200 Subject: [PATCH 6/8] Also query unsupported field data for the TransCalculator. FiedlPropsManager::keys() list the FieldProperties needed by the TransCalculator, but these cannot be queried the normal way as this raises exceptions and results in a deadlock. Hence we use the new funtionality to get also the unsupported ones, by passing true to get_double_field_data. --- opm/simulators/utils/PropsCentroidsDataHandle.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/PropsCentroidsDataHandle.hpp b/opm/simulators/utils/PropsCentroidsDataHandle.hpp index 7ffb7ddb3..4ded06410 100644 --- a/opm/simulators/utils/PropsCentroidsDataHandle.hpp +++ b/opm/simulators/utils/PropsCentroidsDataHandle.hpp @@ -118,7 +118,10 @@ public: for (const auto& doubleKey : m_doubleKeys) { - const auto& fieldData = globalProps.get_double_field_data(doubleKey); + // We need to allow unsupported keywords to get the data + // for TranCalculator, too. + const auto& fieldData = globalProps.get_double_field_data(doubleKey, + /* allow_unsupported = */ true); data.push_back(std::make_pair(fieldData.data[index], static_cast(fieldData.value_status[index]))); } From 99f74cad963ccf1f40ae00653f0ea1c061a0651c Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Fri, 18 Sep 2020 15:01:17 +0200 Subject: [PATCH 7/8] FieldData and TranCalculator are now in Fieldprops namespace. --- opm/simulators/utils/ParallelEclipseState.cpp | 4 ++-- opm/simulators/utils/ParallelEclipseState.hpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opm/simulators/utils/ParallelEclipseState.cpp b/opm/simulators/utils/ParallelEclipseState.cpp index c864fb262..477b65012 100644 --- a/opm/simulators/utils/ParallelEclipseState.cpp +++ b/opm/simulators/utils/ParallelEclipseState.cpp @@ -68,7 +68,7 @@ const std::vector& ParallelFieldPropsManager::get_int(const std::string& ke // Some of the keywords might be defaulted. // We will let rank 0 create them and distribute them using get_global_int auto data = get_global_int(keyword); - auto& local_data = const_cast>&>(m_intProps)[keyword]; + auto& local_data = const_cast>&>(m_intProps)[keyword]; local_data.data.resize(m_activeSize()); local_data.value_status.resize(m_activeSize()); @@ -122,7 +122,7 @@ const std::vector& ParallelFieldPropsManager::get_double(const std::stri // Some of the keywords might be defaulted. // We will let rank 0 create them and distribute them using get_global_int auto data = get_global_double(keyword); - auto& local_data = const_cast>&>(m_doubleProps)[keyword]; + auto& local_data = const_cast>&>(m_doubleProps)[keyword]; local_data.data.resize(m_activeSize()); local_data.value_status.resize(m_activeSize()); for (int i = 0; i < m_activeSize(); ++i) diff --git a/opm/simulators/utils/ParallelEclipseState.hpp b/opm/simulators/utils/ParallelEclipseState.hpp index b57bfdf30..e0f4ffe40 100644 --- a/opm/simulators/utils/ParallelEclipseState.hpp +++ b/opm/simulators/utils/ParallelEclipseState.hpp @@ -103,13 +103,13 @@ public: void deserialize_tran(const std::vector& buffer) override; protected: - std::map> m_intProps; //!< Map of integer properties in process-local compressed indices. - std::map> m_doubleProps; //!< Map of double properties in process-local compressed indices. + std::map> m_intProps; //!< Map of integer properties in process-local compressed indices. + std::map> m_doubleProps; //!< Map of double properties in process-local compressed indices. FieldPropsManager& m_manager; //!< Underlying field property manager (only used on root process). Dune::CollectiveCommunication m_comm; //!< Collective communication handler. std::function m_activeSize; //!< active size function of the grid std::function m_local2Global; //!< mapping from local to global cartesian indices - std::unordered_map m_tran; //!< calculators map + std::unordered_map m_tran; //!< calculators map }; From e5f4971d58e2cd037084791b6661fbacffb13a36 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Mon, 21 Sep 2020 21:30:51 +0200 Subject: [PATCH 8/8] CentroidsPropsDatahandle Use emplace_back for saving pair --- opm/simulators/utils/PropsCentroidsDataHandle.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/opm/simulators/utils/PropsCentroidsDataHandle.hpp b/opm/simulators/utils/PropsCentroidsDataHandle.hpp index 4ded06410..14875fd41 100644 --- a/opm/simulators/utils/PropsCentroidsDataHandle.hpp +++ b/opm/simulators/utils/PropsCentroidsDataHandle.hpp @@ -112,8 +112,8 @@ public: for (const auto& intKey : m_intKeys) { const auto& fieldData = globalProps.get_int_field_data(intKey); - data.push_back(std::make_pair(fieldData.data[index], - static_cast(fieldData.value_status[index]))); + data.emplace_back(fieldData.data[index], + static_cast(fieldData.value_status[index])); } for (const auto& doubleKey : m_doubleKeys) @@ -122,14 +122,14 @@ public: // for TranCalculator, too. const auto& fieldData = globalProps.get_double_field_data(doubleKey, /* allow_unsupported = */ true); - data.push_back(std::make_pair(fieldData.data[index], - static_cast(fieldData.value_status[index]))); + data.emplace_back(fieldData.data[index], + static_cast(fieldData.value_status[index])); } auto cartIndex = cartMapper.cartesianIndex(index); const auto& center = eclGridOnRoot->getCellCenter(cartIndex); for (int dim = 0; dim < Grid::dimensionworld; ++dim) - data.push_back(std::make_pair(center[dim], '1')); // write garbage for value_status + data.emplace_back(center[dim], '1'); // write garbage for value_status } } else