#1275 - pre-proto - Setting default values for stimplan fracture template polygon based on content in file

This commit is contained in:
astridkbjorke 2017-03-02 11:43:28 +01:00
parent 2811e5aa4d
commit 6019ff4586
5 changed files with 57 additions and 7 deletions

View File

@ -63,6 +63,7 @@ void RicNewStimPlanFractureTemplateFeature::onActionTriggered(bool isChecked)
fractureDef->name = "StimPlan Fracture Template";
fractureDef->setFileName(fileName);
fractureDef->loadDataAndUpdate();
fractureDef->setDefaultsBasedOnXMLfile();
fracDefColl->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(fractureDef);

View File

@ -80,6 +80,7 @@ void RimStimPlanFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* ch
{
updateUiTreeName();
loadDataAndUpdate();
setDefaultsBasedOnXMLfile();
}
if (&wellPathDepthAtFracture == changedField || &parameterForPolygon == changedField || &timestepForPolygon == changedField)
@ -235,8 +236,6 @@ void RimStimPlanFractureTemplate::readStimPlanXMLFile(QString * errorMessage)
}
dataFile.close();
setDepthOfWellPathAtFracture();
RiaLogging::info(QString("Setting well/fracture intersection depth at %1").arg(wellPathDepthAtFracture));
if (xmlStream2.hasError())
{
@ -253,12 +252,52 @@ void RimStimPlanFractureTemplate::readStimPlanXMLFile(QString * errorMessage)
RiaLogging::info(QString("Successfully read XML file: '%1'").arg(fileName()));
}
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
if (!activeView) return;
activeView->stimPlanColors->loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanFractureTemplate::setDefaultsBasedOnXMLfile()
{
setDepthOfWellPathAtFracture();
RiaLogging::info(QString("Setting well/fracture intersection depth at %1").arg(wellPathDepthAtFracture));
timestepForPolygon = static_cast<int>(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]));
else RiaLogging::info(QString("Property for polygon calculation not set."));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimStimPlanFractureTemplate::setPropertyForPolygonDefault()
{
//first option: Width
for (std::pair<QString, QString> property : getStimPlanPropertyNamesUnits())
{
if (property.first == "WIDTH")
{
parameterForPolygon = property.first + " " + property.second;
return true;
}
}
//if width not found, use conductivity
for (std::pair<QString, QString> property : getStimPlanPropertyNamesUnits())
{
if (property.first == "CONDUCTIVITY")
{
parameterForPolygon = property.first + " " + property.second;
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -69,6 +69,7 @@ public:
void computeMinMax(const QString& resultName, const QString& unitName, double* minValue, double* maxValue) const;
void loadDataAndUpdate();
void setDefaultsBasedOnXMLfile();
std::vector<std::vector<double>> getDataAtTimeIndex(const QString& resultName, const QString& unitName, size_t timeStepIndex) const;
@ -88,7 +89,6 @@ private:
size_t readStimplanGridAndTimesteps(QXmlStreamReader &xmlStream);
static double getAttributeValueDouble(QXmlStreamReader &xmlStream, QString parameterName);
static QString getAttributeValueString(QXmlStreamReader &xmlStream, QString parameterName);
void getGriddingValues(QXmlStreamReader &xmlStream, std::vector<double>& gridValues, size_t& startNegValues);
@ -97,6 +97,7 @@ private:
caf::PdmField<QString> m_stimPlanFileName;
cvf::ref<RigStimPlanFractureDefinition> m_stimPlanFractureDefinitionData;
bool numberOfParameterValuesOK(std::vector<std::vector<double>> propertyValuesAtTimestep);
void setDepthOfWellPathAtFracture();
bool numberOfParameterValuesOK(std::vector<std::vector<double>> propertyValuesAtTimestep);
bool setPropertyForPolygonDefault();
void setDepthOfWellPathAtFracture();
};

View File

@ -89,6 +89,14 @@ size_t RigStimPlanFractureDefinition::getTimeStepIndex(double timeStepValue)
return -1; //returns -1 if not found
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigStimPlanFractureDefinition::totalNumberTimeSteps()
{
return timeSteps.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -51,11 +51,12 @@ public:
std::vector<double> depths;
std::vector<RigStimPlanData> stimPlanData;
std::vector<RigStimPlanData> stimPlanData;
bool timeStepExisist(double timeStepValue);
void reorderYgridToDepths();
size_t getTimeStepIndex(double timeStepValue);
size_t totalNumberTimeSteps();
void setDataAtTimeValue(QString resultName, QString unit, std::vector<std::vector<double>> data, double timeStepValue);
std::vector<std::vector<double>> getDataAtTimeIndex(const QString& resultName, const QString& unit, size_t timeStepIndex) const;