#1126 Adding RigTofAccumulatedPhaseFractionsCalculatorTester with function calling sortTofAndCalculateAccPhaseFraction, so that this function can be set private.

This commit is contained in:
astridkbjorke committed 2017-08-11 10:31:13 +02:00
1 parent ebab0b50a3
commit ef1208e2f5
3 files changed
+30 -6

No files matched your search

@@ -41,7 +41,6 @@ RigTofAccumulatedPhaseFractionsCalculator::RigTofAccumulatedPhaseFractionsCalcul
QString wellname,
size_t timestep)
{
RigEclipseCaseData* eclipseCaseData = caseToApply->eclipseCaseData();
RifReaderInterface::PorosityModelResultType porosityModel = RifReaderInterface::MATRIX_RESULTS;
RimReservoirCellResultsStorage* gridCellResults = caseToApply->results(porosityModel);
@@ -55,7 +54,6 @@ RigTofAccumulatedPhaseFractionsCalculator::RigTofAccumulatedPhaseFractionsCalcul
const std::vector<double>* sgasResults = &(eclipseCaseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(scalarResultIndexSgas, timestep));
const std::vector<double>* porvResults = &(eclipseCaseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(scalarResultIndexPorv, timestep));
RimFlowDiagSolution* flowDiagSolution = caseToApply->defaultFlowDiagSolution();
std::string resultNameTof = "TOF";
@@ -105,7 +103,7 @@ void RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFract
auto iteratorBoolFromInsertToMap = tofAndIndexMap.insert(std::make_pair(tofData->at(i), vectorOfIndexes));
if (!iteratorBoolFromInsertToMap.second)
{
//Element exist alread, was not inserted
//Element exist already, was not inserted
iteratorBoolFromInsertToMap.first->second.push_back(i);
}
}
@@ -49,6 +49,7 @@ public:
private:
friend class RigTofAccumulatedPhaseFractionsCalculatorTester;
static void sortTofAndCalculateAccPhaseFraction(const std::vector<double>* tofData,
const std::vector<double>* fractionData,
const std::vector<double>* porvResults,
@@ -68,4 +69,29 @@ private:
};
//TODO: tester...
class RigTofAccumulatedPhaseFractionsCalculatorTester
{
public:
static void testSortTofAndCalculateAccPhaseFraction(const std::vector<double>* tofData,
const std::vector<double>* fractionData,
const std::vector<double>* porvResults,
const std::vector<double>* swatResults,
const std::vector<double>* soilResults,
const std::vector<double>* sgasResults,
std::vector<double>& tofInIncreasingOrder,
std::vector<double>& accumulatedPhaseFractionSwat,
std::vector<double>& accumulatedPhaseFractionSoil,
std::vector<double>& accumulatedPhaseFractionSgas)
{
RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFraction(tofData,
fractionData,
porvResults,
swatResults,
soilResults,
sgasResults,
tofInIncreasingOrder,
accumulatedPhaseFractionSwat,
accumulatedPhaseFractionSoil,
accumulatedPhaseFractionSgas);
}
};
@@ -60,7 +60,7 @@ TEST(RigTofAccumulatedPhaseFractionsCalculator, sortTofAndCalculateAccPhaseFract
std::vector<double> accumulatedPhaseFractionSgas;
std::vector<double> tofInIncreasingOrder;
RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFraction(&(tofDataVector),
RigTofAccumulatedPhaseFractionsCalculatorTester::testSortTofAndCalculateAccPhaseFraction(&(tofDataVector),
&(fractionDataVector),
&(porvResultVector),
&(swatResultVector),
@@ -131,7 +131,7 @@ TEST(RigTofAccumulatedPhaseFractionsCalculator, sortTofAndCalculateAccPhaseFract
std::vector<double> accumulatedPhaseFractionSgas2;
std::vector<double> tofInIncreasingOrder2;
RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFraction(&(tofDataVector2),
RigTofAccumulatedPhaseFractionsCalculatorTester::testSortTofAndCalculateAccPhaseFraction(&(tofDataVector2),
&(fractionDataVector2),
&(porvResultVector2),
&(swatResultVector2),