mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-29 10:21:54 -06:00
Backup
This commit is contained in:
parent
058c6d9a35
commit
f4a904b227
@ -56,7 +56,8 @@ void RicNewWellLogPlotFeature::onActionTriggered( bool isChecked )
|
||||
RimWellLogExtractionCurve* curve = RicWellLogTools::addWellLogExtractionCurve( plotTrack, nullptr, nullptr, nullptr, nullptr, -1, true );
|
||||
curve->loadDataAndUpdate( true );
|
||||
RimWellLogPlot* plot = nullptr;
|
||||
plotTrack->firstAncestorOrThisOfTypeAsserted( plot );
|
||||
plotTrack->firstAncestorOrThisOfTypeAsserted(
|
||||
plot );
|
||||
plot->zoomAll();
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
|
@ -19,12 +19,19 @@
|
||||
#include "RimGeoMechFaultReactivationResult.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RicWellLogTools.h"
|
||||
#include "WellLogCommands/RicNewWellLogPlotFeatureImpl.h"
|
||||
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
#include "RimWellLogDiffCurve.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
|
||||
#include "RimOilField.h"
|
||||
@ -55,10 +62,10 @@ RimGeoMechFaultReactivationResult::RimGeoMechFaultReactivationResult()
|
||||
CAF_PDM_InitFieldNoDefault( &m_createFaultReactivationResult, "CreateReactivationResult", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &m_createFaultReactivationResult );
|
||||
|
||||
m_faceAWellPath = new RimModeledWellPath();
|
||||
m_faceAWellPath->setName( "Fault Face A Well" );
|
||||
m_faceBWellPath = new RimModeledWellPath();
|
||||
m_faceBWellPath->setName( "Fault Face B Well" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_faceAWellPath, "FaceAWellPath", "Face A Well Path" );
|
||||
m_faceAWellPath.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitFieldNoDefault( &m_faceBWellPath, "FaceBWellPath", "Face B Well Path" );
|
||||
m_faceBWellPath.uiCapability()->setUiHidden( true );
|
||||
|
||||
setDeletable( false );
|
||||
}
|
||||
@ -72,6 +79,12 @@ RimGeoMechFaultReactivationResult::~RimGeoMechFaultReactivationResult()
|
||||
delete m_faceBWellPath;
|
||||
}
|
||||
|
||||
void RimGeoMechFaultReactivationResult::onLoadDataAndUpdate()
|
||||
{
|
||||
createWellGeometry();
|
||||
createWellLogCurves();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -105,6 +118,8 @@ void RimGeoMechFaultReactivationResult::defineUiOrdering( QString uiConfigName,
|
||||
group->add( &m_distanceFromIntersection );
|
||||
group->add( &m_widthOutsideIntersection );
|
||||
group->add( &m_createFaultReactivationResult );
|
||||
group->add( &m_faceAWellPath );
|
||||
group->add( &m_faceBWellPath );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -114,73 +129,13 @@ void RimGeoMechFaultReactivationResult::fieldChangedByUi( const caf::PdmFieldHan
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_distanceFromIntersection || changedField == &m_widthOutsideIntersection )
|
||||
{
|
||||
createWellGeometry();
|
||||
}
|
||||
if ( changedField == &m_createFaultReactivationResult && m_intersection() )
|
||||
{
|
||||
// TODO: Should set visibility of well paths unchecked (as of now it seems to be a protected/private functionality)
|
||||
|
||||
RimWellPathCollection* wellPathCollection = RimProject::current()->activeOilField()->wellPathCollection();
|
||||
if ( wellPathCollection )
|
||||
{
|
||||
const auto allWellPaths = wellPathCollection->allWellPaths();
|
||||
const auto faceAWellPathItr = std::find( allWellPaths.begin(), allWellPaths.end(), m_faceAWellPath );
|
||||
const auto faceBWellPathItr = std::find( allWellPaths.begin(), allWellPaths.end(), m_faceBWellPath );
|
||||
if ( faceAWellPathItr == allWellPaths.end() )
|
||||
{
|
||||
wellPathCollection->addWellPath( m_faceAWellPath );
|
||||
}
|
||||
if ( faceBWellPathItr == allWellPaths.end() )
|
||||
{
|
||||
wellPathCollection->addWellPath( m_faceBWellPath );
|
||||
}
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
|
||||
if ( !m_faceAWellPath->geometryDefinition() || !m_faceBWellPath->geometryDefinition() ) return;
|
||||
|
||||
// Delete the previous well path target values
|
||||
m_faceAWellPath->geometryDefinition()->deleteAllTargets();
|
||||
m_faceBWellPath->geometryDefinition()->deleteAllTargets();
|
||||
|
||||
// Using first two points from first polyline
|
||||
const auto polyLines = m_intersection()->polyLines();
|
||||
if ( polyLines.size() != 1 || polyLines[0].size() != 2 ) return;
|
||||
|
||||
const std::vector<cvf::Vec3d> wellPoints = { polyLines[0][0], polyLines[0][1] };
|
||||
|
||||
// Add well paths to internal storage?
|
||||
// Apply m_wellDistanceFromIntersection and m_wellWidthOutsideIntersection for adjustment of well paths
|
||||
// TODO:
|
||||
// - Apply m_wellWidthOutsideIntersection for adjustment of point a and b
|
||||
// - Check which cell point is in, then check which part this cell inn -> provide part as name for curves
|
||||
//
|
||||
// NOTES:
|
||||
// - No data for face B well path when creating well log extraction curves? Empty data in part 2-1?
|
||||
|
||||
// Create vector for well path defined by point a and b
|
||||
const cvf::Vec3d a = wellPoints[0];
|
||||
const cvf::Vec3d b = wellPoints[1];
|
||||
const cvf::Vec3d wellVector = b - a;
|
||||
|
||||
// Cross product off well path vector and z-axis. New vector must be normalized
|
||||
const cvf::Vec3d normVector = wellVector ^ cvf::Vector3<double>::Z_AXIS;
|
||||
const cvf::Vec3d distanceVector = m_distanceFromIntersection() * normVector.getNormalized();
|
||||
|
||||
// Get normalized vector along well to adjust point a and b outside of defined intersection
|
||||
const auto normalizedWellVector = wellVector.getNormalized();
|
||||
const cvf::Vec3d widthAdjustedA = a - ( normalizedWellVector * m_widthOutsideIntersection() );
|
||||
const cvf::Vec3d widthAdjustedB = b + ( normalizedWellVector * m_widthOutsideIntersection() );
|
||||
|
||||
const std::vector<cvf::Vec3d> newFaceAWellPoints = { widthAdjustedA + distanceVector, widthAdjustedB + distanceVector };
|
||||
const std::vector<cvf::Vec3d> newFaceBWellPoints = { widthAdjustedA - distanceVector, widthAdjustedB - distanceVector };
|
||||
|
||||
// Update the well paths
|
||||
m_faceAWellPath->geometryDefinition()->createAndInsertTargets( newFaceAWellPoints );
|
||||
m_faceBWellPath->geometryDefinition()->createAndInsertTargets( newFaceBWellPoints );
|
||||
m_faceAWellPath->geometryDefinition()->setUseAutoGeneratedTargetAtSeaLevel( false );
|
||||
m_faceBWellPath->geometryDefinition()->setUseAutoGeneratedTargetAtSeaLevel( false );
|
||||
m_faceAWellPath->createWellPathGeometry();
|
||||
m_faceBWellPath->createWellPathGeometry();
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,7 +151,126 @@ void RimGeoMechFaultReactivationResult::defineEditorAttribute( const caf::PdmFie
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
{
|
||||
attrib->m_buttonText = "Apply";
|
||||
attrib->m_buttonText = "Create Fault Reactivation Curves";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechFaultReactivationResult::createWellGeometry()
|
||||
{
|
||||
RimWellPathCollection* wellPathCollection = RimProject::current()->activeOilField()->wellPathCollection();
|
||||
if ( !wellPathCollection ) return;
|
||||
|
||||
// Create well paths if not existing collection
|
||||
const auto allWellPaths = wellPathCollection->allWellPaths();
|
||||
if ( !m_faceAWellPath ||
|
||||
( m_faceAWellPath && std::find( allWellPaths.begin(), allWellPaths.end(), m_faceAWellPath ) == allWellPaths.end() ) )
|
||||
{
|
||||
m_faceAWellPath = new RimModeledWellPath();
|
||||
m_faceAWellPath->setName( "Fault Face A Well" );
|
||||
wellPathCollection->addWellPath( m_faceAWellPath );
|
||||
}
|
||||
if ( !m_faceBWellPath ||
|
||||
( m_faceBWellPath && std::find( allWellPaths.begin(), allWellPaths.end(), m_faceBWellPath ) == allWellPaths.end() ) )
|
||||
{
|
||||
m_faceBWellPath = new RimModeledWellPath();
|
||||
m_faceBWellPath->setName( "Fault Face B Well" );
|
||||
wellPathCollection->addWellPath( m_faceBWellPath );
|
||||
}
|
||||
|
||||
if ( !m_faceAWellPath->geometryDefinition() || !m_faceBWellPath->geometryDefinition() ) return;
|
||||
|
||||
// Delete the previous well path target values
|
||||
m_faceAWellPath->geometryDefinition()->deleteAllTargets();
|
||||
m_faceBWellPath->geometryDefinition()->deleteAllTargets();
|
||||
|
||||
// Using first two points from first polyline
|
||||
const auto polyLines = m_intersection()->polyLines();
|
||||
if ( polyLines.size() != 1 || polyLines[0].size() != 2 )
|
||||
{
|
||||
RiaLogging::error( "Polyline intersection for fault face must be defined with only 2 points!" );
|
||||
return;
|
||||
}
|
||||
const std::vector<cvf::Vec3d> wellPoints = { polyLines[0][0], polyLines[0][1] };
|
||||
|
||||
// TODO:
|
||||
// - Check which cell point is in, then check which part this cell inn -> provide part as name for curves
|
||||
//
|
||||
// NOTES:
|
||||
// - No data for face B well path when creating well log extraction curves? Empty data in part 2-1?
|
||||
|
||||
// Create vector for well path defined by point a and b
|
||||
const cvf::Vec3d a = wellPoints[0];
|
||||
const cvf::Vec3d b = wellPoints[1];
|
||||
const cvf::Vec3d wellVector = b - a;
|
||||
|
||||
// Cross product off well path vector and z-axis. New vector must be normalized
|
||||
const cvf::Vec3d normVector = wellVector ^ cvf::Vector3<double>::Z_AXIS;
|
||||
const cvf::Vec3d distanceVector = m_distanceFromIntersection() * normVector.getNormalized();
|
||||
|
||||
// Get normalized vector along well to adjust point a and b outside of defined intersection
|
||||
const auto normalizedWellVector = wellVector.getNormalized();
|
||||
const cvf::Vec3d widthAdjustedA = a - ( normalizedWellVector * m_widthOutsideIntersection() );
|
||||
const cvf::Vec3d widthAdjustedB = b + ( normalizedWellVector * m_widthOutsideIntersection() );
|
||||
|
||||
const std::vector<cvf::Vec3d> newFaceAWellPoints = { widthAdjustedA + distanceVector, widthAdjustedB + distanceVector };
|
||||
// const std::vector<cvf::Vec3d> newFaceBWellPoints = { widthAdjustedA - distanceVector, widthAdjustedB - distanceVector };
|
||||
const std::vector<cvf::Vec3d> newFaceBWellPoints = { widthAdjustedA + 2.0 * distanceVector, widthAdjustedB + 2.0 * distanceVector };
|
||||
|
||||
// Update the well paths
|
||||
m_faceAWellPath->geometryDefinition()->createAndInsertTargets( newFaceAWellPoints );
|
||||
m_faceBWellPath->geometryDefinition()->createAndInsertTargets( newFaceBWellPoints );
|
||||
m_faceAWellPath->geometryDefinition()->setUseAutoGeneratedTargetAtSeaLevel( false );
|
||||
m_faceBWellPath->geometryDefinition()->setUseAutoGeneratedTargetAtSeaLevel( false );
|
||||
m_faceAWellPath->createWellPathGeometry();
|
||||
m_faceBWellPath->createWellPathGeometry();
|
||||
|
||||
// Update UI
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechFaultReactivationResult::createWellLogCurves()
|
||||
{
|
||||
// Create well log extraction curve for m_faceAWellPath and m_faceBWellPath
|
||||
// Create well log diff curve for the two well log extraction curves
|
||||
|
||||
// NOTE:
|
||||
// - Single track with 3 curves or 3 tracks with 1 curve each
|
||||
|
||||
// Create well log extraction curves
|
||||
RimWellLogTrack* faultReactivationTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
||||
faultReactivationTrack->setDescription( "Fault Reactivation Curves" );
|
||||
|
||||
RimGeoMechCase* geomCase = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( geomCase );
|
||||
if ( !geomCase ) return;
|
||||
|
||||
Rim3dView* view = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
if ( !view ) return;
|
||||
|
||||
RigFemResultAddress wellLogExtractionResult( RigFemResultPosEnum::RIG_NODAL, "U", "U_LENGTH" );
|
||||
RimWellLogExtractionCurve* faceAWellLogExtractionCurve =
|
||||
RicWellLogTools::addWellLogExtractionCurve( faultReactivationTrack, geomCase, view, m_faceAWellPath(), nullptr, -1, true );
|
||||
RimWellLogExtractionCurve* faceBWellLogExtractionCurve =
|
||||
RicWellLogTools::addWellLogExtractionCurve( faultReactivationTrack, geomCase, view, m_faceBWellPath(), nullptr, -1, true );
|
||||
faceAWellLogExtractionCurve->setGeoMechResultAddress( wellLogExtractionResult );
|
||||
faceBWellLogExtractionCurve->setGeoMechResultAddress( wellLogExtractionResult );
|
||||
faceAWellLogExtractionCurve->updateAllRequiredEditors();
|
||||
faceBWellLogExtractionCurve->updateAllRequiredEditors();
|
||||
|
||||
// Create well log diff curve for m_faceAWellPath and m_faceBWellPath
|
||||
// RicWellLogTools::addWellLogDiffCurve( faultReactivationTrack, geomCase, view );
|
||||
RimWellLogDiffCurve* faceWellLogDiffCurve = new RimWellLogDiffCurve();
|
||||
faceWellLogDiffCurve->setWellLogCurves( faceAWellLogExtractionCurve, faceBWellLogExtractionCurve );
|
||||
faceWellLogDiffCurve->setParentPlotNoReplot( faultReactivationTrack->plotWidget() );
|
||||
faceWellLogDiffCurve->loadDataAndUpdate( false );
|
||||
faultReactivationTrack->addCurve( faceWellLogDiffCurve );
|
||||
faultReactivationTrack->updateAllRequiredEditors();
|
||||
}
|
||||
|
@ -40,21 +40,24 @@ public:
|
||||
~RimGeoMechFaultReactivationResult() override;
|
||||
|
||||
private:
|
||||
void onLoadDataAndUpdate();
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) 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;
|
||||
|
||||
void createWellGeometry();
|
||||
void createWellLogCurves();
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimExtrudedCurveIntersection*> m_intersection;
|
||||
|
||||
caf::PdmField<bool> m_createFaultReactivationResult;
|
||||
|
||||
// TODO: Remove "well" from name?
|
||||
caf::PdmField<double> m_distanceFromIntersection; // To move wells to each side of intersection
|
||||
caf::PdmField<double> m_widthOutsideIntersection; // To stretch well points outside intersection
|
||||
|
||||
// Pdm field?
|
||||
RimModeledWellPath* m_faceAWellPath = nullptr;
|
||||
RimModeledWellPath* m_faceBWellPath = nullptr;
|
||||
caf::PdmPtrField<RimModeledWellPath*> m_faceAWellPath;
|
||||
caf::PdmPtrField<RimModeledWellPath*> m_faceBWellPath;
|
||||
};
|
||||
|
@ -26,6 +26,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRftTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRftTopologyCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurveInfoTextProvider.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogDiffCurve.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@ -56,6 +57,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRftTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRftTopologyCurve.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurveInfoTextProvider.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogDiffCurve.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
@ -0,0 +1,228 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimWellLogDiffCurve.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "RigWellLogCurveData.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RiuPlotCurve.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellLogDiffCurve, "WellLogDiffCurve" );
|
||||
|
||||
#pragma optimize( "", off )
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogDiffCurve::RimWellLogDiffCurve()
|
||||
{
|
||||
CAF_PDM_InitObject( "Well Log Diff Curve", ":/WellLogCurve16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellLogCurveA, "WellLogCurveA", "Well Log Curve A" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellLogCurveB, "WellLogCurveB", "Well Log Curve B" );
|
||||
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogDiffCurve::~RimWellLogDiffCurve()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::setWellLogCurves( RimWellLogCurve* wellLogCurveA, RimWellLogCurve* wellLogCurveB )
|
||||
{
|
||||
if ( wellLogCurveA ) m_wellLogCurveA = wellLogCurveA;
|
||||
if ( wellLogCurveB ) m_wellLogCurveB = wellLogCurveB;
|
||||
|
||||
m_curveName = QString( "Diff (%1 - %2)" ).arg( m_wellLogCurveA->curveName() ).arg( m_wellLogCurveB->curveName() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogDiffCurve::createCurveAutoName()
|
||||
{
|
||||
CAF_ASSERT( "TO BE IMPLEMETNED!" );
|
||||
return QString();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
if ( !m_wellLogCurveA() || !m_wellLogCurveB() ) return;
|
||||
|
||||
// Use well A as reference for resampled curve data
|
||||
auto* curveDataA = m_wellLogCurveA()->curveData();
|
||||
auto* curveDataB = m_wellLogCurveB()->curveData();
|
||||
|
||||
if ( !curveDataA || !curveDataB ) return;
|
||||
|
||||
if ( curveDataA->depthUnit() != curveDataB->depthUnit() )
|
||||
{
|
||||
// Return warning!
|
||||
}
|
||||
|
||||
const auto depthType = RiaDefines::DepthTypeEnum::MEASURED_DEPTH;
|
||||
const auto curveADepths = curveDataA->depths( depthType );
|
||||
const auto curveDataAPropertyValues = curveDataA->propertyValues();
|
||||
|
||||
// Resample curve B to curve A
|
||||
cvf::ref<RigWellLogCurveData> curveDataBResampled = curveDataB->calculateResampledCurveData( depthType, curveADepths );
|
||||
auto curveBDepthValuesResampled = curveDataBResampled->depths( depthType );
|
||||
auto curveBPropertyValuesResampled = curveDataBResampled->propertyValues();
|
||||
|
||||
// curveDataA size and curveBPropertiesResampled size should be the same
|
||||
if ( curveADepths.size() != curveDataAPropertyValues.size() ) return;
|
||||
if ( curveADepths.size() != curveBDepthValuesResampled.size() ) return;
|
||||
if ( curveDataAPropertyValues.size() != curveBPropertyValuesResampled.size() ) return;
|
||||
|
||||
std::vector<double> curveDiffDepthValues( curveADepths.size() );
|
||||
std::vector<double> curveDiffPropertyValues( curveDataAPropertyValues.size() );
|
||||
for ( size_t i = 0; i < curveDataAPropertyValues.size(); ++i )
|
||||
{
|
||||
curveDiffPropertyValues[i] = curveDataAPropertyValues[i] - curveBPropertyValuesResampled[i];
|
||||
curveDiffDepthValues[i] = curveADepths[i];
|
||||
}
|
||||
|
||||
const bool useLogarithmicScale = false;
|
||||
auto depthsMap = std::map<RiaDefines::DepthTypeEnum, std::vector<double>>();
|
||||
depthsMap[depthType] = curveDiffDepthValues;
|
||||
setPropertyValuesAndDepths( curveDiffPropertyValues, depthsMap, 0.0, curveDataA->depthUnit(), false, false, QString( "" ) );
|
||||
|
||||
// TODO: NOT VISUALISING IN PLOT!
|
||||
|
||||
// m_plotCurve->setSamplesFromXValuesAndYValues( curveDiffPropertyValues, curveDiffDepthValues, useLogarithmicScale );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogDiffCurve::wellName() const
|
||||
{
|
||||
CAF_ASSERT( "TO BE IMPLEMETNED!" );
|
||||
return QString();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogDiffCurve::wellLogChannelUiName() const
|
||||
{
|
||||
return ( QString( "Diff (%1 - %2)" ).arg( m_wellLogCurveA->wellLogChannelUiName() ).arg( m_wellLogCurveB->wellLogChannelUiName() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogDiffCurve::wellLogChannelUnits() const
|
||||
{
|
||||
CAF_ASSERT( "TO BE IMPLEMETNED!" );
|
||||
return QString();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Data Source" );
|
||||
group->add( &m_wellLogCurveA );
|
||||
group->add( &m_wellLogCurveB );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
RimWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_wellLogCurveA || changedField == &m_wellLogCurveB )
|
||||
{
|
||||
if ( !m_wellLogCurveA() || !m_wellLogCurveB() ) return;
|
||||
|
||||
onLoadDataAndUpdate( false );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimWellLogDiffCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions );
|
||||
if ( options.size() > 0 ) return options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_wellLogCurveA || fieldNeedingOptions == &m_wellLogCurveB )
|
||||
{
|
||||
RimWellPathCollection* wellPathCollection = RimProject::current()->activeOilField()->wellPathCollection();
|
||||
RimWellLogPlotCollection* wellLogPlotCollection = RimMainPlotCollection::current()->wellLogPlotCollection();
|
||||
|
||||
if ( !wellLogPlotCollection ) return {};
|
||||
|
||||
// Find each well log plot in collection
|
||||
std::vector<RimWellLogCurve*> wellLogCurves;
|
||||
wellLogPlotCollection->descendantsOfType( wellLogCurves );
|
||||
for ( RimWellLogCurve* curve : wellLogCurves )
|
||||
{
|
||||
if ( !curve || curve == this ) continue;
|
||||
options.push_back( caf::PdmOptionItemInfo( curve->curveName(), curve ) );
|
||||
}
|
||||
|
||||
// for ( const auto* wellLogPlot : wellLogPlotCollection->descendantsOfType<>() )
|
||||
//{
|
||||
// if ( !wellLogPlot ) continue;
|
||||
|
||||
// // Retrieve each track in plot
|
||||
// // Note: How to get all RimWellLogTracks - not based on visibility?
|
||||
// for ( auto* rimPlot : wellLogPlot->plots() )
|
||||
// {
|
||||
// RimWellLogTrack* plot = dynamic_cast<RimWellLogTrack*>( rimPlot );
|
||||
// if ( !plot ) continue;
|
||||
|
||||
// // Extract each curve in track
|
||||
// for ( RimWellLogCurve* curve : plot->curves() )
|
||||
// {
|
||||
// options.push_back( caf::PdmOptionItemInfo( curve->uiName(), curve ) );
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
return options;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimWellLogCurve.h"
|
||||
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
class RimCase;
|
||||
class RimWellPath;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellLogDiffCurve : public RimWellLogCurve
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimWellLogDiffCurve();
|
||||
~RimWellLogDiffCurve() override;
|
||||
|
||||
void setWellLogCurves( RimWellLogCurve* wellLogCurveA, RimWellLogCurve* wellLogCurveB );
|
||||
|
||||
// Inherited via RimWellLogCurve
|
||||
virtual QString wellName() const override;
|
||||
virtual QString wellLogChannelUiName() const override;
|
||||
virtual QString wellLogChannelUnits() const override;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
private:
|
||||
// Inherited via RimWellLogCurve
|
||||
virtual QString createCurveAutoName() override;
|
||||
virtual void onLoadDataAndUpdate( bool updateParentPlot ) override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimCase*> m_case;
|
||||
|
||||
caf::PdmPtrField<RimWellLogCurve*> m_wellLogCurveA;
|
||||
caf::PdmPtrField<RimWellLogCurve*> m_wellLogCurveB;
|
||||
};
|
Loading…
Reference in New Issue
Block a user