#1138 - pre-proto - Code cleanup and adding slider for well depth in stimplan file

This commit is contained in:
astridkbjorke 2017-02-17 15:10:04 +01:00
parent 1b99c25297
commit 359f8f9726
3 changed files with 79 additions and 74 deletions

View File

@ -25,6 +25,7 @@
#include "RimStimPlanLegendConfig.h"
#include "cafPdmObject.h"
#include "cafPdmUiDoubleSliderEditor.h"
#include "cafPdmUiFilePathEditor.h"
#include "cvfVector3.h"
@ -50,6 +51,7 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate(void)
m_stimPlanFileName.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
CAF_PDM_InitField(&wellPathDepthAtFracture, "WellPathDepthAtFracture", 0.0, "Depth of Well Path at Fracture", "", "", "");
wellPathDepthAtFracture.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&m_legendConfigurations, "LegendConfigurations", "", "", "", "");
m_legendConfigurations.uiCapability()->setUiTreeHidden(true);
@ -240,6 +242,7 @@ void RimStimPlanFractureTemplate::readStimPlanXMLFile(QString * errorMessage)
qDebug() << dataFile.errorString();
}
setDepthOfWellPathAtFracture();
}
@ -401,6 +404,20 @@ bool RimStimPlanFractureTemplate::numberOfParameterValuesOK(std::vector<std::vec
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanFractureTemplate::setDepthOfWellPathAtFracture()
{
if (!m_stimPlanFractureDefinitionData.isNull())
{
double firstDepth = m_stimPlanFractureDefinitionData->depths[0];
double lastDepth = m_stimPlanFractureDefinitionData->depths[m_stimPlanFractureDefinitionData->depths.size()-1];
double averageDepth = (firstDepth + lastDepth) / 2;
wellPathDepthAtFracture = averageDepth;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -567,78 +584,54 @@ std::vector<std::pair<QString, QString> > RimStimPlanFractureTemplate::getStimPl
return propertyNamesUnits;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<double>> RimStimPlanFractureTemplate::getConductivitiesAtTimeStep(size_t timStep)
{
return m_stimPlanFractureDefinitionData->getDataAtTimeIndex("CONDUCTIVITY", timStep);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<double>> RimStimPlanFractureTemplate::getPermeabilitiesAtTimeStep(size_t timStep)
{
return m_stimPlanFractureDefinitionData->getDataAtTimeIndex("PERMEABILITY", timStep);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<double>> RimStimPlanFractureTemplate::getWidthsAtTimeStep(size_t timStep)
{
return m_stimPlanFractureDefinitionData->getDataAtTimeIndex("WIDTH", timStep);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fracturePolygon()
{
std::vector<cvf::Vec3f> polygon;
std::vector<cvf::Vec3f> polygon;
//TODO: Handle multiple time-step and properties
std::vector<std::vector<double>> ConductivitiesAtTimeStep = m_stimPlanFractureDefinitionData->conductivities[0];
//TODO: Handle multiple time-step and properties
std::vector<std::vector<double>> dataAtTimeStep = m_stimPlanFractureDefinitionData->getDataAtTimeIndex(getStimPlanPropertyNamesUnits()[0].first, 0);
for (int k = 0; k < ConductivitiesAtTimeStep.size(); k++)
{
for (int i = 0; i < ConductivitiesAtTimeStep[k].size(); i++)
{
if ((ConductivitiesAtTimeStep[k])[i] > 1e-7)
{
if ((i < ConductivitiesAtTimeStep[k].size() - 1))
{
if ((ConductivitiesAtTimeStep[k])[(i + 1)] < 1e-7)
{
polygon.push_back(cvf::Vec3f(static_cast<float>(m_stimPlanFractureDefinitionData->gridXs[i]),
static_cast<float>(m_stimPlanFractureDefinitionData->depths[k]), 0.0f));
}
}
else
{
polygon.push_back(cvf::Vec3f(static_cast<float>(m_stimPlanFractureDefinitionData->gridXs[i]),
static_cast<float>(m_stimPlanFractureDefinitionData->depths[k]), 0.0f));
}
}
}
}
for (int k = 0; k < dataAtTimeStep.size(); k++)
{
for (int i = 0; i < dataAtTimeStep[k].size(); i++)
{
if ((dataAtTimeStep[k])[i] > 1e-7)
{
if ((i < dataAtTimeStep[k].size() - 1))
{
if ((dataAtTimeStep[k])[(i + 1)] < 1e-7)
{
polygon.push_back(cvf::Vec3f(static_cast<float>(m_stimPlanFractureDefinitionData->gridXs[i]),
static_cast<float>(m_stimPlanFractureDefinitionData->depths[k]), 0.0f));
}
}
else
{
polygon.push_back(cvf::Vec3f(static_cast<float>(m_stimPlanFractureDefinitionData->gridXs[i]),
static_cast<float>(m_stimPlanFractureDefinitionData->depths[k]), 0.0f));
}
}
}
}
std::vector<cvf::Vec3f> negPolygon;
std::vector<cvf::Vec3f> negPolygon;
for (const auto& node : polygon)
{
cvf::Vec3f negNode = node;
negNode.x() = -negNode.x();
negPolygon.insert(negPolygon.begin(), negNode);
}
for (const auto& node : polygon)
{
cvf::Vec3f negNode = node;
negNode.x() = -negNode.x();
negPolygon.insert(negPolygon.begin(), negNode);
}
for (const auto& negNode : negPolygon)
{
polygon.push_back(negNode);
}
for (const auto& negNode : negPolygon)
{
polygon.push_back(negNode);
}
return polygon;
return polygon;
}
//--------------------------------------------------------------------------------------------------
@ -652,6 +645,7 @@ void RimStimPlanFractureTemplate::defineUiOrdering(QString uiConfigName, caf::Pd
caf::PdmUiGroup* fileGroup = uiOrdering.addNewGroup("File");
fileGroup->add(&m_stimPlanFileName);
fileGroup->add(&wellPathDepthAtFracture);
caf::PdmUiGroup* geometryGroup = uiOrdering.addNewGroup("Fracture geometry");
geometryGroup->add(&orientation);
@ -662,3 +656,23 @@ void RimStimPlanFractureTemplate::defineUiOrdering(QString uiConfigName, caf::Pd
propertyGroup->add(&skinFactor);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanFractureTemplate::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
{
if (field == &wellPathDepthAtFracture)
{
if (!m_stimPlanFractureDefinitionData.isNull())
{
caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
if (myAttr)
{
myAttr->m_minimum = m_stimPlanFractureDefinitionData->depths[0];
myAttr->m_maximum = m_stimPlanFractureDefinitionData->depths[m_stimPlanFractureDefinitionData->depths.size()-1];
}
}
}
}

View File

@ -64,17 +64,13 @@ public:
std::vector<double> getStimPlanTimeValues();
std::vector<std::pair<QString, QString> > getStimPlanPropertyNamesUnits();
//TODO: Remove!!!
std::vector<std::vector<double>> getConductivitiesAtTimeStep(size_t timStep);
std::vector<std::vector<double>> getPermeabilitiesAtTimeStep(size_t timStep);
std::vector<std::vector<double>> getWidthsAtTimeStep(size_t timStep);
void loadDataAndUpdate();
std::vector<std::vector<double>> getDataAtTimeIndex(QString resultName, size_t timeStepIndex);
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;
private:
void updateUiTreeName();
@ -96,4 +92,5 @@ private:
caf::PdmChildArrayField<RimStimPlanLegendConfig*> m_legendConfigurations;
bool numberOfParameterValuesOK(std::vector<std::vector<double>> propertyValuesAtTimestep);
void setDepthOfWellPathAtFracture();
};

View File

@ -32,6 +32,7 @@ public:
QString resultName;
QString unit;
std::vector<std::vector<std::vector<double>>> parameterValues;
//Vector for each time step, for each depth and for each x-value
};
@ -51,13 +52,6 @@ public:
std::vector<RigStimPlanData> stimPlanData;
//Vector for each time step, for each depth and for each x-value
std::vector<std::vector<std::vector<double>>> conductivities;
QString conductivityUnit;
std::vector<std::vector<std::vector<double>>> widths;
QString widthUnit;
std::vector<std::vector<std::vector<double>>> permeabilities;
QString permeabilityUnit;
bool timeStepExisist(double timeStepValue);
void reorderYgridToDepths();