mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1230 Created StimPlan colors and show lenged in 3D view
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "cvfMath.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -90,20 +92,32 @@ size_t RigStimPlanFractureDefinition::getTimeStepIndex(double timeStepValue)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStimPlanFractureDefinition::setDataAtTimeValue(QString resultName, QString unit, std::vector<std::vector<double>> data, double timeStepValue)
|
||||
size_t RigStimPlanFractureDefinition::resultIndex(const QString& resultName, const QString& unit) const
|
||||
{
|
||||
bool resultNameExists = false;
|
||||
for (RigStimPlanData& resultData : stimPlanData)
|
||||
|
||||
for (size_t i = 0; i < stimPlanData.size(); i++)
|
||||
{
|
||||
if (resultData.resultName == resultName)
|
||||
if (stimPlanData[i].resultName == resultName && stimPlanData[i].unit == unit)
|
||||
{
|
||||
resultNameExists = true;
|
||||
resultData.parameterValues[getTimeStepIndex(timeStepValue)] = data;
|
||||
return;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
if (!resultNameExists)
|
||||
return cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStimPlanFractureDefinition::setDataAtTimeValue(QString resultName, QString unit, std::vector<std::vector<double>> data, double timeStepValue)
|
||||
{
|
||||
size_t resIndex = resultIndex(resultName, unit);
|
||||
|
||||
if (resIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
stimPlanData[resIndex].parameterValues[getTimeStepIndex(timeStepValue)] = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
RigStimPlanData resultData;
|
||||
|
||||
@@ -116,21 +130,18 @@ void RigStimPlanFractureDefinition::setDataAtTimeValue(QString resultName, QStri
|
||||
|
||||
stimPlanData.push_back(resultData);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::vector<double>> RigStimPlanFractureDefinition::getDataAtTimeIndex(QString resultName, size_t timeStepIndex)
|
||||
std::vector<std::vector<double>> RigStimPlanFractureDefinition::getDataAtTimeIndex(const QString& resultName, const QString& unit, size_t timeStepIndex) const
|
||||
{
|
||||
for (RigStimPlanData& resultData : stimPlanData)
|
||||
size_t resIndex = resultIndex(resultName, unit);
|
||||
|
||||
if (resIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
if (resultData.resultName == resultName)
|
||||
{
|
||||
return resultData.parameterValues[timeStepIndex];
|
||||
}
|
||||
return stimPlanData[resIndex].parameterValues[timeStepIndex];
|
||||
}
|
||||
|
||||
qDebug() << "ERROR: Requested parameter does not exists in stimPlan data";
|
||||
@@ -138,6 +149,36 @@ std::vector<std::vector<double>> RigStimPlanFractureDefinition::getDataAtTimeInd
|
||||
return emptyVector;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStimPlanFractureDefinition::computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue) const
|
||||
{
|
||||
CVF_ASSERT(minValue && maxValue);
|
||||
|
||||
size_t resIndex = resultIndex(resultName, unit);
|
||||
if (resIndex == cvf::UNDEFINED_SIZE_T) return;
|
||||
|
||||
for (auto timeValues : stimPlanData[resIndex].parameterValues)
|
||||
{
|
||||
for (auto values : timeValues)
|
||||
{
|
||||
for (auto resultValue : values)
|
||||
{
|
||||
if (resultValue < *minValue)
|
||||
{
|
||||
*minValue = resultValue;
|
||||
}
|
||||
|
||||
if (resultValue > *maxValue)
|
||||
{
|
||||
*maxValue = resultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -58,10 +58,14 @@ public:
|
||||
size_t getTimeStepIndex(double timeStepValue);
|
||||
|
||||
void setDataAtTimeValue(QString resultName, QString unit, std::vector<std::vector<double>> data, double timeStepValue);
|
||||
std::vector<std::vector<double>> getDataAtTimeIndex(QString resultName, size_t timeStepIndex);
|
||||
std::vector<std::vector<double>> getDataAtTimeIndex(const QString& resultName, const QString& unit, size_t timeStepIndex) const;
|
||||
void computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue) const;
|
||||
|
||||
std::vector<QString> resultNames() const;
|
||||
|
||||
private:
|
||||
size_t resultIndex(const QString& resultName, const QString& unit) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user