Merge dev branch with automatic conflict resolution

All conflicts resolved by accepting dev branch changes.
This commit is contained in:
Magne Sjaastad committed 2025-12-12 07:04:59 +01:00
commit c74b6b96ce
858 files changed
+151612 -43286

No files matched your search

@@ -33,6 +33,9 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCalculatedCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileDataLoader.h
${CMAKE_CURRENT_LIST_DIR}/RimOsduWellLogDataLoader.h
${CMAKE_CURRENT_LIST_DIR}/RimImportedWellLog.h
${CMAKE_CURRENT_LIST_DIR}/RimImportedWellLogData.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogChannelData.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -72,6 +75,9 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCalculatedCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileDataLoader.cpp
${CMAKE_CURRENT_LIST_DIR}/RimOsduWellLogDataLoader.cpp
${CMAKE_CURRENT_LIST_DIR}/RimImportedWellLog.cpp
${CMAKE_CURRENT_LIST_DIR}/RimImportedWellLogData.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogChannelData.cpp
)
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
@@ -0,0 +1,155 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimImportedWellLog.h"
#include "RimImportedWellLogData.h"
#include "RimWellLogChannel.h"
#include "RimWellPath.h"
#include "Well/RigImportedWellLogData.h"
#include "RiaFieldHandleTools.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include <QString>
CAF_PDM_SOURCE_INIT( RimImportedWellLog, "ImportedWellLog" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimImportedWellLog::RimImportedWellLog()
{
CAF_PDM_InitScriptableObject( "Imported Well Log", ":/LasFile16x16.png", "", "ImportedWellLog" );
CAF_PDM_InitScriptableField( &m_name, "Name", QString(), "Name" );
m_name.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitFieldNoDefault( &m_wellLogData, "WellLogData", "Well Log Data" );
m_wellLogData.uiCapability()->setUiTreeChildrenHidden( true );
setDeletable( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimImportedWellLog::setName( const QString& name )
{
m_name = name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimImportedWellLog::name() const
{
return m_name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimImportedWellLog::wellName() const
{
if ( RimWellPath* wellPath = firstAncestorOrThisOfType<RimWellPath>() )
{
return wellPath->name();
}
return QString();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigWellLogData* RimImportedWellLog::wellLogData()
{
return m_cachedRigData.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimImportedWellLog::setWellLogData( RimImportedWellLogData* wellLogData )
{
m_wellLogData = wellLogData;
// Clear cached Rig data when setting new PDM data
m_cachedRigData = nullptr;
if ( wellLogData )
{
// Create temporary Rig data to update channels
m_cachedRigData = wellLogData->createRigData();
updateChannelsFromWellLogData( m_cachedRigData.p() );
}
else
{
m_wellLogChannels.deleteChildren();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::pair<double, double>>
RimImportedWellLog::findMdAndChannelValuesForWellPath( const RimWellPath& wellPath, const QString& channelName, QString* unitString )
{
if ( unitString ) *unitString = QString();
RigWellLogData* wld = wellLogData();
if ( !wld ) return {};
std::vector<double> depths = wld->depthValues();
std::vector<double> values = wld->values( channelName );
std::vector<std::pair<double, double>> depthValuePairs;
if ( depths.size() == values.size() )
{
for ( size_t i = 0; i < depths.size(); ++i )
{
depthValuePairs.emplace_back( depths[i], values[i] );
}
}
return depthValuePairs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimImportedWellLog::initAfterRead()
{
// Create cached Rig data from PDM data when loading from project file
if ( m_wellLogData() && !m_cachedRigData.notNull() )
{
m_cachedRigData = m_wellLogData()->createRigData();
updateChannelsFromWellLogData( m_cachedRigData.p() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimImportedWellLog::userDescriptionField()
{
return &m_name;
}
@@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimWellLog.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cvfObject.h"
#include <QString>
class RigImportedWellLogData;
class RimImportedWellLogData;
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
class RimImportedWellLog : public RimWellLog
{
CAF_PDM_HEADER_INIT;
public:
RimImportedWellLog();
void setName( const QString& name );
QString name() const override;
QString wellName() const override;
RigWellLogData* wellLogData() override;
void setWellLogData( RimImportedWellLogData* wellLogData );
std::vector<std::pair<double, double>>
findMdAndChannelValuesForWellPath( const RimWellPath& wellPath, const QString& channelName, QString* unitString = nullptr ) override;
private:
void initAfterRead() override;
caf::PdmFieldHandle* userDescriptionField() override;
private:
// PDM-based data storage for project file persistence
caf::PdmChildField<RimImportedWellLogData*> m_wellLogData;
caf::PdmField<QString> m_name;
cvf::ref<RigImportedWellLogData> m_cachedRigData;
};
@@ -0,0 +1,181 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimImportedWellLogData.h"
#include "RimWellLogChannelData.h"
#include "Well/RigImportedWellLogData.h"
CAF_PDM_SOURCE_INIT( RimImportedWellLogData, "ImportedWellLogData" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimImportedWellLogData::RimImportedWellLogData()
{
CAF_PDM_InitObject( "Imported Well Log Data", "", "", "Imported Well Log Data" );
CAF_PDM_InitField( &m_depthValues, "DepthValues", {}, "Depth Values" );
CAF_PDM_InitField( &m_tvdMslValues, "TvdMslValues", {}, "TVD MSL Values" );
CAF_PDM_InitField( &m_tvdRkbValues, "TvdRkbValues", {}, "TVD RKB Values" );
CAF_PDM_InitFieldNoDefault( &m_channelDataObjects, "ChannelDataObjects", "Channel Data Objects" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimImportedWellLogData::setDepthValues( const std::vector<double>& depths )
{
m_depthValues = depths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimImportedWellLogData::setTvdMslValues( const std::vector<double>& tvdMsl )
{
m_tvdMslValues = tvdMsl;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimImportedWellLogData::setTvdRkbValues( const std::vector<double>& tvdRkb )
{
m_tvdRkbValues = tvdRkb;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimImportedWellLogData::setChannelData( const QString& name, const std::vector<double>& values )
{
// Check if channel already exists
for ( RimWellLogChannelData* channelData : m_channelDataObjects )
{
if ( channelData->name() == name )
{
channelData->setValues( values );
return;
}
}
// Create new channel data object
RimWellLogChannelData* channelData = new RimWellLogChannelData();
channelData->setName( name );
channelData->setValues( values );
m_channelDataObjects.push_back( channelData );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimImportedWellLogData::depthValues() const
{
return m_depthValues();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimImportedWellLogData::tvdMslValues() const
{
return m_tvdMslValues();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimImportedWellLogData::tvdRkbValues() const
{
return m_tvdRkbValues();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimImportedWellLogData::channelNames() const
{
std::vector<QString> names;
for ( const RimWellLogChannelData* channelData : m_channelDataObjects )
{
names.push_back( channelData->name() );
}
return names;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimImportedWellLogData::channelValues( const QString& name ) const
{
for ( const RimWellLogChannelData* channelData : m_channelDataObjects )
{
if ( channelData->name() == name )
{
return channelData->values();
}
}
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimImportedWellLogData::hasTvdMslValues() const
{
return !m_tvdMslValues().empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimImportedWellLogData::hasTvdRkbValues() const
{
return !m_tvdRkbValues().empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<RigImportedWellLogData> RimImportedWellLogData::createRigData() const
{
cvf::ref<RigImportedWellLogData> rigData = new RigImportedWellLogData();
// Set depth values
rigData->setDepthValues( m_depthValues() );
// Set TVD values if present
if ( hasTvdMslValues() )
{
rigData->setTvdMslValues( m_tvdMslValues() );
}
if ( hasTvdRkbValues() )
{
rigData->setTvdRkbValues( m_tvdRkbValues() );
}
// Set channel data
for ( const RimWellLogChannelData* channelData : m_channelDataObjects )
{
rigData->setChannelData( channelData->name(), channelData->values() );
}
return rigData;
}
@@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cvfObject.h"
#include <QString>
#include <vector>
class RigImportedWellLogData;
class RimWellLogChannelData;
//==================================================================================================
/// PDM class for storing imported well log data that can be persisted to project files
//==================================================================================================
class RimImportedWellLogData : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimImportedWellLogData();
// Setters for data
void setDepthValues( const std::vector<double>& depths );
void setTvdMslValues( const std::vector<double>& tvdMsl );
void setTvdRkbValues( const std::vector<double>& tvdRkb );
void setChannelData( const QString& name, const std::vector<double>& values );
// Getters for data
std::vector<double> depthValues() const;
std::vector<double> tvdMslValues() const;
std::vector<double> tvdRkbValues() const;
std::vector<QString> channelNames() const;
std::vector<double> channelValues( const QString& name ) const;
bool hasTvdMslValues() const;
bool hasTvdRkbValues() const;
// Method to produce RigImportedWellLogData from PDM data
cvf::ref<RigImportedWellLogData> createRigData() const;
private:
caf::PdmField<std::vector<double>> m_depthValues;
caf::PdmField<std::vector<double>> m_tvdMslValues;
caf::PdmField<std::vector<double>> m_tvdRkbValues;
caf::PdmChildArrayField<RimWellLogChannelData*> m_channelDataObjects;
};
@@ -22,6 +22,8 @@
#include "RimTools.h"
#include "RimWellLogChannel.h"
#include "Well/RigWellLogData.h"
#include "RiaFieldHandleTools.h"
#include "RiaQDateTimeTools.h"
@@ -78,6 +80,24 @@ void RimWellLog::fieldChangedByUi( const caf::PdmFieldHandle* changedField, cons
m_date = RiaQDateTimeTools::createUtcDateTime( m_date().date(), m_date().time() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLog::updateChannelsFromWellLogData( RigWellLogData* wellLogData )
{
m_wellLogChannels.deleteChildren();
if ( !wellLogData ) return;
QStringList wellLogNames = wellLogData->wellLogChannelNames();
for ( int logIdx = 0; logIdx < wellLogNames.size(); logIdx++ )
{
RimWellLogChannel* wellLog = new RimWellLogChannel();
wellLog->setName( wellLogNames[logIdx] );
m_wellLogChannels.push_back( wellLog );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -58,6 +58,8 @@ protected:
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void updateChannelsFromWellLogData( RigWellLogData* wellLogData );
caf::PdmChildArrayField<RimWellLogChannel*> m_wellLogChannels;
caf::PdmField<QDateTime> m_date;
};
@@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellLogChannelData.h"
CAF_PDM_SOURCE_INIT( RimWellLogChannelData, "WellLogChannelData" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogChannelData::RimWellLogChannelData()
{
CAF_PDM_InitObject( "Well Log Channel Data", "", "", "Well Log Channel Data" );
CAF_PDM_InitField( &m_name, "Name", QString(), "Name" );
CAF_PDM_InitField( &m_values, "Values", {}, "Values" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogChannelData::setName( const QString& name )
{
m_name = name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogChannelData::name() const
{
return m_name();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogChannelData::setValues( const std::vector<double>& values )
{
m_values = values;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimWellLogChannelData::values() const
{
return m_values();
}
@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include <QString>
#include <vector>
//==================================================================================================
/// PDM class for storing individual channel data (name and values) for well logs
//==================================================================================================
class RimWellLogChannelData : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogChannelData();
void setName( const QString& name );
QString name() const;
void setValues( const std::vector<double>& values );
std::vector<double> values() const;
private:
caf::PdmField<QString> m_name;
caf::PdmField<std::vector<double>> m_values;
};
@@ -78,15 +78,7 @@ bool RimWellLogCsvFile::readFile( QString* errorMessage )
return false;
}
m_wellLogChannels.deleteChildren();
QStringList wellLogNames = m_wellLogDataFile->wellLogChannelNames();
for ( int logIdx = 0; logIdx < wellLogNames.size(); logIdx++ )
{
RimWellLogChannel* wellLog = new RimWellLogChannel();
wellLog->setName( wellLogNames[logIdx] );
m_wellLogChannels.push_back( wellLog );
}
updateChannelsFromWellLogData( m_wellLogDataFile.p() );
return true;
}
@@ -1160,7 +1160,7 @@ QString RimWellLogExtractionCurve::createCurveAutoName()
// Add part to curve name for geo mech cases with more than 1 part
if ( geomCase && geomCase->geoMechData() && geomCase->geoMechData()->femParts() && geomCase->geoMechData()->femParts()->partCount() > 1 )
{
generatedCurveName.push_back( QString( "Part %1" ).arg( m_geomPartId ) );
generatedCurveName.push_back( QString( "Part %1" ).arg( m_geomPartId() ) );
}
}
@@ -142,15 +142,7 @@ bool RimWellLogLasFile::readFile( QString* errorMessage )
m_date = DEFAULT_DATE_TIME;
}
m_wellLogChannels.deleteChildren();
QStringList wellLogNames = m_wellLogDataFile->wellLogChannelNames();
for ( int logIdx = 0; logIdx < wellLogNames.size(); logIdx++ )
{
RimWellLogChannel* wellLog = new RimWellLogChannel();
wellLog->setName( wellLogNames[logIdx] );
m_wellLogChannels.push_back( wellLog );
}
updateChannelsFromWellLogData( m_wellLogDataFile.p() );
auto fileWellPath = firstAncestorOrThisOfType<RimFileWellPath>();
if ( fileWellPath )
@@ -62,7 +62,7 @@ protected:
QString createCurveAutoName() override;
void onLoadDataAndUpdate( bool updateParentPlot ) override;
// Pdm overrrides
// Pdm overrides
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
@@ -104,7 +104,7 @@ protected:
void onLoadDataAndUpdate( bool updateParentPlot ) override;
RiaDefines::PhaseType phaseType() const override;
// Pdm overrrides
// Pdm overrides
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
@@ -1043,7 +1043,7 @@ QString RimWellLogTrack::asciiDataForPlotExport() const
{
if ( dIdx == 0 )
continue; // Skip the first line. (shallow depth, which is last)
// as it is a fictious value added to make
// as it is a fictitious value added to make
// the plot easier to read
i = curveDepths.size() - 1 - dIdx; // Reverse the order, since the connections are coming bottom to top