#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;