mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1126 Updating inserting to map to use insert. Adding access functions for calculated data and constructor for class (not finished)
This commit is contained in:
parent
e19a63dcff
commit
2ce81e9045
@ -33,6 +33,19 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RigTofAccumulatedPhaseFractionsCalculator::RigTofAccumulatedPhaseFractionsCalculator(RimEclipseCase* caseToApply,
|
||||||
|
QString wellname,
|
||||||
|
size_t timestep)
|
||||||
|
:m_case(caseToApply),
|
||||||
|
m_wellName(wellname),
|
||||||
|
m_timeStep(timestep)
|
||||||
|
{
|
||||||
|
computeTOFaccumulations();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -109,24 +122,17 @@ void RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFract
|
|||||||
|
|
||||||
for (int i = 0; i < tofData->size(); i++)
|
for (int i = 0; i < tofData->size(); i++)
|
||||||
{
|
{
|
||||||
auto it = tofAndIndexMap.find(tofData->at(i));
|
std::vector<int> vectorOfIndexes;
|
||||||
if (it == tofAndIndexMap.end())
|
vectorOfIndexes.push_back(i);
|
||||||
|
|
||||||
|
auto iteratorBoolFromInsertToMap = tofAndIndexMap.insert(std::make_pair(tofData->at(i), vectorOfIndexes));
|
||||||
|
if (!iteratorBoolFromInsertToMap.second)
|
||||||
{
|
{
|
||||||
//Key does not exist
|
//Element exist alread, was not inserted
|
||||||
std::vector<int> vectorOfIndexes;
|
iteratorBoolFromInsertToMap.first->second.push_back(i);
|
||||||
vectorOfIndexes.push_back(i);
|
|
||||||
tofAndIndexMap[tofData->at(i)] = vectorOfIndexes;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Key does exisit
|
|
||||||
std::vector<int> vectorOfIndexes = it->second;
|
|
||||||
vectorOfIndexes.push_back(i);
|
|
||||||
tofAndIndexMap[tofData->at(i)] = vectorOfIndexes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double fractionPorvSum = 0.0;
|
double fractionPorvSum = 0.0;
|
||||||
double fractionPorvPhaseSumSwat = 0.0;
|
double fractionPorvPhaseSumSwat = 0.0;
|
||||||
double fractionPorvPhaseSumSoil = 0.0;
|
double fractionPorvPhaseSumSoil = 0.0;
|
||||||
|
@ -38,7 +38,14 @@ class RigTofAccumulatedPhaseFractionsCalculator
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void computeTOFaccumulations();
|
explicit RigTofAccumulatedPhaseFractionsCalculator(RimEclipseCase* caseToApply,
|
||||||
|
QString wellname,
|
||||||
|
size_t timestep);
|
||||||
|
|
||||||
|
const std::vector<double>& sortedUniqueTOFValues() const { return m_tofInIncreasingOrder; }
|
||||||
|
const std::vector<double>& accumulatedPhaseFractionsSwat() const { return m_accumulatedPhaseFractionSwat; }
|
||||||
|
const std::vector<double>& accumulatedPhaseFractionsSoil() const { return m_accumulatedPhaseFractionSoil; }
|
||||||
|
const std::vector<double>& accumulatedPhaseFractionsSgas() const { return m_accumulatedPhaseFractionSgas; }
|
||||||
|
|
||||||
static void sortTofAndCalculateAccPhaseFraction(const std::vector<double>* tofData,
|
static void sortTofAndCalculateAccPhaseFraction(const std::vector<double>* tofData,
|
||||||
const std::vector<double>* fractionData,
|
const std::vector<double>* fractionData,
|
||||||
@ -51,12 +58,21 @@ public:
|
|||||||
std::vector<double>& accumulatedPhaseFractionSoil,
|
std::vector<double>& accumulatedPhaseFractionSoil,
|
||||||
std::vector<double>& accumulatedPhaseFractionSgas);
|
std::vector<double>& accumulatedPhaseFractionSgas);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void computeTOFaccumulations();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RimEclipseCase* m_case;
|
RimEclipseCase* m_case;
|
||||||
QString m_wellName;
|
QString m_wellName;
|
||||||
|
size_t m_timeStep;
|
||||||
|
|
||||||
caf::PdmField<int> m_timeStep;
|
RimFlowDiagSolution* m_flowDiagSolution ; //hente fra case, rimEclipseResultCase?
|
||||||
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
|
|
||||||
|
std::vector<double> m_tofInIncreasingOrder;
|
||||||
|
std::vector<double> m_accumulatedPhaseFractionSwat;
|
||||||
|
std::vector<double> m_accumulatedPhaseFractionSgas;
|
||||||
|
std::vector<double> m_accumulatedPhaseFractionSoil;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user