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:
@@ -18,21 +18,24 @@
|
|||||||
|
|
||||||
#include "RivWellFracturePartMgr.h"
|
#include "RivWellFracturePartMgr.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimEclipseWell.h"
|
#include "RimEclipseWell.h"
|
||||||
#include "RimFracture.h"
|
#include "RimFracture.h"
|
||||||
|
#include "RimLegendConfig.h"
|
||||||
#include "cafEffectGenerator.h"
|
#include "RimStimPlanColors.h"
|
||||||
|
#include "RimStimPlanFractureTemplate.h"
|
||||||
|
|
||||||
#include "cafDisplayCoordTransform.h"
|
#include "cafDisplayCoordTransform.h"
|
||||||
|
#include "cafEffectGenerator.h"
|
||||||
|
|
||||||
#include "cvfDrawableGeo.h"
|
#include "cvfDrawableGeo.h"
|
||||||
#include "cvfModelBasicList.h"
|
#include "cvfModelBasicList.h"
|
||||||
#include "cvfPart.h"
|
#include "cvfPart.h"
|
||||||
#include "cvfPrimitiveSet.h"
|
#include "cvfPrimitiveSet.h"
|
||||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||||
#include "cvfScalarMapperContinuousLinear.h"
|
#include "cvfScalarMapperContinuousLinear.h"
|
||||||
#include "RimStimPlanFractureTemplate.h"
|
|
||||||
#include "RimLegendConfig.h"
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -108,6 +111,15 @@ void RivWellFracturePartMgr::updatePartGeometryTexture(caf::DisplayCoordTransfor
|
|||||||
|
|
||||||
if (!m_rimFracture->hasValidGeometry()) return;
|
if (!m_rimFracture->hasValidGeometry()) return;
|
||||||
|
|
||||||
|
RimLegendConfig* legendConfig = nullptr;
|
||||||
|
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
||||||
|
if (activeView)
|
||||||
|
{
|
||||||
|
legendConfig = activeView->stimPlanColors->activeLegend();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note : If no legend is found, draw geo using a single color
|
||||||
|
|
||||||
RimFractureTemplate * fracTemplate = m_rimFracture->attachedFractureDefinition();
|
RimFractureTemplate * fracTemplate = m_rimFracture->attachedFractureDefinition();
|
||||||
RimStimPlanFractureTemplate* stimPlanFracTemplate;
|
RimStimPlanFractureTemplate* stimPlanFracTemplate;
|
||||||
|
|
||||||
@@ -118,10 +130,7 @@ void RivWellFracturePartMgr::updatePartGeometryTexture(caf::DisplayCoordTransfor
|
|||||||
else return;
|
else return;
|
||||||
|
|
||||||
int timeStepIndex = m_rimFracture->stimPlanTimeIndexToPlot;
|
int timeStepIndex = m_rimFracture->stimPlanTimeIndexToPlot;
|
||||||
QString resultToPlot = m_rimFracture->stimPlanParameterToPlot;
|
std::vector<std::vector<double> > dataToPlot = stimPlanFracTemplate->getDataAtTimeIndex(activeView->stimPlanColors->resultName(), activeView->stimPlanColors->unit(), timeStepIndex);
|
||||||
std::vector<std::vector<double> > dataToPlot = stimPlanFracTemplate->getDataAtTimeIndex(resultToPlot, timeStepIndex);
|
|
||||||
|
|
||||||
if (dataToPlot.empty()) return; //TODO: Set all values to undefined if no data available...
|
|
||||||
|
|
||||||
const std::vector<cvf::Vec3f>& nodeCoords = m_rimFracture->nodeCoords();
|
const std::vector<cvf::Vec3f>& nodeCoords = m_rimFracture->nodeCoords();
|
||||||
const std::vector<cvf::uint>& triangleIndices = m_rimFracture->triangleIndices();
|
const std::vector<cvf::uint>& triangleIndices = m_rimFracture->triangleIndices();
|
||||||
@@ -139,30 +148,38 @@ void RivWellFracturePartMgr::updatePartGeometryTexture(caf::DisplayCoordTransfor
|
|||||||
m_part = new cvf::Part;
|
m_part = new cvf::Part;
|
||||||
m_part->setDrawable(geo.p());
|
m_part->setDrawable(geo.p());
|
||||||
|
|
||||||
RimLegendConfig* legend = m_rimFracture->activeLegend();
|
if (legendConfig)
|
||||||
cvf::ScalarMapper* scalarMapper = legend->scalarMapper();
|
|
||||||
|
|
||||||
cvf::ref<cvf::Vec2fArray> textureCoords = new cvf::Vec2fArray;
|
|
||||||
textureCoords->resize(nodeCoords.size());
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
for (std::vector<double> depthData : dataToPlot)
|
|
||||||
{
|
{
|
||||||
std::vector<double> mirroredValuesAtDepth = mirrorDataAtSingleDepth(depthData);
|
cvf::ScalarMapper* scalarMapper = legendConfig->scalarMapper();
|
||||||
for (double gridXdata : mirroredValuesAtDepth)
|
|
||||||
|
cvf::ref<cvf::Vec2fArray> textureCoords = new cvf::Vec2fArray;
|
||||||
|
textureCoords->resize(nodeCoords.size());
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for (std::vector<double> depthData : dataToPlot)
|
||||||
{
|
{
|
||||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(gridXdata);
|
std::vector<double> mirroredValuesAtDepth = mirrorDataAtSingleDepth(depthData);
|
||||||
textureCoords->set(i, texCoord);
|
for (double gridXdata : mirroredValuesAtDepth)
|
||||||
i++;
|
{
|
||||||
|
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(gridXdata);
|
||||||
|
textureCoords->set(i, texCoord);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
geo->setTextureCoordArray(textureCoords.p());
|
geo->setTextureCoordArray(textureCoords.p());
|
||||||
|
|
||||||
caf::ScalarMapperEffectGenerator scalarMapperEffectGenerator(scalarMapper, caf::PO_NEG_LARGE);
|
caf::ScalarMapperEffectGenerator scalarMapperEffectGenerator(scalarMapper, caf::PO_NEG_LARGE);
|
||||||
cvf::ref<cvf::Effect> eff = scalarMapperEffectGenerator.generateUnCachedEffect();
|
cvf::ref<cvf::Effect> eff = scalarMapperEffectGenerator.generateCachedEffect();
|
||||||
|
|
||||||
m_part->setEffect(eff.p());
|
m_part->setEffect(eff.p());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN)), caf::PO_1);
|
||||||
|
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
||||||
|
m_part->setEffect(eff.p());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ ${CEE_CURRENT_LIST_DIR}RimFractureExportSettings.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RimFractureTemplate.h
|
${CEE_CURRENT_LIST_DIR}RimFractureTemplate.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimStimPlanFractureTemplate.h
|
${CEE_CURRENT_LIST_DIR}RimStimPlanFractureTemplate.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimStimPlanLegendConfig.h
|
${CEE_CURRENT_LIST_DIR}RimStimPlanLegendConfig.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimStimPlanColors.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
@@ -188,6 +189,7 @@ ${CEE_CURRENT_LIST_DIR}RimFractureExportSettings.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RimFractureTemplate.cpp
|
${CEE_CURRENT_LIST_DIR}RimFractureTemplate.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimStimPlanFractureTemplate.cpp
|
${CEE_CURRENT_LIST_DIR}RimStimPlanFractureTemplate.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimStimPlanLegendConfig.cpp
|
${CEE_CURRENT_LIST_DIR}RimStimPlanLegendConfig.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimStimPlanColors.cpp
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
#include "RimLegendConfig.h"
|
#include "RimLegendConfig.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
|
#include "RimStimPlanColors.h"
|
||||||
#include "RimTernaryLegendConfig.h"
|
#include "RimTernaryLegendConfig.h"
|
||||||
#include "RimViewController.h"
|
#include "RimViewController.h"
|
||||||
#include "RimViewLinker.h"
|
#include "RimViewLinker.h"
|
||||||
@@ -113,6 +114,10 @@ RimEclipseView::RimEclipseView()
|
|||||||
faultResultSettings = new RimEclipseFaultColors();
|
faultResultSettings = new RimEclipseFaultColors();
|
||||||
faultResultSettings.uiCapability()->setUiHidden(true);
|
faultResultSettings.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&stimPlanColors, "StimPlanColors", "Fracture Colors", "", "", "");
|
||||||
|
stimPlanColors = new RimStimPlanColors();
|
||||||
|
stimPlanColors.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&wellCollection, "WellCollection", "Simulation Wells", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&wellCollection, "WellCollection", "Simulation Wells", "", "", "");
|
||||||
wellCollection = new RimEclipseWellCollection;
|
wellCollection = new RimEclipseWellCollection;
|
||||||
wellCollection.uiCapability()->setUiHidden(true);
|
wellCollection.uiCapability()->setUiHidden(true);
|
||||||
@@ -697,6 +702,7 @@ void RimEclipseView::loadDataAndUpdate()
|
|||||||
this->cellEdgeResult()->loadResult();
|
this->cellEdgeResult()->loadResult();
|
||||||
|
|
||||||
this->faultResultSettings()->customFaultResult()->loadResult();
|
this->faultResultSettings()->customFaultResult()->loadResult();
|
||||||
|
this->stimPlanColors->loadDataAndUpdate();
|
||||||
|
|
||||||
updateMdiWindowVisibility();
|
updateMdiWindowVisibility();
|
||||||
|
|
||||||
@@ -997,6 +1003,17 @@ void RimEclipseView::updateLegends()
|
|||||||
this->cellEdgeResult()->legendConfig()->setClosestToZeroValues(0, 0, 0, 0);
|
this->cellEdgeResult()->legendConfig()->setClosestToZeroValues(0, 0, 0, 0);
|
||||||
this->cellEdgeResult()->legendConfig()->setAutomaticRanges(cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE);
|
this->cellEdgeResult()->legendConfig()->setAutomaticRanges(cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RimLegendConfig* stimPlanLegend = stimPlanColors()->activeLegend();
|
||||||
|
if (stimPlanLegend)
|
||||||
|
{
|
||||||
|
stimPlanColors->updateLegendData();
|
||||||
|
|
||||||
|
if (stimPlanLegend->legend())
|
||||||
|
{
|
||||||
|
m_viewer->addColorLegendToBottomLeftCorner(stimPlanLegend->legend());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1332,6 +1349,7 @@ void RimEclipseView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
|||||||
uiTreeOrdering.add(cellResult());
|
uiTreeOrdering.add(cellResult());
|
||||||
uiTreeOrdering.add(cellEdgeResult());
|
uiTreeOrdering.add(cellEdgeResult());
|
||||||
uiTreeOrdering.add(faultResultSettings());
|
uiTreeOrdering.add(faultResultSettings());
|
||||||
|
uiTreeOrdering.add(stimPlanColors());
|
||||||
|
|
||||||
uiTreeOrdering.add(wellCollection());
|
uiTreeOrdering.add(wellCollection());
|
||||||
uiTreeOrdering.add(faultCollection());
|
uiTreeOrdering.add(faultCollection());
|
||||||
|
|||||||
@@ -42,23 +42,24 @@ class RigGridBase;
|
|||||||
class RigGridCellFaceVisibilityFilter;
|
class RigGridCellFaceVisibilityFilter;
|
||||||
class RigMainGrid;
|
class RigMainGrid;
|
||||||
class Rim3dOverlayInfoConfig;
|
class Rim3dOverlayInfoConfig;
|
||||||
class RimEclipseCase;
|
|
||||||
class RimEclipseWell;
|
|
||||||
class RimCellEdgeColors;
|
class RimCellEdgeColors;
|
||||||
class RimEclipsePropertyFilter;
|
|
||||||
class RimEclipsePropertyFilterCollection;
|
|
||||||
class RimCellRangeFilter;
|
class RimCellRangeFilter;
|
||||||
class RimCellRangeFilterCollection;
|
class RimCellRangeFilterCollection;
|
||||||
class RimFaultCollection;
|
class RimEclipseCase;
|
||||||
class RimEclipseFaultColors;
|
|
||||||
class RimReservoirCellResultsStorage;
|
|
||||||
class RimReservoirCellResultsStorage;
|
|
||||||
class RimEclipseCellColors;
|
class RimEclipseCellColors;
|
||||||
|
class RimEclipseFaultColors;
|
||||||
|
class RimEclipsePropertyFilter;
|
||||||
|
class RimEclipsePropertyFilterCollection;
|
||||||
|
class RimEclipseWell;
|
||||||
class RimEclipseWellCollection;
|
class RimEclipseWellCollection;
|
||||||
|
class RimFaultCollection;
|
||||||
|
class RimReservoirCellResultsStorage;
|
||||||
|
class RimReservoirCellResultsStorage;
|
||||||
|
class RimStimPlanColors;
|
||||||
class RiuViewer;
|
class RiuViewer;
|
||||||
|
class RivIntersectionPartMgr;
|
||||||
class RivReservoirPipesPartMgr;
|
class RivReservoirPipesPartMgr;
|
||||||
class RivReservoirWellSpheresPartMgr;
|
class RivReservoirWellSpheresPartMgr;
|
||||||
class RivIntersectionPartMgr;
|
|
||||||
|
|
||||||
namespace cvf
|
namespace cvf
|
||||||
{
|
{
|
||||||
@@ -89,9 +90,10 @@ public:
|
|||||||
|
|
||||||
// Fields containing child objects :
|
// Fields containing child objects :
|
||||||
|
|
||||||
caf::PdmChildField<RimEclipseCellColors*> cellResult;
|
caf::PdmChildField<RimEclipseCellColors*> cellResult;
|
||||||
caf::PdmChildField<RimCellEdgeColors*> cellEdgeResult;
|
caf::PdmChildField<RimCellEdgeColors*> cellEdgeResult;
|
||||||
caf::PdmChildField<RimEclipseFaultColors*> faultResultSettings;
|
caf::PdmChildField<RimEclipseFaultColors*> faultResultSettings;
|
||||||
|
caf::PdmChildField<RimStimPlanColors*> stimPlanColors;
|
||||||
|
|
||||||
caf::PdmChildField<RimEclipseWellCollection*> wellCollection;
|
caf::PdmChildField<RimEclipseWellCollection*> wellCollection;
|
||||||
caf::PdmChildField<RimFaultCollection*> faultCollection;
|
caf::PdmChildField<RimFaultCollection*> faultCollection;
|
||||||
|
|||||||
@@ -50,6 +50,62 @@ RimFractureTemplateCollection::~RimFractureTemplateCollection()
|
|||||||
fractureDefinitions.deleteAllChildObjects();
|
fractureDefinitions.deleteAllChildObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<std::pair<QString, QString> > RimFractureTemplateCollection::stimPlanResultNamesAndUnits() const
|
||||||
|
{
|
||||||
|
std::set<std::pair<QString, QString> > nameSet;
|
||||||
|
|
||||||
|
for (const RimFractureTemplate* f : fractureDefinitions())
|
||||||
|
{
|
||||||
|
auto stimPlanFracture = dynamic_cast<const RimStimPlanFractureTemplate*>(f);
|
||||||
|
if (stimPlanFracture)
|
||||||
|
{
|
||||||
|
std::vector<std::pair<QString, QString> > namesAndUnits = stimPlanFracture->getStimPlanPropertyNamesUnits();
|
||||||
|
|
||||||
|
for (auto nameAndUnit : namesAndUnits)
|
||||||
|
{
|
||||||
|
nameSet.insert(nameAndUnit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::pair<QString, QString>> names(nameSet.begin(), nameSet.end());
|
||||||
|
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<QString> RimFractureTemplateCollection::stimPlanResultNames() const
|
||||||
|
{
|
||||||
|
std::vector<QString> names;
|
||||||
|
|
||||||
|
for (auto nameAndUnit : stimPlanResultNamesAndUnits())
|
||||||
|
{
|
||||||
|
names.push_back(nameAndUnit.first);
|
||||||
|
}
|
||||||
|
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimFractureTemplateCollection::computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue) const
|
||||||
|
{
|
||||||
|
for (const RimFractureTemplate* f : fractureDefinitions())
|
||||||
|
{
|
||||||
|
auto stimPlanFracture = dynamic_cast<const RimStimPlanFractureTemplate*>(f);
|
||||||
|
if (stimPlanFracture)
|
||||||
|
{
|
||||||
|
stimPlanFracture->computeMinMax(resultName, unit, minValue, maxValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ public:
|
|||||||
|
|
||||||
caf::PdmField< caf::AppEnum< RimDefines::UnitSystem > > defaultUnitsForFracTemplates;
|
caf::PdmField< caf::AppEnum< RimDefines::UnitSystem > > defaultUnitsForFracTemplates;
|
||||||
|
|
||||||
|
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 deleteFractureDefinitions();
|
void deleteFractureDefinitions();
|
||||||
void loadAndUpdateData();
|
void loadAndUpdateData();
|
||||||
|
|||||||
278
ApplicationCode/ProjectDataModel/RimStimPlanColors.cpp
Normal file
278
ApplicationCode/ProjectDataModel/RimStimPlanColors.cpp
Normal file
@@ -0,0 +1,278 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017 - Statoil ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RimStimPlanColors.h"
|
||||||
|
|
||||||
|
#include "RimEclipseView.h"
|
||||||
|
#include "RimFractureTemplateCollection.h"
|
||||||
|
#include "RimLegendConfig.h"
|
||||||
|
#include "RimOilField.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
|
||||||
|
#include "cafPdmUiItem.h"
|
||||||
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
|
|
||||||
|
#include "cvfqtUtils.h"
|
||||||
|
|
||||||
|
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimStimPlanColors, "RimStimPlanColors");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimStimPlanColors::RimStimPlanColors()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("StimPlan Colors", ":/draw_style_faults_24x24.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_resultNameAndUnit, "ResultName", QString(""), "Result Variable", "", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_legendConfigurations, "LegendConfigurations", "", "", "", "");
|
||||||
|
m_legendConfigurations.uiCapability()->setUiTreeHidden(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimStimPlanColors::~RimStimPlanColors()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimStimPlanColors::loadDataAndUpdate()
|
||||||
|
{
|
||||||
|
RimFractureTemplateCollection* fractureTemplates = fractureTemplateCollection();
|
||||||
|
|
||||||
|
std::vector<std::pair<QString, QString> > resultNameAndUnits = fractureTemplates->stimPlanResultNamesAndUnits();
|
||||||
|
|
||||||
|
// Delete legends referencing results not present on file
|
||||||
|
{
|
||||||
|
std::vector<RimLegendConfig*> toBeDeleted;
|
||||||
|
for (RimLegendConfig* legend : m_legendConfigurations)
|
||||||
|
{
|
||||||
|
QString legendVariableName = legend->resultVariableName();
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
for (auto resultNameAndUnit : resultNameAndUnits)
|
||||||
|
{
|
||||||
|
if (RimStimPlanColors::toString(resultNameAndUnit) == legendVariableName)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
toBeDeleted.push_back(legend);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto legend : toBeDeleted)
|
||||||
|
{
|
||||||
|
m_legendConfigurations.removeChildObject(legend);
|
||||||
|
|
||||||
|
delete legend;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create legend for result if not already present
|
||||||
|
for (auto resultNameAndUnit : resultNameAndUnits)
|
||||||
|
{
|
||||||
|
QString resultNameUnitString = RimStimPlanColors::toString(resultNameAndUnit);
|
||||||
|
bool foundResult = false;
|
||||||
|
|
||||||
|
for (RimLegendConfig* legend : m_legendConfigurations)
|
||||||
|
{
|
||||||
|
if (legend->resultVariableName() == resultNameUnitString)
|
||||||
|
{
|
||||||
|
foundResult = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!foundResult)
|
||||||
|
{
|
||||||
|
RimLegendConfig* legendConfig = new RimLegendConfig();
|
||||||
|
legendConfig->resultVariableName = resultNameUnitString;
|
||||||
|
|
||||||
|
m_legendConfigurations.push_back(legendConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QList<caf::PdmOptionItemInfo> RimStimPlanColors::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||||
|
{
|
||||||
|
QList<caf::PdmOptionItemInfo> options;
|
||||||
|
|
||||||
|
if (fieldNeedingOptions == &m_resultNameAndUnit)
|
||||||
|
{
|
||||||
|
RimFractureTemplateCollection* fractureTemplates = fractureTemplateCollection();
|
||||||
|
|
||||||
|
options.push_back(caf::PdmOptionItemInfo("None", "None"));
|
||||||
|
|
||||||
|
for (auto resultNameAndUnit : fractureTemplates->stimPlanResultNamesAndUnits())
|
||||||
|
{
|
||||||
|
QString resultNameAndUnitString = RimStimPlanColors::toString(resultNameAndUnit);
|
||||||
|
options.push_back(caf::PdmOptionItemInfo(resultNameAndUnitString, resultNameAndUnitString));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimStimPlanColors::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
RimEclipseView* sourceView = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(sourceView);
|
||||||
|
if (sourceView)
|
||||||
|
{
|
||||||
|
sourceView->scheduleCreateDisplayModelAndRedraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimLegendConfig* RimStimPlanColors::activeLegend() const
|
||||||
|
{
|
||||||
|
for (RimLegendConfig* legendConfig : m_legendConfigurations)
|
||||||
|
{
|
||||||
|
if (m_resultNameAndUnit == legendConfig->resultVariableName())
|
||||||
|
{
|
||||||
|
return legendConfig;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimStimPlanColors::resultName() const
|
||||||
|
{
|
||||||
|
return RimStimPlanColors::toResultName(m_resultNameAndUnit());
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimStimPlanColors::unit() const
|
||||||
|
{
|
||||||
|
return RimStimPlanColors::toUnit(m_resultNameAndUnit());
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimStimPlanColors::updateLegendData()
|
||||||
|
{
|
||||||
|
RimLegendConfig* legendConfig = activeLegend();
|
||||||
|
if (legendConfig)
|
||||||
|
{
|
||||||
|
double minValue = HUGE_VAL;
|
||||||
|
double maxValue = -HUGE_VAL;
|
||||||
|
|
||||||
|
RimFractureTemplateCollection* fracTemplateColl = fractureTemplateCollection();
|
||||||
|
|
||||||
|
fracTemplateColl->computeMinMax(resultName(), unit(), &minValue, &maxValue);
|
||||||
|
|
||||||
|
if (minValue != HUGE_VAL)
|
||||||
|
{
|
||||||
|
legendConfig->setAutomaticRanges(minValue, maxValue, minValue, maxValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
legendConfig->setTitle(cvfqt::Utils::toString(m_resultNameAndUnit()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimFractureTemplateCollection* RimStimPlanColors::fractureTemplateCollection() const
|
||||||
|
{
|
||||||
|
RimProject* proj = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(proj);
|
||||||
|
|
||||||
|
return proj->activeOilField()->fractureDefinitionCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimStimPlanColors::toString(const std::pair<QString, QString>& resultNameAndUnit)
|
||||||
|
{
|
||||||
|
return QString("%1 [%2]").arg(resultNameAndUnit.first).arg(resultNameAndUnit.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimStimPlanColors::toResultName(const QString& resultNameAndUnit)
|
||||||
|
{
|
||||||
|
QStringList items = resultNameAndUnit.split("[");
|
||||||
|
|
||||||
|
if (items.size() > 0)
|
||||||
|
{
|
||||||
|
return items[0].trimmed();
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimStimPlanColors::toUnit(const QString& resultNameAndUnit)
|
||||||
|
{
|
||||||
|
int start = resultNameAndUnit.indexOf("[");
|
||||||
|
int end = resultNameAndUnit.indexOf("]");
|
||||||
|
|
||||||
|
if (start != -1 && end != -1)
|
||||||
|
{
|
||||||
|
return resultNameAndUnit.mid(start + 1, end - start - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimStimPlanColors::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||||
|
{
|
||||||
|
if (activeLegend())
|
||||||
|
{
|
||||||
|
uiTreeOrdering.add(activeLegend());
|
||||||
|
}
|
||||||
|
|
||||||
|
uiTreeOrdering.setForgetRemainingFields(true);
|
||||||
|
}
|
||||||
|
|
||||||
70
ApplicationCode/ProjectDataModel/RimStimPlanColors.h
Normal file
70
ApplicationCode/ProjectDataModel/RimStimPlanColors.h
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017 - Statoil ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cafAppEnum.h"
|
||||||
|
#include "cafPdmChildField.h"
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafPdmChildArrayField.h"
|
||||||
|
|
||||||
|
namespace caf {
|
||||||
|
class PdmOptionItemInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
class RimLegendConfig;
|
||||||
|
class RimFractureTemplateCollection;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimStimPlanColors : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RimStimPlanColors();
|
||||||
|
virtual ~RimStimPlanColors();
|
||||||
|
|
||||||
|
RimLegendConfig* activeLegend() const;
|
||||||
|
|
||||||
|
QString resultName() const;
|
||||||
|
QString unit() const;
|
||||||
|
|
||||||
|
void loadDataAndUpdate();
|
||||||
|
void updateLegendData();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
|
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
RimFractureTemplateCollection* fractureTemplateCollection() const;
|
||||||
|
static QString toString(const std::pair<QString, QString>& resultNameAndUnit);
|
||||||
|
|
||||||
|
static QString toResultName(const QString& resultNameAndUnit);
|
||||||
|
static QString toUnit(const QString& resultNameAndUnit);
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmField<QString> m_resultNameAndUnit;
|
||||||
|
caf::PdmChildArrayField<RimLegendConfig*> m_legendConfigurations;
|
||||||
|
};
|
||||||
|
|
||||||
@@ -306,9 +306,9 @@ void RimStimPlanFractureTemplate::loadDataAndUpdate()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<std::vector<double>> RimStimPlanFractureTemplate::getDataAtTimeIndex(QString resultName, size_t timeStepIndex)
|
std::vector<std::vector<double>> RimStimPlanFractureTemplate::getDataAtTimeIndex(const QString& resultName, const QString& unitName, size_t timeStepIndex) const
|
||||||
{
|
{
|
||||||
return m_stimPlanFractureDefinitionData->getDataAtTimeIndex(resultName, timeStepIndex);
|
return m_stimPlanFractureDefinitionData->getDataAtTimeIndex(resultName, unitName, timeStepIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -348,8 +348,6 @@ void RimStimPlanFractureTemplate::readStimplanGridAndTimesteps(QXmlStreamReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -565,7 +563,6 @@ std::vector<double> RimStimPlanFractureTemplate::adjustedDepthCoordsAroundWellP
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<double> RimStimPlanFractureTemplate::getStimPlanTimeValues()
|
std::vector<double> RimStimPlanFractureTemplate::getStimPlanTimeValues()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m_stimPlanFractureDefinitionData.isNull()) loadDataAndUpdate();
|
if (m_stimPlanFractureDefinitionData.isNull()) loadDataAndUpdate();
|
||||||
return m_stimPlanFractureDefinitionData->timeSteps;
|
return m_stimPlanFractureDefinitionData->timeSteps;
|
||||||
}
|
}
|
||||||
@@ -573,7 +570,7 @@ std::vector<double> RimStimPlanFractureTemplate::getStimPlanTimeValues()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<std::pair<QString, QString> > RimStimPlanFractureTemplate::getStimPlanPropertyNamesUnits()
|
std::vector<std::pair<QString, QString> > RimStimPlanFractureTemplate::getStimPlanPropertyNamesUnits() const
|
||||||
{
|
{
|
||||||
std::vector<RigStimPlanData > allStimPlanData = m_stimPlanFractureDefinitionData->stimPlanData;
|
std::vector<RigStimPlanData > allStimPlanData = m_stimPlanFractureDefinitionData->stimPlanData;
|
||||||
std::vector<std::pair<QString, QString> > propertyNamesUnits;
|
std::vector<std::pair<QString, QString> > propertyNamesUnits;
|
||||||
@@ -584,6 +581,17 @@ std::vector<std::pair<QString, QString> > RimStimPlanFractureTemplate::getStimPl
|
|||||||
return propertyNamesUnits;
|
return propertyNamesUnits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimStimPlanFractureTemplate::computeMinMax(const QString& resultName, const QString& unitName, double* minValue, double* maxValue) const
|
||||||
|
{
|
||||||
|
if (m_stimPlanFractureDefinitionData.notNull())
|
||||||
|
{
|
||||||
|
m_stimPlanFractureDefinitionData->computeMinMax(resultName, unitName, minValue, maxValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -592,7 +600,7 @@ std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fracturePolygon()
|
|||||||
std::vector<cvf::Vec3f> polygon;
|
std::vector<cvf::Vec3f> polygon;
|
||||||
|
|
||||||
//TODO: Handle multiple time-step and properties
|
//TODO: Handle multiple time-step and properties
|
||||||
std::vector<std::vector<double>> dataAtTimeStep = m_stimPlanFractureDefinitionData->getDataAtTimeIndex(getStimPlanPropertyNamesUnits()[0].first, 0);
|
std::vector<std::vector<double>> dataAtTimeStep = m_stimPlanFractureDefinitionData->getDataAtTimeIndex(getStimPlanPropertyNamesUnits()[0].first, getStimPlanPropertyNamesUnits()[0].second, 0);
|
||||||
|
|
||||||
for (int k = 0; k < dataAtTimeStep.size(); k++)
|
for (int k = 0; k < dataAtTimeStep.size(); k++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,11 +62,13 @@ public:
|
|||||||
std::vector<double> getNegAndPosXcoords();
|
std::vector<double> getNegAndPosXcoords();
|
||||||
std::vector<double> adjustedDepthCoordsAroundWellPathPosition();
|
std::vector<double> adjustedDepthCoordsAroundWellPathPosition();
|
||||||
std::vector<double> getStimPlanTimeValues();
|
std::vector<double> getStimPlanTimeValues();
|
||||||
std::vector<std::pair<QString, QString> > getStimPlanPropertyNamesUnits();
|
std::vector<std::pair<QString, QString> > getStimPlanPropertyNamesUnits() const;
|
||||||
|
void computeMinMax(const QString& resultName, const QString& unitName, double* minValue, double* maxValue) const;
|
||||||
|
|
||||||
void loadDataAndUpdate();
|
void loadDataAndUpdate();
|
||||||
|
|
||||||
std::vector<std::vector<double>> getDataAtTimeIndex(QString resultName, size_t timeStepIndex);
|
std::vector<std::vector<double>> getDataAtTimeIndex(const QString& resultName, const QString& unitName, size_t timeStepIndex) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;
|
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#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;
|
return i;
|
||||||
resultData.parameterValues[getTimeStepIndex(timeStepValue)] = data;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
RigStimPlanData resultData;
|
||||||
|
|
||||||
@@ -116,21 +130,18 @@ void RigStimPlanFractureDefinition::setDataAtTimeValue(QString resultName, QStri
|
|||||||
|
|
||||||
stimPlanData.push_back(resultData);
|
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 stimPlanData[resIndex].parameterValues[timeStepIndex];
|
||||||
{
|
|
||||||
return resultData.parameterValues[timeStepIndex];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "ERROR: Requested parameter does not exists in stimPlan data";
|
qDebug() << "ERROR: Requested parameter does not exists in stimPlan data";
|
||||||
@@ -138,6 +149,36 @@ std::vector<std::vector<double>> RigStimPlanFractureDefinition::getDataAtTimeInd
|
|||||||
return emptyVector;
|
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);
|
size_t getTimeStepIndex(double timeStepValue);
|
||||||
|
|
||||||
void setDataAtTimeValue(QString resultName, QString unit, std::vector<std::vector<double>> data, 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;
|
std::vector<QString> resultNames() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
size_t resultIndex(const QString& resultName, const QString& unit) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user