Move RigFlowDiagTimeStepResult to separate file

This commit is contained in:
Magne Sjaastad committed 2025-11-25 10:48:18 +01:00
1 parent 7a029b2de7
commit a803aa1298
6 files changed
+152 -100

No files matched your search

@@ -39,6 +39,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResults.h
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagSolverInterface.h
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagStatCalc.h
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagTimeStepResult.h
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagVisibleCellsStatCalc.h
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagDefines.h
${CMAKE_CURRENT_LIST_DIR}/RigFormationNames.h
@@ -128,6 +129,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResults.cpp
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagSolverInterface.cpp
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagStatCalc.cpp
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagTimeStepResult.cpp
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagVisibleCellsStatCalc.cpp
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagDefines.cpp
${CMAKE_CURRENT_LIST_DIR}/RigFormationNames.cpp
@@ -22,6 +22,7 @@
#include "RigEclipseCaseData.h"
#include "RigFlowDiagSolverInterface.h"
#include "RigFlowDiagStatCalc.h"
#include "RigFlowDiagTimeStepResult.h"
#include "RigMainGrid.h"
#include "RigFlowDiagResultFrames.h"
@@ -45,75 +45,6 @@
#include "cvfTrace.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagTimeStepResult::RigFlowDiagTimeStepResult( size_t activeCellCount )
: m_activeCellCount( activeCellCount )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFlowDiagTimeStepResult::setTracerTOF( const std::string& tracerName,
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
const std::map<int, double>& cellValues )
{
std::set<std::string> tracers;
tracers.insert( tracerName );
RigFlowDiagResultAddress resAddr( RigFlowDiagDefines::tofResultName().toStdString(), phaseSelection, tracers );
addResult( resAddr, cellValues );
std::vector<double>& activeCellValues = m_nativeResults[resAddr];
for ( double& val : activeCellValues )
{
val = val * 1.15741e-5; // days pr second. Converting to days
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFlowDiagTimeStepResult::setTracerFraction( const std::string& tracerName,
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
const std::map<int, double>& cellValues )
{
std::set<std::string> tracers;
tracers.insert( tracerName );
addResult( RigFlowDiagResultAddress( RigFlowDiagDefines::cellFractionResultName().toStdString(), phaseSelection, tracers ), cellValues );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFlowDiagTimeStepResult::setInjProdWellPairFlux( const std::string& injectorTracerName,
const std::string& producerTracerName,
const std::pair<double, double>& injProdFluxes )
{
m_injProdWellPairFluxes[std::make_pair( injectorTracerName, producerTracerName )] = injProdFluxes;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFlowDiagTimeStepResult::addResult( const RigFlowDiagResultAddress& resAddr, const std::map<int, double>& cellValues )
{
std::vector<double>& activeCellValues = m_nativeResults[resAddr];
CVF_ASSERT( activeCellValues.empty() );
activeCellValues.resize( m_activeCellCount, HUGE_VAL );
for ( const auto& pairIt : cellValues )
{
activeCellValues[pairIt.first] = pairIt.second;
}
}
class RigOpmFlowDiagStaticData
{
public:
@@ -18,7 +18,7 @@
#pragma once
#include "RigFlowDiagDefines.h"
#include "RigFlowDiagResultAddress.h"
#include "RigFlowDiagTimeStepResult.h"
#include "cafPdmPointer.h"
@@ -30,36 +30,6 @@
class RimEclipseResultCase;
class RimFlowDiagSolution;
class RigFlowDiagTimeStepResult
{
public:
explicit RigFlowDiagTimeStepResult( size_t activeCellCount );
void setTracerTOF( const std::string& tracerName,
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
const std::map<int, double>& cellValues );
void setTracerFraction( const std::string& tracerName,
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
const std::map<int, double>& cellValues );
void setInjProdWellPairFlux( const std::string& injectorTracerName,
const std::string& producerTracerName,
const std::pair<double, double>& injProdFluxes );
using Curve = std::pair<std::vector<double>, std::vector<double>>;
// Used to "steal" the data from this one using swap
std::map<RigFlowDiagResultAddress, std::vector<double>>& nativeResults() { return m_nativeResults; }
std::map<std::pair<std::string, std::string>, std::pair<double, double>>& injProdWellPairFluxes() { return m_injProdWellPairFluxes; }
private:
void addResult( const RigFlowDiagResultAddress& resAddr, const std::map<int, double>& cellValues );
std::map<RigFlowDiagResultAddress, std::vector<double>> m_nativeResults;
std::map<std::pair<std::string, std::string>, std::pair<double, double>> m_injProdWellPairFluxes;
size_t m_activeCellCount;
};
class RigEclipseCaseData;
class RigOpmFlowDiagStaticData;
@@ -0,0 +1,94 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigFlowDiagTimeStepResult.h"
#include "RigFlowDiagDefines.h"
#include "cvfTrace.h"
#include <set>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagTimeStepResult::RigFlowDiagTimeStepResult( size_t activeCellCount )
: m_activeCellCount( activeCellCount )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFlowDiagTimeStepResult::setTracerTOF( const std::string& tracerName,
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
const std::map<int, double>& cellValues )
{
std::set<std::string> tracers;
tracers.insert( tracerName );
RigFlowDiagResultAddress resAddr( RigFlowDiagDefines::tofResultName().toStdString(), phaseSelection, tracers );
addResult( resAddr, cellValues );
std::vector<double>& activeCellValues = m_nativeResults[resAddr];
for ( double& val : activeCellValues )
{
val = val * 1.15741e-5; // days pr second. Converting to days
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFlowDiagTimeStepResult::setTracerFraction( const std::string& tracerName,
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
const std::map<int, double>& cellValues )
{
std::set<std::string> tracers;
tracers.insert( tracerName );
addResult( RigFlowDiagResultAddress( RigFlowDiagDefines::cellFractionResultName().toStdString(), phaseSelection, tracers ), cellValues );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFlowDiagTimeStepResult::setInjProdWellPairFlux( const std::string& injectorTracerName,
const std::string& producerTracerName,
const std::pair<double, double>& injProdFluxes )
{
m_injProdWellPairFluxes[std::make_pair( injectorTracerName, producerTracerName )] = injProdFluxes;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFlowDiagTimeStepResult::addResult( const RigFlowDiagResultAddress& resAddr, const std::map<int, double>& cellValues )
{
std::vector<double>& activeCellValues = m_nativeResults[resAddr];
CVF_ASSERT( activeCellValues.empty() );
activeCellValues.resize( m_activeCellCount, HUGE_VAL );
for ( const auto& pairIt : cellValues )
{
activeCellValues[pairIt.first] = pairIt.second;
}
}
@@ -0,0 +1,54 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RigFlowDiagResultAddress.h"
#include <map>
#include <string>
#include <vector>
class RigFlowDiagTimeStepResult
{
public:
explicit RigFlowDiagTimeStepResult( size_t activeCellCount );
void setTracerTOF( const std::string& tracerName,
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
const std::map<int, double>& cellValues );
void setTracerFraction( const std::string& tracerName,
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
const std::map<int, double>& cellValues );
void setInjProdWellPairFlux( const std::string& injectorTracerName,
const std::string& producerTracerName,
const std::pair<double, double>& injProdFluxes );
using Curve = std::pair<std::vector<double>, std::vector<double>>;
// Used to "steal" the data from this one using swap
std::map<RigFlowDiagResultAddress, std::vector<double>>& nativeResults() { return m_nativeResults; }
std::map<std::pair<std::string, std::string>, std::pair<double, double>>& injProdWellPairFluxes() { return m_injProdWellPairFluxes; }
private:
void addResult( const RigFlowDiagResultAddress& resAddr, const std::map<int, double>& cellValues );
std::map<RigFlowDiagResultAddress, std::vector<double>> m_nativeResults;
std::map<std::pair<std::string, std::string>, std::pair<double, double>> m_injProdWellPairFluxes;
size_t m_activeCellCount;
};