#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:
astridkbjorke 2017-08-10 15:17:46 +02:00
parent e19a63dcff
commit 2ce81e9045
2 changed files with 39 additions and 17 deletions

View File

@ -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++)
{
auto it = tofAndIndexMap.find(tofData->at(i));
if (it == tofAndIndexMap.end())
std::vector<int> vectorOfIndexes;
vectorOfIndexes.push_back(i);
auto iteratorBoolFromInsertToMap = tofAndIndexMap.insert(std::make_pair(tofData->at(i), vectorOfIndexes));
if (!iteratorBoolFromInsertToMap.second)
{
//Key does not exist
std::vector<int> vectorOfIndexes;
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;
//Element exist alread, was not inserted
iteratorBoolFromInsertToMap.first->second.push_back(i);
}
}
double fractionPorvSum = 0.0;
double fractionPorvPhaseSumSwat = 0.0;
double fractionPorvPhaseSumSoil = 0.0;

View File

@ -38,8 +38,15 @@ class RigTofAccumulatedPhaseFractionsCalculator
{
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,
const std::vector<double>* fractionData,
const std::vector<double>* porvResults,
@ -51,12 +58,21 @@ public:
std::vector<double>& accumulatedPhaseFractionSoil,
std::vector<double>& accumulatedPhaseFractionSgas);
private:
void computeTOFaccumulations();
private:
RimEclipseCase* m_case;
QString m_wellName;
size_t m_timeStep;
caf::PdmField<int> m_timeStep;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
RimFlowDiagSolution* m_flowDiagSolution ; //hente fra case, rimEclipseResultCase?
std::vector<double> m_tofInIncreasingOrder;
std::vector<double> m_accumulatedPhaseFractionSwat;
std::vector<double> m_accumulatedPhaseFractionSgas;
std::vector<double> m_accumulatedPhaseFractionSoil;
};