Move well related pdm files into subfolders to clean up a bit

This commit is contained in:
jonjenssen
2021-07-13 16:58:02 +02:00
committed by jonjenssen
parent 6317489af8
commit ca0433ca3a
89 changed files with 138 additions and 84 deletions

View File

@@ -0,0 +1,64 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogCurve.h
${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogFileCurve.h
${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogExtractionCurve.h
${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogRftCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotNameConfig.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurveNameConfig.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileCurveNameConfig.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurveNameConfig.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurveCommonDataSource.h
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogs.h
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogsCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogCurveSet.h
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogStatistics.h
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogStatisticsCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFile.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileChannel.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogWbsCurve.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFile.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileChannel.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogWbsCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotNameConfig.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurveNameConfig.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileCurveNameConfig.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurveNameConfig.cpp
${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogFileCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogExtractionCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogRftCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurveCommonDataSource.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogs.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogsCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogCurveSet.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogStatistics.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogStatisticsCurve.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "ProjectDataModel\\WellLog" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@@ -0,0 +1,314 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "Rim3dWellLogCurve.h"
#include "RiaCurveDataTools.h"
#include "Riv3dWellLogCurveGeometryGenerator.h"
#include "Rim3dWellLogCurveCollection.h"
#include "RimProject.h"
#include "cafPdmUiDoubleSliderEditor.h"
#include "cvfVector3.h"
#include <algorithm>
//==================================================================================================
///
///
//==================================================================================================
CAF_PDM_ABSTRACT_SOURCE_INIT( Rim3dWellLogCurve, "Rim3dWellLogCurve" );
namespace caf
{
template <>
void AppEnum<Rim3dWellLogCurve::DrawPlane>::setUp()
{
addItem( Rim3dWellLogCurve::VERTICAL_ABOVE, "VERTICAL_ABOVE", "Above" );
addItem( Rim3dWellLogCurve::VERTICAL_CENTER, "VERTICAL_CENTER", "Centered - Vertical" );
addItem( Rim3dWellLogCurve::VERTICAL_BELOW, "VERTICAL_BELOW", "Below" );
addItem( Rim3dWellLogCurve::HORIZONTAL_LEFT, "HORIZONTAL_LEFT", "Left" );
addItem( Rim3dWellLogCurve::HORIZONTAL_CENTER, "HORIZONTAL_CENTER", "Centered - Horizontal" );
addItem( Rim3dWellLogCurve::HORIZONTAL_RIGHT, "HORIZONTAL_RIGHT", "Right" );
setDefault( Rim3dWellLogCurve::VERTICAL_ABOVE );
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogCurve::Rim3dWellLogCurve()
: m_minCurveDataValue( -std::numeric_limits<float>::infinity() )
, m_maxCurveDataValue( std::numeric_limits<float>::infinity() )
{
CAF_PDM_InitObject( "3d Well Log Curve", ":/WellLogCurve16x16.png", "", "" );
CAF_PDM_InitField( &m_showCurve, "Show3dWellLogCurve", true, "Show 3d Well Log Curve", "", "", "" );
m_showCurve.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_minCurveUIValue,
"MinCurveValue",
-std::numeric_limits<float>::infinity(),
"Minimum Curve Value",
"",
"Clip curve values below this.",
"" );
CAF_PDM_InitField( &m_maxCurveUIValue,
"MaxCurveValue",
std::numeric_limits<float>::infinity(),
"Maximum Curve Value",
"",
"Clip curve values above this.",
"" );
CAF_PDM_InitField( &m_drawPlane, "DrawPlane", DrawPlaneEnum( VERTICAL_ABOVE ), "Draw Plane", "", "", "" );
CAF_PDM_InitField( &m_color, "CurveColor", cvf::Color3f( 0.0f, 0.0f, 0.0f ), "Curve Color", "", "", "" );
this->uiCapability()->setUiTreeChildrenHidden( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogCurve::~Rim3dWellLogCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurve::updateCurveIn3dView()
{
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
proj->scheduleCreateDisplayModelAndRedrawAllViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogCurve::DrawPlane Rim3dWellLogCurve::drawPlane() const
{
return m_drawPlane();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double Rim3dWellLogCurve::drawPlaneAngle( Rim3dWellLogCurve::DrawPlane drawPlane )
{
switch ( drawPlane )
{
case HORIZONTAL_LEFT:
case HORIZONTAL_CENTER:
return cvf::PI_D / 2.0;
case HORIZONTAL_RIGHT:
return -cvf::PI_D / 2.0;
case VERTICAL_ABOVE:
case VERTICAL_CENTER:
return 0.0;
case VERTICAL_BELOW:
return cvf::PI_D;
default:
return 0;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f Rim3dWellLogCurve::color() const
{
return m_color;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dWellLogCurve::isShowingCurve() const
{
return m_showCurve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurve::curveValuesAndMdsAtTimeStep( std::vector<double>* values,
std::vector<double>* measuredDepthValues,
int timeStep ) const
{
return this->curveValuesAndMds( values, measuredDepthValues );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<double, double> Rim3dWellLogCurve::findCurveValueRange()
{
double foundMinValue = std::numeric_limits<float>::infinity();
double foundMaxValue = -std::numeric_limits<float>::infinity();
std::vector<double> values;
std::vector<double> measuredDepths;
this->curveValuesAndMds( &values, &measuredDepths );
for ( double value : values )
{
if ( RiaCurveDataTools::isValidValue( value, false ) )
{
foundMinValue = std::min( foundMinValue, value );
foundMaxValue = std::max( foundMaxValue, value );
}
}
return std::make_pair( foundMinValue, foundMaxValue );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurve::setColor( const cvf::Color3f& color )
{
m_color = color;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
float Rim3dWellLogCurve::minCurveUIValue() const
{
return m_minCurveUIValue();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
float Rim3dWellLogCurve::maxCurveUIValue() const
{
return m_maxCurveUIValue();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* Rim3dWellLogCurve::objectToggleField()
{
return &m_showCurve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
if ( changedField == &m_showCurve )
{
proj->reloadCompletionTypeResultsInAllViews();
}
else
{
proj->scheduleCreateDisplayModelAndRedrawAllViews();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurve::configurationUiOrdering( caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* configurationGroup = uiOrdering.addNewGroup( "Curve Appearance" );
configurationGroup->add( &m_drawPlane );
configurationGroup->add( &m_color );
configurationGroup->add( &m_maxCurveUIValue );
configurationGroup->add( &m_minCurveUIValue );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurve::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
if ( m_minCurveDataValue == -std::numeric_limits<float>::infinity() &&
m_maxCurveDataValue == std::numeric_limits<float>::infinity() )
{
this->resetMinMaxValues();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurve::initAfterRead()
{
this->createAutoName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dWellLogCurve::findClosestPointOnCurve( const cvf::Vec3d& globalIntersection,
cvf::Vec3d* closestPoint,
double* measuredDepthAtPoint,
double* valueAtPoint ) const
{
if ( m_geometryGenerator.notNull() )
{
return m_geometryGenerator->findClosestPointOnCurve( globalIntersection,
closestPoint,
measuredDepthAtPoint,
valueAtPoint );
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurve::setGeometryGenerator( Riv3dWellLogCurveGeometryGenerator* generator )
{
m_geometryGenerator = generator;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<Riv3dWellLogCurveGeometryGenerator> Rim3dWellLogCurve::geometryGenerator()
{
return m_geometryGenerator;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurve::resetMinMaxValues()
{
std::tie( m_minCurveDataValue, m_maxCurveDataValue ) = findCurveValueRange();
m_minCurveUIValue = m_minCurveDataValue;
m_maxCurveUIValue = m_maxCurveDataValue;
m_minCurveUIValue.uiCapability()->setUiName( QString( "Minimum Curve Value (%1)" ).arg( m_minCurveDataValue ) );
m_maxCurveUIValue.uiCapability()->setUiName( QString( "Maximum Curve Value (%1)" ).arg( m_maxCurveDataValue ) );
}

View File

@@ -0,0 +1,111 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmChildField.h"
#include "cafPdmFieldCvfColor.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include "RimNameConfig.h"
class Riv3dWellLogCurveGeometryGenerator;
class Rim3dView;
//==================================================================================================
///
///
//==================================================================================================
class Rim3dWellLogCurve : public caf::PdmObject, public RimNameConfigHolderInterface
{
CAF_PDM_HEADER_INIT;
public:
enum DrawPlane
{
VERTICAL_ABOVE,
VERTICAL_CENTER,
VERTICAL_BELOW,
HORIZONTAL_LEFT,
HORIZONTAL_CENTER,
HORIZONTAL_RIGHT
};
typedef caf::AppEnum<DrawPlane> DrawPlaneEnum;
public:
Rim3dWellLogCurve();
~Rim3dWellLogCurve() override;
void updateCurveIn3dView();
virtual QString name() const = 0;
virtual QString resultPropertyString() const = 0;
DrawPlane drawPlane() const;
static double drawPlaneAngle( DrawPlane drawPlane );
cvf::Color3f color() const;
bool isShowingCurve() const;
virtual bool isShowingTimeDependentResult() const { return isShowingCurve(); }
virtual bool showInView( const Rim3dView* gridView ) const { return isShowingCurve(); }
virtual bool followAnimationTimeStep() const { return false; }
virtual void curveValuesAndMds( std::vector<double>* values, std::vector<double>* measuredDepthValues ) const = 0;
virtual void curveValuesAndMdsAtTimeStep( std::vector<double>* values,
std::vector<double>* measuredDepthValues,
int timeStep ) const;
virtual std::pair<double, double> findCurveValueRange();
void setColor( const cvf::Color3f& color );
float minCurveUIValue() const;
float maxCurveUIValue() const;
void resetMinMaxValues();
bool findClosestPointOnCurve( const cvf::Vec3d& globalIntersection,
cvf::Vec3d* closestPoint,
double* measuredDepthAtPoint,
double* valueAtPoint ) const;
void setGeometryGenerator( Riv3dWellLogCurveGeometryGenerator* generator );
cvf::ref<Riv3dWellLogCurveGeometryGenerator> geometryGenerator();
protected:
caf::PdmFieldHandle* objectToggleField() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void configurationUiOrdering( caf::PdmUiOrdering& uiOrdering );
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void initAfterRead() override;
protected:
caf::PdmField<DrawPlaneEnum> m_drawPlane;
caf::PdmField<cvf::Color3f> m_color;
caf::PdmField<float> m_minCurveUIValue;
caf::PdmField<float> m_maxCurveUIValue;
float m_minCurveDataValue;
float m_maxCurveDataValue;
cvf::ref<Riv3dWellLogCurveGeometryGenerator> m_geometryGenerator;
private:
caf::PdmField<bool> m_showCurve;
};

View File

@@ -0,0 +1,561 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "Rim3dWellLogExtractionCurve.h"
#include "RigWellLogFile.h"
#include "RiaCurveDataTools.h"
#include "RiaExtractionTools.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseWellLogExtractor.h"
#include "RigFemPartResultsCollection.h"
#include "RigGeoMechCaseData.h"
#include "RigGeoMechWellLogExtractor.h"
#include "RigResultAccessorFactory.h"
#include "RigWellPath.h"
#include "Rim3dView.h"
#include "RimCase.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseResultDefinition.h"
#include "RimEclipseView.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechResultDefinition.h"
#include "RimGeoMechView.h"
#include "RimTools.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogExtractionCurveNameConfig.h"
#include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h"
#include "RimWellPath.h"
#include "cafUtils.h"
#include <QFileInfo>
#include <set>
//==================================================================================================
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT( Rim3dWellLogExtractionCurve, "Rim3dWellLogExtractionCurve" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogExtractionCurve::Rim3dWellLogExtractionCurve()
{
CAF_PDM_InitObject( "3d Well Log Extraction Curve", ":/WellLogCurve16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case", "", "", "" );
m_case.uiCapability()->setUiTreeChildrenHidden( true );
m_case = nullptr;
CAF_PDM_InitField( &m_timeStep, "CurveTimeStep", -1, "Time Step", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_eclipseResultDefinition, "CurveEclipseResult", "", "", "", "" );
m_eclipseResultDefinition.uiCapability()->setUiHidden( true );
m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
m_eclipseResultDefinition = new RimEclipseResultDefinition;
m_eclipseResultDefinition->findField( "MResultType" )->uiCapability()->setUiName( "Result Type" );
CAF_PDM_InitFieldNoDefault( &m_geomResultDefinition, "CurveGeomechResult", "", "", "", "" );
m_geomResultDefinition.uiCapability()->setUiHidden( true );
m_geomResultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
m_geomResultDefinition = new RimGeoMechResultDefinition;
m_geomResultDefinition->setAddWellPathDerivedResults( true );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimWellLogExtractionCurveNameConfig();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogExtractionCurve::~Rim3dWellLogExtractionCurve()
{
delete m_geomResultDefinition;
delete m_eclipseResultDefinition;
delete m_nameConfig;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view )
{
if ( !view ) return;
m_case = view->ownerCase();
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
m_eclipseResultDefinition->setEclipseCase( eclipseCase );
m_geomResultDefinition->setGeoMechCase( geomCase );
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( view );
if ( eclipseView )
{
m_eclipseResultDefinition->simpleCopy( eclipseView->cellResult() );
}
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view );
if ( geoMechView )
{
m_geomResultDefinition->setResultAddress( geoMechView->cellResultResultDefinition()->resultAddress() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogExtractionCurve::resultPropertyString() const
{
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
QString name;
if ( eclipseCase )
{
name = caf::Utils::makeValidFileBasename( m_eclipseResultDefinition->resultVariableUiShortName() );
}
else if ( geoMechCase )
{
QString resCompName = m_geomResultDefinition->resultComponentUiName();
if ( resCompName.isEmpty() )
{
name = m_geomResultDefinition->resultFieldUiName();
}
else
{
name = m_geomResultDefinition->resultFieldUiName() + "." + resCompName;
}
}
return name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dWellLogExtractionCurve::followAnimationTimeStep() const
{
return m_timeStep() == -1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::curveValuesAndMds( std::vector<double>* values,
std::vector<double>* measuredDepthValues ) const
{
CVF_ASSERT( m_timeStep() >= 0 );
return this->curveValuesAndMdsAtTimeStep( values, measuredDepthValues, m_timeStep() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::curveValuesAndMdsAtTimeStep( std::vector<double>* values,
std::vector<double>* measuredDepthValues,
int timeStep ) const
{
CAF_ASSERT( values != nullptr );
CAF_ASSERT( measuredDepthValues != nullptr );
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
if ( eclipseCase )
{
cvf::ref<RigEclipseWellLogExtractor> eclExtractor =
RiaExtractionTools::findOrCreateWellLogExtractor( wellPath, eclipseCase );
if ( eclExtractor.notNull() )
{
*measuredDepthValues = eclExtractor->cellIntersectionMDs();
m_eclipseResultDefinition->loadResult();
cvf::ref<RigResultAccessor> resAcc =
RigResultAccessorFactory::createFromResultDefinition( eclipseCase->eclipseCaseData(),
0,
timeStep,
m_eclipseResultDefinition );
if ( resAcc.notNull() )
{
eclExtractor->curveData( resAcc.p(), values );
}
}
}
else
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case() );
if ( geomCase )
{
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor =
RiaExtractionTools::findOrCreateWellLogExtractor( wellPath, geomCase );
if ( geomExtractor.notNull() )
{
*measuredDepthValues = geomExtractor->cellIntersectionMDs();
RimWellLogExtractionCurve::findAndLoadWbsParametersFromLasFiles( wellPath, geomExtractor.p() );
m_geomResultDefinition->loadResult();
geomExtractor->curveData( m_geomResultDefinition->resultAddress(), timeStep, values );
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<double, double> Rim3dWellLogExtractionCurve::findCurveValueRange()
{
double foundMinValue = std::numeric_limits<float>::infinity();
double foundMaxValue = -std::numeric_limits<float>::infinity();
if ( m_case() )
{
std::set<int> timeStepsToCheck;
if ( followAnimationTimeStep() )
{
// Check all time steps to avoid range changing during animation.
for ( int i = 0; i < m_case->timeStepStrings().size(); ++i )
{
timeStepsToCheck.insert( i );
}
}
else
{
timeStepsToCheck.insert( m_timeStep() );
}
if ( timeStepsToCheck.empty() )
{
timeStepsToCheck.insert( 0 );
}
for ( int timeStep : timeStepsToCheck )
{
std::vector<double> values;
std::vector<double> measuredDepths;
this->curveValuesAndMdsAtTimeStep( &values, &measuredDepths, timeStep );
for ( double value : values )
{
if ( RiaCurveDataTools::isValidValue( value, false ) )
{
foundMinValue = std::min( foundMinValue, value );
foundMaxValue = std::max( foundMaxValue, value );
}
}
}
}
return std::make_pair( foundMinValue, foundMaxValue );
}
QString Rim3dWellLogExtractionCurve::name() const
{
return m_nameConfig()->name();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogExtractionCurve::createAutoName() const
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
QStringList autoName;
if ( !m_nameConfig->customName().isEmpty() )
{
autoName.push_back( m_nameConfig->customName() );
}
QStringList generatedAutoTags;
if ( m_nameConfig->addWellName() )
{
RimWellPath* wellPath;
this->firstAncestorOrThisOfTypeAsserted( wellPath );
if ( !wellPath->name().isEmpty() )
{
generatedAutoTags += wellPath->name();
}
}
if ( m_nameConfig->addCaseName() && m_case() )
{
generatedAutoTags.push_back( m_case->caseUserDescription() );
}
if ( m_nameConfig->addProperty() && !resultPropertyString().isEmpty() )
{
generatedAutoTags.push_back( resultPropertyString() );
}
if ( m_nameConfig->addTimeStep() || m_nameConfig->addDate() )
{
bool addTimeStep = m_nameConfig->addTimeStep() && m_timeStep() != -1;
size_t maxTimeStep = 0;
if ( eclipseCase )
{
addTimeStep = addTimeStep &&
m_eclipseResultDefinition->resultType() != RiaDefines::ResultCatType::STATIC_NATIVE;
RigEclipseCaseData* data = eclipseCase->eclipseCaseData();
if ( data )
{
maxTimeStep = data->results( m_eclipseResultDefinition->porosityModel() )->maxTimeStepCount();
}
}
else if ( geomCase )
{
RigGeoMechCaseData* data = geomCase->geoMechData();
if ( data )
{
maxTimeStep = data->femPartResults()->frameCount();
}
}
if ( m_nameConfig->addDate() )
{
QString dateString = wellDate();
if ( !dateString.isEmpty() )
{
generatedAutoTags.push_back( dateString );
}
}
if ( addTimeStep )
{
generatedAutoTags.push_back( QString( "[%1/%2]" ).arg( m_timeStep() + 1 ).arg( maxTimeStep ) );
}
}
if ( !generatedAutoTags.empty() )
{
autoName.push_back( generatedAutoTags.join( ", " ) );
}
return autoName.join( ": " );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double Rim3dWellLogExtractionCurve::rkbDiff() const
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
if ( wellPath && wellPath->wellPathGeometry() )
{
return wellPath->wellPathGeometry()->rkbDiff();
}
return HUGE_VAL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dWellLogExtractionCurve::isShowingTimeDependentResult() const
{
if ( dynamic_cast<const RimEclipseCase*>( m_case() ) )
{
return m_eclipseResultDefinition->hasDynamicResult();
}
else if ( dynamic_cast<const RimGeoMechCase*>( m_case() ) )
{
return m_geomResultDefinition->hasResult();
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dWellLogExtractionCurve::showInView( const Rim3dView* gridView ) const
{
if ( isShowingCurve() )
{
if ( dynamic_cast<const RimEclipseCase*>( m_case() ) )
{
return dynamic_cast<const RimEclipseView*>( gridView ) != nullptr;
}
else if ( dynamic_cast<const RimGeoMechCase*>( m_case() ) )
{
return dynamic_cast<const RimGeoMechView*>( gridView ) != nullptr;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* Rim3dWellLogExtractionCurve::userDescriptionField()
{
return m_nameConfig()->nameField();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &m_case )
{
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>( m_case() );
if ( eclipseCase )
{
m_eclipseResultDefinition->setEclipseCase( eclipseCase );
}
else if ( geoMechCase )
{
m_geomResultDefinition->setGeoMechCase( geoMechCase );
}
this->resetMinMaxValues();
this->updateConnectedEditors();
}
else if ( changedField == &m_timeStep )
{
this->resetMinMaxValues();
this->updateConnectedEditors();
}
Rim3dWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo>
Rim3dWellLogExtractionCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
options = Rim3dWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
if ( fieldNeedingOptions == &m_case )
{
RimTools::caseOptionItems( &options );
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
else if ( fieldNeedingOptions == &m_timeStep )
{
options.push_back( caf::PdmOptionItemInfo( QString( "Follow Animation Time Step" ), -1 ) );
RimTools::timeStepsForCase( m_case, &options );
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
curveDataGroup->add( &m_case );
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
if ( eclipseCase )
{
m_eclipseResultDefinition->uiOrdering( uiConfigName, *curveDataGroup );
}
else if ( geomCase )
{
m_geomResultDefinition->uiOrdering( uiConfigName, *curveDataGroup );
}
if ( ( eclipseCase && m_eclipseResultDefinition->hasDynamicResult() ) || geomCase )
{
curveDataGroup->add( &m_timeStep );
}
Rim3dWellLogCurve::configurationUiOrdering( uiOrdering );
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::initAfterRead()
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
m_eclipseResultDefinition->setEclipseCase( eclipseCase );
m_geomResultDefinition->setGeoMechCase( geomCase );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogExtractionCurve::wellDate() const
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
QStringList timeStepNames;
if ( eclipseCase )
{
if ( m_eclipseResultDefinition->resultType() == RiaDefines::ResultCatType::STATIC_NATIVE )
{
return QString();
}
if ( eclipseCase->eclipseCaseData() )
{
timeStepNames = eclipseCase->timeStepStrings();
}
}
else if ( geomCase )
{
if ( geomCase->geoMechData() )
{
timeStepNames = geomCase->timeStepStrings();
}
}
if ( m_timeStep == -1 )
{
return QString( "Animation Time Step" );
}
return ( m_timeStep >= 0 && m_timeStep < timeStepNames.size() ) ? timeStepNames[m_timeStep] : "";
}

View File

@@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "Rim3dWellLogCurve.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmPtrField.h"
class Rim3dView;
class RimCase;
class RimGeoMechResultDefinition;
class RimEclipseResultDefinition;
class RimWellLogExtractionCurveNameConfig;
//==================================================================================================
///
///
//==================================================================================================
class Rim3dWellLogExtractionCurve : public Rim3dWellLogCurve
{
CAF_PDM_HEADER_INIT;
public:
Rim3dWellLogExtractionCurve();
~Rim3dWellLogExtractionCurve() override;
void setPropertiesFromView( Rim3dView* view );
QString resultPropertyString() const override;
bool followAnimationTimeStep() const override;
void curveValuesAndMds( std::vector<double>* values, std::vector<double>* measuredDepthValues ) const override;
void curveValuesAndMdsAtTimeStep( std::vector<double>* values,
std::vector<double>* measuredDepthValues,
int timeStep ) const override;
std::pair<double, double> findCurveValueRange() override;
QString name() const override;
QString createAutoName() const override;
double rkbDiff() const;
bool isShowingTimeDependentResult() const override;
bool showInView( const Rim3dView* gridView ) const override;
protected:
caf::PdmFieldHandle* userDescriptionField() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
private:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void initAfterRead() override;
QString wellDate() const;
private:
caf::PdmPtrField<RimCase*> m_case;
caf::PdmField<int> m_timeStep;
caf::PdmChildField<RimEclipseResultDefinition*> m_eclipseResultDefinition;
caf::PdmChildField<RimGeoMechResultDefinition*> m_geomResultDefinition;
caf::PdmChildField<RimWellLogExtractionCurveNameConfig*> m_nameConfig;
};

View File

@@ -0,0 +1,259 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "Rim3dWellLogFileCurve.h"
#include "RigWellLogFile.h"
#include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h"
#include "RimWellLogFileCurveNameConfig.h"
#include "RimWellPath.h"
#include <QFileInfo>
//==================================================================================================
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT( Rim3dWellLogFileCurve, "Rim3dWellLogFileCurve" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogFileCurve::Rim3dWellLogFileCurve()
{
CAF_PDM_InitObject( "3d Well Log File Curve", ":/WellLogCurve16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellLogChannelName, "CurveWellLogChannel", "Well Log Channel", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellLogFile, "WellLogFile", "Well Log File", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimWellLogFileCurveNameConfig();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogFileCurve::setDefaultFileCurveDataInfo()
{
RimWellPath* wellPath = nullptr;
firstAncestorOrThisOfType( wellPath );
if ( wellPath && !wellPath->wellLogFiles().empty() )
{
m_wellLogFile = wellPath->wellLogFiles()[0];
}
if ( m_wellLogFile )
{
std::vector<RimWellLogFileChannel*> fileLogs = m_wellLogFile->wellLogChannels();
if ( !fileLogs.empty() )
{
m_wellLogChannelName = fileLogs[0]->name();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogFileCurve::curveValuesAndMds( std::vector<double>* values, std::vector<double>* measuredDepthValues ) const
{
CAF_ASSERT( values != nullptr );
CAF_ASSERT( measuredDepthValues != nullptr );
if ( m_wellLogFile )
{
RigWellLogFile* wellLogFile = m_wellLogFile->wellLogFileData();
if ( wellLogFile )
{
*values = wellLogFile->values( m_wellLogChannelName );
*measuredDepthValues = wellLogFile->depthValues();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogFileCurve::resultPropertyString() const
{
return m_wellLogChannelName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogFileCurve::name() const
{
return m_nameConfig->name();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogFileCurve::createAutoName() const
{
QStringList name;
QString unit;
bool channelNameAvailable = false;
RimWellPath* wellPath;
this->firstAncestorOrThisOfType( wellPath );
if ( wellPath )
{
name.push_back( wellPath->name() );
name.push_back( "LAS" );
if ( !m_wellLogChannelName().isEmpty() )
{
name.push_back( m_wellLogChannelName );
channelNameAvailable = true;
}
RigWellLogFile* wellLogFile = m_wellLogFile ? m_wellLogFile->wellLogFileData() : nullptr;
if ( wellLogFile )
{
if ( channelNameAvailable )
{
/* RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType(wellLogPlot);
CVF_ASSERT(wellLogPlot);
QString unitName = wellLogFile->wellLogChannelUnitString(m_wellLogChannelName,
wellLogPlot->depthUnit());
if (!unitName.isEmpty())
{
name.back() += QString(" [%1]").arg(unitName);
} */
}
QString date = wellLogFile->date();
if ( !date.isEmpty() )
{
name.push_back( wellLogFile->date() );
}
}
return name.join( ", " );
}
return "Empty curve";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* Rim3dWellLogFileCurve::userDescriptionField()
{
return m_nameConfig()->nameField();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogFileCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &m_wellLogFile || changedField == &m_wellLogChannelName )
{
this->resetMinMaxValues();
this->updateConnectedEditors();
}
Rim3dWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo>
Rim3dWellLogFileCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
options = Rim3dWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
if ( !options.empty() ) return options;
if ( fieldNeedingOptions == &m_wellLogChannelName )
{
if ( m_wellLogFile )
{
std::vector<RimWellLogFileChannel*> fileLogs = m_wellLogFile->wellLogChannels();
for ( size_t i = 0; i < fileLogs.size(); i++ )
{
QString wellLogChannelName = fileLogs[i]->name();
options.push_back( caf::PdmOptionItemInfo( wellLogChannelName, wellLogChannelName ) );
}
}
if ( options.size() == 0 )
{
options.push_back( caf::PdmOptionItemInfo( "None", "None" ) );
}
}
if ( fieldNeedingOptions == &m_wellLogFile )
{
RimWellPath* wellPath = nullptr;
firstAncestorOrThisOfType( wellPath );
if ( wellPath && !wellPath->wellLogFiles().empty() )
{
for ( RimWellLogFile* const wellLogFile : wellPath->wellLogFiles() )
{
QFileInfo fileInfo( wellLogFile->fileName() );
options.push_back( caf::PdmOptionItemInfo( fileInfo.baseName(), wellLogFile ) );
}
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogFileCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
curveDataGroup->add( &m_wellLogFile );
curveDataGroup->add( &m_wellLogChannelName );
Rim3dWellLogCurve::configurationUiOrdering( uiOrdering );
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
uiOrdering.skipRemainingFields( true );
}

View File

@@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "Rim3dWellLogCurve.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmPtrField.h"
class RimWellLogFile;
class RimWellLogFileCurveNameConfig;
//==================================================================================================
///
///
//==================================================================================================
class Rim3dWellLogFileCurve : public Rim3dWellLogCurve
{
CAF_PDM_HEADER_INIT;
public:
Rim3dWellLogFileCurve();
~Rim3dWellLogFileCurve() override;
void setDefaultFileCurveDataInfo();
void curveValuesAndMds( std::vector<double>* values, std::vector<double>* measuredDepthValues ) const override;
QString resultPropertyString() const override;
QString name() const override;
QString createAutoName() const override;
protected:
caf::PdmFieldHandle* userDescriptionField() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
private:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
caf::PdmPtrField<RimWellLogFile*> m_wellLogFile;
caf::PdmField<QString> m_wellLogChannelName;
caf::PdmChildField<RimWellLogFileCurveNameConfig*> m_nameConfig;
};

View File

@@ -0,0 +1,245 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "Rim3dWellLogRftCurve.h"
#include "RiaQDateTimeTools.h"
#include "RifReaderEclipseRft.h"
#include "RigWellLogCurveData.h"
#include "RimEclipseResultCase.h"
#include "RimTools.h"
#include "RimWellLogCurve.h"
#include "RimWellLogRftCurveNameConfig.h"
#include "RimWellPath.h"
//==================================================================================================
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT( Rim3dWellLogRftCurve, "Rim3dWellLogRftCurve" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogRftCurve::Rim3dWellLogRftCurve()
{
CAF_PDM_InitObject( "3d Well Log RFT Curve", ":/WellLogCurve16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_eclipseResultCase, "eclipseResultCase", "", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_timeStep, "timeStep", "", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellLogChannelName, "wellLogChannelName", "", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_2dWellLogRftCurve, "my2dWellLogRftCurve", "", "", "", "" );
m_2dWellLogRftCurve = new RimWellLogRftCurve();
m_2dWellLogRftCurve.xmlCapability()->disableIO();
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimWellLogRftCurveNameConfig();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogRftCurve::~Rim3dWellLogRftCurve()
{
delete m_nameConfig;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogRftCurve::curveValuesAndMds( std::vector<double>* values, std::vector<double>* measuredDepthValues ) const
{
if ( m_2dWellLogRftCurve->wellName() == QString() )
{
m_2dWellLogRftCurve->setDefaultAddress( wellName() );
}
const RigWellLogCurveData* curveData = m_2dWellLogRftCurve->curveData();
// These values are for a simulation well
*values = curveData->xValues();
*measuredDepthValues = curveData->depths( RiaDefines::DepthTypeEnum::MEASURED_DEPTH );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogRftCurve::resultPropertyString() const
{
return caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( m_wellLogChannelName() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogRftCurve::name() const
{
return m_nameConfig->name();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogRftCurve::createAutoName() const
{
QStringList name;
if ( !wellName().isEmpty() )
{
name.push_back( wellName() );
}
name.push_back( "RFT" );
if ( m_eclipseResultCase )
{
name.push_back( m_eclipseResultCase->caseUserDescription() );
}
if ( m_wellLogChannelName().text() !=
caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::text( RifEclipseRftAddress::NONE ) )
{
RifEclipseRftAddress::RftWellLogChannelType channelNameEnum = m_wellLogChannelName();
name.push_back( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( channelNameEnum ) );
}
if ( !m_timeStep().isNull() )
{
name.push_back( m_timeStep().toString( RiaQDateTimeTools::dateFormatString() ) );
}
return name.join( ", " );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* Rim3dWellLogRftCurve::userDescriptionField()
{
return m_nameConfig()->nameField();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogRftCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &m_wellLogChannelName || changedField == &m_timeStep )
{
this->resetMinMaxValues();
this->updateConnectedEditors();
}
Rim3dWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo>
Rim3dWellLogRftCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_eclipseResultCase )
{
RimTools::caseOptionItems( &options );
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
else if ( fieldNeedingOptions == &m_wellLogChannelName )
{
if ( m_eclipseResultCase )
{
RifReaderEclipseRft* reader = m_eclipseResultCase()->rftReader();
if ( reader )
{
for ( const RifEclipseRftAddress::RftWellLogChannelType& channelName :
reader->availableWellLogChannels( wellName() ) )
{
options.push_back(
caf::PdmOptionItemInfo( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(
channelName ),
channelName ) );
}
}
if ( options.empty() )
{
options.push_back( caf::PdmOptionItemInfo( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(
RifEclipseRftAddress::NONE ),
RifEclipseRftAddress::NONE ) );
}
}
}
else if ( fieldNeedingOptions == &m_timeStep )
{
if ( m_eclipseResultCase )
{
RifReaderEclipseRft* reader = m_eclipseResultCase()->rftReader();
if ( reader )
{
QString dateFormat = "dd MMM yyyy";
std::set<QDateTime> timeStamps = reader->availableTimeSteps( wellName(), m_wellLogChannelName() );
for ( const QDateTime& dt : timeStamps )
{
QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale( dt, dateFormat );
options.push_back( caf::PdmOptionItemInfo( dateString, dt ) );
}
}
options.push_back( caf::PdmOptionItemInfo( "None", QDateTime() ) );
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogRftCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
curveDataGroup->add( &m_eclipseResultCase );
curveDataGroup->add( &m_wellLogChannelName );
curveDataGroup->add( &m_timeStep );
Rim3dWellLogCurve::configurationUiOrdering( uiOrdering );
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogRftCurve::wellName() const
{
RimWellPath* wellPath = nullptr;
firstAncestorOrThisOfType( wellPath );
return wellPath->name();
}

View File

@@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "Rim3dWellLogCurve.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmPtrField.h"
#include "RifEclipseRftAddress.h"
#include "RimWellLogRftCurve.h"
class RimEclipseResultCase;
class RimWellLogRftCurveNameConfig;
class QString;
//==================================================================================================
/// Not in use yet
///
//==================================================================================================
class Rim3dWellLogRftCurve : public Rim3dWellLogCurve
{
CAF_PDM_HEADER_INIT;
public:
Rim3dWellLogRftCurve();
~Rim3dWellLogRftCurve() override;
void curveValuesAndMds( std::vector<double>* values, std::vector<double>* measuredDepthValues ) const override;
QString resultPropertyString() const override;
QString name() const override;
QString createAutoName() const override;
protected:
caf::PdmFieldHandle* userDescriptionField() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
private:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
QString wellName() const;
private:
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase;
caf::PdmField<QDateTime> m_timeStep;
caf::PdmField<caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>> m_wellLogChannelName;
caf::PdmChildField<RimWellLogRftCurve*> m_2dWellLogRftCurve;
caf::PdmChildField<RimWellLogRftCurveNameConfig*> m_nameConfig;
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,174 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "RiaDefines.h"
#include "RimEnsembleCurveSetColorManager.h"
#include "RimEnsembleCurveSetInterface.h"
#include "RigEnsembleParameter.h"
#include "cafAppEnum.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmFieldCvfColor.h"
#include "cafPdmObject.h"
#include "cafPdmProxyValueField.h"
#include "cafPdmPtrArrayField.h"
#include "cafPdmPtrField.h"
#include <QPointer>
class RimEnsembleWellLogs;
class RimEnsembleWellLogsCollection;
class RimEnsembleCurveFilterCollection;
class RimEnsembleStatistics;
class RimEnsembleStatisticsCase;
class RimWellLogCurve;
class RimWellLogFileCurve;
class RimWellLogFile;
class RimEnsembleWellLogStatistics;
class RiuDraggableOverlayFrame;
class QwtPlot;
class QwtPlotCurve;
//==================================================================================================
///
//==================================================================================================
class RimEnsembleWellLogCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInterface
{
CAF_PDM_HEADER_INIT;
public:
enum class ColorMode
{
SINGLE_COLOR,
COLOR_BY_ENSEMBLE_CURVE_SET
};
RimEnsembleWellLogCurveSet();
~RimEnsembleWellLogCurveSet() override;
caf::Signal<> filterChanged;
QString name() const;
bool isCurvesVisible();
void setColor( cvf::Color3f color );
void loadDataAndUpdate( bool updateParentPlot );
void setParentQwtPlotNoReplot( QwtPlot* plot );
void detachQwtCurves();
void reattachQwtCurves();
std::vector<RimWellLogCurve*> curves() const;
void deleteEnsembleCurves();
void deleteStatisticsCurves();
ColorMode colorMode() const;
void setColorMode( ColorMode mode );
void updateEnsembleLegendItem();
RiuDraggableOverlayFrame* legendFrame() const;
void showCurves( bool show );
void updateAllTextInPlot();
std::vector<RimWellLogFile*> filterEnsembleCases( const std::vector<RimWellLogFile*>& sumCases );
void disableStatisticCurves();
bool isFiltered() const;
void updateEditors() override;
void updateAllCurves() override;
void updateStatisticsCurves() override;
bool hasP10Data() const override;
bool hasP50Data() const override;
bool hasP90Data() const override;
bool hasMeanData() const override;
void appendColorGroup( caf::PdmUiOrdering& uiOrdering );
void updateFilterLegend();
const RimEnsembleWellLogStatistics* ensembleWellLogStatistics() const;
void updateStatistics();
private:
void updateEnsembleCurves( const std::vector<RimWellLogFile*>& curves );
void updateStatisticsCurves( const std::vector<RimWellLogFile*>& curves );
void updateStatistics( const std::vector<RimWellLogFile*>& sumCases );
caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmFieldHandle* objectToggleField() override;
void initAfterRead() override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
QString createAutoName() const;
void updateCurveColors();
bool isSameRealization( RimSummaryCase* summaryCase, RimWellLogFile* wellLogFile ) const;
RimSummaryCase* findMatchingSummaryCase( RimWellLogFileCurve* wellLogCurve ) const;
void connectEnsembleCurveSetFilterSignals();
void onFilterSourceChanged( const caf::SignalEmitter* emitter );
private:
caf::PdmField<bool> m_showCurves;
caf::PdmPtrArrayField<RimWellLogCurve*> m_curves;
caf::PdmPointer<RimWellLogCurve> m_currentWellLogCurve;
caf::PdmField<caf::AppEnum<ColorMode>> m_colorMode;
caf::PdmField<cvf::Color3f> m_color;
caf::PdmChildField<RimEnsembleStatistics*> m_statistics;
caf::PdmField<bool> m_isUsingAutoName;
caf::PdmField<QString> m_userDefinedName;
caf::PdmProxyValueField<QString> m_autoGeneratedName;
caf::PdmPtrField<RimEnsembleWellLogs*> m_ensembleWellLogs;
caf::PdmField<QString> m_wellLogChannelName;
caf::PdmPtrField<RimEnsembleCurveSet*> m_ensembleCurveSet;
QwtPlotCurve* m_qwtPlotCurveForLegendText;
QPointer<RiuDraggableOverlayFrame> m_legendOverlayFrame;
QPointer<RiuDraggableOverlayFrame> m_filterOverlayFrame;
std::unique_ptr<RimEnsembleWellLogStatistics> m_ensembleWellLogStatistics;
bool m_disableStatisticCurves;
bool m_isCurveSetFiltered;
};

View File

@@ -0,0 +1,237 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil 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 "RimEnsembleWellLogStatistics.h"
#include "RiaCurveMerger.h"
#include "RiaDefines.h"
#include "RiaLogging.h"
#include "RiaWeightedMeanCalculator.h"
#include "RiaWellLogUnitTools.h"
#include "RigStatisticsMath.h"
#include "RigWellLogFile.h"
#include "RimWellLogFile.h"
#include "cafAppEnum.h"
namespace caf
{
template <>
void caf::AppEnum<RimEnsembleWellLogStatistics::StatisticsType>::setUp()
{
addItem( RimEnsembleWellLogStatistics::StatisticsType::P10, "P10", "P10" );
addItem( RimEnsembleWellLogStatistics::StatisticsType::P50, "P50", "P50" );
addItem( RimEnsembleWellLogStatistics::StatisticsType::P90, "P90", "P90" );
addItem( RimEnsembleWellLogStatistics::StatisticsType::MEAN, "MEAN", "Mean" );
setDefault( RimEnsembleWellLogStatistics::StatisticsType::MEAN );
}
}; // namespace caf
RimEnsembleWellLogStatistics::RimEnsembleWellLogStatistics()
{
m_depthUnit = RiaDefines::DepthUnitType::UNIT_NONE;
m_logChannelUnitString = RiaWellLogUnitTools<double>::noUnitString();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogStatistics::calculate( const std::vector<RimWellLogFile*>& wellLogFiles,
const QString& wellLogChannelName )
{
RiaCurveMerger<double> curveMerger;
RiaWeightedMeanCalculator<size_t> dataSetSizeCalc;
for ( RimWellLogFile* wellLogFile : wellLogFiles )
{
QString errorMessage;
if ( wellLogFile->readFile( &errorMessage ) )
{
RigWellLogFile* fileData = wellLogFile->wellLogFileData();
RiaDefines::DepthUnitType depthUnitInFile = fileData->depthUnit();
if ( m_depthUnit != RiaDefines::DepthUnitType::UNIT_NONE && m_depthUnit != depthUnitInFile )
{
RiaLogging::error( QString( "Unexpected depth unit in file %1." ).arg( wellLogFile->fileName() ) );
}
m_depthUnit = depthUnitInFile;
QString logChannelUnitString = fileData->wellLogChannelUnitString( wellLogChannelName );
if ( m_logChannelUnitString != RiaWellLogUnitTools<double>::noUnitString() &&
m_logChannelUnitString != logChannelUnitString )
{
RiaLogging::error( QString( "Unexpected unit in file %1." ).arg( wellLogFile->fileName() ) );
}
m_logChannelUnitString = logChannelUnitString;
std::vector<double> depths = fileData->depthValues();
std::vector<double> values = fileData->values( wellLogChannelName );
if ( !depths.empty() && !values.empty() )
{
dataSetSizeCalc.addValueAndWeight( depths.size(), 1.0 );
curveMerger.addCurveData( depths, values );
}
}
else
{
RiaLogging::error( errorMessage );
}
}
curveMerger.computeInterpolatedValues( true );
clearData();
const std::vector<double>& allDepths = curveMerger.allXValues();
if ( !allDepths.empty() )
{
// Make sure we end up with approximately the same amount of points as originally
// Since allDepths contain *valid* values, it can potentially be smaller than the mean.
// Thus we need to ensure sizeMultiplier is at least 1.
size_t sizeMultiplier = std::max( (size_t)1, allDepths.size() / dataSetSizeCalc.weightedMean() );
for ( size_t depthIdx = 0; depthIdx < allDepths.size(); depthIdx += sizeMultiplier )
{
std::vector<double> valuesAtDepth;
valuesAtDepth.reserve( curveMerger.curveCount() );
for ( size_t curveIdx = 0; curveIdx < curveMerger.curveCount(); ++curveIdx )
{
const std::vector<double>& curveValues = curveMerger.interpolatedYValuesForAllXValues( curveIdx );
valuesAtDepth.push_back( curveValues[depthIdx] );
}
double p10, p50, p90, mean;
RigStatisticsMath::calculateStatisticsCurves( valuesAtDepth, &p10, &p50, &p90, &mean );
m_measuredDepths.push_back( allDepths[depthIdx] );
m_p10Data.push_back( p10 );
m_p50Data.push_back( p50 );
m_p90Data.push_back( p90 );
m_meanData.push_back( mean );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>& RimEnsembleWellLogStatistics::measuredDepths() const
{
return m_measuredDepths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>& RimEnsembleWellLogStatistics::tvDepths() const
{
return m_tvDepths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>& RimEnsembleWellLogStatistics::p10() const
{
return m_p10Data;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>& RimEnsembleWellLogStatistics::p50() const
{
return m_p50Data;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>& RimEnsembleWellLogStatistics::p90() const
{
return m_p90Data;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>& RimEnsembleWellLogStatistics::mean() const
{
return m_meanData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEnsembleWellLogStatistics::hasP10Data() const
{
return !m_p10Data.empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEnsembleWellLogStatistics::hasP50Data() const
{
return !m_p50Data.empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEnsembleWellLogStatistics::hasP90Data() const
{
return !m_p90Data.empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEnsembleWellLogStatistics::hasMeanData() const
{
return !m_meanData.empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogStatistics::clearData()
{
m_measuredDepths.clear();
m_tvDepths.clear();
m_p10Data.clear();
m_p50Data.clear();
m_p90Data.clear();
m_meanData.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::DepthUnitType RimEnsembleWellLogStatistics::depthUnitType() const
{
return m_depthUnit;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEnsembleWellLogStatistics::logChannelUnitString() const
{
return m_logChannelUnitString;
}

View File

@@ -0,0 +1,72 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "RiaDefines.h"
#include <vector>
class QString;
class RimWellLogFile;
//==================================================================================================
///
//==================================================================================================
class RimEnsembleWellLogStatistics
{
public:
enum class StatisticsType
{
P10,
P50,
P90,
MEAN
};
RimEnsembleWellLogStatistics();
const std::vector<double>& measuredDepths() const;
const std::vector<double>& tvDepths() const;
const std::vector<double>& p10() const;
const std::vector<double>& p50() const;
const std::vector<double>& p90() const;
const std::vector<double>& mean() const;
QString logChannelUnitString() const;
RiaDefines::DepthUnitType depthUnitType() const;
bool hasP10Data() const;
bool hasP50Data() const;
bool hasP90Data() const;
bool hasMeanData() const;
void calculate( const std::vector<RimWellLogFile*>& sumCases, const QString& wellLogChannelName );
private:
void clearData();
QString m_logChannelUnitString;
RiaDefines::DepthUnitType m_depthUnit;
std::vector<double> m_measuredDepths;
std::vector<double> m_tvDepths;
std::vector<double> m_p10Data;
std::vector<double> m_p50Data;
std::vector<double> m_p90Data;
std::vector<double> m_meanData;
};

View File

@@ -0,0 +1,181 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "RimEnsembleWellLogStatisticsCurve.h"
#include "RiaApplication.h"
#include "RiaDefines.h"
#include "RiaInterpolationTools.h"
#include "RiaLogging.h"
#include "RimEnsembleWellLogCurveSet.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RiuQwtPlotCurve.h"
#include "RiuQwtPlotWidget.h"
#include "cafPdmUiTreeOrdering.h"
CAF_PDM_SOURCE_INIT( RimEnsembleWellLogStatisticsCurve, "EnsembleWellLogStatisticsCurve" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEnsembleWellLogStatisticsCurve::RimEnsembleWellLogStatisticsCurve()
{
CAF_PDM_InitObject( "Ensemble Well Log Statistics Curve", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_ensembleWellLogCurveSet, "EnsembleWellLogCurveSet", "Ensemble Well Log Curve Set", "", "", "" );
m_ensembleWellLogCurveSet.uiCapability()->setUiTreeChildrenHidden( true );
m_ensembleWellLogCurveSet.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_statisticsType, "StatisticsType", "Statistics Type", "", "", "" );
m_statisticsType.uiCapability()->setUiHidden( true );
m_wellPath = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEnsembleWellLogStatisticsCurve::~RimEnsembleWellLogStatisticsCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogStatisticsCurve::setEnsembleWellLogCurveSet( RimEnsembleWellLogCurveSet* ensembleWellLogCurveSet )
{
m_ensembleWellLogCurveSet = ensembleWellLogCurveSet;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogStatisticsCurve::setStatisticsType( RimEnsembleWellLogStatistics::StatisticsType statisticsType )
{
m_statisticsType = statisticsType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEnsembleWellLogStatistics::StatisticsType RimEnsembleWellLogStatisticsCurve::statisticsType() const
{
return m_statisticsType();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogStatisticsCurve::performDataExtraction( bool* isUsingPseudoLength )
{
std::vector<double> values;
std::vector<double> measuredDepthValues;
std::vector<double> tvDepthValues;
double rkbDiff = 0.0;
*isUsingPseudoLength = false;
if ( m_ensembleWellLogCurveSet )
{
const RimEnsembleWellLogStatistics* ensembleWellLogStatistics =
m_ensembleWellLogCurveSet->ensembleWellLogStatistics();
m_ensembleWellLogCurveSet->updateStatistics();
RiaDefines::DepthUnitType depthUnit = ensembleWellLogStatistics->depthUnitType();
QString xUnits = ensembleWellLogStatistics->logChannelUnitString();
if ( m_statisticsType == RimEnsembleWellLogStatistics::StatisticsType::MEAN )
{
values = ensembleWellLogStatistics->mean();
measuredDepthValues = ensembleWellLogStatistics->measuredDepths();
}
else if ( m_statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P10 )
{
values = ensembleWellLogStatistics->p10();
measuredDepthValues = ensembleWellLogStatistics->measuredDepths();
}
else if ( m_statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P50 )
{
values = ensembleWellLogStatistics->p50();
measuredDepthValues = ensembleWellLogStatistics->measuredDepths();
}
else if ( m_statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P90 )
{
values = ensembleWellLogStatistics->p90();
measuredDepthValues = ensembleWellLogStatistics->measuredDepths();
}
bool performDataSmoothing = false;
if ( !values.empty() && !measuredDepthValues.empty() && measuredDepthValues.size() == values.size() )
{
addDatapointsForBottomOfSegment( measuredDepthValues, values );
this->setValuesAndDepths( values,
measuredDepthValues,
RiaDefines::DepthTypeEnum::MEASURED_DEPTH,
rkbDiff,
depthUnit,
!performDataSmoothing,
xUnits );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEnsembleWellLogStatisticsCurve::createCurveAutoName()
{
return caf::AppEnum<RimEnsembleWellLogStatistics::StatisticsType>::uiText( m_statisticsType() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogStatisticsCurve::addDatapointsForBottomOfSegment( std::vector<double>& depthValues,
std::vector<double>& values )
{
std::vector<double> depthValuesWithBottomLayers;
std::vector<double> valuesWithBottomLayers;
for ( size_t i = 0; i < values.size(); i++ )
{
// Add the data point at top of the layer
double topLayerDepth = depthValues[i];
double value = values[i];
depthValuesWithBottomLayers.push_back( topLayerDepth );
valuesWithBottomLayers.push_back( value );
// Add extra data points for bottom part of the layer
if ( i < values.size() - 1 )
{
double bottomLayerDepth = depthValues[i + 1];
double bottomValue = value;
depthValuesWithBottomLayers.push_back( bottomLayerDepth );
valuesWithBottomLayers.push_back( bottomValue );
}
}
values = valuesWithBottomLayers;
depthValues = depthValuesWithBottomLayers;
}

View File

@@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "RimEnsembleWellLogStatistics.h"
#include "RimWellLogExtractionCurve.h"
#include "cafPdmField.h"
#include "cafPdmPtrField.h"
#include <vector>
class RimEnsembleWellLogCurveSet;
//==================================================================================================
///
//==================================================================================================
class RimEnsembleWellLogStatisticsCurve : public RimWellLogExtractionCurve
{
CAF_PDM_HEADER_INIT;
public:
RimEnsembleWellLogStatisticsCurve();
~RimEnsembleWellLogStatisticsCurve() override;
void setEnsembleWellLogCurveSet( RimEnsembleWellLogCurveSet* ensembleWellLogCurveSet );
void setStatisticsType( RimEnsembleWellLogStatistics::StatisticsType );
RimEnsembleWellLogStatistics::StatisticsType statisticsType() const;
protected:
void performDataExtraction( bool* isUsingPseudoLength ) override;
QString createCurveAutoName() override;
static void addDatapointsForBottomOfSegment( std::vector<double>& depthValues, std::vector<double>& values );
caf::PdmPtrField<RimEnsembleWellLogCurveSet*> m_ensembleWellLogCurveSet;
caf::PdmField<caf::AppEnum<RimEnsembleWellLogStatistics::StatisticsType>> m_statisticsType;
};

View File

@@ -0,0 +1,78 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "RimEnsembleWellLogs.h"
#include "RiaLogging.h"
#include "RimWellLogFile.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
CAF_PDM_SOURCE_INIT( RimEnsembleWellLogs, "EnsembleWellLogs" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEnsembleWellLogs::RimEnsembleWellLogs()
{
CAF_PDM_InitScriptableObject( "Ensemble Well Logs", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellLogFiles, "WellLogFiles", "", "", "", "" );
m_wellLogFiles.uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogs::removeWellLogFile( RimWellLogFile* summaryCase )
{
m_wellLogFiles.removeChildObject( summaryCase );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogs::addWellLogFile( RimWellLogFile* summaryCase )
{
m_wellLogFiles.push_back( summaryCase );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogFile*> RimEnsembleWellLogs::wellLogFiles() const
{
return m_wellLogFiles().childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogs::loadDataAndUpdate()
{
for ( auto& w : m_wellLogFiles )
{
QString errorMessage;
if ( !w->readFile( &errorMessage ) )
{
RiaLogging::warning( errorMessage );
}
}
}

View File

@@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "RimNamedObject.h"
#include "cafPdmChildArrayField.h"
class RimWellLogFile;
//==================================================================================================
///
//==================================================================================================
class RimEnsembleWellLogs : public RimNamedObject
{
CAF_PDM_HEADER_INIT;
public:
RimEnsembleWellLogs();
void removeWellLogFile( RimWellLogFile* wellLogFile );
void addWellLogFile( RimWellLogFile* wellLogFile );
std::vector<RimWellLogFile*> wellLogFiles() const;
void loadDataAndUpdate();
private:
caf::PdmChildArrayField<RimWellLogFile*> m_wellLogFiles;
};

View File

@@ -0,0 +1,76 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "RimEnsembleWellLogsCollection.h"
#include "RimEnsembleWellLogs.h"
#include "cafProgressInfo.h"
CAF_PDM_SOURCE_INIT( RimEnsembleWellLogsCollection, "EnsembleWellLogsCollection" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEnsembleWellLogsCollection::RimEnsembleWellLogsCollection()
{
CAF_PDM_InitObject( "Ensemble Well Logs", ":/LasFile16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_ensembleWellLogs, "EnsembleWellLogsCollection", "", "", "", "" );
m_ensembleWellLogs.uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEnsembleWellLogsCollection::~RimEnsembleWellLogsCollection()
{
m_ensembleWellLogs.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogsCollection::addEnsembleWellLogs( RimEnsembleWellLogs* ensembleWellLogs )
{
m_ensembleWellLogs.push_back( ensembleWellLogs );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimEnsembleWellLogs*> RimEnsembleWellLogsCollection::ensembleWellLogs() const
{
std::vector<RimEnsembleWellLogs*> ensembleWellLogs;
for ( const auto& e : m_ensembleWellLogs )
{
ensembleWellLogs.push_back( e );
}
return ensembleWellLogs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogsCollection::loadDataAndUpdate()
{
for ( const auto& e : m_ensembleWellLogs )
{
e->loadDataAndUpdate();
}
}

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "cafPdmObject.h"
class RimEnsembleWellLogs;
//==================================================================================================
///
//==================================================================================================
class RimEnsembleWellLogsCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimEnsembleWellLogsCollection();
~RimEnsembleWellLogsCollection() override;
std::vector<RimEnsembleWellLogs*> ensembleWellLogs() const;
void addEnsembleWellLogs( RimEnsembleWellLogs* ensembleWellLogs );
void loadDataAndUpdate();
private:
caf::PdmChildArrayField<RimEnsembleWellLogs*> m_ensembleWellLogs;
};

View File

@@ -0,0 +1,334 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RimWellLogCurve.h"
#include "RiaCurveDataTools.h"
#include "RigWellLogCurveData.h"
#include "RimDepthTrackPlot.h"
#include "RimWellLogTrack.h"
#include "RiuQwtPlotCurve.h"
#include "RiuQwtPlotWidget.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cvfAssert.h"
#include "qwt_symbol.h"
#include <algorithm>
// NB! Special macro for pure virtual class
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimWellLogCurve, "WellLogPlotCurve" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogCurve::RimWellLogCurve()
{
CAF_PDM_InitObject( "WellLogCurve", ":/WellLogCurve16x16.png", "", "" );
m_qwtPlotCurve->setXAxis( QwtPlot::xTop );
m_qwtCurveErrorBars->setXAxis( QwtPlot::xTop );
m_qwtPlotCurve->setYAxis( QwtPlot::yLeft );
m_curveData = new RigWellLogCurveData;
m_curveDataXRange = std::make_pair( std::numeric_limits<double>::infinity(), -std::numeric_limits<double>::infinity() );
setDeletable( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogCurve::~RimWellLogCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::setDepthUnit( RiaDefines::DepthUnitType depthUnit )
{
m_curveData->setDepthUnit( depthUnit );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogCurve::xValueRangeInData( double* minimumValue, double* maximumValue ) const
{
CAF_ASSERT( minimumValue && maximumValue );
if ( !( minimumValue && maximumValue ) )
{
return false;
}
if ( m_curveDataXRange.first == -std::numeric_limits<double>::infinity() ||
m_curveDataXRange.second == std::numeric_limits<double>::infinity() )
{
return false;
}
*minimumValue = m_curveDataXRange.first;
*maximumValue = m_curveDataXRange.second;
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogCurve::yValueRangeInData( double* minimumValue, double* maximumValue ) const
{
CAF_ASSERT( minimumValue && maximumValue );
if ( !( minimumValue && maximumValue ) )
{
return false;
}
RimDepthTrackPlot* wellLogPlot = nullptr;
firstAncestorOrThisOfTypeAsserted( wellLogPlot );
auto depthType = wellLogPlot->depthType();
auto displayUnit = wellLogPlot->depthUnit();
return m_curveData->calculateDepthRange( depthType, displayUnit, minimumValue, maximumValue );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::setValuesAndDepths( const std::vector<double>& xValues,
const std::vector<double>& depths,
RiaDefines::DepthTypeEnum depthType,
double rkbDiff,
RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve,
const QString& xUnits )
{
m_curveData->setValuesAndDepths( xValues, depths, depthType, rkbDiff, depthUnit, isExtractionCurve );
m_curveData->setXUnits( xUnits );
calculateCurveDataXRange();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::setValuesAndDepths( const std::vector<double>& xValues,
const std::map<RiaDefines::DepthTypeEnum, std::vector<double>>& depths,
double rkbDiff,
RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve,
const QString& xUnits )
{
m_curveData->setValuesAndDepths( xValues, depths, rkbDiff, depthUnit, isExtractionCurve );
m_curveData->setXUnits( xUnits );
calculateCurveDataXRange();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::setValuesWithMdAndTVD( const std::vector<double>& xValues,
const std::vector<double>& measuredDepths,
const std::vector<double>& tvdMSL,
double rkbDiff,
RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve,
const QString& xUnits )
{
std::map<RiaDefines::DepthTypeEnum, std::vector<double>> depths = { { RiaDefines::DepthTypeEnum::MEASURED_DEPTH,
measuredDepths },
{ RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH,
tvdMSL } };
setValuesAndDepths( xValues, depths, rkbDiff, depthUnit, isExtractionCurve, xUnits );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigWellLogCurveData* RimWellLogCurve::curveData() const
{
return m_curveData.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::updateCurveAppearance()
{
RimPlotCurve::updateCurveAppearance();
if ( m_fillStyle != Qt::BrushStyle::NoBrush )
{
m_qwtPlotCurve->setOrientation( Qt::Horizontal );
m_qwtPlotCurve->setBaseline( -std::numeric_limits<double>::infinity() );
m_qwtPlotCurve->setCurveAttribute( QwtPlotCurve::Inverted, true );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogCurve::wellLogChannelName() const
{
return wellLogChannelUiName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogCurve::wellLogCurveIconName()
{
return ":/WellLogCurve16x16.png";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::setOverrideCurveData( const std::vector<double>& xValues,
const std::vector<double>& depthValues,
const RiaCurveDataTools::CurveIntervals& curveIntervals )
{
auto minmax_it = std::minmax_element( xValues.begin(), xValues.end() );
this->setOverrideCurveDataXRange( *( minmax_it.first ), *( minmax_it.second ) );
if ( m_qwtPlotCurve )
{
m_qwtPlotCurve->setSamples( xValues.data(), depthValues.data(), static_cast<int>( depthValues.size() ) );
m_qwtPlotCurve->setLineSegmentStartStopIndices( curveIntervals );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::PhaseType RimWellLogCurve::resultPhase() const
{
return RiaDefines::PhaseType::PHASE_NOT_APPLICABLE;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::updateZoomInParentPlot()
{
const double eps = 1.0e-8;
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfType( wellLogTrack );
if ( wellLogTrack )
{
wellLogTrack->setAutoScaleXIfNecessary();
RimDepthTrackPlot* wellLogPlot;
wellLogTrack->firstAncestorOrThisOfType( wellLogPlot );
if ( wellLogPlot )
{
double minPlotDepth, maxPlotDepth;
wellLogPlot->availableDepthRange( &minPlotDepth, &maxPlotDepth );
bool updateDepthZoom = false;
if ( minPlotDepth == std::numeric_limits<double>::infinity() ||
maxPlotDepth == -std::numeric_limits<double>::infinity() )
{
updateDepthZoom = true;
}
else
{
double plotRange = std::abs( maxPlotDepth - minPlotDepth );
double minCurveDepth, maxCurveDepth;
m_curveData->calculateDepthRange( wellLogPlot->depthType(),
wellLogPlot->depthUnit(),
&minCurveDepth,
&maxCurveDepth );
updateDepthZoom = minCurveDepth < minPlotDepth - eps * plotRange ||
maxCurveDepth > maxPlotDepth + eps * plotRange;
}
if ( updateDepthZoom )
{
wellLogPlot->setAutoScaleDepthEnabled( true );
}
wellLogPlot->updateZoom();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::updateLegendsInPlot()
{
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfType( wellLogTrack );
if ( wellLogTrack )
{
wellLogTrack->updateLegend();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::setOverrideCurveDataXRange( double minimumValue, double maximumValue )
{
m_curveDataXRange = std::make_pair( minimumValue, maximumValue );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::calculateCurveDataXRange()
{
// Invalidate range first
m_curveDataXRange = std::make_pair( std::numeric_limits<double>::infinity(), -std::numeric_limits<double>::infinity() );
for ( double xValue : m_curveData->xValues() )
{
if ( RiaCurveDataTools::isValidValue( xValue, false ) )
{
m_curveDataXRange.first = std::min( m_curveDataXRange.first, xValue );
m_curveDataXRange.second = std::max( m_curveDataXRange.second, xValue );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimStackablePlotCurve::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_showCurve && m_showCurve() )
{
updateZoomInParentPlot();
}
if ( changedField == &m_isStacked )
{
loadDataAndUpdate( true );
}
}

View File

@@ -0,0 +1,97 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RiaDefines.h"
#include "RiaWellLogUnitTools.h"
#include "RimStackablePlotCurve.h"
#include "cafSignal.h"
#include "cvfObject.h"
class RigWellLogCurveData;
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogCurve : public RimStackablePlotCurve
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogCurve();
~RimWellLogCurve() override;
void setDepthUnit( RiaDefines::DepthUnitType depthUnit );
bool xValueRangeInData( double* minimumValue, double* maximumValue ) const;
bool yValueRangeInData( double* minimumValue, double* maximumValue ) const;
void setValuesAndDepths( const std::vector<double>& xValues,
const std::vector<double>& depths,
RiaDefines::DepthTypeEnum depthType,
double rkbDiff,
RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve,
const QString& xUnits = RiaWellLogUnitTools<double>::noUnitString() );
void setValuesWithMdAndTVD( const std::vector<double>& xValues,
const std::vector<double>& measuredDepths,
const std::vector<double>& tvDepths,
double rkbDiff,
RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve,
const QString& xUnits = RiaWellLogUnitTools<double>::noUnitString() );
void setValuesAndDepths( const std::vector<double>& xValues,
const std::map<RiaDefines::DepthTypeEnum, std::vector<double>>& depths,
double rkbDiff,
RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve,
const QString& xUnits = RiaWellLogUnitTools<double>::noUnitString() );
const RigWellLogCurveData* curveData() const;
void updateCurveAppearance() override;
virtual QString wellName() const = 0;
virtual QString wellLogChannelUiName() const = 0;
virtual QString wellLogChannelName() const;
virtual QString wellLogChannelUnits() const = 0;
virtual QString wellDate() const { return ""; };
static QString wellLogCurveIconName();
void setOverrideCurveData( const std::vector<double>& xValues,
const std::vector<double>& depthValues,
const RiaCurveDataTools::CurveIntervals& curveIntervals );
virtual RiaDefines::PhaseType resultPhase() const;
protected:
void updateZoomInParentPlot() override;
void updateLegendsInPlot() override;
void setOverrideCurveDataXRange( double minimumValue, double maximumValue );
void calculateCurveDataXRange();
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
private:
cvf::ref<RigWellLogCurveData> m_curveData;
std::pair<double, double> m_curveDataXRange;
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,126 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil 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 "RiaDefines.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "cafPdmUiOrdering.h"
#include "cafTristate.h"
class RimCase;
class RimWellLogCurve;
class RimWellLogPlot;
class RimWellLogTrack;
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
class RimWellLogCurveCommonDataSource : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
class DoubleComparator
{
public:
DoubleComparator( double eps = 1.0e-6 );
bool operator()( const double& lhs, const double& rhs ) const;
private:
double m_eps;
};
RimWellLogCurveCommonDataSource();
void setCaseType( RiaDefines::CaseType caseType );
RimCase* caseToApply() const;
void setCaseToApply( RimCase* val );
int trajectoryTypeToApply() const;
void setTrajectoryTypeToApply( int val );
RimWellPath* wellPathToApply() const;
void setWellPathToApply( RimWellPath* val );
int branchIndexToApply() const;
void setBranchIndexToApply( int val );
caf::Tristate branchDetectionToApply() const;
void setBranchDetectionToApply( caf::Tristate::State val );
caf::Tristate wbsSmoothingToApply() const;
void setWbsSmoothingToApply( caf::Tristate::State val );
double wbsSmoothingThreshold() const;
void setWbsSmoothingThreshold( double smoothingThreshold );
QString simWellNameToApply() const;
void setSimWellNameToApply( const QString& val );
int timeStepToApply() const;
void setTimeStepToApply( int val );
void resetDefaultOptions();
void updateDefaultOptions( const std::vector<RimWellLogCurve*>& curves, const std::vector<RimWellLogTrack*>& tracks );
void updateDefaultOptions();
void updateCurvesAndTracks( const std::vector<RimWellLogCurve*>& curves, const std::vector<RimWellLogTrack*>& tracks );
void updateCurvesAndTracks();
void applyPrevCase();
void applyNextCase();
void applyPrevWell();
void applyNextWell();
void applyPrevTimeStep();
void applyNextTimeStep();
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
static QString smoothingUiOrderinglabel();
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void modifyCurrentIndex( caf::PdmValueField* field, int indexOffset );
private:
RiaDefines::CaseType m_caseType;
caf::PdmPtrField<RimCase*> m_case;
caf::PdmField<int> m_trajectoryType;
caf::PdmPtrField<RimWellPath*> m_wellPath;
caf::PdmField<QString> m_simWellName;
caf::PdmField<int> m_branchIndex;
caf::PdmField<caf::Tristate> m_branchDetection;
caf::PdmField<int> m_timeStep;
caf::PdmField<caf::Tristate> m_wbsSmoothing;
caf::PdmField<double> m_wbsSmoothingThreshold;
std::set<RimCase*> m_uniqueCases;
std::set<int> m_uniqueTrajectoryTypes;
std::set<RimWellPath*> m_uniqueWellPaths;
std::set<QString> m_uniqueWellNames;
std::set<int> m_uniqueTimeSteps;
std::set<bool> m_uniqueBranchDetection;
std::set<int> m_uniqueBranchIndices;
std::set<bool> m_uniqueWbsSmoothing;
std::set<double, DoubleComparator> m_uniqueWbsSmoothingThreshold;
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,139 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RigWbsParameter.h"
#include "RimWellLogCurve.h"
#include "cafPdmChildField.h"
#include "cafPdmPtrField.h"
class RigFemResultAddress;
class RigGeoMechWellLogExtractor;
class RigWellPath;
class RimCase;
class RimEclipseResultDefinition;
class RimGeoMechResultDefinition;
class Rim3dView;
class RimWellPath;
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogExtractionCurve : public RimWellLogCurve
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogExtractionCurve();
~RimWellLogExtractionCurve() override;
enum TrajectoryType
{
WELL_PATH,
SIMULATION_WELL
};
void setWellPath( RimWellPath* wellPath );
RimWellPath* wellPath() const;
void setFromSimulationWellName( const QString& simWellName, int branchIndex, bool branchDetection );
void setCase( RimCase* rimCase );
RimCase* rimCase() const;
void setPropertiesFromView( Rim3dView* view );
TrajectoryType trajectoryType() const;
QString wellName() const override;
QString wellLogChannelUiName() const override;
QString wellLogChannelName() const override;
QString wellLogChannelUnits() const override;
QString wellDate() const override;
int branchIndex() const;
bool branchDetection() const;
bool isEclipseCurve() const;
QString caseName() const;
int currentTimeStep() const;
void setCurrentTimeStep( int timeStep );
void setEclipseResultVariable( const QString& resVarname );
QString eclipseResultVariable() const;
void setEclipseResultCategory( RiaDefines::ResultCatType catType );
void setGeoMechResultAddress( const RigFemResultAddress& resAddr );
void setTrajectoryType( TrajectoryType trajectoryType );
void setWellName( QString wellName );
void setBranchDetection( bool branchDetection );
void setBranchIndex( int index );
static void findAndLoadWbsParametersFromLasFiles( const RimWellPath* wellPath,
RigGeoMechWellLogExtractor* geomExtractor );
void setAutoNameComponents( bool addCaseName, bool addProperty, bool addWellname, bool addTimeStep, bool addDate );
RiaDefines::PhaseType phaseType() const override;
protected:
QString createCurveAutoName() override;
void onLoadDataAndUpdate( bool updateParentPlot ) override;
void onCaseSettingsChanged( const caf::SignalEmitter* emitter );
void connectCaseSignals( RimCase* rimCase );
virtual void performDataExtraction( bool* isUsingPseudoLength );
void extractData( bool* isUsingPseudoLength, bool performDataSmoothing = false, double smoothingThreshold = -1.0 );
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;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void initAfterRead() override;
static QString dataSourceGroupKeyword();
void setLogScaleFromSelectedResult();
void clampTimestep();
void clampBranchIndex();
std::set<QString> sortedSimWellNames();
void clearGeneratedSimWellPaths();
caf::PdmPtrField<RimCase*> m_case;
caf::PdmField<caf::AppEnum<TrajectoryType>> m_trajectoryType;
caf::PdmPtrField<RimWellPath*> m_wellPath;
caf::PdmField<QString> m_simWellName;
caf::PdmField<int> m_branchIndex;
caf::PdmField<bool> m_branchDetection;
caf::PdmChildField<RimEclipseResultDefinition*> m_eclipseResultDefinition;
caf::PdmChildField<RimGeoMechResultDefinition*> m_geomResultDefinition;
caf::PdmField<int> m_timeStep;
caf::PdmField<bool> m_addCaseNameToCurveName;
caf::PdmField<bool> m_addPropertyToCurveName;
caf::PdmField<bool> m_addWellNameToCurveName;
caf::PdmField<bool> m_addTimestepToCurveName;
caf::PdmField<bool> m_addDateToCurveName;
std::vector<const RigWellPath*> m_wellPathsWithExtractors;
};

View File

@@ -0,0 +1,106 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "RimWellLogExtractionCurveNameConfig.h"
//==================================================================================================
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT( RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionCurveNameConfig" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurveNameConfig::RimWellLogExtractionCurveNameConfig()
: RimNameConfig( "Log Extraction" )
{
CAF_PDM_InitObject( "Well Log Extraction Curve Name Generator", "", "", "" );
CAF_PDM_InitField( &m_addCaseName, "AddCaseName", true, "Add Case Name", "", "", "" );
CAF_PDM_InitField( &m_addProperty, "AddProperty", true, "Add Property Type", "", "", "" );
CAF_PDM_InitField( &m_addWellName, "AddWellName", true, "Add Well Name", "", "", "" );
CAF_PDM_InitField( &m_addTimestep, "AddTimeStep", true, "Add Time Step", "", "", "" );
CAF_PDM_InitField( &m_addDate, "AddDate", true, "Add Date", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogExtractionCurveNameConfig::addCaseName() const
{
return m_addCaseName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogExtractionCurveNameConfig::addProperty() const
{
return m_addProperty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogExtractionCurveNameConfig::addWellName() const
{
return m_addWellName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogExtractionCurveNameConfig::addTimeStep() const
{
return m_addTimestep();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogExtractionCurveNameConfig::addDate() const
{
return m_addDate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurveNameConfig::doEnableAllAutoNameTags( bool enable )
{
m_addCaseName = enable;
m_addProperty = enable;
m_addWellName = enable;
m_addTimestep = enable;
m_addDate = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurveNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering );
uiOrdering.add( &m_addCaseName );
uiOrdering.add( &m_addProperty );
uiOrdering.add( &m_addWellName );
uiOrdering.add( &m_addTimestep );
uiOrdering.add( &m_addDate );
}

View File

@@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "RimNameConfig.h"
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogExtractionCurveNameConfig : public RimNameConfig
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogExtractionCurveNameConfig();
bool addCaseName() const;
bool addProperty() const;
bool addWellName() const;
bool addTimeStep() const;
bool addDate() const;
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
void doEnableAllAutoNameTags( bool enable ) override;
private:
caf::PdmField<bool> m_addCaseName;
caf::PdmField<bool> m_addProperty;
caf::PdmField<bool> m_addWellName;
caf::PdmField<bool> m_addTimestep;
caf::PdmField<bool> m_addDate;
};

View File

@@ -0,0 +1,351 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RiaGuiApplication.h"
#include "RiaLogging.h"
#include "RiaDateStringParser.h"
#include "RiaFieldHandleTools.h"
#include "RiaQDateTimeTools.h"
#include "RigWellLogFile.h"
#include "RimFileWellPath.h"
#include "RimTools.h"
#include "RimWellLogFileChannel.h"
#include "RimWellPathCollection.h"
#include "RimWellPlotTools.h"
#include "Riu3DMainWindowTools.h"
#include "cafPdmUiDateEditor.h"
#include <QFileInfo>
#include <QString>
#include <QStringList>
CAF_PDM_SOURCE_INIT( RimWellLogFile, "WellLogFile" );
namespace caf
{
template <>
void caf::AppEnum<RimWellLogFile::WellFlowCondition>::setUp()
{
addItem( RimWellLogFile::WELL_FLOW_COND_RESERVOIR, "RESERVOIR", "Reservoir Volumes" );
addItem( RimWellLogFile::WELL_FLOW_COND_STANDARD, "STANDARD", "Standard Volumes" );
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QDateTime RimWellLogFile::DEFAULT_DATE_TIME = RiaQDateTimeTools::createUtcDateTime( QDate( 1900, 1, 1 ) );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFile::RimWellLogFile()
{
CAF_PDM_InitObject( "Well LAS File Info", ":/LasFile16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "", "", "", "" );
m_wellName.uiCapability()->setUiReadOnly( true );
RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_wellName );
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<RimWellLogFile::WellFlowCondition>( RimWellLogFile::WELL_FLOW_COND_STANDARD ),
"Well Flow Rates",
"",
"",
"" );
CAF_PDM_InitField( &m_invalidDateMessage, "InvalidDateMessage", QString( "Invalid or no date" ), "", "", "", "" );
m_invalidDateMessage.uiCapability()->setUiReadOnly( true );
m_invalidDateMessage.xmlCapability()->disableIO();
m_wellLogDataFile = nullptr;
m_lasFileHasValidDate = false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFile::~RimWellLogFile()
{
m_wellLogChannelNames.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFile* RimWellLogFile::readWellLogFile( const QString& logFilePath, QString* errorMessage )
{
CAF_ASSERT( errorMessage );
QFileInfo fi( logFilePath );
RimWellLogFile* wellLogFile = nullptr;
if ( fi.suffix().toUpper().compare( "LAS" ) == 0 )
{
wellLogFile = new RimWellLogFile();
wellLogFile->setFileName( logFilePath );
if ( !wellLogFile->readFile( errorMessage ) )
{
delete wellLogFile;
wellLogFile = nullptr;
}
}
return wellLogFile;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFile::setFileName( const QString& fileName )
{
m_fileName = fileName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogFile::readFile( QString* errorMessage )
{
if ( !m_wellLogDataFile.p() )
{
m_wellLogDataFile = new RigWellLogFile;
}
m_name = QFileInfo( m_fileName().path() ).fileName();
if ( !m_wellLogDataFile->open( m_fileName().path(), errorMessage ) )
{
m_wellLogDataFile = nullptr;
return false;
}
m_wellName = m_wellLogDataFile->wellName();
QDateTime date = RiaDateStringParser::parseDateString( m_wellLogDataFile->date() );
m_lasFileHasValidDate = isDateValid( date );
if ( m_lasFileHasValidDate )
{
m_date = date;
}
else if ( !isDateValid( m_date() ) )
{
RiaLogging::warning( QString( "The LAS-file '%1' contains no recognizable date. Please assign a date in the "
"LAS-file property panel." )
.arg( m_name() ) );
m_date = DEFAULT_DATE_TIME;
}
m_wellLogChannelNames.deleteAllChildObjects();
QStringList wellLogNames = m_wellLogDataFile->wellLogChannelNames();
for ( int logIdx = 0; logIdx < wellLogNames.size(); logIdx++ )
{
RimWellLogFileChannel* wellLog = new RimWellLogFileChannel();
wellLog->setName( wellLogNames[logIdx] );
m_wellLogChannelNames.push_back( wellLog );
}
RimFileWellPath* wellPath;
this->firstAncestorOrThisOfType( wellPath );
if ( wellPath )
{
if ( wellPath->filePath().isEmpty() ) // Has dummy wellpath
{
wellPath->setName( m_wellName );
}
}
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogFile::wellName() const
{
return m_wellName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QDateTime RimWellLogFile::date() const
{
return m_date;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogFileChannel*> RimWellLogFile::wellLogChannels() const
{
std::vector<RimWellLogFileChannel*> channels;
for ( const auto& channel : m_wellLogChannelNames )
{
channels.push_back( channel );
}
return channels;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogFile::hasFlowData() const
{
return RimWellPlotTools::hasFlowData( this );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFile::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
{
// bool foundFile = false;
// std::vector<QString> searchedPaths;
//
// QString fileNameCandidate =
// RimTools::relocateFile( m_fileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
// if ( foundFile )
// {
// m_fileName = fileNameCandidate;
// }
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::pair<double, double>> RimWellLogFile::findMdAndChannelValuesForWellPath( const RimWellPath* wellPath,
const QString& channelName,
QString* unitString /*=nullptr*/ )
{
CVF_ASSERT( wellPath );
std::vector<RimWellLogFile*> wellLogFiles;
wellPath->descendantsIncludingThisOfType( wellLogFiles );
for ( RimWellLogFile* wellLogFile : wellLogFiles )
{
RigWellLogFile* fileData = wellLogFile->wellLogFileData();
std::vector<double> channelValues = fileData->values( channelName );
if ( !channelValues.empty() )
{
if ( unitString )
{
*unitString = fileData->wellLogChannelUnitString( channelName );
}
std::vector<double> depthValues = fileData->depthValues();
CVF_ASSERT( depthValues.size() == channelValues.size() );
std::vector<std::pair<double, double>> depthValuePairs;
for ( size_t i = 0; i < depthValues.size(); ++i )
{
depthValuePairs.push_back( std::make_pair( depthValues[i], channelValues[i] ) );
}
return depthValuePairs;
}
}
return std::vector<std::pair<double, double>>();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFile::setupBeforeSave()
{
m_wellFlowCondition.xmlCapability()->setIOWritable( hasFlowData() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFile::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_fileName );
uiOrdering.add( &m_date );
m_date.uiCapability()->setUiReadOnly( m_lasFileHasValidDate );
if ( !isDateValid( m_date() ) )
{
uiOrdering.add( &m_invalidDateMessage );
}
if ( hasFlowData() )
{
uiOrdering.add( &m_wellFlowCondition );
}
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFile::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &m_date )
{
// Due to a possible bug in QDateEdit/PdmUiDateEditor, convert m_date to a QDateTime having UTC timespec
m_date = RiaQDateTimeTools::createUtcDateTime( m_date().date(), m_date().time() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFile::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
caf::PdmUiDateEditorAttribute* attrib = dynamic_cast<caf::PdmUiDateEditorAttribute*>( attribute );
if ( attrib != nullptr )
{
attrib->dateFormat = RiaQDateTimeTools::dateFormatString();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogFile::isDateValid( const QDateTime dateTime )
{
return dateTime.isValid() && dateTime != DEFAULT_DATE_TIME;
}

View File

@@ -0,0 +1,103 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RigWellLogFile.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmProxyValueField.h"
#include <QDateTime>
class RimWellLogFileChannel;
class RimWellPath;
class QString;
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogFile : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
const static QDateTime DEFAULT_DATE_TIME;
public:
RimWellLogFile();
~RimWellLogFile() override;
static RimWellLogFile* 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 );
QString wellName() const;
QDateTime date() const;
RigWellLogFile* wellLogFileData() { return m_wellLogDataFile.p(); }
std::vector<RimWellLogFileChannel*> wellLogChannels() const;
bool hasFlowData() const;
enum WellFlowCondition
{
WELL_FLOW_COND_RESERVOIR,
WELL_FLOW_COND_STANDARD
};
RimWellLogFile::WellFlowCondition wellFlowRateCondition() const { return m_wellFlowCondition(); }
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
static std::vector<std::pair<double, double>> findMdAndChannelValuesForWellPath( const RimWellPath* wellPath,
const QString& channelName,
QString* unitString = nullptr );
private:
void setupBeforeSave() override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
caf::PdmFieldHandle* userDescriptionField() override { return &m_name; }
static bool isDateValid( const QDateTime dateTime );
caf::PdmChildArrayField<RimWellLogFileChannel*> m_wellLogChannelNames;
private:
cvf::ref<RigWellLogFile> 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;
caf::PdmField<caf::AppEnum<WellFlowCondition>> m_wellFlowCondition;
caf::PdmField<QString> m_invalidDateMessage;
};

View File

@@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RimWellLogFileChannel.h"
#include "RiaFieldHandleTools.h"
#include <QString>
CAF_PDM_SOURCE_INIT( RimWellLogFileChannel, "WellLogFileChannel" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileChannel::RimWellLogFileChannel()
{
CAF_PDM_InitObject( "Well Log File Channel", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_name, "Name", "", "", "", "" );
RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_name );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileChannel::setName( const QString& name )
{
m_name = name;
}

View File

@@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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"
class QString;
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogFileChannel : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogFileChannel();
void setName( const QString& name );
QString name() const { return m_name; }
caf::PdmFieldHandle* userDescriptionField() override { return &m_name; }
private:
caf::PdmField<QString> m_name;
};

View File

@@ -0,0 +1,463 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RimWellLogFileCurve.h"
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RigWellLogCurveData.h"
#include "RigWellPath.h"
#include "RimProject.h"
#include "RimTools.h"
#include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPlotTools.h"
#include "RimWellRftPlot.h"
#include "RiuQwtPlotCurve.h"
#include "RiuQwtPlotWidget.h"
#include "cafPdmUiTreeOrdering.h"
#include <QFileInfo>
CAF_PDM_SOURCE_INIT( RimWellLogFileCurve, "WellLogFileCurve" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileCurve::RimWellLogFileCurve()
{
CAF_PDM_InitObject( "Well Log File Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Path", "", "", "" );
m_wellPath.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitFieldNoDefault( &m_wellLogChannelName, "CurveWellLogChannel", "Well Log Channel", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellLogFile, "WellLogFile", "Well Log File", "", "", "" );
m_wellPath = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileCurve::~RimWellLogFileCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
if ( isCurveVisible() )
{
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType( wellLogPlot );
CVF_ASSERT( wellLogPlot );
if ( m_wellPath && m_wellLogFile )
{
RigWellLogFile* wellLogFile = m_wellLogFile->wellLogFileData();
if ( wellLogFile )
{
std::vector<double> values = wellLogFile->values( m_wellLogChannelName );
std::vector<double> measuredDepthValues = wellLogFile->depthValues();
std::vector<double> tvdMslValues = wellLogFile->tvdMslValues();
std::vector<double> tvdRkbValues = wellLogFile->tvdRkbValues();
bool rkbDiff = m_wellPath->wellPathGeometry() ? m_wellPath->wellPathGeometry()->rkbDiff() : 0.0;
if ( tvdMslValues.size() != values.size() )
{
RigWellPath* rigWellPath = m_wellPath->wellPathGeometry();
if ( rigWellPath )
{
tvdMslValues.clear();
for ( double measuredDepthValue : measuredDepthValues )
{
tvdMslValues.push_back( -rigWellPath->interpolatedPointAlongWellPath( measuredDepthValue ).z() );
}
}
}
if ( tvdRkbValues.size() != values.size() )
{
RigWellPath* rigWellPath = m_wellPath->wellPathGeometry();
if ( rigWellPath )
{
tvdRkbValues.clear();
for ( double measuredDepthValue : measuredDepthValues )
{
tvdRkbValues.push_back( -rigWellPath->interpolatedPointAlongWellPath( measuredDepthValue ).z() +
m_wellPath->wellPathGeometry()->rkbDiff() );
}
}
}
std::map<RiaDefines::DepthTypeEnum, std::vector<double>> validDepths;
if ( values.size() == measuredDepthValues.size() )
{
validDepths.insert( std::make_pair( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, measuredDepthValues ) );
}
if ( values.size() == tvdMslValues.size() )
{
validDepths.insert( std::make_pair( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, tvdMslValues ) );
}
if ( values.size() == tvdRkbValues.size() )
{
validDepths.insert( std::make_pair( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB, tvdRkbValues ) );
}
this->setValuesAndDepths( values, validDepths, rkbDiff, wellLogFile->depthUnit(), false );
QString errMsg;
if ( wellLogPlot && !this->curveData()->availableDepthTypes().count( wellLogPlot->depthType() ) )
{
QString depthTitle = wellLogPlot->depthAxisTitle();
errMsg = QString( "Display of %1 for LAS curves is not possible without %2 "
"values in the LAS-file or a well path to derive them from." )
.arg( depthTitle )
.arg( depthTitle );
}
bool showWarning = !RiaPreferences::current()->showLasCurveWithoutTvdWarning();
if ( !errMsg.isEmpty() && showWarning )
{
QString tmp = QString( "The LAS curve can not be displayed.\n%1\n" ).arg( errMsg );
tmp += "Control display of this warning from \"Preferences->Show LAS curve without TVD "
"warning\"";
RiaLogging::errorInMessageBox( nullptr, "LAS curve without current depth type", tmp );
}
}
if ( m_isUsingAutoName )
{
m_qwtPlotCurve->setTitle( createCurveAutoName() );
}
}
RiaDefines::DepthUnitType displayUnit = RiaDefines::DepthUnitType::UNIT_METER;
if ( wellLogPlot )
{
displayUnit = wellLogPlot->depthUnit();
}
RiaDefines::DepthTypeEnum depthType = RiaDefines::DepthTypeEnum::MEASURED_DEPTH;
if ( wellLogPlot && this->curveData()->availableDepthTypes().count( wellLogPlot->depthType() ) )
{
depthType = wellLogPlot->depthType();
}
m_qwtPlotCurve->setSamples( this->curveData()->xPlotValues().data(),
this->curveData()->depthPlotValues( depthType, displayUnit ).data(),
static_cast<int>( this->curveData()->xPlotValues().size() ) );
m_qwtPlotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );
if ( updateParentPlot )
{
updateZoomInParentPlot();
}
if ( m_parentQwtPlot )
{
m_parentQwtPlot->replot();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::setWellPath( RimWellPath* wellPath )
{
m_wellPath = wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RimWellLogFileCurve::wellPath() const
{
return m_wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::setWellLogChannelName( const QString& name )
{
m_wellLogChannelName = name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::setWellLogFile( RimWellLogFile* wellLogFile )
{
m_wellLogFile = wellLogFile;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_wellPath )
{
this->loadDataAndUpdate( true );
}
else if ( changedField == &m_wellLogChannelName )
{
this->loadDataAndUpdate( true );
}
else if ( changedField == &m_wellLogFile )
{
this->loadDataAndUpdate( true );
}
if ( m_parentQwtPlot ) m_parentQwtPlot->replot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimPlotCurve::updateOptionSensitivity();
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
curveDataGroup->add( &m_wellPath );
curveDataGroup->add( &m_wellLogFile );
curveDataGroup->add( &m_wellLogChannelName );
caf::PdmUiGroup* stackingGroup = uiOrdering.addNewGroup( "Stacking" );
RimStackablePlotCurve::stackingUiOrdering( *stackingGroup );
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
nameGroup->add( &m_showLegend );
RimPlotCurve::curveNameUiOrdering( *nameGroup );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
{
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellLogFileCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
if ( options.size() > 0 ) return options;
if ( fieldNeedingOptions == &m_wellPath )
{
auto wellPathColl = RimTools::wellPathCollection();
if ( wellPathColl )
{
for ( auto wellPath : wellPathColl->allWellPaths() )
{
// Only include well paths coming from a well log file
if ( wellPath->wellLogFiles().size() > 0 )
{
options.push_back( caf::PdmOptionItemInfo( wellPath->name(), wellPath ) );
}
}
if ( options.size() > 0 )
{
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
}
}
if ( fieldNeedingOptions == &m_wellLogChannelName )
{
if ( m_wellPath() )
{
if ( m_wellLogFile )
{
std::vector<RimWellLogFileChannel*> fileLogs = m_wellLogFile->wellLogChannels();
for ( size_t i = 0; i < fileLogs.size(); i++ )
{
QString wellLogChannelName = fileLogs[i]->name();
options.push_back( caf::PdmOptionItemInfo( wellLogChannelName, wellLogChannelName ) );
}
}
}
if ( options.size() == 0 )
{
options.push_back( caf::PdmOptionItemInfo( "None", "None" ) );
}
}
if ( fieldNeedingOptions == &m_wellLogFile )
{
if ( m_wellPath() && m_wellPath->wellLogFiles().size() > 0 )
{
for ( RimWellLogFile* const wellLogFile : m_wellPath->wellLogFiles() )
{
QFileInfo fileInfo( wellLogFile->fileName() );
options.push_back( caf::PdmOptionItemInfo( fileInfo.baseName(), wellLogFile ) );
}
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::initAfterRead()
{
if ( !m_wellPath ) return;
if ( m_wellPath->wellLogFiles().size() == 1 )
{
m_wellLogFile = m_wellPath->wellLogFiles().front();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogFileCurve::isRftPlotChild() const
{
RimWellRftPlot* rftPlot;
firstAncestorOrThisOfType( rftPlot );
return rftPlot != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogFileCurve::createCurveAutoName()
{
QStringList name;
QString unit;
bool channelNameAvailable = false;
if ( m_wellPath )
{
name.push_back( wellName() );
name.push_back( "LAS" );
if ( !m_wellLogChannelName().isEmpty() )
{
name.push_back( m_wellLogChannelName );
channelNameAvailable = true;
}
RigWellLogFile* wellLogFile = m_wellLogFile ? m_wellLogFile->wellLogFileData() : nullptr;
if ( wellLogFile )
{
if ( channelNameAvailable )
{
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType( wellLogPlot );
CVF_ASSERT( wellLogPlot );
QString unitName = wellLogFile->wellLogChannelUnitString( m_wellLogChannelName, wellLogPlot->depthUnit() );
if ( !unitName.isEmpty() )
{
name.back() += QString( " [%1]" ).arg( unitName );
}
}
QString date = wellLogFile->date();
if ( !date.isEmpty() )
{
name.push_back( wellLogFile->date() );
}
}
return name.join( ", " );
}
return "Empty curve";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogFileCurve::wellLogChannelUiName() const
{
return m_wellLogChannelName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogFileCurve::wellLogChannelUnits() const
{
if ( m_wellLogFile && m_wellLogFile->wellLogFileData() )
{
return m_wellLogFile->wellLogFileData()->wellLogChannelUnitString( m_wellLogChannelName );
}
return RiaWellLogUnitTools<double>::noUnitString();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFile* RimWellLogFileCurve::wellLogFile() const
{
return m_wellLogFile();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogFileCurve::wellName() const
{
if ( m_wellPath )
{
return m_wellPath->name();
}
return QString( "" );
}

View File

@@ -0,0 +1,77 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RimWellLogCurve.h"
#include "cafPdmField.h"
#include "cafPdmPtrField.h"
#include <vector>
class RimWellPath;
class RimWellLogFileChannel;
class RimWellLogFile;
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogFileCurve : public RimWellLogCurve
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogFileCurve();
~RimWellLogFileCurve() override;
void setWellPath( RimWellPath* wellPath );
RimWellPath* wellPath() const;
void setWellLogChannelName( const QString& name );
void setWellLogFile( RimWellLogFile* wellLogFile );
// Overrides from RimWellLogPlotCurve
QString wellName() const override;
QString wellLogChannelUiName() const override;
QString wellLogChannelUnits() const override;
RimWellLogFile* wellLogFile() const;
protected:
// Overrides from RimWellLogPlotCurve
QString createCurveAutoName() override;
void onLoadDataAndUpdate( bool updateParentPlot ) override;
// Pdm overrrides
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;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void initAfterRead() override;
bool isRftPlotChild() const;
protected:
caf::PdmPtrField<RimWellPath*> m_wellPath;
caf::PdmPtrField<RimWellLogFile*> m_wellLogFile;
caf::PdmField<QString> m_wellLogChannelName;
caf::PdmField<QString> m_wellLogChannnelUnit;
};

View File

@@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "RimWellLogFileCurveNameConfig.h"
//==================================================================================================
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT( RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConfig" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileCurveNameConfig::RimWellLogFileCurveNameConfig()
: RimNameConfig( "Las Curve" )
{
CAF_PDM_InitObject( "Well Log File Curve Name Generator", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurveNameConfig::doEnableAllAutoNameTags( bool enable )
{
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "RimNameConfig.h"
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogFileCurveNameConfig : public RimNameConfig
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogFileCurveNameConfig();
private:
void doEnableAllAutoNameTags( bool enable ) override;
};

View File

@@ -0,0 +1,81 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RimWellLogPlot.h"
#include "RigWellLogCurveData.h"
#include "RigWellPath.h"
#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
#include "RimPlot.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogCurve.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogTrack.h"
#include "RiuMultiPlotPage.h"
#include "RiuPlotMainWindow.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuQwtPlotWidget.h"
#include "RiuWellLogPlot.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiDoubleValueEditor.h"
#include "cvfAssert.h"
#include <QKeyEvent>
#include <cmath>
#define RI_LOGPLOT_MINDEPTH_DEFAULT 0.0
#define RI_LOGPLOT_MAXDEPTH_DEFAULT 1000.0
CAF_PDM_SOURCE_INIT( RimWellLogPlot, "WellLogPlot" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot::RimWellLogPlot()
{
CAF_PDM_InitScriptableObject( "Well Log Plot",
":/WellLogPlot16x16.png",
"",
"A Well Log Plot With a shared Depth Axis and Multiple Tracks" );
setDeletable( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot::~RimWellLogPlot()
{
}
//--------------------------------------------------------------------------------------------------
/// Move-assignment operator. Argument has to be passed with std::move()
//--------------------------------------------------------------------------------------------------
RimWellLogPlot& RimWellLogPlot::operator=( RimWellLogPlot&& rhs )
{
RimDepthTrackPlot::operator=( std::move( rhs ) );
return *this;
}

View File

@@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "cafPdmObject.h"
#include "RimDepthTrackPlot.h"
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogPlot : public RimDepthTrackPlot
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogPlot();
~RimWellLogPlot() override;
RimWellLogPlot& operator=( RimWellLogPlot&& rhs );
};

View File

@@ -0,0 +1,265 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RimWellLogPlotCollection.h"
#include "RiaGuiApplication.h"
#include "RiuPlotMainWindow.h"
#include "RigEclipseWellLogExtractor.h"
#include "RigGeoMechCaseData.h"
#include "RigGeoMechWellLogExtractor.h"
#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
#include "RimProject.h"
#include "RimWellLogPlot.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cvfAssert.h"
CAF_PDM_SOURCE_INIT( RimWellLogPlotCollection, "WellLogPlotCollection" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotCollection::RimWellLogPlotCollection()
{
CAF_PDM_InitScriptableObject( "Well Log Plots", ":/WellLogPlots16x16.png", "", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_wellLogPlots, "WellLogPlots", "", "", "", "" );
m_wellLogPlots.uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotCollection::~RimWellLogPlotCollection()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateSimWellExtractor( const QString& simWellName,
const QString& caseUserDescription,
const RigWellPath* wellPathGeometry,
const RigEclipseCaseData* eclCaseData )
{
if ( !( wellPathGeometry && eclCaseData ) ) return nullptr;
for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx )
{
if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathGeometry() == wellPathGeometry )
{
return m_extractors[exIdx].p();
}
}
std::string errorIdName = ( simWellName + " " + caseUserDescription ).toStdString();
cvf::ref<RigEclipseWellLogExtractor> extractor =
new RigEclipseWellLogExtractor( eclCaseData, wellPathGeometry, errorIdName );
m_extractors.push_back( extractor.p() );
return extractor.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( RimWellPath* wellPath, RimEclipseCase* eclCase )
{
if ( !( wellPath && eclCase ) ) return nullptr;
RigEclipseCaseData* eclCaseData = eclCase->eclipseCaseData();
auto wellPathGeometry = wellPath->wellPathGeometry();
if ( !( eclCaseData && wellPathGeometry ) ) return nullptr;
for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx )
{
if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathGeometry() == wellPathGeometry )
{
return m_extractors[exIdx].p();
}
}
std::string errorIdName = ( wellPath->name() + " " + eclCase->caseUserDescription() ).toStdString();
cvf::ref<RigEclipseWellLogExtractor> extractor =
new RigEclipseWellLogExtractor( eclCaseData, wellPathGeometry, errorIdName );
m_extractors.push_back( extractor.p() );
return extractor.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( RimWellPath* wellPath,
RimGeoMechCase* geoMechCase )
{
if ( !( wellPath && geoMechCase ) ) return nullptr;
RigGeoMechCaseData* caseData = geoMechCase->geoMechData();
auto wellPathGeometry = wellPath->wellPathGeometry();
if ( !( caseData && wellPathGeometry ) ) return nullptr;
for ( size_t exIdx = 0; exIdx < m_geomExtractors.size(); ++exIdx )
{
if ( m_geomExtractors[exIdx]->caseData() == caseData &&
m_geomExtractors[exIdx]->wellPathGeometry() == wellPathGeometry )
{
return m_geomExtractors[exIdx].p();
}
}
std::string errorIdName = ( wellPath->name() + " " + geoMechCase->caseUserDescription() ).toStdString();
cvf::ref<RigGeoMechWellLogExtractor> extractor =
new RigGeoMechWellLogExtractor( caseData, wellPathGeometry, errorIdName );
m_geomExtractors.push_back( extractor.p() );
return extractor.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogPlot*> RimWellLogPlotCollection::wellLogPlots() const
{
return m_wellLogPlots.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::addWellLogPlot( gsl::not_null<RimWellLogPlot*> wellLogPlot )
{
m_wellLogPlots.push_back( wellLogPlot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::deleteAllPlots()
{
m_wellLogPlots.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::loadDataAndUpdateAllPlots()
{
for ( const auto& w : m_wellLogPlots() )
{
w->loadDataAndUpdate();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::deleteAllExtractors()
{
m_extractors.clear();
m_geomExtractors.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::removeExtractors( const RigWellPath* wellPathGeometry )
{
for ( int eIdx = (int)m_extractors.size() - 1; eIdx >= 0; eIdx-- )
{
if ( m_extractors[eIdx]->wellPathGeometry() == wellPathGeometry )
{
m_extractors.eraseAt( eIdx );
}
}
for ( int eIdx = (int)m_geomExtractors.size() - 1; eIdx >= 0; eIdx-- )
{
if ( m_geomExtractors[eIdx]->wellPathGeometry() == wellPathGeometry )
{
m_geomExtractors.eraseAt( eIdx );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::removeExtractors( const RigEclipseCaseData* caseData )
{
for ( int eIdx = (int)m_extractors.size() - 1; eIdx >= 0; eIdx-- )
{
if ( m_extractors[eIdx]->caseData() == caseData )
{
m_extractors.eraseAt( eIdx );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::removeExtractors( const RigGeoMechCaseData* caseData )
{
for ( int eIdx = (int)m_geomExtractors.size() - 1; eIdx >= 0; eIdx-- )
{
if ( m_geomExtractors[eIdx]->caseData() == caseData )
{
m_geomExtractors.eraseAt( eIdx );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects )
{
// Make sure the plot collection disappears with the last plot
if ( m_wellLogPlots().empty() )
{
RimProject* project = RimProject::current();
if ( project )
{
project->updateConnectedEditors();
}
}
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
mainPlotWindow->updateWellLogPlotToolBar();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimWellLogPlotCollection::plotCount() const
{
return m_wellLogPlots.size();
}

View File

@@ -0,0 +1,79 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RimAbstractPlotCollection.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cvfCollection.h"
#include <gsl/gsl>
class RimWellLogPlot;
class RigEclipseWellLogExtractor;
class RigGeoMechWellLogExtractor;
class RimGeoMechCase;
class RigEclipseCaseData;
class RigGeoMechCaseData;
class RigWellPath;
class RimWellPath;
class RimEclipseCase;
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogPlotCollection : public caf::PdmObject, public RimPlotCollection
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogPlotCollection();
~RimWellLogPlotCollection() override;
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( const QString& simWellName,
const QString& caseUserDescription,
const RigWellPath* wellPathGeometry,
const RigEclipseCaseData* eclCaseData );
RigEclipseWellLogExtractor* findOrCreateExtractor( RimWellPath* wellPath, RimEclipseCase* eclCase );
RigGeoMechWellLogExtractor* findOrCreateExtractor( RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
std::vector<RimWellLogPlot*> wellLogPlots() const;
void addWellLogPlot( gsl::not_null<RimWellLogPlot*> wellLogPlot );
void deleteAllPlots() override;
void loadDataAndUpdateAllPlots() override;
size_t plotCount() const override;
void deleteAllExtractors();
void removeExtractors( const RigWellPath* wellPathGeometry );
void removeExtractors( const RigEclipseCaseData* caseData );
void removeExtractors( const RigGeoMechCaseData* caseData );
private:
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
caf::PdmChildArrayField<RimWellLogPlot*> m_wellLogPlots;
cvf::Collection<RigEclipseWellLogExtractor> m_extractors;
cvf::Collection<RigGeoMechWellLogExtractor> m_geomExtractors;
};

View File

@@ -0,0 +1,135 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "RimWellLogPlotNameConfig.h"
//==================================================================================================
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT( RimWellLogPlotNameConfig, "RimWellLogPlotNameConfig" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotNameConfig::RimWellLogPlotNameConfig()
: RimNameConfig( "Well Log Plot" )
{
CAF_PDM_InitObject( "Well Log Plot Name Generator", "", "", "" );
CAF_PDM_InitField( &m_addCaseName, "AddCaseName", false, "Show Case Name", "", "", "" );
CAF_PDM_InitField( &m_addWellName, "AddWellName", false, "Show Well Name", "", "", "" );
CAF_PDM_InitField( &m_addTimestep, "AddTimeStep", false, "Show Time Step", "", "", "" );
CAF_PDM_InitField( &m_addAirGap, "AddAirGap", false, "Show Air Gap", "", "", "" );
CAF_PDM_InitField( &m_addWaterDepth, "AddWaterDepth", false, "Show Water Depth", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotNameConfig::addCaseName() const
{
return m_addCaseName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotNameConfig::addWellName() const
{
return m_addWellName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotNameConfig::addTimeStep() const
{
return m_addTimestep();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotNameConfig::addAirGap() const
{
return m_addAirGap();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotNameConfig::addWaterDepth() const
{
return m_addWaterDepth();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotNameConfig::setAutoNameTags( bool addCaseName,
bool addWellName,
bool addTimeStep,
bool addAirGap,
bool addWaterDepth )
{
m_addCaseName = addCaseName;
m_addWellName = addWellName;
m_addTimestep = addTimeStep;
m_addAirGap = addAirGap;
m_addWaterDepth = addWaterDepth;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotNameConfig::setFieldVisibility( bool caseNameVisible,
bool wellNameVisible,
bool timeStepVisible,
bool airGapVisible,
bool waterDepthVisible )
{
m_addCaseName.uiCapability()->setUiHidden( !caseNameVisible );
m_addWellName.uiCapability()->setUiHidden( !wellNameVisible );
m_addTimestep.uiCapability()->setUiHidden( !timeStepVisible );
m_addAirGap.uiCapability()->setUiHidden( !airGapVisible );
m_addWaterDepth.uiCapability()->setUiHidden( !waterDepthVisible );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotNameConfig::doEnableAllAutoNameTags( bool enable )
{
setAutoNameTags( enable, enable, enable, enable, enable );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering );
uiOrdering.add( &m_addCaseName );
uiOrdering.add( &m_addWellName );
uiOrdering.add( &m_addTimestep );
uiOrdering.add( &m_addAirGap );
uiOrdering.add( &m_addWaterDepth );
}

View File

@@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "RimNameConfig.h"
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogPlotNameConfig : public RimNameConfig
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogPlotNameConfig();
bool addCaseName() const;
bool addWellName() const;
bool addTimeStep() const;
bool addAirGap() const;
bool addWaterDepth() const;
void setAutoNameTags( bool addCaseName, bool addWellName, bool addTimeStep, bool addAirGap, bool addWaterDepth );
void setFieldVisibility( bool caseNameVisible,
bool wellNameVisible,
bool timeStepVisible,
bool airGapVisible,
bool waterDepthVisible );
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
void doEnableAllAutoNameTags( bool enable ) override;
private:
caf::PdmField<bool> m_addCaseName;
caf::PdmField<bool> m_addWellName;
caf::PdmField<bool> m_addTimestep;
caf::PdmField<bool> m_addAirGap;
caf::PdmField<bool> m_addWaterDepth;
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,129 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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 "RimWellLogCurve.h"
#include "RifEclipseRftAddress.h"
#include "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmPtrField.h"
#include "cvfObject.h"
#include <map>
class RifReaderRftInterface;
class RigEclipseWellLogExtractor;
class RimEclipseResultCase;
class RimObservedFmuRftData;
class RimSummaryCase;
class RimSummaryCaseCollection;
class RimWellPath;
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogRftCurve : public RimWellLogCurve
{
CAF_PDM_HEADER_INIT;
public:
enum DerivedMDSource
{
NO_SOURCE,
WELL_PATH,
OBSERVED_DATA
};
public:
RimWellLogRftCurve();
~RimWellLogRftCurve() override;
QString wellName() const override;
QString wellLogChannelUiName() const override;
QString wellLogChannelUnits() const override;
void setEclipseResultCase( RimEclipseResultCase* eclipseResultCase );
RimEclipseResultCase* eclipseResultCase() const;
void setSummaryCase( RimSummaryCase* summaryCase );
RimSummaryCase* summaryCase() const;
void setEnsemble( RimSummaryCaseCollection* ensemble );
RimSummaryCaseCollection* ensemble() const;
void setObservedFmuRftData( RimObservedFmuRftData* observedFmuRftData );
RimObservedFmuRftData* observedFmuRftData() const;
void setRftAddress( RifEclipseRftAddress address );
RifEclipseRftAddress rftAddress() const;
void setDefaultAddress( QString wellName );
void updateWellChannelNameAndTimeStep();
void setSimWellBranchData( bool branchDetection, int branchIndex );
protected:
// Overrides from RimWellLogPlotCurve
QString createCurveAutoName() override;
void onLoadDataAndUpdate( bool updateParentPlot ) override;
// Pdm overrrides
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
std::vector<QString> perPointLabels() const;
private:
RifReaderRftInterface* rftReader() const;
RigEclipseWellLogExtractor* extractor();
bool createWellPathIdxToRftFileIdxMapping();
size_t rftFileIndex( size_t wellPathIndex );
std::vector<size_t> sortedIndicesInRftFile();
std::vector<double> xValues();
std::vector<double> errorValues();
std::vector<double> tvDepthValues();
std::vector<double> measuredDepthValues();
bool deriveMeasuredDepthValuesFromWellPath( const std::vector<double>& tvDepthValues,
std::vector<double>& derivedMDValues );
bool deriveMeasuredDepthFromObservedData( const std::vector<double>& tvDepthValues,
std::vector<double>& derivedMDValues );
private:
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase;
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble;
caf::PdmPtrField<RimObservedFmuRftData*> m_observedFmuRftData;
caf::PdmField<QDateTime> m_timeStep;
caf::PdmField<QString> m_wellName;
caf::PdmField<int> m_branchIndex;
caf::PdmField<bool> m_branchDetection;
std::map<size_t, size_t> m_idxInWellPathToIdxInRftFile;
caf::PdmField<caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>> m_wellLogChannelName;
};

View File

@@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "RimWellLogRftCurveNameConfig.h"
//==================================================================================================
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT( RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameConfig" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogRftCurveNameConfig::RimWellLogRftCurveNameConfig()
: RimNameConfig( "Rft Curve" )
{
CAF_PDM_InitObject( "Well Log Rft Curve Name Generator", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogRftCurveNameConfig::doEnableAllAutoNameTags( bool enable )
{
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "RimNameConfig.h"
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogRftCurveNameConfig : public RimNameConfig
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogRftCurveNameConfig();
private:
void doEnableAllAutoNameTags( bool enable ) override;
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,366 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RimWellLogPlot.h"
#include "RigWellPathFormations.h"
#include "RiuPlotAnnotationTool.h"
#include "RimPlot.h"
#include "RimRegularLegendConfig.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "qwt_plot.h"
#include <QPointer>
#include <map>
#include <memory>
#include <vector>
class RigWellPath;
class RimCase;
class RimWellPathAttributeCollection;
class RimWellFlowRateCurve;
class RimWellLogCurve;
class RimWellPath;
class RimDepthTrackPlot;
class RiuWellPathComponentPlotItem;
class RiuWellLogTrack;
class RigEclipseWellLogExtractor;
class RimWellLogPlotCollection;
class RigGeoMechWellLogExtractor;
class RigResultAccessor;
class RigFemResultAddress;
class RigWellLogExtractor;
class RimEclipseResultDefinition;
class RimColorLegend;
class RimEnsembleWellLogCurveSet;
class QwtPlotCurve;
struct CurveSamplingPointData
{
std::vector<double> data;
std::vector<double> md;
std::vector<double> tvd;
double rkbDiff;
};
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogTrack : public RimPlot
{
CAF_PDM_HEADER_INIT;
public:
enum TrajectoryType
{
WELL_PATH,
SIMULATION_WELL
};
enum FormationSource
{
CASE,
WELL_PICK_FILTER
};
using RegionAnnotationTypeEnum = caf::AppEnum<RiuPlotAnnotationTool::RegionAnnotationType>;
using RegionAnnotationDisplayEnum = caf::AppEnum<RiuPlotAnnotationTool::RegionDisplay>;
public:
RimWellLogTrack();
~RimWellLogTrack() override;
QWidget* viewWidget() override;
RiuQwtPlotWidget* viewer() override;
QImage snapshotWindowContent() override;
void zoomAll() override;
QString description() const override;
void setDescription( const QString& description );
void addCurve( RimWellLogCurve* curve );
void insertCurve( RimWellLogCurve* curve, size_t index );
void removeCurve( RimWellLogCurve* curve );
void deleteAllCurves();
size_t curveIndex( RimWellLogCurve* curve );
size_t curveCount() { return m_curves.size(); }
void setXAxisTitle( const QString& text );
QString yAxisTitle() const;
void setFormationWellPath( RimWellPath* wellPath );
RimWellPath* formationWellPath() const;
void setFormationSimWellName( const QString& simWellName );
QString formationSimWellName() const;
void setFormationBranchDetection( bool branchDetection );
bool formationBranchDetection() const;
void setFormationBranchIndex( int branchIndex );
int formationBranchIndex() const;
void setFormationCase( RimCase* rimCase );
RimCase* formationNamesCase() const;
void setFormationTrajectoryType( TrajectoryType trajectoryType );
TrajectoryType formationTrajectoryType() const;
void setRegionPropertyResultType( RiaDefines::ResultCatType resultCatType, const QString& resultVariable );
void detachAllCurves() override;
void reattachAllCurves() override;
void setAndUpdateWellPathFormationNamesData( RimCase* rimCase, RimWellPath* wellPath );
void setAndUpdateSimWellFormationNamesAndBranchData( RimCase* rimCase,
const QString& simWellName,
int branchIndex,
bool useBranchDetection );
void setAndUpdateSimWellFormationNamesData( RimCase* rimCase, const QString& simWellName );
void setAutoScaleXEnabled( bool enabled ) override;
void setAutoScaleYEnabled( bool enabled ) override;
void setAutoScaleXIfNecessary();
void availableXAxisRange( double* minX, double* maxX );
void availableDepthRange( double* minimumDepth, double* maximumDepth );
void visibleXAxisRange( double* minX, double* maxX );
void visibleDepthRange( double* minimumDepth, double* maximumDepth );
void setVisibleXRange( double minValue, double maxValue );
void setVisibleYRange( double minValue, double maxValue );
void updateZoomInQwt() override;
void updateZoomFromQwt() override;
void updateParentPlotZoom();
void updateEditors();
void setTickIntervals( double majorTickInterval, double minorTickInterval );
void setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility gridLines );
void setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType annotationType );
void setAnnotationDisplay( RiuPlotAnnotationTool::RegionDisplay annotationDisplay );
void setAnnotationTransparency( int percent );
void setColorShadingLegend( RimColorLegend* colorLegend );
RiuPlotAnnotationTool::RegionAnnotationType annotationType() const;
RiuPlotAnnotationTool::RegionDisplay annotationDisplay() const;
bool showFormations() const;
void setShowRegionLabels( bool on );
bool showWellPathAttributes() const;
void setShowWellPathAttributes( bool on );
void setShowWellPathAttributesInLegend( bool on );
void setShowWellPathCompletionsInLegend( bool on );
void setShowBothSidesOfWell( bool on );
void setWellPathAttributesSource( RimWellPath* wellPath );
void setOverburdenHeight( double overburdenHeight );
void setUnderburdenHeight( double underburdenHeight );
RimWellPath* wellPathAttributeSource() const;
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
void setLogarithmicScale( bool enable );
bool isLogarithmicScale() const;
std::map<int, std::vector<RimWellLogCurve*>> visibleStackedCurves();
std::vector<RimWellLogCurve*> curves() const;
std::vector<RimWellLogCurve*> visibleCurves() const;
void uiOrderingForRftPltFormations( caf::PdmUiOrdering& uiOrdering );
void uiOrderingForXAxisSettings( caf::PdmUiOrdering& uiOrdering );
void setFormationsForCaseWithSimWellOnly( bool caseWithSimWellOnly );
void updateXAxisAndGridTickIntervals();
void updateLegend() override;
QString asciiDataForPlotExport() const override;
void onAxisSelected( int axis, bool toggle ) override;
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
void updateAxes() override;
static CurveSamplingPointData curveSamplingPointData( RigEclipseWellLogExtractor* extractor,
RigResultAccessor* resultAccessor );
static CurveSamplingPointData curveSamplingPointData( RigGeoMechWellLogExtractor* extractor,
const RigFemResultAddress& resultAddress );
static void findRegionNamesToPlot( const CurveSamplingPointData& curveData,
const std::vector<QString>& formationNamesVector,
RimWellLogPlot::DepthTypeEnum depthType,
std::vector<QString>* formationNamesToPlot,
std::vector<std::pair<double, double>>* yValues );
static std::vector<QString> formationNamesVector( RimCase* rimCase );
void updateStackedCurveData();
static void addOverburden( std::vector<QString>& namesVector, CurveSamplingPointData& curveData, double height );
static void addUnderburden( std::vector<QString>& namesVector, CurveSamplingPointData& curveData, double height );
void setCurvesTreeVisibility( bool isVisible );
void setEnsembleWellLogCurveSet( RimEnsembleWellLogCurveSet* curveSet );
protected:
// RimViewWindow overrides
void deleteViewWidget() override;
void onLoadDataAndUpdate() override;
private:
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
void cleanupBeforeClose();
void detachAllPlotItems();
void calculateXZoomRange();
void calculateYZoomRange();
void updateXZoom();
void updateYZoom();
int axisFontSize() const;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void curveDataChanged( const caf::SignalEmitter* emitter );
void curveVisibilityChanged( const caf::SignalEmitter* emitter, bool visible );
void curveAppearanceChanged( const caf::SignalEmitter* emitter );
void curveStackingChanged( const caf::SignalEmitter* emitter, bool stacked );
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void initAfterRead() override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
caf::PdmFieldHandle* userDescriptionField() override;
void computeAndSetXRangeMinForLogarithmicScale();
static void simWellOptionItems( QList<caf::PdmOptionItemInfo>* options, RimCase* eclCase );
static RigEclipseWellLogExtractor* createSimWellExtractor( RimWellLogPlotCollection* wellLogCollection,
RimCase* rimCase,
const QString& simWellName,
int branchIndex,
bool useBranchDetection );
void setFormationFieldsUiReadOnly( bool readOnly = true );
void updateRegionAnnotationsOnPlot();
void updateFormationNamesOnPlot();
void updateResultPropertyNamesOnPlot();
void updateCurveDataRegionsOnPlot();
void updateWellPathAttributesOnPlot();
void removeRegionAnnotations();
void updateAxisScaleEngine();
std::pair<double, double> adjustXRange( double minValue, double maxValue, double tickInterval );
void updateWellPathAttributesCollection();
RimDepthTrackPlot* parentWellLogPlot() const;
void handleWheelEvent( QWheelEvent* event ) override;
void doUpdateLayout() override;
std::vector<std::pair<double, double>> waterAndRockRegions( RiaDefines::DepthTypeEnum depthType,
const RigGeoMechWellLogExtractor* extractor ) const;
void connectCurveSignals( RimWellLogCurve* curve );
private:
QString m_xAxisTitle;
caf::PdmField<QString> m_description;
caf::PdmChildArrayField<RimWellLogCurve*> m_curves;
caf::PdmField<double> m_visibleXRangeMin;
caf::PdmField<double> m_visibleXRangeMax;
caf::PdmField<double> m_visibleDepthRangeMin;
caf::PdmField<double> m_visibleDepthRangeMax;
caf::PdmField<bool> m_isAutoScaleXEnabled;
caf::PdmField<bool> m_isLogarithmicScaleEnabled;
caf::PdmField<RimWellLogPlot::AxisGridEnum> m_xAxisGridVisibility;
caf::PdmField<bool> m_explicitTickIntervals;
caf::PdmField<double> m_majorTickInterval;
caf::PdmField<double> m_minorTickInterval;
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_axisFontSize;
caf::PdmField<RegionAnnotationTypeEnum> m_regionAnnotationType;
caf::PdmField<RegionAnnotationDisplayEnum> m_regionAnnotationDisplay;
caf::PdmPtrField<RimColorLegend*> m_colorShadingLegend;
caf::PdmField<int> m_colorShadingTransparency;
caf::PdmField<bool> m_showRegionLabels;
caf::PdmField<caf::AppEnum<FormationSource>> m_formationSource;
caf::PdmPtrField<RimCase*> m_formationCase;
caf::PdmField<caf::AppEnum<TrajectoryType>> m_formationTrajectoryType;
caf::PdmPtrField<RimWellPath*> m_formationWellPathForSourceCase;
caf::PdmPtrField<RimWellPath*> m_formationWellPathForSourceWellPath;
caf::PdmField<QString> m_formationSimWellName;
caf::PdmField<int> m_formationBranchIndex;
caf::PdmField<caf::AppEnum<RigWellPathFormations::FormationLevel>> m_formationLevel;
caf::PdmField<bool> m_showformationFluids;
caf::PdmField<bool> m_formationBranchDetection;
caf::PdmField<bool> m_showWellPathAttributes;
caf::PdmField<bool> m_showWellPathCompletions;
caf::PdmField<bool> m_showWellPathComponentsBothSides;
caf::PdmField<bool> m_showWellPathComponentLabels;
caf::PdmField<bool> m_wellPathAttributesInLegend;
caf::PdmField<bool> m_wellPathCompletionsInLegend;
caf::PdmPtrField<RimWellPath*> m_wellPathComponentSource;
caf::PdmPtrField<RimWellPathAttributeCollection*> m_wellPathAttributeCollection;
caf::PdmChildField<RimEclipseResultDefinition*> m_resultDefinition;
caf::PdmField<double> m_overburdenHeight;
caf::PdmField<double> m_underburdenHeight;
caf::PdmChildField<RimEnsembleWellLogCurveSet*> m_ensembleWellLogCurveSet;
std::vector<std::unique_ptr<RiuWellPathComponentPlotItem>> m_wellPathAttributePlotObjects;
bool m_formationsForCaseWithSimWellOnly;
QPointer<RiuWellLogTrack> m_plotWidget;
std::unique_ptr<RiuPlotAnnotationTool> m_annotationTool;
double m_availableXRangeMin;
double m_availableXRangeMax;
double m_availableDepthRangeMin;
double m_availableDepthRangeMax;
};

View File

@@ -0,0 +1,86 @@
#include "RimWellLogWbsCurve.h"
//==================================================================================================
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT( RimWellLogWbsCurve, "RimWellLogWbsCurve" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogWbsCurve::RimWellLogWbsCurve()
{
CAF_PDM_InitObject( "Well Bore Stability Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" );
CAF_PDM_InitField( &m_smoothCurve, "SmoothCurve", false, "Smooth Curve", "", "", "" );
CAF_PDM_InitField( &m_smoothingThreshold, "SmoothingThreshold", 0.002, "Smoothing Threshold", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogWbsCurve::smoothCurve() const
{
return m_smoothCurve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellLogWbsCurve::smoothingThreshold() const
{
return m_smoothingThreshold;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogWbsCurve::setSmoothCurve( bool smooth )
{
m_smoothCurve = smooth;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogWbsCurve::setSmoothingThreshold( double threshold )
{
m_smoothingThreshold = threshold;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogWbsCurve::performDataExtraction( bool* isUsingPseudoLength )
{
extractData( isUsingPseudoLength, m_smoothCurve(), m_smoothingThreshold() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogWbsCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimWellLogExtractionCurve::defineUiOrdering( uiConfigName, uiOrdering );
caf::PdmUiGroup* dataGroup = uiOrdering.findGroup( dataSourceGroupKeyword() );
dataGroup->add( &m_smoothCurve );
dataGroup->add( &m_smoothingThreshold );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogWbsCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimWellLogExtractionCurve::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_smoothCurve || changedField == &m_smoothingThreshold )
{
this->loadDataAndUpdate( true );
}
}

View File

@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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 "RimWellLogExtractionCurve.h"
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogWbsCurve : public RimWellLogExtractionCurve
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogWbsCurve();
bool smoothCurve() const;
double smoothingThreshold() const;
void setSmoothCurve( bool smooth );
void setSmoothingThreshold( double threshold );
protected:
void performDataExtraction( bool* isUsingPseudoLength ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
protected:
caf::PdmField<bool> m_smoothCurve;
caf::PdmField<double> m_smoothingThreshold;
};