mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactor: add RimWellLogFile interface
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "RigGeoMechCaseData.h"
|
||||
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimWellLogFileUtil.h"
|
||||
#include "RimWellLogLasFile.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
@@ -378,7 +379,7 @@ void RimWbsParameters::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWbsParameters::hasLasFileWithChannel( const QString& channel ) const
|
||||
{
|
||||
return m_wellPath && !RimWellLogLasFile::findMdAndChannelValuesForWellPath( m_wellPath, channel ).empty();
|
||||
return m_wellPath && !RimWellLogFileUtil::findMdAndChannelValuesForWellPath( *m_wellPath, channel ).empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -19,6 +19,8 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogLasCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogLasFile.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFile.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileUtil.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogChannel.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogLasFileCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurve.h
|
||||
@@ -36,6 +38,8 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurve.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogLasFile.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFile.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileUtil.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileChannel.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogLasFileCurve.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurve.cpp
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimWellLogCurveCommonDataSource.h"
|
||||
#include "RimWellLogFileChannel.h"
|
||||
#include "RimWellLogFileUtil.h"
|
||||
#include "RimWellLogLasFile.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
@@ -872,7 +873,7 @@ void RimWellLogExtractionCurve::findAndLoadWbsParametersFromFiles( const RimWell
|
||||
|
||||
QString lasUnits;
|
||||
std::vector<std::pair<double, double>> lasFileValues =
|
||||
RimWellLogLasFile::findMdAndChannelValuesForWellPath( wellPath, lasAddress, &lasUnits );
|
||||
RimWellLogFileUtil::findMdAndChannelValuesForWellPath( *wellPath, lasAddress, &lasUnits );
|
||||
if ( !lasFileValues.empty() )
|
||||
{
|
||||
QString extractorUnits = RigGeoMechWellLogExtractor::parameterInputUnits( parameter );
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023- 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 "RimWellLogFile.h"
|
||||
|
||||
#include "RimFileWellPath.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellLogFileChannel.h"
|
||||
|
||||
#include "RiaFieldHandleTools.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
CAF_PDM_ABSTRACT_SOURCE_INIT( RimWellLogFile, "WellLogFileInterface" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogFile::RimWellLogFile()
|
||||
{
|
||||
CAF_PDM_InitObject( "Well File Info", ":/LasFile16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_fileName, "FileName", "Filename" );
|
||||
m_fileName.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellLogChannelNames, "WellLogFileChannels", "" );
|
||||
RiaFieldHandleTools::disableWriteAndSetFieldHidden( &m_wellLogChannelNames );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogFile::~RimWellLogFile()
|
||||
{
|
||||
m_wellLogChannelNames.deleteChildren();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFile::setFileName( const QString& fileName )
|
||||
{
|
||||
m_fileName = fileName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogFile::fileName() const
|
||||
{
|
||||
return m_fileName().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogFileChannel*> RimWellLogFile::wellLogChannels() const
|
||||
{
|
||||
std::vector<RimWellLogFileChannel*> channels;
|
||||
for ( const auto& channel : m_wellLogChannelNames )
|
||||
{
|
||||
channels.push_back( channel );
|
||||
}
|
||||
return channels;
|
||||
}
|
||||
52
ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.h
Normal file
52
ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023- 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 <QString>
|
||||
|
||||
class RimWellLogFileChannel;
|
||||
class RimWellPath;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellLogFile : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimWellLogFile();
|
||||
~RimWellLogFile() override;
|
||||
|
||||
virtual void setFileName( const QString& fileName );
|
||||
virtual QString fileName() const;
|
||||
virtual std::vector<RimWellLogFileChannel*> wellLogChannels() const;
|
||||
|
||||
virtual std::vector<std::pair<double, double>>
|
||||
findMdAndChannelValuesForWellPath( const RimWellPath& wellPath, const QString& channelName, QString* unitString = nullptr ) = 0;
|
||||
|
||||
protected:
|
||||
caf::PdmChildArrayField<RimWellLogFileChannel*> m_wellLogChannelNames;
|
||||
caf::PdmField<caf::FilePath> m_fileName;
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023- 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 "RimWellLogFileUtil.h"
|
||||
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::pair<double, double>> RimWellLogFileUtil::findMdAndChannelValuesForWellPath( const RimWellPath& wellPath,
|
||||
const QString& channelName,
|
||||
QString* unitString /*=nullptr*/ )
|
||||
{
|
||||
std::vector<RimWellLogFile*> wellLogFiles = wellPath.descendantsIncludingThisOfType<RimWellLogFile>();
|
||||
for ( RimWellLogFile* wellLogFile : wellLogFiles )
|
||||
{
|
||||
auto values = wellLogFile->findMdAndChannelValuesForWellPath( wellPath, channelName, unitString );
|
||||
if ( !values.empty() ) return values;
|
||||
}
|
||||
|
||||
return std::vector<std::pair<double, double>>();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023- 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 <vector>
|
||||
|
||||
class RimWellPath;
|
||||
|
||||
class QString;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellLogFileUtil
|
||||
{
|
||||
public:
|
||||
static std::vector<std::pair<double, double>>
|
||||
findMdAndChannelValuesForWellPath( const RimWellPath& wellPath, const QString& channelName, QString* unitString = nullptr );
|
||||
};
|
||||
@@ -73,16 +73,10 @@ RimWellLogLasFile::RimWellLogLasFile()
|
||||
CAF_PDM_InitFieldNoDefault( &m_date, "Date", "Date" );
|
||||
m_date.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_fileName, "FileName", "Filename" );
|
||||
m_fileName.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_name, "Name", "" );
|
||||
m_name.uiCapability()->setUiReadOnly( true );
|
||||
RiaFieldHandleTools::disableWriteAndSetFieldHidden( &m_name );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellLogChannelNames, "WellLogFileChannels", "" );
|
||||
RiaFieldHandleTools::disableWriteAndSetFieldHidden( &m_wellLogChannelNames );
|
||||
|
||||
CAF_PDM_InitField( &m_wellFlowCondition,
|
||||
"WellFlowCondition",
|
||||
caf::AppEnum<RimWellLogLasFile::WellFlowCondition>( RimWellLogLasFile::WELL_FLOW_COND_STANDARD ),
|
||||
@@ -129,14 +123,6 @@ RimWellLogLasFile* RimWellLogLasFile::readWellLogFile( const QString& logFilePat
|
||||
return wellLogFile;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogLasFile::setFileName( const QString& fileName )
|
||||
{
|
||||
m_fileName = fileName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -210,19 +196,6 @@ QDateTime RimWellLogLasFile::date() const
|
||||
return m_date;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogFileChannel*> RimWellLogLasFile::wellLogChannels() const
|
||||
{
|
||||
std::vector<RimWellLogFileChannel*> channels;
|
||||
for ( const auto& channel : m_wellLogChannelNames )
|
||||
{
|
||||
channels.push_back( channel );
|
||||
}
|
||||
return channels;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -234,12 +207,11 @@ bool RimWellLogLasFile::hasFlowData() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::pair<double, double>> RimWellLogLasFile::findMdAndChannelValuesForWellPath( const RimWellPath* wellPath,
|
||||
std::vector<std::pair<double, double>> RimWellLogLasFile::findMdAndChannelValuesForWellPath( const RimWellPath& wellPath,
|
||||
const QString& channelName,
|
||||
QString* unitString /*=nullptr*/ )
|
||||
{
|
||||
CVF_ASSERT( wellPath );
|
||||
std::vector<RimWellLogLasFile*> wellLogFiles = wellPath->descendantsIncludingThisOfType<RimWellLogLasFile>();
|
||||
std::vector<RimWellLogLasFile*> wellLogFiles = wellPath.descendantsIncludingThisOfType<RimWellLogLasFile>();
|
||||
for ( RimWellLogLasFile* wellLogFile : wellLogFiles )
|
||||
{
|
||||
RigWellLogLasFile* fileData = wellLogFile->wellLogFileData();
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimWellLogFile.h"
|
||||
|
||||
#include "RigWellLogLasFile.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
@@ -36,7 +38,7 @@ class QString;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellLogLasFile : public caf::PdmObject
|
||||
class RimWellLogLasFile : public RimWellLogFile
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@@ -48,8 +50,6 @@ public:
|
||||
|
||||
static RimWellLogLasFile* readWellLogFile( const QString& logFilePath, QString* errorMessage );
|
||||
|
||||
void setFileName( const QString& fileName );
|
||||
QString fileName() const { return m_fileName().path(); }
|
||||
QString name() const { return m_name; }
|
||||
|
||||
bool readFile( QString* errorMessage );
|
||||
@@ -57,8 +57,7 @@ public:
|
||||
QString wellName() const;
|
||||
QDateTime date() const;
|
||||
|
||||
RigWellLogLasFile* wellLogFileData() { return m_wellLogDataFile.p(); }
|
||||
std::vector<RimWellLogFileChannel*> wellLogChannels() const;
|
||||
RigWellLogLasFile* wellLogFileData() { return m_wellLogDataFile.p(); }
|
||||
|
||||
bool hasFlowData() const;
|
||||
|
||||
@@ -70,8 +69,8 @@ public:
|
||||
|
||||
RimWellLogLasFile::WellFlowCondition wellFlowRateCondition() const { return m_wellFlowCondition(); }
|
||||
|
||||
static std::vector<std::pair<double, double>>
|
||||
findMdAndChannelValuesForWellPath( const RimWellPath* wellPath, const QString& channelName, QString* unitString = nullptr );
|
||||
std::vector<std::pair<double, double>>
|
||||
findMdAndChannelValuesForWellPath( const RimWellPath& wellPath, const QString& channelName, QString* unitString = nullptr ) override;
|
||||
|
||||
private:
|
||||
void setupBeforeSave() override;
|
||||
@@ -83,12 +82,9 @@ private:
|
||||
|
||||
static bool isDateValid( const QDateTime dateTime );
|
||||
|
||||
caf::PdmChildArrayField<RimWellLogFileChannel*> m_wellLogChannelNames;
|
||||
|
||||
private:
|
||||
cvf::ref<RigWellLogLasFile> m_wellLogDataFile;
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<caf::FilePath> m_fileName;
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmField<QDateTime> m_date;
|
||||
bool m_lasFileHasValidDate;
|
||||
|
||||
Reference in New Issue
Block a user