mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-24 23:36:50 -06:00
#1126 Adding RigTofAccumulatedPhaseFractionsCalculatorTester with function calling sortTofAndCalculateAccPhaseFraction, so that this function can be set private.
This commit is contained in:
parent
ebab0b50a3
commit
ef1208e2f5
@ -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);
|
||||
@ -54,8 +53,7 @@ RigTofAccumulatedPhaseFractionsCalculator::RigTofAccumulatedPhaseFractionsCalcul
|
||||
const std::vector<double>* soilResults = &(eclipseCaseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(scalarResultIndexSoil, timestep));
|
||||
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,17 +60,17 @@ TEST(RigTofAccumulatedPhaseFractionsCalculator, sortTofAndCalculateAccPhaseFract
|
||||
std::vector<double> accumulatedPhaseFractionSgas;
|
||||
std::vector<double> tofInIncreasingOrder;
|
||||
|
||||
RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFraction(&(tofDataVector),
|
||||
&(fractionDataVector),
|
||||
&(porvResultVector),
|
||||
&(swatResultVector),
|
||||
&(soilResultVector),
|
||||
&(sgasResultVector),
|
||||
tofInIncreasingOrder,
|
||||
accumulatedPhaseFractionSwat,
|
||||
accumulatedPhaseFractionSoil,
|
||||
accumulatedPhaseFractionSgas
|
||||
);
|
||||
RigTofAccumulatedPhaseFractionsCalculatorTester::testSortTofAndCalculateAccPhaseFraction(&(tofDataVector),
|
||||
&(fractionDataVector),
|
||||
&(porvResultVector),
|
||||
&(swatResultVector),
|
||||
&(soilResultVector),
|
||||
&(sgasResultVector),
|
||||
tofInIncreasingOrder,
|
||||
accumulatedPhaseFractionSwat,
|
||||
accumulatedPhaseFractionSoil,
|
||||
accumulatedPhaseFractionSgas
|
||||
);
|
||||
|
||||
EXPECT_LT(tofInIncreasingOrder[0], tofInIncreasingOrder[1]);
|
||||
EXPECT_LT(tofInIncreasingOrder[1], tofInIncreasingOrder[2]);
|
||||
@ -131,16 +131,16 @@ TEST(RigTofAccumulatedPhaseFractionsCalculator, sortTofAndCalculateAccPhaseFract
|
||||
std::vector<double> accumulatedPhaseFractionSgas2;
|
||||
std::vector<double> tofInIncreasingOrder2;
|
||||
|
||||
RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFraction(&(tofDataVector2),
|
||||
&(fractionDataVector2),
|
||||
&(porvResultVector2),
|
||||
&(swatResultVector2),
|
||||
&(soilResultVector2),
|
||||
&(sgasResultVector2),
|
||||
tofInIncreasingOrder2,
|
||||
accumulatedPhaseFractionSwat2,
|
||||
accumulatedPhaseFractionSoil2,
|
||||
accumulatedPhaseFractionSgas2);
|
||||
RigTofAccumulatedPhaseFractionsCalculatorTester::testSortTofAndCalculateAccPhaseFraction(&(tofDataVector2),
|
||||
&(fractionDataVector2),
|
||||
&(porvResultVector2),
|
||||
&(swatResultVector2),
|
||||
&(soilResultVector2),
|
||||
&(sgasResultVector2),
|
||||
tofInIncreasingOrder2,
|
||||
accumulatedPhaseFractionSwat2,
|
||||
accumulatedPhaseFractionSoil2,
|
||||
accumulatedPhaseFractionSgas2);
|
||||
EXPECT_EQ(tofInIncreasingOrder2.size(), 3);
|
||||
|
||||
double sumForOneTOF = accumulatedPhaseFractionSwat2[2]
|
||||
|
Loading…
Reference in New Issue
Block a user