mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -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:
@@ -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())
|
for (const RimFractureTemplate* f : fractureDefinitions())
|
||||||
{
|
{
|
||||||
auto stimPlanFracture = dynamic_cast<const RimStimPlanFractureTemplate*>(f);
|
auto stimPlanFracture = dynamic_cast<const RimStimPlanFractureTemplate*>(f);
|
||||||
if (stimPlanFracture)
|
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<std::pair<QString, QString> > stimPlanResultNamesAndUnits() const;
|
||||||
std::vector<QString> stimPlanResultNames() 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 deleteFractureDefinitions();
|
||||||
void loadAndUpdateData();
|
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())
|
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();
|
const std::vector<double>& timeSteps();
|
||||||
std::vector<std::pair<QString, QString> > resultNamesWithUnit() const;
|
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<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;
|
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 minValue = HUGE_VAL;
|
||||||
double maxValue = -HUGE_VAL;
|
double maxValue = -HUGE_VAL;
|
||||||
|
double posClosestToZero = HUGE_VAL;
|
||||||
|
double negClosestToZero = -HUGE_VAL;
|
||||||
|
|
||||||
RimFractureTemplateCollection* fracTemplateColl = fractureTemplateCollection();
|
RimFractureTemplateCollection* fracTemplateColl = fractureTemplateCollection();
|
||||||
|
|
||||||
fracTemplateColl->computeMinMax(resultName(), unit(), &minValue, &maxValue);
|
fracTemplateColl->computeMinMax(resultName(), unit(), &minValue, &maxValue, &posClosestToZero, &negClosestToZero);
|
||||||
|
|
||||||
if (minValue != HUGE_VAL)
|
if (minValue != HUGE_VAL)
|
||||||
{
|
{
|
||||||
legendConfig->setAutomaticRanges(minValue, maxValue, minValue, maxValue);
|
legendConfig->setAutomaticRanges(minValue, maxValue, minValue, maxValue);
|
||||||
|
legendConfig->setClosestToZeroValues(posClosestToZero, negClosestToZero, posClosestToZero, negClosestToZero);
|
||||||
}
|
}
|
||||||
|
|
||||||
legendConfig->setTitle(cvfqt::Utils::toString(m_resultNameAndUnit()));
|
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);
|
size_t resIndex = resultIndex(resultName, unit);
|
||||||
if (resIndex == cvf::UNDEFINED_SIZE_T) return;
|
if (resIndex == cvf::UNDEFINED_SIZE_T) return;
|
||||||
@@ -585,6 +587,16 @@ void RigStimPlanFractureDefinition::computeMinMax(const QString& resultName, con
|
|||||||
{
|
{
|
||||||
*maxValue = resultValue;
|
*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,
|
std::vector<double> fractureGridResults(const QString& resultName,
|
||||||
const QString& unitName,
|
const QString& unitName,
|
||||||
size_t timeStepIndex) const;
|
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
|
// Setup
|
||||||
void reorderYgridToDepths();
|
void reorderYgridToDepths();
|
||||||
|
|||||||
Reference in New Issue
Block a user