Add TranCalculator functionality to ParallelFieldPropsManager

This commit is contained in:
Markus Blatt 2020-09-17 12:16:21 +02:00
parent 9b997aea8c
commit 5987eae7d5
2 changed files with 23 additions and 0 deletions

View File

@ -167,6 +167,17 @@ std::vector<double> 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<double>& 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<char>& buffer)
{
Opm::deserialize_tran(m_tran, buffer);
}
bool ParallelFieldPropsManager::has_double(const std::string& keyword) const
{

View File

@ -20,6 +20,7 @@
#define PARALLEL_ECLIPSE_STATE_HPP
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/TranCalculator.hpp>
#include <dune/common/parallel/mpihelper.hh>
#include <functional>
@ -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<double>& trans) const override;
void deserialize_tran(const std::vector<char>& buffer) override;
protected:
std::map<std::string, Opm::FieldData<int>> m_intProps; //!< Map of integer properties in process-local compressed indices.
std::map<std::string, Opm::FieldData<double>> m_doubleProps; //!< Map of double properties in process-local compressed indices.
@ -102,6 +109,7 @@ protected:
Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator> m_comm; //!< Collective communication handler.
std::function<int(void)> m_activeSize; //!< active size function of the grid
std::function<int(const int)> m_local2Global; //!< mapping from local to global cartesian indices
std::unordered_map<std::string, TranCalculator> m_tran; //!< calculators map
};