#1585 Move code away from StimPlanTemplate, and prepare to move more

This commit is contained in:
Jacob Støren 2017-06-12 14:30:18 +02:00
parent 4254f7da68
commit e159fa5bca
5 changed files with 125 additions and 109 deletions

View File

@ -179,24 +179,24 @@ QString RimStimPlanFractureTemplate::fileNameWithOutPath()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimStimPlanFractureTemplate::readStimPlanXMLFile(QString * errorMessage) cvf::ref<RigStimPlanFractureDefinition> RimStimPlanFractureTemplate::readStimPlanXMLFile(const QString& stimPlanFileName, QString * errorMessage)
{ {
RiaLogging::info(QString("Starting to open StimPlan XML file: '%1'").arg(fileName())); RiaLogging::info(QString("Starting to open StimPlan XML file: '%1'").arg(stimPlanFileName));
m_stimPlanFractureDefinitionData = new RigStimPlanFractureDefinition; cvf::ref<RigStimPlanFractureDefinition> stimPlanFileData = new RigStimPlanFractureDefinition;
size_t startingNegXsValues = 0; size_t startingNegXsValues = 0;
{ {
QFile dataFile(m_stimPlanFileName()); QFile dataFile(stimPlanFileName);
if (!dataFile.open(QFile::ReadOnly)) if (!dataFile.open(QFile::ReadOnly))
{ {
if (errorMessage) (*errorMessage) += "Could not open the File: " + (m_stimPlanFileName()) + "\n"; if (errorMessage) (*errorMessage) += "Could not open the File: " + (stimPlanFileName) + "\n";
return; return nullptr;
} }
QXmlStreamReader xmlStream; QXmlStreamReader xmlStream;
xmlStream.setDevice(&dataFile); xmlStream.setDevice(&dataFile);
xmlStream.readNext(); xmlStream.readNext();
startingNegXsValues = readStimplanGridAndTimesteps(xmlStream); startingNegXsValues = readStimplanGridAndTimesteps(xmlStream, stimPlanFileData.p());
if (xmlStream.hasError()) if (xmlStream.hasError())
{ {
@ -207,20 +207,20 @@ void RimStimPlanFractureTemplate::readStimPlanXMLFile(QString * errorMessage)
} }
size_t numberOfDepthValues = m_stimPlanFractureDefinitionData->depths.size(); size_t numberOfDepthValues = stimPlanFileData->depths.size();
RiaLogging::debug(QString("Grid size X: %1, Y: %2").arg(QString::number(m_stimPlanFractureDefinitionData->gridXs.size()), RiaLogging::debug(QString("Grid size X: %1, Y: %2").arg(QString::number(stimPlanFileData->gridXs.size()),
QString::number(numberOfDepthValues))); QString::number(numberOfDepthValues)));
size_t numberOfTimeSteps = m_stimPlanFractureDefinitionData->timeSteps.size(); size_t numberOfTimeSteps = stimPlanFileData->timeSteps.size();
RiaLogging::debug(QString("Number of time-steps: %1").arg(numberOfTimeSteps)); RiaLogging::debug(QString("Number of time-steps: %1").arg(numberOfTimeSteps));
//Start reading from top: //Start reading from top:
QFile dataFile(m_stimPlanFileName()); QFile dataFile(stimPlanFileName);
if (!dataFile.open(QFile::ReadOnly)) if (!dataFile.open(QFile::ReadOnly))
{ {
if (errorMessage) (*errorMessage) += "Could not open the File: " + (m_stimPlanFileName()) + "\n"; if (errorMessage) (*errorMessage) += "Could not open the File: " + (stimPlanFileName) + "\n";
return; return nullptr;
} }
QXmlStreamReader xmlStream2; QXmlStreamReader xmlStream2;
@ -246,13 +246,13 @@ void RimStimPlanFractureTemplate::readStimPlanXMLFile(QString * errorMessage)
{ {
if (unit == "md-ft") if (unit == "md-ft")
{ {
fractureTemplateUnit = RimUnitSystem::UNITS_FIELD; stimPlanFileData->unitSet = RimUnitSystem::UNITS_FIELD;
RiaLogging::info(QString("Setting unit system to Field for StimPlan fracture template %1").arg(name)); RiaLogging::info(QString("Setting unit system to Field for StimPlan fracture template %1").arg(stimPlanFileName));
} }
if (unit == "md-m") if (unit == "md-m")
{ {
fractureTemplateUnit = RimUnitSystem::UNITS_METRIC; stimPlanFileData->unitSet = RimUnitSystem::UNITS_METRIC;
RiaLogging::info(QString("Setting unit system to Metric for StimPlan fracture template %1").arg(name)); RiaLogging::info(QString("Setting unit system to Metric for StimPlan fracture template %1").arg(stimPlanFileName));
} }
} }
@ -264,14 +264,14 @@ void RimStimPlanFractureTemplate::readStimPlanXMLFile(QString * errorMessage)
std::vector<std::vector<double>> propertyValuesAtTimestep = getAllDepthDataAtTimeStep(xmlStream2, startingNegXsValues); std::vector<std::vector<double>> propertyValuesAtTimestep = getAllDepthDataAtTimeStep(xmlStream2, startingNegXsValues);
bool valuesOK = numberOfParameterValuesOK(propertyValuesAtTimestep); bool valuesOK = stimPlanFileData->numberOfParameterValuesOK(propertyValuesAtTimestep);
if (!valuesOK) if (!valuesOK)
{ {
RiaLogging::error(QString("Inconsistency detected in reading XML file: '%1'").arg(dataFile.fileName())); RiaLogging::error(QString("Inconsistency detected in reading XML file: '%1'").arg(dataFile.fileName()));
return; return nullptr;
} }
m_stimPlanFractureDefinitionData->setDataAtTimeValue(parameter, unit, propertyValuesAtTimestep, timeStepValue); stimPlanFileData->setDataAtTimeValue(parameter, unit, propertyValuesAtTimestep, timeStepValue);
} }
} }
@ -291,12 +291,11 @@ void RimStimPlanFractureTemplate::readStimPlanXMLFile(QString * errorMessage)
} }
else else
{ {
RiaLogging::info(QString("Successfully read XML file: '%1'").arg(fileName())); RiaLogging::info(QString("Successfully read XML file: '%1'").arg(stimPlanFileName));
} }
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
if (!activeView) return; return stimPlanFileData;
activeView->stimPlanColors->loadDataAndUpdate();
} }
@ -346,11 +345,24 @@ bool RimStimPlanFractureTemplate::setPropertyForPolygonDefault()
void RimStimPlanFractureTemplate::loadDataAndUpdate() void RimStimPlanFractureTemplate::loadDataAndUpdate()
{ {
QString errorMessage; QString errorMessage;
readStimPlanXMLFile(&errorMessage); m_stimPlanFractureDefinitionData = readStimPlanXMLFile( m_stimPlanFileName(), &errorMessage);
if (errorMessage.size() > 0) RiaLogging::error(errorMessage); if (errorMessage.size() > 0) RiaLogging::error(errorMessage);
if (m_stimPlanFractureDefinitionData.notNull())
{
fractureTemplateUnit = m_stimPlanFractureDefinitionData->unitSet;
}
else
{
fractureTemplateUnit = RimUnitSystem::UNITS_UNKNOWN;
}
setupStimPlanCells(); setupStimPlanCells();
// Todo: Must update all views using this fracture template
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
if (activeView) activeView->stimPlanColors->loadDataAndUpdate();
updateConnectedEditors(); updateConnectedEditors();
} }
@ -362,23 +374,6 @@ std::vector<std::vector<double>> RimStimPlanFractureTemplate::getDataAtTimeIndex
return m_stimPlanFractureDefinitionData->getDataAtTimeIndex(resultName, unitName, timeStepIndex); return m_stimPlanFractureDefinitionData->getDataAtTimeIndex(resultName, unitName, timeStepIndex);
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<double>> RimStimPlanFractureTemplate::getMirroredDataAtTimeIndex(const QString& resultName, const QString& unitName, size_t timeStepIndex) const
{
std::vector<std::vector<double>> notMirrordedData = m_stimPlanFractureDefinitionData->getDataAtTimeIndex(resultName, unitName, timeStepIndex);
std::vector<std::vector<double>> mirroredData;
for (std::vector<double> depthData : notMirrordedData)
{
std::vector<double> mirrordDepthData = RivWellFracturePartMgr::mirrorDataAtSingleDepth(depthData);
mirroredData.push_back(mirrordDepthData);
}
return mirroredData;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -415,7 +410,7 @@ QList<caf::PdmOptionItemInfo> RimStimPlanFractureTemplate::calculateValueOptions
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
size_t RimStimPlanFractureTemplate::readStimplanGridAndTimesteps(QXmlStreamReader &xmlStream) size_t RimStimPlanFractureTemplate::readStimplanGridAndTimesteps(QXmlStreamReader &xmlStream, RigStimPlanFractureDefinition* stimPlanFileData)
{ {
size_t startNegValuesXs = 0; size_t startNegValuesXs = 0;
@ -435,24 +430,24 @@ size_t RimStimPlanFractureTemplate::readStimplanGridAndTimesteps(QXmlStreamReade
{ {
std::vector<double> gridValues; std::vector<double> gridValues;
getGriddingValues(xmlStream, gridValues, startNegValuesXs); getGriddingValues(xmlStream, gridValues, startNegValuesXs);
m_stimPlanFractureDefinitionData->gridXs = gridValues; stimPlanFileData->gridXs = gridValues;
} }
else if (xmlStream.name() == "ys") else if (xmlStream.name() == "ys")
{ {
std::vector<double> gridValues; std::vector<double> gridValues;
getGriddingValues(xmlStream, gridValues, startNegValuesYs); getGriddingValues(xmlStream, gridValues, startNegValuesYs);
m_stimPlanFractureDefinitionData->gridYs = gridValues; stimPlanFileData->gridYs = gridValues;
m_stimPlanFractureDefinitionData->reorderYgridToDepths(); stimPlanFileData->reorderYgridToDepths();
} }
else if (xmlStream.name() == "time") else if (xmlStream.name() == "time")
{ {
double timeStepValue = getAttributeValueDouble(xmlStream, "value"); double timeStepValue = getAttributeValueDouble(xmlStream, "value");
if (!m_stimPlanFractureDefinitionData->timeStepExisist(timeStepValue)) if (!stimPlanFileData->timeStepExisist(timeStepValue))
{ {
m_stimPlanFractureDefinitionData->timeSteps.push_back(timeStepValue); stimPlanFileData->timeSteps.push_back(timeStepValue);
} }
} }
} }
@ -506,22 +501,6 @@ std::vector<std::vector<double>> RimStimPlanFractureTemplate::getAllDepthDataAt
return propertyValuesAtTimestep; return propertyValuesAtTimestep;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimStimPlanFractureTemplate::numberOfParameterValuesOK(std::vector<std::vector<double>> propertyValuesAtTimestep)
{
size_t depths = m_stimPlanFractureDefinitionData->depths.size();
size_t gridXvalues = m_stimPlanFractureDefinitionData->gridXs.size();
if (propertyValuesAtTimestep.size() != depths) return false;
for (std::vector<double> valuesAtDepthVector : propertyValuesAtTimestep)
{
if (valuesAtDepthVector.size() != gridXvalues) return false;
}
return true;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -629,7 +608,7 @@ void RimStimPlanFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3
} }
std::vector<double> xCoords = getNegAndPosXcoords(); std::vector<double> xCoords = m_stimPlanFractureDefinitionData->getNegAndPosXcoords();
cvf::uint lenXcoords = static_cast<cvf::uint>(xCoords.size()); cvf::uint lenXcoords = static_cast<cvf::uint>(xCoords.size());
std::vector<double> adjustedDepths = adjustedDepthCoordsAroundWellPathPosition(); std::vector<double> adjustedDepths = adjustedDepthCoordsAroundWellPathPosition();
@ -697,28 +676,6 @@ void RimStimPlanFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimStimPlanFractureTemplate::getNegAndPosXcoords() const
{
std::vector<double> allXcoords;
for (const double& xCoord : m_stimPlanFractureDefinitionData->gridXs)
{
if (xCoord > 1e-5)
{
double negXcoord = -xCoord;
allXcoords.insert(allXcoords.begin(), negXcoord);
}
}
for (const double& xCoord : m_stimPlanFractureDefinitionData->gridXs)
{
allXcoords.push_back(xCoord);
}
return allXcoords;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -778,14 +735,14 @@ void RimStimPlanFractureTemplate::computeMinMax(const QString& resultName, const
void RimStimPlanFractureTemplate::getStimPlanDataAsPolygonsAndValues(std::vector<std::vector<cvf::Vec3d> > &cellsAsPolygons, std::vector<double> &parameterValues, const QString& resultName, const QString& unitName, size_t timeStepIndex) void RimStimPlanFractureTemplate::getStimPlanDataAsPolygonsAndValues(std::vector<std::vector<cvf::Vec3d> > &cellsAsPolygons, std::vector<double> &parameterValues, const QString& resultName, const QString& unitName, size_t timeStepIndex)
{ {
std::vector<std::vector<double>> propertyValuesAtTimeStep = getMirroredDataAtTimeIndex(resultName, unitName, timeStepIndex); std::vector< std::vector<double> > propertyValuesAtTimeStep = m_stimPlanFractureDefinitionData->getMirroredDataAtTimeIndex(resultName, unitName, timeStepIndex);
cellsAsPolygons.clear(); cellsAsPolygons.clear();
parameterValues.clear(); parameterValues.clear();
//TODO: Code partly copied from RivWellFracturePartMgr - can this be combined in some function? //TODO: Code partly copied from RivWellFracturePartMgr - can this be combined in some function?
std::vector<double> depthCoordsAtNodes = adjustedDepthCoordsAroundWellPathPosition(); std::vector<double> depthCoordsAtNodes = adjustedDepthCoordsAroundWellPathPosition();
std::vector<double> xCoordsAtNodes = getNegAndPosXcoords(); std::vector<double> xCoordsAtNodes = m_stimPlanFractureDefinitionData->getNegAndPosXcoords();
//Cells are around nodes instead of between nodes //Cells are around nodes instead of between nodes
std::vector<double> xCoords; std::vector<double> xCoords;
@ -827,15 +784,15 @@ void RimStimPlanFractureTemplate::setupStimPlanCells()
bool wellCenterStimPlanCellFound = false; bool wellCenterStimPlanCellFound = false;
std::vector<std::vector<double>> displayPropertyValuesAtTimeStep = getMirroredDataAtTimeIndex(resultNameFromColors, resultUnitFromColors, activeTimeStepIndex); std::vector<std::vector<double>> displayPropertyValuesAtTimeStep = m_stimPlanFractureDefinitionData->getMirroredDataAtTimeIndex(resultNameFromColors, resultUnitFromColors, activeTimeStepIndex);
QString condUnit; QString condUnit;
if (fractureTemplateUnit == RimUnitSystem::UNITS_METRIC) condUnit = "md-m"; if (fractureTemplateUnit == RimUnitSystem::UNITS_METRIC) condUnit = "md-m";
if (fractureTemplateUnit == RimUnitSystem::UNITS_FIELD) condUnit = "md-ft"; if (fractureTemplateUnit == RimUnitSystem::UNITS_FIELD) condUnit = "md-ft";
std::vector<std::vector<double>> conductivityValuesAtTimeStep = getMirroredDataAtTimeIndex("CONDUCTIVITY", condUnit, activeTimeStepIndex); std::vector<std::vector<double>> conductivityValuesAtTimeStep = m_stimPlanFractureDefinitionData->getMirroredDataAtTimeIndex("CONDUCTIVITY", condUnit, activeTimeStepIndex);
std::vector<double> depthCoordsAtNodes = adjustedDepthCoordsAroundWellPathPosition(); std::vector<double> depthCoordsAtNodes = adjustedDepthCoordsAroundWellPathPosition();
std::vector<double> xCoordsAtNodes = getNegAndPosXcoords(); std::vector<double> xCoordsAtNodes = m_stimPlanFractureDefinitionData->getNegAndPosXcoords();
std::vector<double> xCoords; std::vector<double> xCoords;
for (int i = 0; i < xCoordsAtNodes.size() - 1; i++) xCoords.push_back((xCoordsAtNodes[i] + xCoordsAtNodes[i + 1]) / 2); for (int i = 0; i < xCoordsAtNodes.size() - 1; i++) xCoords.push_back((xCoordsAtNodes[i] + xCoordsAtNodes[i + 1]) / 2);
@ -894,7 +851,7 @@ void RimStimPlanFractureTemplate::setupStimPlanCells()
m_fractureGrid->setFractureCells(stimPlanCells); m_fractureGrid->setFractureCells(stimPlanCells);
m_fractureGrid->setWellCenterFractureCellIJ(wellCenterStimPlanCellIJ); m_fractureGrid->setWellCenterFractureCellIJ(wellCenterStimPlanCellIJ);
m_fractureGrid->setICellCount(getNegAndPosXcoords().size() - 2); m_fractureGrid->setICellCount(m_stimPlanFractureDefinitionData->getNegAndPosXcoords().size() - 2);
m_fractureGrid->setJCellCount(adjustedDepthCoordsAroundWellPathPosition().size() - 2); m_fractureGrid->setJCellCount(adjustedDepthCoordsAroundWellPathPosition().size() - 2);
} }
@ -914,7 +871,7 @@ std::vector<cvf::Vec3d> RimStimPlanFractureTemplate::getStimPlanRowPolygon(size_
std::vector<cvf::Vec3d> rowPolygon; std::vector<cvf::Vec3d> rowPolygon;
std::vector<double> depthCoordsAtNodes = adjustedDepthCoordsAroundWellPathPosition(); std::vector<double> depthCoordsAtNodes = adjustedDepthCoordsAroundWellPathPosition();
std::vector<double> xCoordsAtNodes = getNegAndPosXcoords(); std::vector<double> xCoordsAtNodes = m_stimPlanFractureDefinitionData->getNegAndPosXcoords();
std::vector<double> xCoords; std::vector<double> xCoords;
for (int i = 0; i < xCoordsAtNodes.size() - 1; i++) xCoords.push_back((xCoordsAtNodes[i] + xCoordsAtNodes[i + 1]) / 2); for (int i = 0; i < xCoordsAtNodes.size() - 1; i++) xCoords.push_back((xCoordsAtNodes[i] + xCoordsAtNodes[i + 1]) / 2);
@ -937,7 +894,7 @@ std::vector<cvf::Vec3d> RimStimPlanFractureTemplate::getStimPlanColPolygon(size_
std::vector<cvf::Vec3d> colPolygon; std::vector<cvf::Vec3d> colPolygon;
std::vector<double> depthCoordsAtNodes = adjustedDepthCoordsAroundWellPathPosition(); std::vector<double> depthCoordsAtNodes = adjustedDepthCoordsAroundWellPathPosition();
std::vector<double> xCoordsAtNodes = getNegAndPosXcoords(); std::vector<double> xCoordsAtNodes = m_stimPlanFractureDefinitionData->getNegAndPosXcoords();
std::vector<double> xCoords; std::vector<double> xCoords;
for (int i = 0; i < xCoordsAtNodes.size() - 1; i++) xCoords.push_back((xCoordsAtNodes[i] + xCoordsAtNodes[i + 1]) / 2); for (int i = 0; i < xCoordsAtNodes.size() - 1; i++) xCoords.push_back((xCoordsAtNodes[i] + xCoordsAtNodes[i + 1]) / 2);

View File

@ -58,8 +58,6 @@ public:
caf::PdmField<int> activeTimeStepIndex; caf::PdmField<int> activeTimeStepIndex;
caf::PdmField<bool> showStimPlanMesh; caf::PdmField<bool> showStimPlanMesh;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
void loadDataAndUpdate(); void loadDataAndUpdate();
void setFileName(const QString& fileName); void setFileName(const QString& fileName);
@ -87,23 +85,24 @@ public:
std::vector<cvf::Vec3d> getStimPlanColPolygon(size_t j); std::vector<cvf::Vec3d> getStimPlanColPolygon(size_t j);
protected: protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering); virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override; virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;
private: private:
void updateUiTreeName(); void updateUiTreeName();
void readStimPlanXMLFile(QString * errorMessage); static cvf::ref<RigStimPlanFractureDefinition> readStimPlanXMLFile(const QString& stimPlanFileName, QString * errorMessage);
size_t readStimplanGridAndTimesteps(QXmlStreamReader &xmlStream); static size_t readStimplanGridAndTimesteps(QXmlStreamReader &xmlStream, RigStimPlanFractureDefinition* stimPlanFileData);
static double getAttributeValueDouble(QXmlStreamReader &xmlStream, QString parameterName); static double getAttributeValueDouble(QXmlStreamReader &xmlStream, QString parameterName);
static QString getAttributeValueString(QXmlStreamReader &xmlStream, QString parameterName); static QString getAttributeValueString(QXmlStreamReader &xmlStream, QString parameterName);
void getGriddingValues(QXmlStreamReader &xmlStream, std::vector<double>& gridValues, size_t& startNegValues); static void getGriddingValues(QXmlStreamReader &xmlStream, std::vector<double>& gridValues, size_t& startNegValues);
std::vector<std::vector<double>> getAllDepthDataAtTimeStep(QXmlStreamReader &xmlStream, size_t startingNegValuesXs);
std::vector<std::vector<double>> getMirroredDataAtTimeIndex(const QString& resultName, const QString& unitName, size_t timeStepIndex) const; static std::vector<std::vector<double>> getAllDepthDataAtTimeStep(QXmlStreamReader &xmlStream, size_t startingNegValuesXs);
std::vector<double> getNegAndPosXcoords() const;
std::vector<double> adjustedDepthCoordsAroundWellPathPosition() const; std::vector<double> adjustedDepthCoordsAroundWellPathPosition() const;
bool numberOfParameterValuesOK(std::vector<std::vector<double>> propertyValuesAtTimestep);
bool setPropertyForPolygonDefault(); bool setPropertyForPolygonDefault();
void setDepthOfWellPathAtFracture(); void setDepthOfWellPathAtFracture();
QString getUnitForStimPlanParameter(QString parameterName); QString getUnitForStimPlanParameter(QString parameterName);

View File

@ -28,8 +28,8 @@ public:
{ {
UNITS_METRIC, UNITS_METRIC,
UNITS_FIELD, UNITS_FIELD,
//UNITS_LAB, // Not yet
UNITS_UNKNOWN, UNITS_UNKNOWN,
//UNITS_LAB
}; };
typedef caf::AppEnum< RimUnitSystem::UnitSystem > UnitSystemType; typedef caf::AppEnum< RimUnitSystem::UnitSystem > UnitSystemType;

View File

@ -21,6 +21,7 @@
#include <QDebug> #include <QDebug>
#include "cvfMath.h" #include "cvfMath.h"
#include "RivWellFracturePartMgr.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -34,7 +35,7 @@ RigStimPlanResultFrames::RigStimPlanResultFrames()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigStimPlanFractureDefinition::RigStimPlanFractureDefinition() RigStimPlanFractureDefinition::RigStimPlanFractureDefinition() : unitSet(RimUnitSystem::UNITS_UNKNOWN)
{ {
} }
@ -47,6 +48,23 @@ RigStimPlanFractureDefinition::~RigStimPlanFractureDefinition()
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<double>> RigStimPlanFractureDefinition::getMirroredDataAtTimeIndex(const QString& resultName, const QString& unitName, size_t timeStepIndex) const
{
std::vector<std::vector<double>> notMirrordedData = this->getDataAtTimeIndex(resultName, unitName, timeStepIndex);
std::vector<std::vector<double>> mirroredData;
for ( std::vector<double> depthData : notMirrordedData )
{
std::vector<double> mirrordDepthData = RivWellFracturePartMgr::mirrorDataAtSingleDepth(depthData);
mirroredData.push_back(mirrordDepthData);
}
return mirroredData;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -23,6 +23,7 @@
#include <QString> #include <QString>
#include <vector> #include <vector>
#include "RimUnitSystem.h"
class RigStimPlanResultFrames class RigStimPlanResultFrames
{ {
@ -31,8 +32,9 @@ public:
QString resultName; QString resultName;
QString unit; QString unit;
std::vector<std::vector<std::vector<double>>> parameterValues;
//Vector for each time step, for each depth and for each x-value // Vector for each time step, for each depth and for each x-value
std::vector< std::vector< std::vector<double> > > parameterValues;
}; };
@ -50,7 +52,47 @@ public:
std::vector<double> timeSteps; std::vector<double> timeSteps;
std::vector<double> depths; std::vector<double> depths;
RimUnitSystem::UnitSystem unitSet;
std::vector<double> getNegAndPosXcoords() const
{
std::vector<double> allXcoords;
for (const double& xCoord : gridXs)
{
if (xCoord > 1e-5)
{
double negXcoord = -xCoord;
allXcoords.insert(allXcoords.begin(), negXcoord);
}
}
for (const double& xCoord : gridXs)
{
allXcoords.push_back(xCoord);
}
return allXcoords;
}
bool numberOfParameterValuesOK(std::vector<std::vector<double>> propertyValuesAtTimestep)
{
size_t depths = this->depths.size();
size_t gridXvalues = this->gridXs.size();
if (propertyValuesAtTimestep.size() != depths) return false;
for (std::vector<double> valuesAtDepthVector : propertyValuesAtTimestep)
{
if (valuesAtDepthVector.size() != gridXvalues) return false;
}
return true;
}
std::vector<std::vector<double>> getMirroredDataAtTimeIndex(const QString& resultName,
const QString& unitName,
size_t timeStepIndex) const;
std::vector<RigStimPlanResultFrames> stimPlanData; std::vector<RigStimPlanResultFrames> stimPlanData;
bool timeStepExisist(double timeStepValue); bool timeStepExisist(double timeStepValue);