mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1585 Clean up in the RigStimPlanFractureDefinition
This commit is contained in:
parent
e9b9b17739
commit
add7516532
@ -51,6 +51,77 @@ RigStimPlanFractureDefinition::~RigStimPlanFractureDefinition()
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigStimPlanFractureDefinition::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 RigStimPlanFractureDefinition::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<double> RigStimPlanFractureDefinition::adjustedDepthCoordsAroundWellPathPosition(double wellPathDepthAtFracture) const
|
||||
{
|
||||
std::vector<double> depthRelativeToWellPath;
|
||||
|
||||
for ( const double& depth : this->depths )
|
||||
{
|
||||
double adjustedDepth = depth - wellPathDepthAtFracture;
|
||||
adjustedDepth = -adjustedDepth;
|
||||
depthRelativeToWellPath.push_back(adjustedDepth);
|
||||
}
|
||||
return depthRelativeToWellPath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::pair<QString, QString> > RigStimPlanFractureDefinition::getStimPlanPropertyNamesUnits() const
|
||||
{
|
||||
std::vector<std::pair<QString, QString> > propertyNamesUnits;
|
||||
{
|
||||
std::vector<RigStimPlanResultFrames > allStimPlanData = this->m_stimPlanResults;
|
||||
for ( RigStimPlanResultFrames stimPlanDataEntry : allStimPlanData )
|
||||
{
|
||||
propertyNamesUnits.push_back(std::make_pair(stimPlanDataEntry.resultName, stimPlanDataEntry.unit));
|
||||
}
|
||||
}
|
||||
return propertyNamesUnits;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -406,9 +477,9 @@ size_t RigStimPlanFractureDefinition::totalNumberTimeSteps()
|
||||
size_t RigStimPlanFractureDefinition::resultIndex(const QString& resultName, const QString& unit) const
|
||||
{
|
||||
|
||||
for (size_t i = 0; i < stimPlanData.size(); i++)
|
||||
for (size_t i = 0; i < m_stimPlanResults.size(); i++)
|
||||
{
|
||||
if (stimPlanData[i].resultName == resultName && stimPlanData[i].unit == unit)
|
||||
if (m_stimPlanResults[i].resultName == resultName && m_stimPlanResults[i].unit == unit)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@ -426,7 +497,7 @@ void RigStimPlanFractureDefinition::setDataAtTimeValue(QString resultName, QStri
|
||||
|
||||
if (resIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
stimPlanData[resIndex].parameterValues[getTimeStepIndex(timeStepValue)] = data;
|
||||
m_stimPlanResults[resIndex].parameterValues[getTimeStepIndex(timeStepValue)] = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -439,7 +510,7 @@ void RigStimPlanFractureDefinition::setDataAtTimeValue(QString resultName, QStri
|
||||
resultData.parameterValues = values;
|
||||
resultData.parameterValues[getTimeStepIndex(timeStepValue)] = data;
|
||||
|
||||
stimPlanData.push_back(resultData);
|
||||
m_stimPlanResults.push_back(resultData);
|
||||
}
|
||||
}
|
||||
|
||||
@ -452,9 +523,9 @@ std::vector<std::vector<double>> RigStimPlanFractureDefinition::getDataAtTimeInd
|
||||
|
||||
if (resIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
if (timeStepIndex < stimPlanData[resIndex].parameterValues.size())
|
||||
if (timeStepIndex < m_stimPlanResults[resIndex].parameterValues.size())
|
||||
{
|
||||
return stimPlanData[resIndex].parameterValues[timeStepIndex];
|
||||
return m_stimPlanResults[resIndex].parameterValues[timeStepIndex];
|
||||
}
|
||||
}
|
||||
|
||||
@ -473,7 +544,7 @@ void RigStimPlanFractureDefinition::computeMinMax(const QString& resultName, con
|
||||
size_t resIndex = resultIndex(resultName, unit);
|
||||
if (resIndex == cvf::UNDEFINED_SIZE_T) return;
|
||||
|
||||
for (auto timeValues : stimPlanData[resIndex].parameterValues)
|
||||
for (auto timeValues : m_stimPlanResults[resIndex].parameterValues)
|
||||
{
|
||||
for (auto values : timeValues)
|
||||
{
|
||||
|
@ -47,114 +47,61 @@ public:
|
||||
RigStimPlanFractureDefinition();
|
||||
~RigStimPlanFractureDefinition();
|
||||
|
||||
std::vector<double> gridXs;
|
||||
std::vector<double> gridYs;
|
||||
RimUnitSystem::UnitSystem unitSet;
|
||||
std::vector<double> gridXs;
|
||||
|
||||
//TODO: Consider removing gridYs or depths,
|
||||
//In example file these are the same, but can there be examples where not all gridY values are included in depths?
|
||||
|
||||
std::vector<double> timeSteps;
|
||||
std::vector<double> depths;
|
||||
std::vector<double> gridYs;
|
||||
std::vector<double> depths;
|
||||
|
||||
RimUnitSystem::UnitSystem unitSet;
|
||||
std::vector<double> timeSteps;
|
||||
|
||||
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<double> adjustedDepthCoordsAroundWellPathPosition(double wellPathDepthAtFracture) const
|
||||
{
|
||||
std::vector<double> depthRelativeToWellPath;
|
||||
|
||||
for (const double& depth : this->depths)
|
||||
{
|
||||
double adjustedDepth = depth - wellPathDepthAtFracture;
|
||||
adjustedDepth = -adjustedDepth;
|
||||
depthRelativeToWellPath.push_back(adjustedDepth);
|
||||
}
|
||||
return depthRelativeToWellPath;
|
||||
}
|
||||
|
||||
std::vector<std::pair<QString, QString> > getStimPlanPropertyNamesUnits() const
|
||||
{
|
||||
std::vector<std::pair<QString, QString> > propertyNamesUnits;
|
||||
{
|
||||
std::vector<RigStimPlanResultFrames > allStimPlanData = this->stimPlanData;
|
||||
for (RigStimPlanResultFrames stimPlanDataEntry : allStimPlanData)
|
||||
{
|
||||
propertyNamesUnits.push_back(std::make_pair(stimPlanDataEntry.resultName, stimPlanDataEntry.unit));
|
||||
}
|
||||
}
|
||||
return propertyNamesUnits;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::vector<double>> getMirroredDataAtTimeIndex(const QString& resultName,
|
||||
const QString& unitName,
|
||||
size_t timeStepIndex) const;
|
||||
|
||||
|
||||
cvf::ref<RigFractureGrid> createFractureGrid(const QString& resultNameFromColors,
|
||||
const QString& resultUnitFromColors,
|
||||
int m_activeTimeStepIndex,
|
||||
RimUnitSystem::UnitSystemType fractureTemplateUnit,
|
||||
double m_wellPathDepthAtFracture);
|
||||
|
||||
void createFractureTriangleGeometry(double m_wellPathDepthAtFracture,
|
||||
RimUnitSystem::UnitSystem neededUnit,
|
||||
const QString& fractureUserName,
|
||||
std::vector<cvf::Vec3f>* vertices,
|
||||
std::vector<cvf::uint>* triangleIndices);
|
||||
|
||||
std::vector<cvf::Vec3f> createFractureBorderPolygon(const QString& resultName,
|
||||
const QString& resultUnit,
|
||||
int m_activeTimeStepIndex,
|
||||
double m_wellPathDepthAtFracture,
|
||||
RimUnitSystem::UnitSystem neededUnit,
|
||||
const QString& fractureUserName);
|
||||
|
||||
std::vector<RigStimPlanResultFrames> 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;
|
||||
void computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue) const;
|
||||
|
||||
private:
|
||||
size_t resultIndex(const QString& resultName, const QString& unit) const;
|
||||
// Grid Geometry
|
||||
|
||||
std::vector<double> getNegAndPosXcoords() const;
|
||||
std::vector<double> adjustedDepthCoordsAroundWellPathPosition(double wellPathDepthAtFracture) const;
|
||||
std::vector<std::vector<double>> getMirroredDataAtTimeIndex(const QString& resultName,
|
||||
const QString& unitName,
|
||||
size_t timeStepIndex) const;
|
||||
|
||||
|
||||
cvf::ref<RigFractureGrid> createFractureGrid(const QString& resultNameFromColors,
|
||||
const QString& resultUnitFromColors,
|
||||
int m_activeTimeStepIndex,
|
||||
RimUnitSystem::UnitSystemType fractureTemplateUnit,
|
||||
double m_wellPathDepthAtFracture);
|
||||
|
||||
void createFractureTriangleGeometry(double m_wellPathDepthAtFracture,
|
||||
RimUnitSystem::UnitSystem neededUnit,
|
||||
const QString& fractureUserName,
|
||||
std::vector<cvf::Vec3f>* vertices,
|
||||
std::vector<cvf::uint>* triangleIndices);
|
||||
|
||||
std::vector<cvf::Vec3f> createFractureBorderPolygon(const QString& resultName,
|
||||
const QString& resultUnit,
|
||||
int m_activeTimeStepIndex,
|
||||
double m_wellPathDepthAtFracture,
|
||||
RimUnitSystem::UnitSystem neededUnit,
|
||||
const QString& fractureUserName);
|
||||
// Result Access
|
||||
|
||||
std::vector<std::pair<QString, QString> > getStimPlanPropertyNamesUnits() const;
|
||||
bool numberOfParameterValuesOK(std::vector<std::vector<double>> propertyValuesAtTimestep);
|
||||
bool timeStepExisist(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;
|
||||
void computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue) const;
|
||||
|
||||
// Setup
|
||||
void reorderYgridToDepths();
|
||||
private:
|
||||
size_t getTimeStepIndex(double timeStepValue);
|
||||
size_t resultIndex(const QString& resultName, const QString& unit) const;
|
||||
|
||||
std::vector<RigStimPlanResultFrames> m_stimPlanResults;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user