Merge pull request #5247 from bska/expose-fipreg-statistics

Add Procedure for Calculating Basic FIP Region Statistics
This commit is contained in:
Bård Skaflestad 2024-04-08 08:59:20 +02:00 committed by GitHub
commit 5f522cf172
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 0 deletions

View File

@ -170,6 +170,8 @@ public:
}
this->rank_ = this->simulator_.vanguard().grid().comm().rank();
this->simulator_.vanguard().eclState().computeFipRegionStatistics();
}
~EclWriter()

View File

@ -20,13 +20,18 @@
#include <config.h>
#include <opm/simulators/utils/ParallelEclipseState.hpp>
#include <opm/input/eclipse/EclipseState/Grid/FIPRegionStatistics.hpp>
#include <opm/input/eclipse/EclipseState/Grid/FieldData.hpp>
#include <opm/input/eclipse/EclipseState/Runspec.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <cstddef>
#include <map>
#include <regex>
#include <stdexcept>
#include <string>
#include <vector>
namespace {
bool is_FIP(const std::string& keyword)
@ -280,6 +285,20 @@ const FieldPropsManager& ParallelEclipseState::globalFieldProps() const
}
void ParallelEclipseState::computeFipRegionStatistics()
{
if (! this->fipRegionStatistics_.has_value()) {
this->fipRegionStatistics_
.emplace(declaredMaxRegionID(this->runspec()),
this->fieldProps(),
[this](std::vector<int>& maxRegionID)
{
this->m_comm.max(maxRegionID.data(), maxRegionID.size());
});
}
}
const EclipseGrid& ParallelEclipseState::getInputGrid() const
{
if (m_comm.rank() != 0)

View File

@ -179,6 +179,12 @@ public:
//! \details Can only be called on root process.
const FieldPropsManager& globalFieldProps() const override;
//! \brief Compute basic descriptive statistics about all FIP region sets
//!
//! MPI-aware version which knows how to compute statistics across all
//! ranks.
void computeFipRegionStatistics() override;
//! \brief Returns a const ref to the eclipse grid.
//! \details Can only be called on root process.
const EclipseGrid& getInputGrid() const override;