mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2509 Fracture : Move unit conversion of top/bot perforation depth
This commit is contained in:
parent
35febab8db
commit
4e737885e4
@ -184,6 +184,8 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps(QXmlStreamReader &xmlStr
|
|||||||
|
|
||||||
if (xmlStream.isStartElement())
|
if (xmlStream.isStartElement())
|
||||||
{
|
{
|
||||||
|
RiaEclipseUnitTools::UnitSystem destinationUnit = requiredUnit;
|
||||||
|
|
||||||
if (xmlStream.name() == "grid")
|
if (xmlStream.name() == "grid")
|
||||||
{
|
{
|
||||||
gridunit = getAttributeValueString(xmlStream, "uom");
|
gridunit = getAttributeValueString(xmlStream, "uom");
|
||||||
@ -192,11 +194,20 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps(QXmlStreamReader &xmlStr
|
|||||||
else if (gridunit == "ft") stimPlanFileData->m_unitSet = RiaEclipseUnitTools::UNITS_FIELD;
|
else if (gridunit == "ft") stimPlanFileData->m_unitSet = RiaEclipseUnitTools::UNITS_FIELD;
|
||||||
else stimPlanFileData->m_unitSet = RiaEclipseUnitTools::UNITS_UNKNOWN;
|
else stimPlanFileData->m_unitSet = RiaEclipseUnitTools::UNITS_UNKNOWN;
|
||||||
|
|
||||||
double tvdToTopPerfFt = getAttributeValueDouble(xmlStream, "TVDToTopPerfFt");
|
if (destinationUnit == RiaEclipseUnitTools::UNITS_UNKNOWN)
|
||||||
double tvdToBottomPerfFt = getAttributeValueDouble(xmlStream, "TVDToBottomPerfFt");
|
{
|
||||||
|
// Use file unit set if requested unit is unknown
|
||||||
|
destinationUnit = stimPlanFileData->m_unitSet;
|
||||||
|
}
|
||||||
|
|
||||||
stimPlanFileData->setTvdToTopPerf(tvdToTopPerfFt, RiaDefines::UNIT_FEET);
|
double tvdToTopPerfFt = getAttributeValueDouble(xmlStream, "TVDToTopPerfFt");
|
||||||
stimPlanFileData->setTvdToBottomPerf(tvdToBottomPerfFt, RiaDefines::UNIT_FEET);
|
double tvdToBotPerfFt = getAttributeValueDouble(xmlStream, "TVDToBottomPerfFt");
|
||||||
|
|
||||||
|
double tvdToTopPerfRequestedUnit = RifStimPlanXmlReader::valueInRequiredUnitSystem(RiaEclipseUnitTools::UNITS_FIELD, destinationUnit, tvdToTopPerfFt);
|
||||||
|
double tvdToBotPerfRequestedUnit = RifStimPlanXmlReader::valueInRequiredUnitSystem(RiaEclipseUnitTools::UNITS_FIELD, destinationUnit, tvdToBotPerfFt);
|
||||||
|
|
||||||
|
stimPlanFileData->setTvdToTopPerf(tvdToTopPerfRequestedUnit);
|
||||||
|
stimPlanFileData->setTvdToBottomPerf(tvdToBotPerfRequestedUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xmlStream.name() == "xs")
|
if (xmlStream.name() == "xs")
|
||||||
@ -207,7 +218,7 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps(QXmlStreamReader &xmlStr
|
|||||||
std::vector<double> gridValues;
|
std::vector<double> gridValues;
|
||||||
getGriddingValues(xmlStream, gridValues, dummy);
|
getGriddingValues(xmlStream, gridValues, dummy);
|
||||||
|
|
||||||
gridValuesXs = RifStimPlanXmlReader::valuesInRequiredUnitSystem(stimPlanFileData->m_unitSet, requiredUnit, gridValues);
|
gridValuesXs = RifStimPlanXmlReader::valuesInRequiredUnitSystem(stimPlanFileData->m_unitSet, destinationUnit, gridValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
stimPlanFileData->m_fileXs = gridValuesXs;
|
stimPlanFileData->m_fileXs = gridValuesXs;
|
||||||
@ -222,7 +233,7 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps(QXmlStreamReader &xmlStr
|
|||||||
std::vector<double> gridValues;
|
std::vector<double> gridValues;
|
||||||
getGriddingValues(xmlStream, gridValues, startNegValuesYs);
|
getGriddingValues(xmlStream, gridValues, startNegValuesYs);
|
||||||
|
|
||||||
gridValuesYs = RifStimPlanXmlReader::valuesInRequiredUnitSystem(stimPlanFileData->m_unitSet, requiredUnit, gridValues);
|
gridValuesYs = RifStimPlanXmlReader::valuesInRequiredUnitSystem(stimPlanFileData->m_unitSet, destinationUnit, gridValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reorder and change sign
|
// Reorder and change sign
|
||||||
@ -317,6 +328,25 @@ std::vector<double> RifStimPlanXmlReader::valuesInRequiredUnitSystem(RiaEclipseU
|
|||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
double RifStimPlanXmlReader::valueInRequiredUnitSystem(RiaEclipseUnitTools::UnitSystem sourceUnit,
|
||||||
|
RiaEclipseUnitTools::UnitSystem requiredUnit,
|
||||||
|
double value)
|
||||||
|
{
|
||||||
|
if (sourceUnit == RiaEclipseUnitTools::UNITS_FIELD && requiredUnit == RiaEclipseUnitTools::UNITS_METRIC)
|
||||||
|
{
|
||||||
|
return RiaEclipseUnitTools::feetToMeter(value);
|
||||||
|
}
|
||||||
|
else if (sourceUnit == RiaEclipseUnitTools::UNITS_METRIC && requiredUnit == RiaEclipseUnitTools::UNITS_FIELD)
|
||||||
|
{
|
||||||
|
return RiaEclipseUnitTools::meterToFeet(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -56,6 +56,8 @@ private:
|
|||||||
static std::vector<double> valuesInRequiredUnitSystem(RiaEclipseUnitTools::UnitSystem sourceUnit,
|
static std::vector<double> valuesInRequiredUnitSystem(RiaEclipseUnitTools::UnitSystem sourceUnit,
|
||||||
RiaEclipseUnitTools::UnitSystem requiredUnit,
|
RiaEclipseUnitTools::UnitSystem requiredUnit,
|
||||||
const std::vector<double>& values);
|
const std::vector<double>& values);
|
||||||
|
|
||||||
|
static double valueInRequiredUnitSystem(RiaEclipseUnitTools::UnitSystem sourceUnit,
|
||||||
|
RiaEclipseUnitTools::UnitSystem requiredUnit,
|
||||||
|
double value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,59 +133,17 @@ double RigStimPlanFractureDefinition::maxY() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RigStimPlanFractureDefinition::setTvdToTopPerf(double topPerfTvd, RiaDefines::DepthUnitType unit)
|
void RigStimPlanFractureDefinition::setTvdToTopPerf(double topPerfTvd)
|
||||||
{
|
{
|
||||||
if (unit == RiaDefines::UNIT_METER)
|
|
||||||
{
|
|
||||||
if (m_unitSet == RiaEclipseUnitTools::UNITS_FIELD)
|
|
||||||
{
|
|
||||||
m_topPerfTvd = RiaEclipseUnitTools::meterToFeet(topPerfTvd);
|
|
||||||
}
|
|
||||||
else if (m_unitSet == RiaEclipseUnitTools::UNITS_METRIC)
|
|
||||||
{
|
|
||||||
m_topPerfTvd = topPerfTvd;
|
m_topPerfTvd = topPerfTvd;
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (unit == RiaDefines::UNIT_FEET)
|
|
||||||
{
|
|
||||||
if (m_unitSet == RiaEclipseUnitTools::UNITS_FIELD)
|
|
||||||
{
|
|
||||||
m_topPerfTvd = topPerfTvd;
|
|
||||||
}
|
|
||||||
else if (m_unitSet == RiaEclipseUnitTools::UNITS_METRIC)
|
|
||||||
{
|
|
||||||
m_topPerfTvd = RiaEclipseUnitTools::feetToMeter(topPerfTvd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RigStimPlanFractureDefinition::setTvdToBottomPerf(double bottomPerfTvd, RiaDefines::DepthUnitType unit)
|
void RigStimPlanFractureDefinition::setTvdToBottomPerf(double bottomPerfTvd)
|
||||||
{
|
{
|
||||||
if (unit == RiaDefines::UNIT_METER)
|
|
||||||
{
|
|
||||||
if (m_unitSet == RiaEclipseUnitTools::UNITS_FIELD)
|
|
||||||
{
|
|
||||||
m_bottomPerfTvd = RiaEclipseUnitTools::meterToFeet(bottomPerfTvd);
|
|
||||||
}
|
|
||||||
else if (m_unitSet == RiaEclipseUnitTools::UNITS_METRIC)
|
|
||||||
{
|
|
||||||
m_bottomPerfTvd = bottomPerfTvd;
|
m_bottomPerfTvd = bottomPerfTvd;
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (unit == RiaDefines::UNIT_FEET)
|
|
||||||
{
|
|
||||||
if (m_unitSet == RiaEclipseUnitTools::UNITS_FIELD)
|
|
||||||
{
|
|
||||||
m_bottomPerfTvd = bottomPerfTvd;
|
|
||||||
}
|
|
||||||
else if (m_unitSet == RiaEclipseUnitTools::UNITS_METRIC)
|
|
||||||
{
|
|
||||||
m_bottomPerfTvd = RiaEclipseUnitTools::feetToMeter(bottomPerfTvd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -68,8 +68,8 @@ public:
|
|||||||
double maxDepth() const;
|
double maxDepth() const;
|
||||||
double topPerfTvd() const;
|
double topPerfTvd() const;
|
||||||
double bottomPerfTvd() const;
|
double bottomPerfTvd() const;
|
||||||
void setTvdToTopPerf(double topPerfTvd, RiaDefines::DepthUnitType unit);
|
void setTvdToTopPerf(double topPerfTvd);
|
||||||
void setTvdToBottomPerf(double bottomPerfTvd, RiaDefines::DepthUnitType unit);
|
void setTvdToBottomPerf(double bottomPerfTvd);
|
||||||
|
|
||||||
cvf::ref<RigFractureGrid> createFractureGrid(const QString& resultName,
|
cvf::ref<RigFractureGrid> createFractureGrid(const QString& resultName,
|
||||||
int activeTimeStepIndex,
|
int activeTimeStepIndex,
|
||||||
|
Loading…
Reference in New Issue
Block a user