#5663 Fix element property input for UCS

This commit is contained in:
Gaute Lindkvist 2020-03-10 18:43:11 +01:00
parent 2b7cbee0a6
commit 1c75d9b4bd
16 changed files with 219 additions and 146 deletions

View File

@ -42,7 +42,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaCellDividingTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaFieldHandleTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaFieldHandleTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaBoundingBoxTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaBoundingBoxTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaWellLogUnitTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaWellLogUnitTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaWellLogUnitTools.inl
) )
set (SOURCE_GROUP_SOURCE_FILES set (SOURCE_GROUP_SOURCE_FILES
@ -82,7 +82,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaGitDiff.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaCellDividingTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaCellDividingTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaFieldHandleTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaFieldHandleTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaBoundingBoxTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaBoundingBoxTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaWellLogUnitTools.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES

View File

@ -25,11 +25,13 @@
class RigWellPath; class RigWellPath;
template <typename FloatType>
class RiaWellLogUnitTools class RiaWellLogUnitTools
{ {
public: public:
static const double GRAVITY_ACCEL; static const FloatType gravityAcceleration();
static const double UNIT_WEIGHT_OF_WATER; static const FloatType unitWeightOfWater();
static bool stringsMatch( const QString& lhs, const QString& rhs );
static QString noUnitString(); static QString noUnitString();
static QString sg_emwUnitString(); static QString sg_emwUnitString();
@ -39,35 +41,38 @@ public:
static QString gPerCm3UnitString(); static QString gPerCm3UnitString();
static QString kgPerM3UnitString(); static QString kgPerM3UnitString();
static QString pascalUnitString(); static QString pascalUnitString();
static QString pascalUnitStringShort();
public: public:
static std::vector<double> convertDepths( const std::vector<double>& depthsIn, static std::vector<FloatType> convertDepths( const std::vector<FloatType>& depthsIn,
RiaDefines::DepthUnitType unitsIn, RiaDefines::DepthUnitType unitsIn,
RiaDefines::DepthUnitType unitsOut ); RiaDefines::DepthUnitType unitsOut );
static bool convertValues( const std::vector<double>& tvdRKBs, static bool convertValues( const std::vector<FloatType>& tvdRKBs,
const std::vector<double>& valuesIn, const std::vector<FloatType>& valuesIn,
std::vector<double>* valuesOut, std::vector<FloatType>* valuesOut,
const QString& unitsIn, const QString& unitsIn,
const QString& unitsOut ); const QString& unitsOut );
static bool convertValues( std::vector<std::pair<double, double>>* measuredDepthsAndValues, static bool convertValues( std::vector<std::pair<FloatType, FloatType>>* measuredDepthsAndValues,
const QString& unitsIn, const QString& unitsIn,
const QString& unitsOut, const QString& unitsOut,
const RigWellPath* wellPath ); const RigWellPath* wellPath );
static std::vector<double> tvdRKBs( const std::vector<double>& measuredDepths, const RigWellPath* wellPath ); static std::vector<FloatType> tvdRKBs( const std::vector<FloatType>& measuredDepths, const RigWellPath* wellPath );
// Supported conversions // Supported conversions
static std::vector<double> convertGpcm3ToBar( const std::vector<double>& tvdRKBs, static std::vector<FloatType> convertGpcm3ToBar( const std::vector<FloatType>& tvdRKBs,
const std::vector<double>& valuesInGpcm3 ); const std::vector<FloatType>& valuesInGpcm3 );
static std::vector<double> convertBarToGpcm3( const std::vector<double>& tvdRKBs, static std::vector<FloatType> convertBarToGpcm3( const std::vector<FloatType>& tvdRKBs,
const std::vector<double>& valuesInBar ); const std::vector<FloatType>& valuesInBar );
static std::vector<double> convertNormalizedByPPToBar( const std::vector<double>& tvdRKBs, static std::vector<FloatType> convertNormalizedByPPToBar( const std::vector<FloatType>& tvdRKBs,
const std::vector<double>& valuesInBar ); const std::vector<FloatType>& valuesInBar );
static std::vector<double> convertBarToNormalizedByPP( const std::vector<double>& tvdRKBs, static std::vector<FloatType> convertBarToNormalizedByPP( const std::vector<FloatType>& tvdRKBs,
const std::vector<double>& valuesInBar ); const std::vector<FloatType>& valuesInBar );
static std::vector<double> multiply( const std::vector<double>& values, double factor ); static std::vector<FloatType> multiply( const std::vector<FloatType>& values, FloatType factor );
static double pascalPerBar(); static FloatType pascalPerBar();
static double MPaPerBar(); static FloatType MPaPerBar();
static double hydrostaticPorePressureBar( double tvdRKB ); static FloatType hydrostaticPorePressureBar( FloatType tvdRKB );
}; };
#include "RiaWellLogUnitTools.inl"

View File

@ -15,8 +15,6 @@
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#include "RiaWellLogUnitTools.h"
#include "RiaEclipseUnitTools.h" #include "RiaEclipseUnitTools.h"
#include "RigWellPath.h" #include "RigWellPath.h"
@ -24,10 +22,30 @@
#include <limits> #include <limits>
const double RiaWellLogUnitTools::GRAVITY_ACCEL = 9.81;
const double RiaWellLogUnitTools::UNIT_WEIGHT_OF_WATER = RiaWellLogUnitTools::GRAVITY_ACCEL * 1000.0; // N / m^3
bool stringsMatch( const QString& lhs, const QString& rhs ) //--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
const FloatType RiaWellLogUnitTools<FloatType>::gravityAcceleration()
{
return (FloatType) 9.81;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
const FloatType RiaWellLogUnitTools<FloatType>::unitWeightOfWater()
{
return RiaWellLogUnitTools<FloatType>::gravityAcceleration() * 1000.0; // N / m^3
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
bool RiaWellLogUnitTools<FloatType>::stringsMatch( const QString& lhs, const QString& rhs )
{ {
return QString::compare( lhs, rhs, Qt::CaseInsensitive ) == 0; return QString::compare( lhs, rhs, Qt::CaseInsensitive ) == 0;
} }
@ -35,7 +53,8 @@ bool stringsMatch( const QString& lhs, const QString& rhs )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::noUnitString() template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::noUnitString()
{ {
return "NO_UNIT"; return "NO_UNIT";
} }
@ -43,7 +62,8 @@ QString RiaWellLogUnitTools::noUnitString()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::sg_emwUnitString() template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::sg_emwUnitString()
{ {
return "sg_EMW"; return "sg_EMW";
} }
@ -51,7 +71,8 @@ QString RiaWellLogUnitTools::sg_emwUnitString()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::barUnitString() template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::barUnitString()
{ {
return "Bar"; return "Bar";
} }
@ -59,7 +80,8 @@ QString RiaWellLogUnitTools::barUnitString()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::barX100UnitString() template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::barX100UnitString()
{ {
return "Bar x100"; return "Bar x100";
} }
@ -67,7 +89,8 @@ QString RiaWellLogUnitTools::barX100UnitString()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::MPaUnitString() template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::MPaUnitString()
{ {
return "MPa"; return "MPa";
} }
@ -75,7 +98,8 @@ QString RiaWellLogUnitTools::MPaUnitString()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::gPerCm3UnitString() template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::gPerCm3UnitString()
{ {
return "g/cm3"; return "g/cm3";
} }
@ -83,7 +107,8 @@ QString RiaWellLogUnitTools::gPerCm3UnitString()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::kgPerM3UnitString() template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::kgPerM3UnitString()
{ {
return "kg/m3"; return "kg/m3";
} }
@ -91,7 +116,8 @@ QString RiaWellLogUnitTools::kgPerM3UnitString()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::pascalUnitString() template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::pascalUnitString()
{ {
return "pascal"; return "pascal";
} }
@ -99,7 +125,17 @@ QString RiaWellLogUnitTools::pascalUnitString()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::convertDepths( const std::vector<double>& depthsIn, template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::pascalUnitStringShort()
{
return "pa";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertDepths( const std::vector<FloatType>& depthsIn,
RiaDefines::DepthUnitType unitsIn, RiaDefines::DepthUnitType unitsIn,
RiaDefines::DepthUnitType unitsOut ) RiaDefines::DepthUnitType unitsOut )
{ {
@ -117,9 +153,10 @@ std::vector<double> RiaWellLogUnitTools::convertDepths( const std::vector<double
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaWellLogUnitTools::convertValues( const std::vector<double>& tvdRKBs, template <typename FloatType>
const std::vector<double>& valuesIn, bool RiaWellLogUnitTools<FloatType>::convertValues( const std::vector<FloatType>& tvdRKBs,
std::vector<double>* valuesOut, const std::vector<FloatType>& valuesIn,
std::vector<FloatType>* valuesOut,
const QString& unitsIn, const QString& unitsIn,
const QString& unitsOut ) const QString& unitsOut )
{ {
@ -162,13 +199,13 @@ bool RiaWellLogUnitTools::convertValues( const std::vector<double>& tvdRKBs,
} }
else if ( stringsMatch( unitsIn, barX100UnitString() ) && stringsMatch( unitsOut, MPaUnitString() ) ) else if ( stringsMatch( unitsIn, barX100UnitString() ) && stringsMatch( unitsOut, MPaUnitString() ) )
{ {
*valuesOut = multiply( valuesIn, 100.0 ); *valuesOut = multiply( valuesIn, (FloatType)100.0 );
*valuesOut = multiply( *valuesOut, MPaPerBar() ); *valuesOut = multiply( *valuesOut, MPaPerBar() );
return true; return true;
} }
else if ( stringsMatch( unitsIn, barX100UnitString() ) && stringsMatch( unitsOut, barUnitString() ) ) else if ( stringsMatch( unitsIn, barX100UnitString() ) && stringsMatch( unitsOut, barUnitString() ) )
{ {
*valuesOut = multiply( valuesIn, 100 ); *valuesOut = multiply( valuesIn, (FloatType)100 );
return true; return true;
} }
else if ( stringsMatch( unitsIn, barUnitString() ) && stringsMatch( unitsOut, MPaUnitString() ) ) else if ( stringsMatch( unitsIn, barUnitString() ) && stringsMatch( unitsOut, MPaUnitString() ) )
@ -178,7 +215,7 @@ bool RiaWellLogUnitTools::convertValues( const std::vector<double>& tvdRKBs,
} }
else if ( stringsMatch( unitsIn, barUnitString() ) && stringsMatch( unitsOut, barX100UnitString() ) ) else if ( stringsMatch( unitsIn, barUnitString() ) && stringsMatch( unitsOut, barX100UnitString() ) )
{ {
*valuesOut = multiply( valuesIn, 1.0 / 100.0 ); *valuesOut = multiply( valuesIn, (FloatType) 0.01 );
return true; return true;
} }
else if ( ( stringsMatch( unitsIn, noUnitString() ) || stringsMatch( unitsIn, sg_emwUnitString() ) ) && else if ( ( stringsMatch( unitsIn, noUnitString() ) || stringsMatch( unitsIn, sg_emwUnitString() ) ) &&
@ -193,12 +230,12 @@ bool RiaWellLogUnitTools::convertValues( const std::vector<double>& tvdRKBs,
*valuesOut = convertBarToNormalizedByPP( tvdRKBs, valuesIn ); *valuesOut = convertBarToNormalizedByPP( tvdRKBs, valuesIn );
return true; return true;
} }
else if ( stringsMatch( unitsIn, pascalUnitString() ) && stringsMatch( unitsOut, barUnitString() ) ) else if ( (stringsMatch( unitsIn, pascalUnitString()) || stringsMatch( unitsIn, pascalUnitString() ) && stringsMatch( unitsOut, barUnitString() ) ))
{ {
*valuesOut = multiply( valuesIn, 1.0 / pascalPerBar() ); *valuesOut = multiply( valuesIn, 1.0 / pascalPerBar() );
return true; return true;
} }
else if ( stringsMatch( unitsIn, barUnitString() ) && stringsMatch( unitsOut, pascalUnitString() ) ) else if ( stringsMatch( unitsIn, barUnitString() ) && (stringsMatch( unitsIn, pascalUnitString()) || stringsMatch( unitsIn, pascalUnitString() )) )
{ {
*valuesOut = multiply( valuesIn, pascalPerBar() ); *valuesOut = multiply( valuesIn, pascalPerBar() );
return true; return true;
@ -209,7 +246,8 @@ bool RiaWellLogUnitTools::convertValues( const std::vector<double>& tvdRKBs,
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaWellLogUnitTools::convertValues( std::vector<std::pair<double, double>>* measuredDepthsAndValues, template <typename FloatType>
bool RiaWellLogUnitTools<FloatType>::convertValues( std::vector<std::pair<FloatType, FloatType>>* measuredDepthsAndValues,
const QString& unitsIn, const QString& unitsIn,
const QString& unitsOut, const QString& unitsOut,
const RigWellPath* wellPath ) const RigWellPath* wellPath )
@ -217,8 +255,8 @@ bool RiaWellLogUnitTools::convertValues( std::vector<std::pair<double, double>>*
CAF_ASSERT( measuredDepthsAndValues ); CAF_ASSERT( measuredDepthsAndValues );
if ( unitsIn == unitsOut ) return true; if ( unitsIn == unitsOut ) return true;
std::vector<double> tvdRKBs( measuredDepthsAndValues->size(), 0.0 ); std::vector<FloatType> tvdRKBs( measuredDepthsAndValues->size(), 0.0 );
std::vector<double> values( measuredDepthsAndValues->size(), 0.0 ); std::vector<FloatType> values( measuredDepthsAndValues->size(), 0.0 );
for ( size_t i = 0; i < measuredDepthsAndValues->size(); ++i ) for ( size_t i = 0; i < measuredDepthsAndValues->size(); ++i )
{ {
auto depthValuePair = ( *measuredDepthsAndValues )[i]; auto depthValuePair = ( *measuredDepthsAndValues )[i];
@ -227,7 +265,7 @@ bool RiaWellLogUnitTools::convertValues( std::vector<std::pair<double, double>>*
tvdRKBs[i] = -point.z() + wellPath->rkbDiff(); tvdRKBs[i] = -point.z() + wellPath->rkbDiff();
values[i] = depthValuePair.second; values[i] = depthValuePair.second;
} }
std::vector<double> valuesOut; std::vector<FloatType> valuesOut;
if ( convertValues( tvdRKBs, values, &valuesOut, unitsIn, unitsOut ) ) if ( convertValues( tvdRKBs, values, &valuesOut, unitsIn, unitsOut ) )
{ {
CAF_ASSERT( measuredDepthsAndValues->size() == valuesOut.size() ); CAF_ASSERT( measuredDepthsAndValues->size() == valuesOut.size() );
@ -243,7 +281,8 @@ bool RiaWellLogUnitTools::convertValues( std::vector<std::pair<double, double>>*
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::tvdRKBs( const std::vector<double>& measuredDepths, const RigWellPath* wellPath ) template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::tvdRKBs( const std::vector<FloatType>& measuredDepths, const RigWellPath* wellPath )
{ {
std::vector<double> tvdRKBs( measuredDepths.size(), 0.0 ); std::vector<double> tvdRKBs( measuredDepths.size(), 0.0 );
for ( size_t i = 0; i < measuredDepths.size(); ++i ) for ( size_t i = 0; i < measuredDepths.size(); ++i )
@ -251,28 +290,29 @@ std::vector<double> RiaWellLogUnitTools::tvdRKBs( const std::vector<double>& mea
cvf::Vec3d point = wellPath->interpolatedPointAlongWellPath( measuredDepths[i] ); cvf::Vec3d point = wellPath->interpolatedPointAlongWellPath( measuredDepths[i] );
tvdRKBs[i] = -point.z() + wellPath->rkbDiff(); tvdRKBs[i] = -point.z() + wellPath->rkbDiff();
} }
return tvdRKBs; return std::vector<FloatType>(tvdRKBs.begin(), tvdRKBs.end());
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::convertGpcm3ToBar( const std::vector<double>& tvdRKBs, template <typename FloatType>
const std::vector<double>& valuesInGpcm3 ) std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertGpcm3ToBar( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInGpcm3 )
{ {
CAF_ASSERT( tvdRKBs.size() == valuesInGpcm3.size() ); CAF_ASSERT( tvdRKBs.size() == valuesInGpcm3.size() );
std::vector<double> valuesInBar( valuesInGpcm3.size(), 0.0 ); std::vector<FloatType> valuesInBar( valuesInGpcm3.size(), 0.0 );
for ( size_t i = 0; i < tvdRKBs.size(); ++i ) for ( size_t i = 0; i < tvdRKBs.size(); ++i )
{ {
// We need SI as input (kg / m^3), so multiply by 1000: // We need SI as input (kg / m^3), so multiply by 1000:
double mudWeightsSI = valuesInGpcm3[i] * 1000; FloatType mudWeightsSI = valuesInGpcm3[i] * 1000;
// To get specific mudWeight (N / m^3): // To get specific mudWeight (N / m^3):
double specificMudWeight = mudWeightsSI * GRAVITY_ACCEL; FloatType specificMudWeight = mudWeightsSI * gravityAcceleration();
// Pore pressure in pascal // Pore pressure in pascal
double valuePascal = specificMudWeight * tvdRKBs[i]; FloatType valuePascal = specificMudWeight * tvdRKBs[i];
// Pore pressure in bar // Pore pressure in bar
valuesInBar[i] = 1.0 / pascalPerBar() * valuePascal; valuesInBar[i] = 1.0 / pascalPerBar() * valuePascal;
@ -283,22 +323,23 @@ std::vector<double> RiaWellLogUnitTools::convertGpcm3ToBar( const std::vector<do
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::convertBarToGpcm3( const std::vector<double>& tvdRKBs, template <typename FloatType>
const std::vector<double>& valuesInBar ) std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertBarToGpcm3( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInBar )
{ {
CAF_ASSERT( tvdRKBs.size() == valuesInBar.size() ); CAF_ASSERT( tvdRKBs.size() == valuesInBar.size() );
std::vector<double> valuesInGpcm3( valuesInBar.size(), 0.0 ); std::vector<FloatType> valuesInGpcm3( valuesInBar.size(), 0.0 );
for ( size_t i = 0; i < tvdRKBs.size(); ++i ) for ( size_t i = 0; i < tvdRKBs.size(); ++i )
{ {
// Pore pressure in pascal (N / m^2) // Pore pressure in pascal (N / m^2)
double valuePascal = pascalPerBar() * valuesInBar[i]; FloatType valuePascal = pascalPerBar() * valuesInBar[i];
// N / m^3: // N / m^3:
double specificMudWeight = valuePascal / tvdRKBs[i]; FloatType specificMudWeight = valuePascal / tvdRKBs[i];
// Mud weight in SI (kg / m^3): // Mud weight in SI (kg / m^3):
double mudWeightsSI = specificMudWeight / GRAVITY_ACCEL; FloatType mudWeightsSI = specificMudWeight / gravityAcceleration();
// Mud weights g/cm^3: // Mud weights g/cm^3:
valuesInGpcm3[i] = mudWeightsSI / 1000; valuesInGpcm3[i] = mudWeightsSI / 1000;
@ -309,12 +350,13 @@ std::vector<double> RiaWellLogUnitTools::convertBarToGpcm3( const std::vector<do
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::convertNormalizedByPPToBar( const std::vector<double>& tvdRKBs, template<typename FloatType>
const std::vector<double>& normalizedValues ) std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertNormalizedByPPToBar( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& normalizedValues )
{ {
CAF_ASSERT( tvdRKBs.size() == normalizedValues.size() ); CAF_ASSERT( tvdRKBs.size() == normalizedValues.size() );
std::vector<double> valuesInBar( tvdRKBs.size(), 0.0 ); std::vector<FloatType> valuesInBar( tvdRKBs.size(), 0.0 );
for ( size_t i = 0; i < tvdRKBs.size(); ++i ) for ( size_t i = 0; i < tvdRKBs.size(); ++i )
{ {
valuesInBar[i] = normalizedValues[i] * hydrostaticPorePressureBar( tvdRKBs[i] ); valuesInBar[i] = normalizedValues[i] * hydrostaticPorePressureBar( tvdRKBs[i] );
@ -325,12 +367,13 @@ std::vector<double> RiaWellLogUnitTools::convertNormalizedByPPToBar( const std::
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::convertBarToNormalizedByPP( const std::vector<double>& tvdRKBs, template <typename FloatType>
const std::vector<double>& valuesInBar ) std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertBarToNormalizedByPP( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInBar )
{ {
CAF_ASSERT( tvdRKBs.size() == valuesInBar.size() ); CAF_ASSERT( tvdRKBs.size() == valuesInBar.size() );
std::vector<double> normalizedValues( tvdRKBs.size(), 0.0 ); std::vector<FloatType> normalizedValues( tvdRKBs.size(), 0.0 );
for ( size_t i = 0; i < tvdRKBs.size(); ++i ) for ( size_t i = 0; i < tvdRKBs.size(); ++i )
{ {
normalizedValues[i] = valuesInBar[i] / hydrostaticPorePressureBar( tvdRKBs[i] ); normalizedValues[i] = valuesInBar[i] / hydrostaticPorePressureBar( tvdRKBs[i] );
@ -341,9 +384,10 @@ std::vector<double> RiaWellLogUnitTools::convertBarToNormalizedByPP( const std::
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::multiply( const std::vector<double>& valuesIn, double factor ) template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::multiply( const std::vector<FloatType>& valuesIn, FloatType factor )
{ {
std::vector<double> valuesOut( valuesIn.size(), std::numeric_limits<double>::infinity() ); std::vector<FloatType> valuesOut( valuesIn.size(), std::numeric_limits<FloatType>::infinity() );
for ( size_t i = 0; i < valuesIn.size(); ++i ) for ( size_t i = 0; i < valuesIn.size(); ++i )
{ {
valuesOut[i] = valuesIn[i] * factor; valuesOut[i] = valuesIn[i] * factor;
@ -354,7 +398,8 @@ std::vector<double> RiaWellLogUnitTools::multiply( const std::vector<double>& va
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RiaWellLogUnitTools::pascalPerBar() template <typename FloatType>
FloatType RiaWellLogUnitTools<FloatType>::pascalPerBar()
{ {
return 1.0e5; return 1.0e5;
} }
@ -362,15 +407,17 @@ double RiaWellLogUnitTools::pascalPerBar()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RiaWellLogUnitTools::MPaPerBar() template <typename FloatType>
FloatType RiaWellLogUnitTools<FloatType>::MPaPerBar()
{ {
return 1.0e-1; return (FloatType) 1.0e-1;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RiaWellLogUnitTools::hydrostaticPorePressureBar( double depth ) template <typename FloatType>
FloatType RiaWellLogUnitTools<FloatType>::hydrostaticPorePressureBar( FloatType depth )
{ {
return 1.0 / pascalPerBar() * depth * UNIT_WEIGHT_OF_WATER; return (FloatType) 1.0 / pascalPerBar() * depth * unitWeightOfWater();
} }

View File

@ -1290,7 +1290,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateNormalizedResult
size_t elmNodeResIdx = femPart->elementNodeResultIdx( elmIdx, elmLocalNodeIdx ); size_t elmNodeResIdx = femPart->elementNodeResultIdx( elmIdx, elmLocalNodeIdx );
const int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodeResIdx ); const int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodeResIdx );
double tvdRKB = std::abs( nodeCoords[nodeIdx].z() ) + m_normalizationAirGap; double tvdRKB = std::abs( nodeCoords[nodeIdx].z() ) + m_normalizationAirGap;
double hydrostaticPressure = RiaWellLogUnitTools::hydrostaticPorePressureBar( tvdRKB ); double hydrostaticPressure = RiaWellLogUnitTools<double>::hydrostaticPorePressureBar( tvdRKB );
dstFrameData[elmNodeResIdx] /= hydrostaticPressure; dstFrameData[elmNodeResIdx] /= hydrostaticPressure;
} }
} }
@ -1300,7 +1300,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateNormalizedResult
cvf::Vec3d cellCentroid = femPartGrid->cellCentroid( elmIdx ); cvf::Vec3d cellCentroid = femPartGrid->cellCentroid( elmIdx );
double cellCentroidTvdRKB = std::abs( cellCentroid.z() ) + m_normalizationAirGap; double cellCentroidTvdRKB = std::abs( cellCentroid.z() ) + m_normalizationAirGap;
double cellCenterHydroStaticPressure = double cellCenterHydroStaticPressure =
RiaWellLogUnitTools::hydrostaticPorePressureBar( cellCentroidTvdRKB ); RiaWellLogUnitTools<double>::hydrostaticPorePressureBar( cellCentroidTvdRKB );
for ( int elmLocalNodeIdx = 0; elmLocalNodeIdx < 8; ++elmLocalNodeIdx ) for ( int elmLocalNodeIdx = 0; elmLocalNodeIdx < 8; ++elmLocalNodeIdx )
{ {

View File

@ -119,7 +119,7 @@ QString RimWellFlowRateCurve::wellLogChannelUiName() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimWellFlowRateCurve::wellLogChannelUnits() const QString RimWellFlowRateCurve::wellLogChannelUnits() const
{ {
return RiaWellLogUnitTools::noUnitString(); return RiaWellLogUnitTools<double>::noUnitString();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -787,12 +787,12 @@ QString RimGeoMechResultDefinition::currentResultUnits() const
{ {
if ( resultName == this->resultFieldName() ) if ( resultName == this->resultFieldName() )
{ {
return RiaWellLogUnitTools::sg_emwUnitString(); return RiaWellLogUnitTools<double>::sg_emwUnitString();
} }
} }
} }
return RiaWellLogUnitTools::noUnitString(); return RiaWellLogUnitTools<double>::noUnitString();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -919,7 +919,7 @@ void RimGeoMechResultDefinition::updateLegendTextAndRanges( RimRegularLegendConf
} }
QString unitString = currentResultUnits(); QString unitString = currentResultUnits();
if ( unitString != RiaWellLogUnitTools::noUnitString() ) if ( unitString != RiaWellLogUnitTools<double>::noUnitString() )
{ {
legendTitle += QString( " [%1]" ).arg( unitString ); legendTitle += QString( " [%1]" ).arg( unitString );
} }

View File

@ -49,20 +49,20 @@ public:
double rkbDiff, double rkbDiff,
RiaDefines::DepthUnitType depthUnit, RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve, bool isExtractionCurve,
const QString& xUnits = RiaWellLogUnitTools::noUnitString() ); const QString& xUnits = RiaWellLogUnitTools<double>::noUnitString() );
void setValuesWithMdAndTVD( const std::vector<double>& xValues, void setValuesWithMdAndTVD( const std::vector<double>& xValues,
const std::vector<double>& measuredDepths, const std::vector<double>& measuredDepths,
const std::vector<double>& tvDepths, const std::vector<double>& tvDepths,
double rkbDiff, double rkbDiff,
RiaDefines::DepthUnitType depthUnit, RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve, bool isExtractionCurve,
const QString& xUnits = RiaWellLogUnitTools::noUnitString() ); const QString& xUnits = RiaWellLogUnitTools<double>::noUnitString() );
void setValuesAndDepths( const std::vector<double>& xValues, void setValuesAndDepths( const std::vector<double>& xValues,
const std::map<RiaDefines::DepthTypeEnum, std::vector<double>>& depths, const std::map<RiaDefines::DepthTypeEnum, std::vector<double>>& depths,
double rkbDiff, double rkbDiff,
RiaDefines::DepthUnitType depthUnit, RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve, bool isExtractionCurve,
const QString& xUnits = RiaWellLogUnitTools::noUnitString() ); const QString& xUnits = RiaWellLogUnitTools<double>::noUnitString() );
const RigWellLogCurveData* curveData() const; const RigWellLogCurveData* curveData() const;

View File

@ -451,7 +451,7 @@ void RimWellLogExtractionCurve::extractData( bool* isUsingPseudoLength,
double rkbDiff = 0.0; double rkbDiff = 0.0;
RiaDefines::DepthUnitType depthUnit = RiaDefines::UNIT_METER; RiaDefines::DepthUnitType depthUnit = RiaDefines::UNIT_METER;
QString xUnits = RiaWellLogUnitTools::noUnitString(); QString xUnits = RiaWellLogUnitTools<double>::noUnitString();
if ( eclExtractor.notNull() && eclipseCase ) if ( eclExtractor.notNull() && eclipseCase )
{ {
@ -554,7 +554,10 @@ void RimWellLogExtractionCurve::findAndLoadWbsParametersFromLasFiles( const RimW
{ {
QString extractorUnits = geomExtractor->parameterInputUnits( parameter ); QString extractorUnits = geomExtractor->parameterInputUnits( parameter );
if ( RiaWellLogUnitTools::convertValues( &lasFileValues, lasUnits, extractorUnits, wellPath->wellPathGeometry() ) ) if ( RiaWellLogUnitTools<double>::convertValues( &lasFileValues,
lasUnits,
extractorUnits,
wellPath->wellPathGeometry() ) )
{ {
geomExtractor->setWbsLasValues( parameter, lasFileValues ); geomExtractor->setWbsLasValues( parameter, lasFileValues );
} }
@ -905,7 +908,7 @@ QString RimWellLogExtractionCurve::wellLogChannelUnits() const
QString name; QString name;
if ( eclipseCase ) if ( eclipseCase )
{ {
name = RiaWellLogUnitTools::noUnitString(); name = RiaWellLogUnitTools<double>::noUnitString();
} }
else if ( geoMechCase ) else if ( geoMechCase )
{ {

View File

@ -439,7 +439,7 @@ QString RimWellLogFileCurve::wellLogChannelUnits() const
{ {
return m_wellLogFile->wellLogFileData()->wellLogChannelUnitString( m_wellLogChannelName ); return m_wellLogFile->wellLogFileData()->wellLogChannelUnitString( m_wellLogChannelName );
} }
return RiaWellLogUnitTools::noUnitString(); return RiaWellLogUnitTools<double>::noUnitString();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -151,7 +151,7 @@ QString RimWellLogRftCurve::wellLogChannelUiName() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimWellLogRftCurve::wellLogChannelUnits() const QString RimWellLogRftCurve::wellLogChannelUnits() const
{ {
return RiaWellLogUnitTools::noUnitString(); return RiaWellLogUnitTools<double>::noUnitString();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -285,7 +285,7 @@ QString RimWellMeasurementCurve::wellLogChannelUiName() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimWellMeasurementCurve::wellLogChannelUnits() const QString RimWellMeasurementCurve::wellLogChannelUnits() const
{ {
return RiaWellLogUnitTools::noUnitString(); return RiaWellLogUnitTools<double>::noUnitString();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -178,16 +178,16 @@ QString RigGeoMechWellLogExtractor::curveData( const RigFemResultAddress& resAdd
{ {
if ( isValid( value ) ) value /= 100.0; if ( isValid( value ) ) value /= 100.0;
} }
return RiaWellLogUnitTools::barX100UnitString(); return RiaWellLogUnitTools<double>::barX100UnitString();
} }
else if ( param == RigWbsParameter::DF() || param == RigWbsParameter::poissonRatio() ) else if ( param == RigWbsParameter::DF() || param == RigWbsParameter::poissonRatio() )
{ {
return RiaWellLogUnitTools::noUnitString(); return RiaWellLogUnitTools<double>::noUnitString();
} }
} }
} }
} }
return RiaWellLogUnitTools::sg_emwUnitString(); return RiaWellLogUnitTools<double>::sg_emwUnitString();
} }
else if ( resAddr.isValid() ) else if ( resAddr.isValid() )
{ {
@ -215,7 +215,7 @@ QString RigGeoMechWellLogExtractor::curveData( const RigFemResultAddress& resAdd
} }
} }
} }
return RiaWellLogUnitTools::barUnitString(); return RiaWellLogUnitTools<double>::barUnitString();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -268,11 +268,23 @@ std::vector<RigGeoMechWellLogExtractor::WbsParameterSource>
const std::vector<std::pair<double, double>>& lasFileValues = m_lasFileValues.at( parameter ); const std::vector<std::pair<double, double>>& lasFileValues = m_lasFileValues.at( parameter );
const double& userDefinedValue = m_userDefinedValues.at( parameter ); const double& userDefinedValue = m_userDefinedValues.at( parameter );
const std::vector<float>* elementPropertyValues = nullptr; std::vector<float> elementPropertyValues;
if ( std::find( allSources.begin(), allSources.end(), RigWbsParameter::ELEMENT_PROPERTY_TABLE ) != allSources.end() ) if ( std::find( allSources.begin(), allSources.end(), RigWbsParameter::ELEMENT_PROPERTY_TABLE ) != allSources.end() )
{ {
const std::vector<float>* elementPropertyValuesInput = nullptr;
std::vector<float> tvdRKBs;
for ( double tvdValue : m_intersectionTVDs )
{
tvdRKBs.push_back( tvdValue + m_wellPath->rkbDiff() );
}
RigFemResultAddress elementPropertyAddr = parameter.femAddress( RigWbsParameter::ELEMENT_PROPERTY_TABLE ); RigFemResultAddress elementPropertyAddr = parameter.femAddress( RigWbsParameter::ELEMENT_PROPERTY_TABLE );
elementPropertyValues = &( resultCollection->resultValues( elementPropertyAddr, 0, frameIndex ) ); elementPropertyValuesInput = &( resultCollection->resultValues( elementPropertyAddr, 0, frameIndex ) );
RiaWellLogUnitTools<float>::convertValues( tvdRKBs,
*elementPropertyValuesInput,
&elementPropertyValues,
parameter.units( RigWbsParameter::ELEMENT_PROPERTY_TABLE ),
parameterInputUnits( parameter ) );
} }
std::vector<double> unscaledValues( m_intersections.size(), std::numeric_limits<double>::infinity() ); std::vector<double> unscaledValues( m_intersections.size(), std::numeric_limits<double>::infinity() );
@ -310,11 +322,11 @@ std::vector<RigGeoMechWellLogExtractor::WbsParameterSource>
} }
else if ( *it == RigWbsParameter::ELEMENT_PROPERTY_TABLE ) // Priority 2: Element property table value else if ( *it == RigWbsParameter::ELEMENT_PROPERTY_TABLE ) // Priority 2: Element property table value
{ {
CVF_ASSERT( elementPropertyValues ); CVF_ASSERT( !elementPropertyValues.empty() );
size_t elmIdx = m_intersectedCellsGlobIdx[intersectionIdx]; size_t elmIdx = m_intersectedCellsGlobIdx[intersectionIdx];
if ( elmIdx < elementPropertyValues->size() ) if ( elmIdx < elementPropertyValues.size() )
{ {
unscaledValues[intersectionIdx] = ( *elementPropertyValues )[elmIdx]; unscaledValues[intersectionIdx] = elementPropertyValues[elmIdx];
finalSourcesPerSegment[intersectionIdx] = RigWbsParameter::ELEMENT_PROPERTY_TABLE; finalSourcesPerSegment[intersectionIdx] = RigWbsParameter::ELEMENT_PROPERTY_TABLE;
break; break;
} }
@ -767,17 +779,17 @@ QString RigGeoMechWellLogExtractor::parameterInputUnits( const RigWbsParameter&
if ( parameter == RigWbsParameter::PP_NonReservoir() || parameter == RigWbsParameter::PP_Reservoir() || if ( parameter == RigWbsParameter::PP_NonReservoir() || parameter == RigWbsParameter::PP_Reservoir() ||
parameter == RigWbsParameter::UCS() ) parameter == RigWbsParameter::UCS() )
{ {
return RiaWellLogUnitTools::barUnitString(); return RiaWellLogUnitTools<double>::barUnitString();
} }
else if ( parameter == RigWbsParameter::poissonRatio() || parameter == RigWbsParameter::DF() ) else if ( parameter == RigWbsParameter::poissonRatio() || parameter == RigWbsParameter::DF() )
{ {
return RiaWellLogUnitTools::noUnitString(); return RiaWellLogUnitTools<double>::noUnitString();
} }
else if ( parameter == RigWbsParameter::waterDensity() ) else if ( parameter == RigWbsParameter::waterDensity() )
{ {
return RiaWellLogUnitTools::gPerCm3UnitString(); return RiaWellLogUnitTools<double>::gPerCm3UnitString();
} }
return RiaWellLogUnitTools::sg_emwUnitString(); return RiaWellLogUnitTools<double>::sg_emwUnitString();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -526,7 +526,7 @@ void RigLasFileExporter::appendLasFileDescriptions( const std::vector<RimWellLog
} }
QString units = curve->curveData()->xUnits(); QString units = curve->curveData()->xUnits();
if ( convertCurveUnits || units == RiaWellLogUnitTools::barX100UnitString() ) if ( convertCurveUnits || units == RiaWellLogUnitTools<double>::barX100UnitString() )
{ {
units = curve->wellLogChannelUnits(); units = curve->wellLogChannelUnits();
} }

View File

@ -136,7 +136,7 @@ QString RigWbsParameter::units( Source source ) const
{ {
return m_sources.front().second.units; return m_sources.front().second.units;
} }
return RiaWellLogUnitTools::noUnitString(); return RiaWellLogUnitTools<double>::noUnitString();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -238,13 +238,13 @@ bool RigWbsParameter::operator<( const RigWbsParameter& rhs ) const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigWbsParameter RigWbsParameter::PP_Reservoir() RigWbsParameter RigWbsParameter::PP_Reservoir()
{ {
SourceVector sources = {{GRID, SourceAddress( "POR-Bar", "", RiaWellLogUnitTools::barUnitString() )}, SourceVector sources =
{LAS_FILE, SourceAddress( "PP_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )}, {{GRID, SourceAddress( "POR-Bar", "", RiaWellLogUnitTools<double>::barUnitString() )},
{LAS_FILE, SourceAddress( "PP_RES_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )}, {LAS_FILE, SourceAddress( "PP_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )},
{LAS_FILE, SourceAddress( "POR_RES_INP", "", RiaWellLogUnitTools::gPerCm3UnitString() )}, {LAS_FILE, SourceAddress( "PP_RES_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )},
{ELEMENT_PROPERTY_TABLE, SourceAddress( "POR_INP", "", RiaWellLogUnitTools::barUnitString() )}, {LAS_FILE, SourceAddress( "POR_RES_INP", "", RiaWellLogUnitTools<double>::gPerCm3UnitString() )},
{ELEMENT_PROPERTY_TABLE, {ELEMENT_PROPERTY_TABLE, SourceAddress( "POR_INP", "", RiaWellLogUnitTools<double>::pascalUnitString() )},
SourceAddress( "PP_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )}}; {ELEMENT_PROPERTY_TABLE, SourceAddress( "PP_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )}};
return RigWbsParameter( "PP Reservoir", true, sources ); return RigWbsParameter( "PP Reservoir", true, sources );
} }
@ -255,10 +255,13 @@ RigWbsParameter RigWbsParameter::PP_NonReservoir()
{ {
return RigWbsParameter( "PP Non-Reservoir", return RigWbsParameter( "PP Non-Reservoir",
true, true,
{{LAS_FILE, SourceAddress( "PP_NONRES_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )}, {{LAS_FILE,
{LAS_FILE, SourceAddress( "POR_NONRES_INP", "", RiaWellLogUnitTools::gPerCm3UnitString() )}, SourceAddress( "PP_NONRES_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )},
{USER_DEFINED, SourceAddress( "", "", RiaWellLogUnitTools::barUnitString() )}, {LAS_FILE,
{HYDROSTATIC, SourceAddress( "Hydrostatic", "", RiaWellLogUnitTools::barUnitString() )}} ); SourceAddress( "POR_NONRES_INP", "", RiaWellLogUnitTools<double>::gPerCm3UnitString() )},
{USER_DEFINED, SourceAddress( "", "", RiaWellLogUnitTools<double>::barUnitString() )},
{HYDROSTATIC,
SourceAddress( "Hydrostatic", "", RiaWellLogUnitTools<double>::barUnitString() )}} );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -280,9 +283,10 @@ RigWbsParameter RigWbsParameter::UCS()
{ {
return RigWbsParameter( "UCS", return RigWbsParameter( "UCS",
false, false,
{{LAS_FILE, SourceAddress( "UCS_INP", "", RiaWellLogUnitTools::MPaUnitString() )}, {{LAS_FILE, SourceAddress( "UCS_INP", "", RiaWellLogUnitTools<double>::MPaUnitString() )},
{ELEMENT_PROPERTY_TABLE, SourceAddress( "UCS_INP", RiaWellLogUnitTools::barUnitString() )}, {ELEMENT_PROPERTY_TABLE,
{USER_DEFINED, SourceAddress( "", "", RiaWellLogUnitTools::barUnitString() )}} ); SourceAddress( "UCS_INP", "", RiaWellLogUnitTools<double>::pascalUnitString() )},
{USER_DEFINED, SourceAddress( "", "", RiaWellLogUnitTools<double>::barUnitString() )}} );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -291,8 +295,8 @@ RigWbsParameter RigWbsParameter::UCS()
RigWbsParameter RigWbsParameter::OBG() RigWbsParameter RigWbsParameter::OBG()
{ {
std::vector<std::pair<Source, SourceAddress>> sources = std::vector<std::pair<Source, SourceAddress>> sources =
{{GRID, SourceAddress( "ST", "S33", RiaWellLogUnitTools::barUnitString() )}, {{GRID, SourceAddress( "ST", "S33", RiaWellLogUnitTools<double>::barUnitString() )},
{LAS_FILE, SourceAddress( "OBG_INP", "", RiaWellLogUnitTools::barUnitString() )}}; {LAS_FILE, SourceAddress( "OBG_INP", "", RiaWellLogUnitTools<double>::barUnitString() )}};
return RigWbsParameter( "OBG Input", true, sources ); return RigWbsParameter( "OBG Input", true, sources );
} }
@ -302,8 +306,8 @@ RigWbsParameter RigWbsParameter::OBG()
RigWbsParameter RigWbsParameter::OBG0() RigWbsParameter RigWbsParameter::OBG0()
{ {
std::vector<std::pair<Source, SourceAddress>> sources = std::vector<std::pair<Source, SourceAddress>> sources =
{{GRID, SourceAddress( "ST", "S33", RiaWellLogUnitTools::barUnitString() )}, {{GRID, SourceAddress( "ST", "S33", RiaWellLogUnitTools<double>::barUnitString() )},
{LAS_FILE, SourceAddress( "OBG0_INP", "", RiaWellLogUnitTools::barUnitString() )}}; {LAS_FILE, SourceAddress( "OBG0_INP", "", RiaWellLogUnitTools<double>::barUnitString() )}};
return RigWbsParameter( "OBG0", true, sources ); return RigWbsParameter( "OBG0", true, sources );
} }
@ -313,7 +317,7 @@ RigWbsParameter RigWbsParameter::OBG0()
RigWbsParameter RigWbsParameter::SH() RigWbsParameter RigWbsParameter::SH()
{ {
std::vector<std::pair<Source, SourceAddress>> sources = { std::vector<std::pair<Source, SourceAddress>> sources = {
{GRID, SourceAddress( "ST", "S3", RiaWellLogUnitTools::barUnitString() )}}; {GRID, SourceAddress( "ST", "S3", RiaWellLogUnitTools<double>::barUnitString() )}};
return RigWbsParameter( "SH Input", true, sources ); return RigWbsParameter( "SH Input", true, sources );
} }
@ -336,7 +340,7 @@ RigWbsParameter RigWbsParameter::K0_FG()
{ {
return RigWbsParameter( "K0_FG", return RigWbsParameter( "K0_FG",
false, false,
{{LAS_FILE, SourceAddress( "K0_FG_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )}, {{LAS_FILE, SourceAddress( "K0_FG_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )},
{ELEMENT_PROPERTY_TABLE, SourceAddress( "K0_FG_INP" )}, {ELEMENT_PROPERTY_TABLE, SourceAddress( "K0_FG_INP" )},
{USER_DEFINED, SourceAddress()}} ); {USER_DEFINED, SourceAddress()}} );
} }
@ -348,7 +352,7 @@ RigWbsParameter RigWbsParameter::K0_SH()
{ {
return RigWbsParameter( "K0_SH", return RigWbsParameter( "K0_SH",
false, false,
{{LAS_FILE, SourceAddress( "K0_SH_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )}, {{LAS_FILE, SourceAddress( "K0_SH_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )},
{ELEMENT_PROPERTY_TABLE, SourceAddress( "K0_SH_INP" )}, {ELEMENT_PROPERTY_TABLE, SourceAddress( "K0_SH_INP" )},
{USER_DEFINED, SourceAddress()}} ); {USER_DEFINED, SourceAddress()}} );
} }
@ -362,7 +366,8 @@ RigWbsParameter RigWbsParameter::FG_Shale()
false, false,
{{DERIVED_FROM_K0FG, SourceAddress()}, {{DERIVED_FROM_K0FG, SourceAddress()},
{PROPORTIONAL_TO_SH, SourceAddress()}, {PROPORTIONAL_TO_SH, SourceAddress()},
{LAS_FILE, SourceAddress( "FG_SHALE_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )}} ); {LAS_FILE,
SourceAddress( "FG_SHALE_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )}} );
param.setOptionsExclusive( true ); param.setOptionsExclusive( true );
return param; return param;
} }
@ -375,7 +380,7 @@ RigWbsParameter RigWbsParameter::waterDensity()
RigWbsParameter param( "Density of Sea Water", RigWbsParameter param( "Density of Sea Water",
false, false,
{{USER_DEFINED, SourceAddress()}, {{USER_DEFINED, SourceAddress()},
{LAS_FILE, SourceAddress( "RHO_INP", "", RiaWellLogUnitTools::gPerCm3UnitString() )}} ); {LAS_FILE, SourceAddress( "RHO_INP", "", RiaWellLogUnitTools<double>::gPerCm3UnitString() )}} );
return param; return param;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -96,7 +96,9 @@ private:
QString primary; // i.e. grid field name, las entry, etc. QString primary; // i.e. grid field name, las entry, etc.
QString secondary; // i.e. grid component name QString secondary; // i.e. grid component name
QString units; // The unit string QString units; // The unit string
SourceAddress( QString primary = "", QString secondary = "", QString units = RiaWellLogUnitTools::noUnitString() ) SourceAddress( QString primary = "",
QString secondary = "",
QString units = RiaWellLogUnitTools<double>::noUnitString() )
: primary( primary ) : primary( primary )
, secondary( secondary ) , secondary( secondary )
, units( units ) , units( units )

View File

@ -35,7 +35,7 @@ RigWellLogCurveData::RigWellLogCurveData()
{ {
m_isExtractionCurve = false; m_isExtractionCurve = false;
m_depthUnit = RiaDefines::UNIT_METER; m_depthUnit = RiaDefines::UNIT_METER;
m_xUnitString = RiaWellLogUnitTools::noUnitString(); m_xUnitString = RiaWellLogUnitTools<double>::noUnitString();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -117,7 +117,7 @@ std::vector<double> RigWellLogCurveData::xValues() const
std::vector<double> RigWellLogCurveData::xValues( const QString& units ) const std::vector<double> RigWellLogCurveData::xValues( const QString& units ) const
{ {
std::vector<double> convertedValues; std::vector<double> convertedValues;
if ( units != m_xUnitString && RiaWellLogUnitTools::convertValues( depths( RiaDefines::TRUE_VERTICAL_DEPTH_RKB ), if ( units != m_xUnitString && RiaWellLogUnitTools<double>::convertValues( depths( RiaDefines::TRUE_VERTICAL_DEPTH_RKB ),
m_xValues, m_xValues,
&convertedValues, &convertedValues,
m_xUnitString, m_xUnitString,
@ -228,7 +228,7 @@ std::vector<double> RigWellLogCurveData::depthPlotValues( RiaDefines::DepthTypeE
else else
{ {
std::vector<double> convertedValues = std::vector<double> convertedValues =
RiaWellLogUnitTools().convertDepths( depthValues, m_depthUnit, destinationDepthUnit ); RiaWellLogUnitTools<double>::convertDepths( depthValues, m_depthUnit, destinationDepthUnit );
RiaCurveDataTools::getValuesByIntervals( convertedValues, m_intervalsOfContinousValidValues, &filteredValues ); RiaCurveDataTools::getValuesByIntervals( convertedValues, m_intervalsOfContinousValidValues, &filteredValues );
} }
} }