diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp index 77cd83b587..6a70161ddd 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp @@ -354,7 +354,7 @@ QList RimFracture::calculateValueOptions(const caf::PdmF if (dynamic_cast(fracTemplate)) { RimStimPlanFractureTemplate* fracTemplateStimPlan = dynamic_cast(fracTemplate); - std::vector timeValues = fracTemplateStimPlan->getStimPlanTimeValues(); + std::vector timeValues = fracTemplateStimPlan->getStimPlanTimeSteps(); int index = 0; for (double value : timeValues) { diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp index abf6460bc2..ad43c923bd 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp @@ -59,7 +59,7 @@ std::vector > RimFractureTemplateCollection::stimPla auto stimPlanFracture = dynamic_cast(f); if (stimPlanFracture) { - std::vector > namesAndUnits = stimPlanFracture->getStimPlanPropertyNamesUnits(); + std::vector > namesAndUnits = stimPlanFracture->getStimPlanResultNamesWithUnit(); for (auto nameAndUnit : namesAndUnits) { diff --git a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp index ead874bbd8..01a0bf6f2d 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp @@ -66,7 +66,7 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate(void) CAF_PDM_InitField(&m_wellPathDepthAtFracture, "WellPathDepthAtFracture", 0.0, "Well/Fracture Intersection Depth", "", "", ""); m_wellPathDepthAtFracture.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName()); - CAF_PDM_InitField(&m_parameterForPolygon, "parameterForPolyton", QString(""), "Parameter", "", "", ""); + CAF_PDM_InitField(&m_borderPolygonResultName, "parameterForPolyton", QString(""), "Parameter", "", "", ""); CAF_PDM_InitField(&m_activeTimeStepIndex, "activeTimeStepIndex", 0, "Active TimeStep Index", "", "", ""); CAF_PDM_InitField(&m_showStimPlanMesh, "showStimPlanMesh", true, "Show StimPlan Mesh", "", "", ""); @@ -118,7 +118,7 @@ void RimStimPlanFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* ch } - if (&m_wellPathDepthAtFracture == changedField || &m_parameterForPolygon == changedField || &m_activeTimeStepIndex == changedField || &m_showStimPlanMesh == changedField) + if (&m_wellPathDepthAtFracture == changedField || &m_borderPolygonResultName == changedField || &m_activeTimeStepIndex == changedField || &m_showStimPlanMesh == changedField) { RimProject* proj; this->firstAncestorOrThisOfType(proj); @@ -186,32 +186,32 @@ void RimStimPlanFractureTemplate::setDefaultsBasedOnXMLfile() setDepthOfWellPathAtFracture(); RiaLogging::info(QString("Setting well/fracture intersection depth at %1").arg(m_wellPathDepthAtFracture)); m_activeTimeStepIndex = static_cast(m_stimPlanFractureDefinitionData->totalNumberTimeSteps() - 1); - bool polygonPropertySet = setPropertyForPolygonDefault(); + bool polygonPropertySet = setBorderPolygonResultNameToDefault(); - if (polygonPropertySet) RiaLogging::info(QString("Calculating polygon outline based on %1 at timestep %2").arg(m_parameterForPolygon).arg(m_stimPlanFractureDefinitionData->timeSteps[m_activeTimeStepIndex])); + if (polygonPropertySet) RiaLogging::info(QString("Calculating polygon outline based on %1 at timestep %2").arg(m_borderPolygonResultName).arg(m_stimPlanFractureDefinitionData->timeSteps[m_activeTimeStepIndex])); else RiaLogging::info(QString("Property for polygon calculation not set.")); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimStimPlanFractureTemplate::setPropertyForPolygonDefault() +bool RimStimPlanFractureTemplate::setBorderPolygonResultNameToDefault() { //first option: Width - for (std::pair property : getStimPlanPropertyNamesUnits()) + for (std::pair property : getStimPlanResultNamesWithUnit()) { if (property.first == "WIDTH") { - m_parameterForPolygon = property.first; + m_borderPolygonResultName = property.first; return true; } } //if width not found, use conductivity - for (std::pair property : getStimPlanPropertyNamesUnits()) + for (std::pair property : getStimPlanResultNamesWithUnit()) { if (property.first == "CONDUCTIVITY") { - m_parameterForPolygon = property.first; + m_borderPolygonResultName = property.first; return true; } } @@ -261,9 +261,9 @@ QList RimStimPlanFractureTemplate::calculateValueOptions { QList options; - if (fieldNeedingOptions == &m_parameterForPolygon) + if (fieldNeedingOptions == &m_borderPolygonResultName) { - for (std::pair nameUnit : getStimPlanPropertyNamesUnits()) + for (std::pair nameUnit : getStimPlanResultNamesWithUnit()) { //options.push_back(caf::PdmOptionItemInfo(nameUnit.first + " [" + nameUnit.second + "]", nameUnit.first + " " + nameUnit.second)); options.push_back(caf::PdmOptionItemInfo(nameUnit.first, nameUnit.first)); @@ -272,7 +272,7 @@ QList RimStimPlanFractureTemplate::calculateValueOptions else if (fieldNeedingOptions == &m_activeTimeStepIndex) { - std::vector timeValues = getStimPlanTimeValues(); + std::vector timeValues = getStimPlanTimeSteps(); int index = 0; for (double value : timeValues) { @@ -309,7 +309,7 @@ QString RimStimPlanFractureTemplate::getUnitForStimPlanParameter(QString paramet bool found = false; bool foundMultiple = false; - for (std::pair nameUnit : getStimPlanPropertyNamesUnits()) + for (std::pair nameUnit : getStimPlanResultNamesWithUnit()) { if (nameUnit.first == parameterName) { @@ -410,7 +410,7 @@ void RimStimPlanFractureTemplate::fractureTriangleGeometry(std::vector RimStimPlanFractureTemplate::getStimPlanTimeValues() +std::vector RimStimPlanFractureTemplate::getStimPlanTimeSteps() { if (m_stimPlanFractureDefinitionData.isNull()) loadDataAndUpdate(); return m_stimPlanFractureDefinitionData->timeSteps; @@ -419,7 +419,7 @@ std::vector RimStimPlanFractureTemplate::getStimPlanTimeValues() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector > RimStimPlanFractureTemplate::getStimPlanPropertyNamesUnits() const +std::vector > RimStimPlanFractureTemplate::getStimPlanResultNamesWithUnit() const { std::vector > propertyNamesUnits; if (m_stimPlanFractureDefinitionData.notNull()) @@ -440,47 +440,6 @@ void RimStimPlanFractureTemplate::computeMinMax(const QString& resultName, const } } -//-------------------------------------------------------------------------------------------------- -/// OBSOLETE ! Only used for upscaling code -//-------------------------------------------------------------------------------------------------- -void RimStimPlanFractureTemplate::getStimPlanDataAsPolygonsAndValues(std::vector > &cellsAsPolygons, - std::vector ¶meterValues, - const QString& resultName, - const QString& unitName, - size_t timeStepIndex) -{ - std::vector< std::vector > propertyValuesAtTimeStep = m_stimPlanFractureDefinitionData->getMirroredDataAtTimeIndex(resultName, unitName, timeStepIndex); - - cellsAsPolygons.clear(); - parameterValues.clear(); - - //TODO: Code partly copied from RivWellFracturePartMgr - can this be combined in some function? - std::vector depthCoordsAtNodes = m_stimPlanFractureDefinitionData->adjustedDepthCoordsAroundWellPathPosition(m_wellPathDepthAtFracture()); - std::vector xCoordsAtNodes = m_stimPlanFractureDefinitionData->getNegAndPosXcoords(); - - //Cells are around nodes instead of between nodes - std::vector xCoords; - for (int i = 0; i < xCoordsAtNodes.size() - 1; i++) xCoords.push_back((xCoordsAtNodes[i] + xCoordsAtNodes[i + 1]) / 2); - std::vector depthCoords; - for (int i = 0; i < depthCoordsAtNodes.size() - 1; i++) depthCoords.push_back((depthCoordsAtNodes[i] + depthCoordsAtNodes[i + 1]) / 2); - - for (int i = 0; i < xCoords.size() - 1; i++) - { - for (int j = 0; j < depthCoords.size() - 1; j++) - { - std::vector cellAsPolygon; - cellAsPolygon.push_back(cvf::Vec3d(static_cast(xCoords[i]), static_cast(depthCoords[j]), 0.0)); - cellAsPolygon.push_back(cvf::Vec3d(static_cast(xCoords[i + 1]), static_cast(depthCoords[j]), 0.0)); - cellAsPolygon.push_back(cvf::Vec3d(static_cast(xCoords[i + 1]), static_cast(depthCoords[j + 1]), 0.0)); - cellAsPolygon.push_back(cvf::Vec3d(static_cast(xCoords[i]), static_cast(depthCoords[j + 1]), 0.0)); - cellsAsPolygons.push_back(cellAsPolygon); - //TODO: Values for both neg and pos x values... - parameterValues.push_back(propertyValuesAtTimeStep[j+1][i+1]); //TODO test that this value exsist... - - } - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -582,7 +541,7 @@ std::vector RimStimPlanFractureTemplate::fractureBorderPolygon(RimUn { std::vector polygon; - QString parameterName = m_parameterForPolygon; + QString parameterName = m_borderPolygonResultName; QString parameterUnit = getUnitForStimPlanParameter(parameterName); std::vector> dataAtTimeStep = m_stimPlanFractureDefinitionData->getDataAtTimeIndex(parameterName, parameterUnit, m_activeTimeStepIndex); @@ -729,7 +688,7 @@ void RimStimPlanFractureTemplate::defineUiOrdering(QString uiConfigName, caf::Pd propertyGroup->add(&wellDiameter); caf::PdmUiGroup* polygonGroup = uiOrdering.addNewGroup("Fracture Polygon Basis"); - polygonGroup->add(&m_parameterForPolygon); + polygonGroup->add(&m_borderPolygonResultName); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h index ebfb8c0450..631f5787ba 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h @@ -65,10 +65,9 @@ public: std::vector* triangleIndices, RimUnitSystem::UnitSystem neededUnit) override; std::vector fractureBorderPolygon(RimUnitSystem::UnitSystem neededUnit); - void sortPolygon(std::vector &polygon); - std::vector getStimPlanTimeValues(); - std::vector > getStimPlanPropertyNamesUnits() const; + std::vector getStimPlanTimeSteps(); + std::vector > getStimPlanResultNamesWithUnit() const; void computeMinMax(const QString& resultName, const QString& unitName, double* minValue, double* maxValue) const; void setDefaultsBasedOnXMLfile(); std::vector> getDataAtTimeIndex(const QString& resultName, const QString& unitName, size_t timeStepIndex) const; @@ -76,7 +75,7 @@ public: void setupStimPlanCells(); const RigFractureGrid* fractureGrid() const; - //Function used by upscaling only + // OBSOLETE : Function used by upscaling only void getStimPlanDataAsPolygonsAndValues(std::vector > &cellsAsPolygons, std::vector ¶meterValue, const QString& resultName, const QString& unitName, size_t timeStepIndex); protected: @@ -88,15 +87,17 @@ protected: private: void updateUiTreeName(); - bool setPropertyForPolygonDefault(); + bool setBorderPolygonResultNameToDefault(); void setDepthOfWellPathAtFracture(); QString getUnitForStimPlanParameter(QString parameterName); + void sortPolygon(std::vector &polygon); + caf::PdmField m_activeTimeStepIndex; caf::PdmField m_showStimPlanMesh; caf::PdmField m_wellPathDepthAtFracture; - caf::PdmField m_parameterForPolygon; + caf::PdmField m_borderPolygonResultName; caf::PdmField m_stimPlanFileName; cvf::ref m_stimPlanFractureDefinitionData; diff --git a/ApplicationCode/ReservoirDataModel/RigStimPlanUpscalingCalc.cpp b/ApplicationCode/ReservoirDataModel/RigStimPlanUpscalingCalc.cpp index 7d7b24f4fd..444024a0c9 100644 --- a/ApplicationCode/ReservoirDataModel/RigStimPlanUpscalingCalc.cpp +++ b/ApplicationCode/ReservoirDataModel/RigStimPlanUpscalingCalc.cpp @@ -7,6 +7,7 @@ #include "RigFractureCell.h" #include "RiaLogging.h" #include "RigFractureGrid.h" +#include "RimStimPlanFractureTemplate.h" //-------------------------------------------------------------------------------------------------- @@ -353,3 +354,45 @@ std::vector RigStimPlanUpscalingCalc::getColOfStimPlanCells(st return stimPlanCellCol; } +#include "RigStimPlanFractureDefinition.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimStimPlanFractureTemplate::getStimPlanDataAsPolygonsAndValues(std::vector > &cellsAsPolygons, + std::vector ¶meterValues, + const QString& resultName, + const QString& unitName, + size_t timeStepIndex) +{ + std::vector< std::vector > propertyValuesAtTimeStep = m_stimPlanFractureDefinitionData->getMirroredDataAtTimeIndex(resultName, unitName, timeStepIndex); + + cellsAsPolygons.clear(); + parameterValues.clear(); + + //TODO: Code partly copied from RivWellFracturePartMgr - can this be combined in some function? + std::vector depthCoordsAtNodes = m_stimPlanFractureDefinitionData->adjustedDepthCoordsAroundWellPathPosition(m_wellPathDepthAtFracture()); + std::vector xCoordsAtNodes = m_stimPlanFractureDefinitionData->getNegAndPosXcoords(); + + //Cells are around nodes instead of between nodes + std::vector xCoords; + for (int i = 0; i < xCoordsAtNodes.size() - 1; i++) xCoords.push_back((xCoordsAtNodes[i] + xCoordsAtNodes[i + 1]) / 2); + std::vector depthCoords; + for (int i = 0; i < depthCoordsAtNodes.size() - 1; i++) depthCoords.push_back((depthCoordsAtNodes[i] + depthCoordsAtNodes[i + 1]) / 2); + + for (int i = 0; i < xCoords.size() - 1; i++) + { + for (int j = 0; j < depthCoords.size() - 1; j++) + { + std::vector cellAsPolygon; + cellAsPolygon.push_back(cvf::Vec3d(static_cast(xCoords[i]), static_cast(depthCoords[j]), 0.0)); + cellAsPolygon.push_back(cvf::Vec3d(static_cast(xCoords[i + 1]), static_cast(depthCoords[j]), 0.0)); + cellAsPolygon.push_back(cvf::Vec3d(static_cast(xCoords[i + 1]), static_cast(depthCoords[j + 1]), 0.0)); + cellAsPolygon.push_back(cvf::Vec3d(static_cast(xCoords[i]), static_cast(depthCoords[j + 1]), 0.0)); + cellsAsPolygons.push_back(cellAsPolygon); + //TODO: Values for both neg and pos x values... + parameterValues.push_back(propertyValuesAtTimeStep[j+1][i+1]); //TODO test that this value exsist... + + } + } +}