mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
#1634 Calculating smallest positive value and using this value for the min range value when using logarithmic scale
This commit is contained in:
parent
d6ae3b4a53
commit
032630f6e9
@ -91,14 +91,14 @@ std::vector<QString> RimFractureTemplateCollection::stimPlanResultNames() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureTemplateCollection::computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue) const
|
||||
void RimFractureTemplateCollection::computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue, double* posClosestToZero, double* negClosestToZero) const
|
||||
{
|
||||
for (const RimFractureTemplate* f : fractureDefinitions())
|
||||
{
|
||||
auto stimPlanFracture = dynamic_cast<const RimStimPlanFractureTemplate*>(f);
|
||||
if (stimPlanFracture)
|
||||
{
|
||||
stimPlanFracture->computeMinMax(resultName, unit, minValue, maxValue);
|
||||
stimPlanFracture->computeMinMax(resultName, unit, minValue, maxValue, posClosestToZero, negClosestToZero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
|
||||
std::vector<std::pair<QString, QString> > stimPlanResultNamesAndUnits() const;
|
||||
std::vector<QString> stimPlanResultNames() const;
|
||||
void computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue) const;
|
||||
void computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue, double* posClosestToZero, double* negClosestToZero) const;
|
||||
|
||||
void deleteFractureDefinitions();
|
||||
void loadAndUpdateData();
|
||||
|
@ -348,11 +348,11 @@ std::vector<std::pair<QString, QString> > RimStimPlanFractureTemplate::resultNam
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStimPlanFractureTemplate::computeMinMax(const QString& resultName, const QString& unitName, double* minValue, double* maxValue) const
|
||||
void RimStimPlanFractureTemplate::computeMinMax(const QString& resultName, const QString& unitName, double* minValue, double* maxValue, double* posClosestToZero, double* negClosestToZero) const
|
||||
{
|
||||
if (m_stimPlanFractureDefinitionData.notNull())
|
||||
{
|
||||
m_stimPlanFractureDefinitionData->computeMinMax(resultName, unitName, minValue, maxValue);
|
||||
m_stimPlanFractureDefinitionData->computeMinMax(resultName, unitName, minValue, maxValue, posClosestToZero, negClosestToZero);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
|
||||
const std::vector<double>& timeSteps();
|
||||
std::vector<std::pair<QString, QString> > resultNamesWithUnit() const;
|
||||
void computeMinMax(const QString& resultName, const QString& unitName, double* minValue, double* maxValue) const;
|
||||
void computeMinMax(const QString& resultName, const QString& unitName, double* minValue, double* maxValue, double* posClosestToZero, double* negClosestToZero) const;
|
||||
std::vector<std::vector<double>> resultValues(const QString& resultName, const QString& unitName, size_t timeStepIndex) const;
|
||||
std::vector<double> fractureGridResults(const QString& resultName, const QString& unitName, size_t timeStepIndex) const;
|
||||
|
||||
|
@ -247,14 +247,17 @@ void RimStimPlanColors::updateLegendData()
|
||||
{
|
||||
double minValue = HUGE_VAL;
|
||||
double maxValue = -HUGE_VAL;
|
||||
double posClosestToZero = HUGE_VAL;
|
||||
double negClosestToZero = -HUGE_VAL;
|
||||
|
||||
RimFractureTemplateCollection* fracTemplateColl = fractureTemplateCollection();
|
||||
|
||||
fracTemplateColl->computeMinMax(resultName(), unit(), &minValue, &maxValue);
|
||||
fracTemplateColl->computeMinMax(resultName(), unit(), &minValue, &maxValue, &posClosestToZero, &negClosestToZero);
|
||||
|
||||
if (minValue != HUGE_VAL)
|
||||
{
|
||||
legendConfig->setAutomaticRanges(minValue, maxValue, minValue, maxValue);
|
||||
legendConfig->setClosestToZeroValues(posClosestToZero, negClosestToZero, posClosestToZero, negClosestToZero);
|
||||
}
|
||||
|
||||
legendConfig->setTitle(cvfqt::Utils::toString(m_resultNameAndUnit()));
|
||||
|
@ -563,9 +563,11 @@ const std::vector<std::vector<double>>& RigStimPlanFractureDefinition::getDataAt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStimPlanFractureDefinition::computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue) const
|
||||
void RigStimPlanFractureDefinition::computeMinMax(const QString& resultName, const QString& unit,
|
||||
double* minValue, double* maxValue,
|
||||
double* posClosestToZero, double* negClosestToZero) const
|
||||
{
|
||||
CVF_ASSERT(minValue && maxValue);
|
||||
CVF_ASSERT(minValue && maxValue && posClosestToZero && negClosestToZero);
|
||||
|
||||
size_t resIndex = resultIndex(resultName, unit);
|
||||
if (resIndex == cvf::UNDEFINED_SIZE_T) return;
|
||||
@ -585,6 +587,16 @@ void RigStimPlanFractureDefinition::computeMinMax(const QString& resultName, con
|
||||
{
|
||||
*maxValue = resultValue;
|
||||
}
|
||||
|
||||
if (resultValue > 0 && resultValue < *posClosestToZero)
|
||||
{
|
||||
*posClosestToZero = resultValue;
|
||||
}
|
||||
|
||||
if (resultValue < 0 && resultValue > *negClosestToZero)
|
||||
{
|
||||
*posClosestToZero = resultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public:
|
||||
std::vector<double> fractureGridResults(const QString& resultName,
|
||||
const QString& unitName,
|
||||
size_t timeStepIndex) const;
|
||||
void computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue) const;
|
||||
void computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue, double* posClosestToZero, double* negClosestToZero) const;
|
||||
|
||||
// Setup
|
||||
void reorderYgridToDepths();
|
||||
|
Loading…
Reference in New Issue
Block a user