From 50f71a873e1879d40a30dea3a4b93eff9bbe2857 Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Fri, 7 Apr 2017 10:17:17 +0200 Subject: [PATCH] #1409, #1410 - pre-proto - Using parameter from FractureColor and units based on parameter/unit system when setting up RigStimPlanCells, and using fromer polygonTimeStep as timestep for setting up RigStimPlanCells --- .../RivWellFracturePartMgr.cpp | 3 + .../RimStimPlanFractureTemplate.cpp | 64 +++++++++++-------- .../RimStimPlanFractureTemplate.h | 4 +- 3 files changed, 42 insertions(+), 29 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp index b7ab2fc0e1..d44e1ad593 100644 --- a/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp @@ -284,6 +284,9 @@ void RivWellFracturePartMgr::generateStimPlanMeshPart(caf::DisplayCoordTransform //-------------------------------------------------------------------------------------------------- cvf::ref RivWellFracturePartMgr::createStimPlanMeshDrawable(RimStimPlanFractureTemplate* stimPlanFracTemplate, caf::DisplayCoordTransform* displayCoordTransform) { + //TODO: Kjør setupStimPlanCells igjen, siden parametere kan ha endre seg... + stimPlanFracTemplate->setupStimPlanCells(); + std::vector stimPlanCells = stimPlanFracTemplate->getStimPlanCells(); std::vector stimPlanMeshVertices; diff --git a/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.cpp b/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.cpp index 1fe244e018..846a17d046 100644 --- a/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.cpp +++ b/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.cpp @@ -62,7 +62,7 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate(void) wellPathDepthAtFracture.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName()); CAF_PDM_InitField(¶meterForPolygon, "parameterForPolyton", QString(""), "Parameter", "", "", ""); - CAF_PDM_InitField(×tepForPolygon, "timestepForPolygon", 0, "TimeStep", "", "", ""); + CAF_PDM_InitField(&activeTimeStepIndex, "activeTimeStepIndex", 0, "Active TimeStep Index", "", "", ""); CAF_PDM_InitField(&showStimPlanMesh, "showStimPlanMesh", true, "Show StimPlan Mesh", "", "", "") } @@ -88,7 +88,7 @@ void RimStimPlanFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* ch setDefaultsBasedOnXMLfile(); } - if (&wellPathDepthAtFracture == changedField || ¶meterForPolygon == changedField || ×tepForPolygon == changedField || &showStimPlanMesh == changedField) + if (&wellPathDepthAtFracture == changedField || ¶meterForPolygon == changedField || &activeTimeStepIndex == changedField || &showStimPlanMesh == changedField) { RimProject* proj; this->firstAncestorOrThisOfType(proj); @@ -109,13 +109,6 @@ void RimStimPlanFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* ch proj->createDisplayModelAndRedrawAllViews(); } - -// if (¶meterForPolygon == changedField || ×tepForPolygon == changedField) -// { -// fracturePolygon(); -// } - - } @@ -285,10 +278,10 @@ void RimStimPlanFractureTemplate::setDefaultsBasedOnXMLfile() { setDepthOfWellPathAtFracture(); RiaLogging::info(QString("Setting well/fracture intersection depth at %1").arg(wellPathDepthAtFracture)); - timestepForPolygon = static_cast(m_stimPlanFractureDefinitionData->totalNumberTimeSteps() - 1); + activeTimeStepIndex = static_cast(m_stimPlanFractureDefinitionData->totalNumberTimeSteps() - 1); bool polygonPropertySet = setPropertyForPolygonDefault(); - if (polygonPropertySet) RiaLogging::info(QString("Calculating polygon outline based on %1 at timestep %2").arg(parameterForPolygon).arg(m_stimPlanFractureDefinitionData->timeSteps[timestepForPolygon])); + if (polygonPropertySet) RiaLogging::info(QString("Calculating polygon outline based on %1 at timestep %2").arg(parameterForPolygon).arg(m_stimPlanFractureDefinitionData->timeSteps[activeTimeStepIndex])); else RiaLogging::info(QString("Property for polygon calculation not set.")); } @@ -327,11 +320,7 @@ void RimStimPlanFractureTemplate::loadDataAndUpdate() readStimPlanXMLFile(&errorMessage); if (errorMessage.size() > 0) RiaLogging::error(errorMessage); - //TODO: Get these more generally: - QString resultName = "CONDUCTIVITY"; - QString resultUnit = "md-m"; - size_t timeStepIndex = 0; - setupStimPlanCells(resultName, resultUnit, timeStepIndex); + setupStimPlanCells(); updateConnectedEditors(); } @@ -378,7 +367,7 @@ QList RimStimPlanFractureTemplate::calculateValueOptions } } - else if (fieldNeedingOptions == ×tepForPolygon) + else if (fieldNeedingOptions == &activeTimeStepIndex) { std::vector timeValues = getStimPlanTimeValues(); int index = 0; @@ -794,16 +783,21 @@ void RimStimPlanFractureTemplate::getStimPlanDataAsPolygonsAndValues(std::vector //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimStimPlanFractureTemplate::setupStimPlanCells(const QString& resultName, const QString& unitName, size_t timeStepIndex) +void RimStimPlanFractureTemplate::setupStimPlanCells() { + RimEclipseView* activeView = dynamic_cast(RiaApplication::instance()->activeReservoirView()); + if (!activeView) return; + QString resultNameFromColors = activeView->stimPlanColors->resultName(); + QString resultUnitFromColors = activeView->stimPlanColors->unit(); + std::vector stimPlanCells; - std::vector> displayPropertyValuesAtTimeStep = getMirroredDataAtTimeIndex(resultName, unitName, timeStepIndex); - - std::vector> conductivityValuesAtTimeStep = getMirroredDataAtTimeIndex("CONDUCTIVITY", unitName, timeStepIndex); - //TODO: Handle units - //TODO: Handle not having cond in files!!! + std::vector> displayPropertyValuesAtTimeStep = getMirroredDataAtTimeIndex(resultNameFromColors, resultUnitFromColors, activeTimeStepIndex); + QString condUnit; + if (fractureTemplateUnit == RimDefines::UNITS_METRIC) condUnit = "md-m"; + if (fractureTemplateUnit == RimDefines::UNITS_FIELD) condUnit = "md-ft"; + std::vector> conductivityValuesAtTimeStep = getMirroredDataAtTimeIndex("CONDUCTIVITY", condUnit, activeTimeStepIndex); std::vector depthCoordsAtNodes = adjustedDepthCoordsAroundWellPathPosition(); std::vector xCoordsAtNodes = getNegAndPosXcoords(); @@ -824,8 +818,24 @@ void RimStimPlanFractureTemplate::setupStimPlanCells(const QString& resultName, cellPolygon.push_back(cvf::Vec3d(static_cast(xCoords[j]), static_cast(depthCoords[i + 1]), 0.0)); RigStimPlanCell stimPlanCell(cellPolygon, i, j); - stimPlanCell.setConductivityValue(conductivityValuesAtTimeStep[i + 1][j + 1]); - stimPlanCell.setDisplayValue(displayPropertyValuesAtTimeStep[i + 1][j + 1]); + if (conductivityValuesAtTimeStep.size() > 0) //Assuming vector to be of correct length, or no values + { + stimPlanCell.setConductivityValue(conductivityValuesAtTimeStep[i + 1][j + 1]); + } + else + { + stimPlanCell.setConductivityValue(cvf::UNDEFINED_DOUBLE); + } + + if (displayPropertyValuesAtTimeStep.size() > 0) + { + stimPlanCell.setDisplayValue(displayPropertyValuesAtTimeStep[i + 1][j + 1]); + } + else + { + stimPlanCell.setDisplayValue(cvf::UNDEFINED_DOUBLE); + } + stimPlanCells.push_back(stimPlanCell); } } @@ -897,7 +907,7 @@ std::vector RimStimPlanFractureTemplate::fracturePolygon(caf::AppEnu QString parameterName = parameterForPolygon; QString parameterUnit = getUnitForStimPlanParameter(parameterName); - std::vector> dataAtTimeStep = m_stimPlanFractureDefinitionData->getDataAtTimeIndex(parameterName, parameterUnit, timestepForPolygon); + std::vector> dataAtTimeStep = m_stimPlanFractureDefinitionData->getDataAtTimeIndex(parameterName, parameterUnit, activeTimeStepIndex); for (int k = 0; k < dataAtTimeStep.size(); k++) { @@ -1049,7 +1059,7 @@ void RimStimPlanFractureTemplate::defineUiOrdering(QString uiConfigName, caf::Pd caf::PdmUiGroup* polygonGroup = uiOrdering.addNewGroup("Fracture Polygon Basis"); polygonGroup->add(¶meterForPolygon); - polygonGroup->add(×tepForPolygon); + polygonGroup->add(&activeTimeStepIndex); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.h b/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.h index 14bf057766..95ab9982de 100644 --- a/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.h +++ b/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.h @@ -52,7 +52,7 @@ public: caf::PdmField wellPathDepthAtFracture; caf::PdmField parameterForPolygon; - caf::PdmField timestepForPolygon; + caf::PdmField activeTimeStepIndex; caf::PdmField showStimPlanMesh; virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; @@ -76,7 +76,7 @@ public: void computeMinMax(const QString& resultName, const QString& unitName, double* minValue, double* maxValue) const; void getStimPlanDataAsPolygonsAndValues(std::vector > &cellsAsPolygons, std::vector ¶meterValue, const QString& resultName, const QString& unitName, size_t timeStepIndex); - void setupStimPlanCells(const QString& resultName, const QString& unitName, size_t timeStepIndex); + void setupStimPlanCells(); const std::vector& getStimPlanCells(); std::vector getStimPlanRowPolygon(size_t i); std::vector getStimPlanColPolygon(size_t j);