#1230 Added infrastructure for loadAndUpdate of StimPlan data

This commit is contained in:
Magne Sjaastad 2017-02-17 09:29:46 +01:00
parent aef913739c
commit 81c92d2781
7 changed files with 94 additions and 7 deletions

View File

@ -47,7 +47,9 @@
#include "RimEclipseView.h"
#include "RimEclipseWellCollection.h"
#include "RimFaultCollection.h"
#include "RimFlowPlotCollection.h"
#include "RimFormationNamesCollection.h"
#include "RimFractureTemplateCollection.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h"
#include "RimGeoMechModels.h"
@ -70,7 +72,6 @@
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellPath.h"
#include "RimFlowPlotCollection.h"
#include "RimWellPathCollection.h"
#include "RiuMainPlotWindow.h"
@ -459,6 +460,8 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
}
oilField->summaryCaseCollection()->createSummaryCasesFromRelevantEclipseResultCases();
oilField->summaryCaseCollection()->loadAllSummaryCaseData();
oilField->fractureDefinitionCollection()->loadAndUpdateData();
}
// If load action is specified to recalculate statistics, do it now.

View File

@ -19,8 +19,9 @@
#include "RimFractureTemplateCollection.h"
#include "RimFractureTemplate.h"
#include "cafPdmObject.h"
#include "RimStimPlanFractureTemplate.h"
#include "cafPdmObject.h"
@ -55,3 +56,18 @@ void RimFractureTemplateCollection::deleteFractureDefinitions()
fractureDefinitions.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFractureTemplateCollection::loadAndUpdateData()
{
for (RimFractureTemplate* f : fractureDefinitions())
{
RimStimPlanFractureTemplate* stimPlanFracture = dynamic_cast<RimStimPlanFractureTemplate*>(f);
if (stimPlanFracture)
{
stimPlanFracture->loadDataAndUpdate();
}
}
}

View File

@ -41,5 +41,6 @@ public:
caf::PdmField<bool> isActive;
void deleteFractureDefinitions();
void loadAndUpdateData();
};

View File

@ -22,6 +22,7 @@
#include "RimFracture.h"
#include "RimProject.h"
#include "RimStimPlanLegendConfig.h"
#include "cafPdmObject.h"
#include "cafPdmUiFilePathEditor.h"
@ -48,7 +49,8 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate(void)
CAF_PDM_InitField(&wellPathDepthAtFracture, "WellPathDepthAtFracture", 0.0, "Depth of Well Path at Fracture", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_legendConfigurations, "LegendConfigurations", "", "", "", "");
m_legendConfigurations.uiCapability()->setUiTreeHidden(true);
}
//--------------------------------------------------------------------------------------------------
@ -67,12 +69,15 @@ void RimStimPlanFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* ch
if (&m_stimPlanFileName == changedField)
{
updateUiTreeName();
loadDataAndUpdate();
/*
QString errorMessage;
readStimPlanXMLFile(&errorMessage);
if (!errorMessage.isEmpty())
{
QMessageBox::warning(nullptr, "StimPlanFile", errorMessage);
}
*/
}
if (&wellPathDepthAtFracture == changedField)
@ -141,8 +146,6 @@ QString RimStimPlanFractureTemplate::fileNameWithOutPath()
//--------------------------------------------------------------------------------------------------
void RimStimPlanFractureTemplate::readStimPlanXMLFile(QString * errorMessage)
{
m_stimPlanFractureDefinitionData = new RigStimPlanFractureDefinition;
{
QFile dataFile(m_stimPlanFileName());
@ -258,6 +261,52 @@ void RimStimPlanFractureTemplate::loadDataAndUpdate()
QString errorMessage;
readStimPlanXMLFile(&errorMessage);
qDebug() << errorMessage;
std::vector<QString> resultNames = m_stimPlanFractureDefinitionData->resultNames();
// Delete legends referencing results not present on file
{
std::vector<RimStimPlanLegendConfig*> toBeDeleted;
for (RimStimPlanLegendConfig* legend : m_legendConfigurations)
{
QString legendName = legend->name();
if (std::find(resultNames.begin(), resultNames.end(), legendName) == resultNames.end())
{
toBeDeleted.push_back(legend);
}
}
for (auto legend : toBeDeleted)
{
m_legendConfigurations.removeChildObject(legend);
delete legend;
}
}
// Create legend for result if not already present
for (auto resultName : resultNames)
{
bool foundResult = false;
for (RimStimPlanLegendConfig* legend : m_legendConfigurations)
{
if (legend->name().compare(resultName) == 0)
{
foundResult = true;
}
}
if (!foundResult)
{
RimStimPlanLegendConfig* legendConfig = new RimStimPlanLegendConfig();
legendConfig->setName(resultName);
m_legendConfigurations.push_back(legendConfig);
}
}
updateConnectedEditors();
}

View File

@ -20,11 +20,13 @@
#include "RimFractureTemplate.h"
#include "cafAppEnum.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmFieldCvfVec3d.h"
#include "cafPdmFieldHandle.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfVector3.h"
@ -32,7 +34,7 @@
#include <vector>
class RigStimPlanFractureDefinition;
class RimStimPlanLegendConfig;
//==================================================================================================
///
@ -66,6 +68,7 @@ public:
std::vector<std::vector<double>> getPermeabilitiesAtTimeStep(size_t timStep);
std::vector<std::vector<double>> getWidthsAtTimeStep(size_t timStep);
void loadDataAndUpdate();
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
@ -74,7 +77,6 @@ private:
void updateUiTreeName();
void readStimPlanXMLFile(QString * errorMessage);
void loadDataAndUpdate();
void readStimplanGridAndTimesteps(QXmlStreamReader &xmlStream);
@ -88,6 +90,7 @@ private:
caf::PdmField<QString> m_stimPlanFileName;
cvf::ref<RigStimPlanFractureDefinition> m_stimPlanFractureDefinitionData;
caf::PdmChildArrayField<RimStimPlanLegendConfig*> m_legendConfigurations;
bool numberOfParameterValuesOK(std::vector<std::vector<double>> propertyValuesAtTimestep);
};

View File

@ -75,3 +75,17 @@ size_t RigStimPlanFractureDefinition::getTimeStepIndex(double timeStepValue)
}
return -1; //returns -1 if not found
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RigStimPlanFractureDefinition::resultNames() const
{
std::vector<QString> names;
names.push_back("Conductivity");
names.push_back("Permeability");
names.push_back("Width");
return names;
}

View File

@ -48,6 +48,7 @@ public:
size_t getTimeStepIndex(double timeStepValue);
std::vector<QString> resultNames() const;
};