mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1332 Fixed wrong mapping of tracername to index based result value. Resulted in wrong colors for "tracer with max fraction" results, and wrong property filtering.
This commit is contained in:
parent
7095e80696
commit
003da9f640
@ -275,19 +275,24 @@ std::vector<double>* RigFlowDiagResults::calculateSumOfFractionsResult(const Rig
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double>* RigFlowDiagResults::calculateTracerWithMaxFractionResult(const RigFlowDiagResultAddress &resVarAddr, size_t frameIndex)
|
||||
{
|
||||
std::vector<int> selectedTracerIdxToGlobalTracerIdx;
|
||||
std::vector< std::pair<std::string, const std::vector<double>* > > fractions = findNamedResultsForSelectedTracers(resVarAddr,
|
||||
frameIndex,
|
||||
RIG_FLD_CELL_FRACTION_RESNAME,
|
||||
RimFlowDiagSolution::UNDEFINED);
|
||||
|
||||
std::vector<int> resultTracerIdxToGlobalTracerIdx;
|
||||
{
|
||||
selectedTracerIdxToGlobalTracerIdx.resize(resVarAddr.selectedTracerNames.size(), -1);
|
||||
resultTracerIdxToGlobalTracerIdx.resize(fractions.size(), -1);
|
||||
|
||||
std::vector<QString> allTracerNames = m_flowDiagSolution->tracerNames();
|
||||
int selTracerIdx = 0;
|
||||
for ( const std::string& tracerName: resVarAddr.selectedTracerNames )
|
||||
for ( const auto& trNameFractionPair: fractions )
|
||||
{
|
||||
for ( size_t globIdx = 0; globIdx < allTracerNames.size(); ++globIdx )
|
||||
{
|
||||
if ( allTracerNames[globIdx].toStdString() == tracerName )
|
||||
if ( allTracerNames[globIdx].toStdString() == trNameFractionPair.first )
|
||||
{
|
||||
selectedTracerIdxToGlobalTracerIdx[selTracerIdx] = static_cast<int>(globIdx);
|
||||
resultTracerIdxToGlobalTracerIdx[selTracerIdx] = static_cast<int>(globIdx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -302,10 +307,6 @@ std::vector<double>* RigFlowDiagResults::calculateTracerWithMaxFractionResult(co
|
||||
std::vector<double>& maxFractionTracerIdx = maxFractionTracerIdxFrames->frameData(frameIndex);
|
||||
{
|
||||
|
||||
std::vector<const std::vector<double>* > fractions = findResultsForSelectedTracers(resVarAddr,
|
||||
frameIndex,
|
||||
RIG_FLD_CELL_FRACTION_RESNAME,
|
||||
RimFlowDiagSolution::UNDEFINED);
|
||||
maxFractionTracerIdx.resize(activeCellCount, HUGE_VAL);
|
||||
|
||||
std::vector<double> maxFraction;
|
||||
@ -313,7 +314,7 @@ std::vector<double>* RigFlowDiagResults::calculateTracerWithMaxFractionResult(co
|
||||
|
||||
for ( size_t frIdx = 0; frIdx < fractions.size(); ++frIdx )
|
||||
{
|
||||
const std::vector<double> * fr = fractions[frIdx];
|
||||
const std::vector<double> * fr = fractions[frIdx].second;
|
||||
|
||||
for ( size_t acIdx = 0 ; acIdx < activeCellCount; ++acIdx )
|
||||
{
|
||||
@ -322,20 +323,12 @@ std::vector<double>* RigFlowDiagResults::calculateTracerWithMaxFractionResult(co
|
||||
if ( maxFraction[acIdx] < (*fr)[acIdx] )
|
||||
{
|
||||
maxFraction[acIdx] = (*fr)[acIdx];
|
||||
maxFractionTracerIdx[acIdx] = frIdx;
|
||||
maxFractionTracerIdx[acIdx] = resultTracerIdxToGlobalTracerIdx[frIdx];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( size_t acIdx = 0 ; acIdx < activeCellCount; ++acIdx )
|
||||
{
|
||||
if ( maxFractionTracerIdx[acIdx] == HUGE_VAL ) continue;
|
||||
|
||||
double selectedTracerIdx = static_cast<int>(maxFractionTracerIdx[acIdx]);
|
||||
maxFractionTracerIdx[acIdx] = selectedTracerIdxToGlobalTracerIdx[selectedTracerIdx];
|
||||
}
|
||||
|
||||
return &maxFractionTracerIdx;
|
||||
}
|
||||
|
||||
@ -403,6 +396,32 @@ std::vector<const std::vector<double>* > RigFlowDiagResults::findResultsForSelec
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector< std::pair<std::string, const std::vector<double>*> >
|
||||
RigFlowDiagResults::findNamedResultsForSelectedTracers(const RigFlowDiagResultAddress& resVarAddr,
|
||||
size_t frameIndex,
|
||||
const std::string& nativeResultName,
|
||||
RimFlowDiagSolution::TracerStatusType wantedTracerType)
|
||||
{
|
||||
|
||||
std::vector<std::pair<std::string, const std::vector<double>* > > selectedTracersResults;
|
||||
|
||||
for ( const std::string& tracerName: resVarAddr.selectedTracerNames )
|
||||
{
|
||||
RimFlowDiagSolution::TracerStatusType tracerType = m_flowDiagSolution->tracerStatusInTimeStep(QString::fromStdString(tracerName), frameIndex);
|
||||
|
||||
if (tracerType != RimFlowDiagSolution::CLOSED
|
||||
&& ( tracerType == wantedTracerType || wantedTracerType == RimFlowDiagSolution::UNDEFINED) )
|
||||
{
|
||||
selectedTracersResults.push_back(std::make_pair(tracerName, findOrCalculateResult(RigFlowDiagResultAddress(nativeResultName, tracerName), frameIndex)));
|
||||
}
|
||||
}
|
||||
|
||||
return selectedTracersResults;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -81,6 +81,12 @@ private:
|
||||
size_t frameIndex,
|
||||
const std::string& nativeResultName,
|
||||
RimFlowDiagSolution::TracerStatusType wantedTracerType);
|
||||
std::vector< std::pair<std::string, const std::vector<double>*> >
|
||||
findNamedResultsForSelectedTracers(const RigFlowDiagResultAddress& resVarAddr,
|
||||
size_t frameIndex,
|
||||
const std::string& nativeResultName,
|
||||
RimFlowDiagSolution::TracerStatusType wantedTracerType);
|
||||
|
||||
void calculateSumOfFractionAndFractionMultTOF(size_t activeCellCount,
|
||||
const std::vector<const std::vector<double> *>& injectorFractions,
|
||||
const std::vector<const std::vector<double> *>& injectorTOFs,
|
||||
|
Loading…
Reference in New Issue
Block a user