Merge dev into feature-analysis-plots-initial

This commit is contained in:
Jacob Støren
2020-03-31 13:13:47 +02:00
288 changed files with 44732 additions and 2326 deletions

View File

@@ -35,8 +35,7 @@
#include "HoloLensCommands/RicHoloLensSessionManager.h"
#include "RicImportGeneralDataFeature.h"
#include "RicfCommandFileExecutor.h"
#include "RicfFieldHandle.h"
#include "RicfObjectCapability.h"
#include "RicfCommandObject.h"
#include "Rim2dIntersectionViewCollection.h"
#include "RimAnalysisPlot.h"
@@ -99,6 +98,8 @@
#include "cafPdmCodeGenerator.h"
#include "cafPdmDataValueField.h"
#include "cafPdmDefaultObjectFactory.h"
#include "cafPdmMarkdownBuilder.h"
#include "cafPdmMarkdownGenerator.h"
#include "cafPdmScriptIOMessages.h"
#include "cafPdmSettings.h"
#include "cafPdmUiModelChangeDetector.h"
@@ -1262,7 +1263,7 @@ QVariant RiaApplication::cacheDataObject( const QString& key ) const
//--------------------------------------------------------------------------------------------------
void RiaApplication::executeCommandFile( const QString& commandFile )
{
QFile file( commandFile );
QFile file( commandFile );
caf::PdmScriptIOMessages messages;
if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
{
@@ -1723,22 +1724,118 @@ bool RiaApplication::generateCode( const QString& fileName, QString* errMsg )
{
CAF_ASSERT( errMsg );
QFile outputFile( fileName );
if ( !outputFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
{
*errMsg = QString( "Could not open file %1 for writing" ).arg( fileName );
return false;
}
QTextStream out( &outputFile );
std::string fileExt = QFileInfo( fileName ).suffix().toStdString();
{
// TODO: Manually instantiate the markdown generator until cmake issues are fixed
// This will make sure the markdown generator is registered in the factory in the cafPdmScripting library
caf::PdmMarkdownGenerator testObj;
}
std::unique_ptr<caf::PdmCodeGenerator> generator( caf::PdmCodeGeneratorFactory::instance()->create( fileExt ) );
if ( !generator )
{
*errMsg = QString( "No code generator matches the provided file extension" );
return false;
}
out << generator->generate( caf::PdmDefaultObjectFactory::instance() );
auto markdownGenerator = dynamic_cast<caf::PdmMarkdownGenerator*>( generator.get() );
if ( markdownGenerator )
{
QFileInfo fi( fileName );
QDir dir( fi.absoluteDir() );
QString baseName = fi.baseName();
{
QString outputFileName = dir.absoluteFilePath( baseName + "_class.md" );
QFile outputFile( outputFileName );
if ( !outputFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
{
*errMsg = QString( "Could not open file %1 for writing" ).arg( outputFileName );
return false;
}
QTextStream out( &outputFile );
{
out << "+++ \n";
out << "title = \"Python Classes (BETA)\" \n";
out << "published = true \n";
out << "weight = 95 \n";
out << "+++ \n";
out << "# Introduction\n\n";
out << "As the Python interface is growing release by release, we are investigating how to automate "
"the building of documentation. This document shows the inheritance relationship between "
"objects derived from **PdmObject**. The **PdmObject** is the base object for all "
"objects automatically created based on the data model in ResInsight.";
}
out << generator->generate( caf::PdmDefaultObjectFactory::instance() );
}
{
QString outputFileName = dir.absoluteFilePath( baseName + "_commands.md" );
QFile outputFile( outputFileName );
if ( !outputFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
{
*errMsg = QString( "Could not open file %1 for writing" ).arg( outputFileName );
return false;
}
QTextStream out( &outputFile );
{
out << "+++ \n";
out << "title = \"Command Reference (BETA)\" \n";
out << "published = true \n";
out << "weight = 96 \n";
out << "+++ \n";
out << "# Introduction\n\n";
out << "As the Python interface is growing release by release, we are investigating how to automate "
"the building of reference documentation. This document is not complete, but will improve as "
"the automation "
"moves forward.\n";
out << "## Currently missing features\n\n";
out << " - Description of enums\n";
out << " - Description of return values/classes\n";
out << " - Description of each object\n";
}
std::vector<std::shared_ptr<const caf::PdmObject>> commandObjects;
QStringList excludedClassNames{"TestCommand1", "TC2"}; // See RifCommandCore-Text.cpp
auto allObjects = caf::PdmMarkdownBuilder::createAllObjects( caf::PdmDefaultObjectFactory::instance() );
for ( auto classObject : allObjects )
{
if ( dynamic_cast<const RicfCommandObject*>( classObject.get() ) )
{
if ( !excludedClassNames.contains( classObject->classKeyword(), Qt::CaseInsensitive ) )
{
commandObjects.push_back( classObject );
}
}
}
out << caf::PdmMarkdownBuilder::generateDocCommandObjects( commandObjects );
}
}
else
{
QFile outputFile( fileName );
if ( !outputFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
{
*errMsg = QString( "Could not open file %1 for writing" ).arg( fileName );
return false;
}
QTextStream out( &outputFile );
out << generator->generate( caf::PdmDefaultObjectFactory::instance() );
}
return true;
}

View File

@@ -25,7 +25,6 @@
#include "RiaDefines.h"
#include "RiaFontCache.h"
#include "RiaGuiApplication.h"
#include "RiaQDateTimeTools.h"
#include "cafAppEnum.h"
#include "cafPdmChildField.h"

View File

@@ -42,7 +42,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaCellDividingTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaFieldHandleTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaBoundingBoxTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaWellLogUnitTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaWellLogUnitTools.inl
)
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}/RiaFieldHandleTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaBoundingBoxTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaWellLogUnitTools.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -23,6 +23,8 @@
#include <QString>
#include "cafAppEnum.h"
#include "cafPdmUiItem.h"
#include <cvfAssert.h>
#include <cmath>
@@ -506,4 +508,31 @@ QString RiaQDateTimeTools::timeFormatString( const QString& fullTimeFormat, Time
}
CVF_ASSERT( false && "Time format string is malformed" );
return "";
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RiaQDateTimeTools::createOptionItems( const std::vector<time_t>& timeSteps )
{
QList<caf::PdmOptionItemInfo> options;
std::vector<QDateTime> dateTimes;
for ( time_t timeT : timeSteps )
{
QDateTime dateTime = RiaQDateTimeTools::fromTime_t( timeT );
dateTimes.push_back( dateTime );
}
QString formatString = RiaQDateTimeTools::createTimeFormatStringFromDates( dateTimes );
for ( size_t i = 0; i < dateTimes.size(); i++ )
{
const auto& dt = dateTimes[i];
QString text = RiaQDateTimeTools::toStringUsingApplicationLocale( dt, formatString );
options.push_back( {text, static_cast<int>( i )} );
}
return options;
}

View File

@@ -35,6 +35,11 @@ class QDate;
class QTime;
class DateTimeSpan;
namespace caf
{
class PdmOptionItemInfo;
};
//==================================================================================================
//
//==================================================================================================
@@ -135,6 +140,8 @@ public:
static QString dateFormatString( const QString& fullDateFormat, DateFormatComponents dateComponents );
static QString timeFormatString( const QString& fullTimeFormat, TimeFormatComponents timeComponents );
static QList<caf::PdmOptionItemInfo> createOptionItems( const std::vector<time_t>& timeSteps );
private:
static quint64 secondsInDay();
static quint64 secondsInYear();

View File

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

View File

@@ -15,8 +15,6 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaWellLogUnitTools.h"
#include "RiaEclipseUnitTools.h"
#include "RigWellPath.h"
@@ -24,10 +22,30 @@
#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;
}
@@ -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";
}
@@ -43,7 +62,8 @@ QString RiaWellLogUnitTools::noUnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::sg_emwUnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::sg_emwUnitString()
{
return "sg_EMW";
}
@@ -51,7 +71,8 @@ QString RiaWellLogUnitTools::sg_emwUnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::barUnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::barUnitString()
{
return "Bar";
}
@@ -59,7 +80,8 @@ QString RiaWellLogUnitTools::barUnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::barX100UnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::barX100UnitString()
{
return "Bar x100";
}
@@ -67,7 +89,8 @@ QString RiaWellLogUnitTools::barX100UnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::MPaUnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::MPaUnitString()
{
return "MPa";
}
@@ -75,7 +98,8 @@ QString RiaWellLogUnitTools::MPaUnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::gPerCm3UnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::gPerCm3UnitString()
{
return "g/cm3";
}
@@ -83,7 +107,8 @@ QString RiaWellLogUnitTools::gPerCm3UnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::kgPerM3UnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::kgPerM3UnitString()
{
return "kg/m3";
}
@@ -91,7 +116,8 @@ QString RiaWellLogUnitTools::kgPerM3UnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::pascalUnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::pascalUnitString()
{
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 unitsOut )
{
@@ -117,9 +153,10 @@ std::vector<double> RiaWellLogUnitTools::convertDepths( const std::vector<double
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaWellLogUnitTools::convertValues( const std::vector<double>& tvdRKBs,
const std::vector<double>& valuesIn,
std::vector<double>* valuesOut,
template <typename FloatType>
bool RiaWellLogUnitTools<FloatType>::convertValues( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesIn,
std::vector<FloatType>* valuesOut,
const QString& unitsIn,
const QString& unitsOut )
{
@@ -162,13 +199,13 @@ bool RiaWellLogUnitTools::convertValues( const std::vector<double>& tvdRKBs,
}
else if ( stringsMatch( unitsIn, barX100UnitString() ) && stringsMatch( unitsOut, MPaUnitString() ) )
{
*valuesOut = multiply( valuesIn, 100.0 );
*valuesOut = multiply( valuesIn, (FloatType)100.0 );
*valuesOut = multiply( *valuesOut, MPaPerBar() );
return true;
}
else if ( stringsMatch( unitsIn, barX100UnitString() ) && stringsMatch( unitsOut, barUnitString() ) )
{
*valuesOut = multiply( valuesIn, 100 );
*valuesOut = multiply( valuesIn, (FloatType)100 );
return true;
}
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() ) )
{
*valuesOut = multiply( valuesIn, 1.0 / 100.0 );
*valuesOut = multiply( valuesIn, (FloatType) 0.01 );
return true;
}
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 );
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() );
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() );
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& unitsOut,
const RigWellPath* wellPath )
@@ -217,8 +255,8 @@ bool RiaWellLogUnitTools::convertValues( std::vector<std::pair<double, double>>*
CAF_ASSERT( measuredDepthsAndValues );
if ( unitsIn == unitsOut ) return true;
std::vector<double> tvdRKBs( measuredDepthsAndValues->size(), 0.0 );
std::vector<double> values( measuredDepthsAndValues->size(), 0.0 );
std::vector<FloatType> tvdRKBs( measuredDepthsAndValues->size(), 0.0 );
std::vector<FloatType> values( measuredDepthsAndValues->size(), 0.0 );
for ( size_t i = 0; i < measuredDepthsAndValues->size(); ++i )
{
auto depthValuePair = ( *measuredDepthsAndValues )[i];
@@ -227,7 +265,7 @@ bool RiaWellLogUnitTools::convertValues( std::vector<std::pair<double, double>>*
tvdRKBs[i] = -point.z() + wellPath->rkbDiff();
values[i] = depthValuePair.second;
}
std::vector<double> valuesOut;
std::vector<FloatType> valuesOut;
if ( convertValues( tvdRKBs, values, &valuesOut, unitsIn, unitsOut ) )
{
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 );
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] );
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,
const std::vector<double>& valuesInGpcm3 )
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertGpcm3ToBar( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInGpcm3 )
{
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 )
{
// 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):
double specificMudWeight = mudWeightsSI * GRAVITY_ACCEL;
FloatType specificMudWeight = mudWeightsSI * gravityAcceleration();
// Pore pressure in pascal
double valuePascal = specificMudWeight * tvdRKBs[i];
FloatType valuePascal = specificMudWeight * tvdRKBs[i];
// Pore pressure in bar
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,
const std::vector<double>& valuesInBar )
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertBarToGpcm3( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInBar )
{
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 )
{
// Pore pressure in pascal (N / m^2)
double valuePascal = pascalPerBar() * valuesInBar[i];
FloatType valuePascal = pascalPerBar() * valuesInBar[i];
// N / m^3:
double specificMudWeight = valuePascal / tvdRKBs[i];
FloatType specificMudWeight = valuePascal / tvdRKBs[i];
// Mud weight in SI (kg / m^3):
double mudWeightsSI = specificMudWeight / GRAVITY_ACCEL;
FloatType mudWeightsSI = specificMudWeight / gravityAcceleration();
// Mud weights g/cm^3:
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,
const std::vector<double>& normalizedValues )
template<typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertNormalizedByPPToBar( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& normalizedValues )
{
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 )
{
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,
const std::vector<double>& valuesInBar )
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertBarToNormalizedByPP( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInBar )
{
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 )
{
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 )
{
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;
}
@@ -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();
}