mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-12 08:25:03 -05:00
#1126 Adding RigTofAccumulatedPhaseFractionsCalculatorTester with function calling sortTofAndCalculateAccPhaseFraction, so that this function can be set private.
This commit is contained in:
1 parent
ebab0b50a3
commit
ef1208e2f5
3 files changed
+49
-25
No files matched your search
@@ -41,7 +41,6 @@ RigTofAccumulatedPhaseFractionsCalculator::RigTofAccumulatedPhaseFractionsCalcul
|
|||||||
QString wellname,
|
QString wellname,
|
||||||
size_t timestep)
|
size_t timestep)
|
||||||
{
|
{
|
||||||
|
|
||||||
RigEclipseCaseData* eclipseCaseData = caseToApply->eclipseCaseData();
|
RigEclipseCaseData* eclipseCaseData = caseToApply->eclipseCaseData();
|
||||||
RifReaderInterface::PorosityModelResultType porosityModel = RifReaderInterface::MATRIX_RESULTS;
|
RifReaderInterface::PorosityModelResultType porosityModel = RifReaderInterface::MATRIX_RESULTS;
|
||||||
RimReservoirCellResultsStorage* gridCellResults = caseToApply->results(porosityModel);
|
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>* sgasResults = &(eclipseCaseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(scalarResultIndexSgas, timestep));
|
||||||
const std::vector<double>* porvResults = &(eclipseCaseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(scalarResultIndexPorv, timestep));
|
const std::vector<double>* porvResults = &(eclipseCaseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(scalarResultIndexPorv, timestep));
|
||||||
|
|
||||||
|
|
||||||
RimFlowDiagSolution* flowDiagSolution = caseToApply->defaultFlowDiagSolution();
|
RimFlowDiagSolution* flowDiagSolution = caseToApply->defaultFlowDiagSolution();
|
||||||
|
|
||||||
std::string resultNameTof = "TOF";
|
std::string resultNameTof = "TOF";
|
||||||
@@ -105,7 +103,7 @@ void RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFract
|
|||||||
auto iteratorBoolFromInsertToMap = tofAndIndexMap.insert(std::make_pair(tofData->at(i), vectorOfIndexes));
|
auto iteratorBoolFromInsertToMap = tofAndIndexMap.insert(std::make_pair(tofData->at(i), vectorOfIndexes));
|
||||||
if (!iteratorBoolFromInsertToMap.second)
|
if (!iteratorBoolFromInsertToMap.second)
|
||||||
{
|
{
|
||||||
//Element exist alread, was not inserted
|
//Element exist already, was not inserted
|
||||||
iteratorBoolFromInsertToMap.first->second.push_back(i);
|
iteratorBoolFromInsertToMap.first->second.push_back(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend class RigTofAccumulatedPhaseFractionsCalculatorTester;
|
||||||
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,
|
||||||
const std::vector<double>* porvResults,
|
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> accumulatedPhaseFractionSgas;
|
||||||
std::vector<double> tofInIncreasingOrder;
|
std::vector<double> tofInIncreasingOrder;
|
||||||
|
|
||||||
RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFraction(&(tofDataVector),
|
RigTofAccumulatedPhaseFractionsCalculatorTester::testSortTofAndCalculateAccPhaseFraction(&(tofDataVector),
|
||||||
&(fractionDataVector),
|
&(fractionDataVector),
|
||||||
&(porvResultVector),
|
&(porvResultVector),
|
||||||
&(swatResultVector),
|
&(swatResultVector),
|
||||||
&(soilResultVector),
|
&(soilResultVector),
|
||||||
&(sgasResultVector),
|
&(sgasResultVector),
|
||||||
tofInIncreasingOrder,
|
tofInIncreasingOrder,
|
||||||
accumulatedPhaseFractionSwat,
|
accumulatedPhaseFractionSwat,
|
||||||
accumulatedPhaseFractionSoil,
|
accumulatedPhaseFractionSoil,
|
||||||
accumulatedPhaseFractionSgas
|
accumulatedPhaseFractionSgas
|
||||||
);
|
);
|
||||||
|
|
||||||
EXPECT_LT(tofInIncreasingOrder[0], tofInIncreasingOrder[1]);
|
EXPECT_LT(tofInIncreasingOrder[0], tofInIncreasingOrder[1]);
|
||||||
EXPECT_LT(tofInIncreasingOrder[1], tofInIncreasingOrder[2]);
|
EXPECT_LT(tofInIncreasingOrder[1], tofInIncreasingOrder[2]);
|
||||||
@@ -131,16 +131,16 @@ TEST(RigTofAccumulatedPhaseFractionsCalculator, sortTofAndCalculateAccPhaseFract
|
|||||||
std::vector<double> accumulatedPhaseFractionSgas2;
|
std::vector<double> accumulatedPhaseFractionSgas2;
|
||||||
std::vector<double> tofInIncreasingOrder2;
|
std::vector<double> tofInIncreasingOrder2;
|
||||||
|
|
||||||
RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFraction(&(tofDataVector2),
|
RigTofAccumulatedPhaseFractionsCalculatorTester::testSortTofAndCalculateAccPhaseFraction(&(tofDataVector2),
|
||||||
&(fractionDataVector2),
|
&(fractionDataVector2),
|
||||||
&(porvResultVector2),
|
&(porvResultVector2),
|
||||||
&(swatResultVector2),
|
&(swatResultVector2),
|
||||||
&(soilResultVector2),
|
&(soilResultVector2),
|
||||||
&(sgasResultVector2),
|
&(sgasResultVector2),
|
||||||
tofInIncreasingOrder2,
|
tofInIncreasingOrder2,
|
||||||
accumulatedPhaseFractionSwat2,
|
accumulatedPhaseFractionSwat2,
|
||||||
accumulatedPhaseFractionSoil2,
|
accumulatedPhaseFractionSoil2,
|
||||||
accumulatedPhaseFractionSgas2);
|
accumulatedPhaseFractionSgas2);
|
||||||
EXPECT_EQ(tofInIncreasingOrder2.size(), 3);
|
EXPECT_EQ(tofInIncreasingOrder2.size(), 3);
|
||||||
|
|
||||||
double sumForOneTOF = accumulatedPhaseFractionSwat2[2]
|
double sumForOneTOF = accumulatedPhaseFractionSwat2[2]
|
||||||
|
|||||||
Reference in new issue
Block a user