mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-29 10:21:54 -06:00
Backup
This commit is contained in:
parent
f4a904b227
commit
05a822f33a
@ -23,6 +23,7 @@
|
||||
|
||||
#include "RicWellLogTools.h"
|
||||
#include "WellLogCommands/RicNewWellLogPlotFeatureImpl.h"
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
@ -151,7 +152,7 @@ void RimGeoMechFaultReactivationResult::defineEditorAttribute( const caf::PdmFie
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
{
|
||||
attrib->m_buttonText = "Create Fault Reactivation Curves";
|
||||
attrib->m_buttonText = "Create";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -262,15 +263,19 @@ void RimGeoMechFaultReactivationResult::createWellLogCurves()
|
||||
RicWellLogTools::addWellLogExtractionCurve( faultReactivationTrack, geomCase, view, m_faceBWellPath(), nullptr, -1, true );
|
||||
faceAWellLogExtractionCurve->setGeoMechResultAddress( wellLogExtractionResult );
|
||||
faceBWellLogExtractionCurve->setGeoMechResultAddress( wellLogExtractionResult );
|
||||
faceAWellLogExtractionCurve->updateAllRequiredEditors();
|
||||
faceBWellLogExtractionCurve->updateAllRequiredEditors();
|
||||
faceAWellLogExtractionCurve->updateConnectedEditors();
|
||||
faceBWellLogExtractionCurve->updateConnectedEditors();
|
||||
|
||||
// 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 );
|
||||
const cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( faultReactivationTrack->curveCount() );
|
||||
faceWellLogDiffCurve->setColor( curveColor );
|
||||
|
||||
faultReactivationTrack->addCurve( faceWellLogDiffCurve );
|
||||
faultReactivationTrack->updateAllRequiredEditors();
|
||||
|
||||
faceWellLogDiffCurve->loadDataAndUpdate( true );
|
||||
faceWellLogDiffCurve->updateConnectedEditors();
|
||||
faultReactivationTrack->updateConnectedEditors();
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "RimWellLogDiffCurve.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RigWellLogCurveData.h"
|
||||
|
||||
@ -33,6 +34,8 @@
|
||||
|
||||
#include "RiuPlotCurve.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellLogDiffCurve, "WellLogDiffCurve" );
|
||||
|
||||
#pragma optimize( "", off )
|
||||
@ -47,6 +50,7 @@ RimWellLogDiffCurve::RimWellLogDiffCurve()
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellLogCurveA, "WellLogCurveA", "Well Log Curve A" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellLogCurveB, "WellLogCurveB", "Well Log Curve B" );
|
||||
|
||||
setNamingMethod( RiaDefines::ObjectNamingMethod::AUTO );
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
@ -65,7 +69,10 @@ void RimWellLogDiffCurve::setWellLogCurves( RimWellLogCurve* wellLogCurveA, RimW
|
||||
if ( wellLogCurveA ) m_wellLogCurveA = wellLogCurveA;
|
||||
if ( wellLogCurveB ) m_wellLogCurveB = wellLogCurveB;
|
||||
|
||||
m_curveName = QString( "Diff (%1 - %2)" ).arg( m_wellLogCurveA->curveName() ).arg( m_wellLogCurveB->curveName() );
|
||||
if ( m_namingMethod() == RiaDefines::ObjectNamingMethod::AUTO )
|
||||
{
|
||||
setAutomaticName();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -73,8 +80,8 @@ void RimWellLogDiffCurve::setWellLogCurves( RimWellLogCurve* wellLogCurveA, RimW
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogDiffCurve::createCurveAutoName()
|
||||
{
|
||||
CAF_ASSERT( "TO BE IMPLEMETNED!" );
|
||||
return QString();
|
||||
if ( !m_wellLogCurveA() || !m_wellLogCurveB() ) return QString( "Invalid well log curves" );
|
||||
return QString( "Diff (%1 - %2)" ).arg( m_wellLogCurveA->curveName() ).arg( m_wellLogCurveB->curveName() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -84,47 +91,73 @@ void RimWellLogDiffCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
if ( !m_wellLogCurveA() || !m_wellLogCurveB() ) return;
|
||||
|
||||
if ( m_namingMethod() == RiaDefines::ObjectNamingMethod::AUTO )
|
||||
{
|
||||
setAutomaticName();
|
||||
}
|
||||
|
||||
// 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!
|
||||
RiaLogging::warning( "Well log curve depth units are not the same" );
|
||||
}
|
||||
if ( curveDataA->propertyValueUnit() != curveDataB->propertyValueUnit() )
|
||||
{
|
||||
RiaLogging::warning( "Well log curve property value units are not the same" );
|
||||
}
|
||||
|
||||
const auto depthType = RiaDefines::DepthTypeEnum::MEASURED_DEPTH;
|
||||
const auto curveADepths = curveDataA->depths( depthType );
|
||||
const auto depthUnit = curveDataA->depthUnit();
|
||||
const auto depthType = RiaDefines::DepthTypeEnum::MEASURED_DEPTH;
|
||||
const auto propertyUnit = curveDataA->propertyValueUnit();
|
||||
|
||||
// Get curve A depths and property values
|
||||
const auto curveADepthValues = curveDataA->depths( depthType );
|
||||
const auto curveDataAPropertyValues = curveDataA->propertyValues();
|
||||
|
||||
// Resample curve B to curve A
|
||||
cvf::ref<RigWellLogCurveData> curveDataBResampled = curveDataB->calculateResampledCurveData( depthType, curveADepths );
|
||||
cvf::ref<RigWellLogCurveData> curveDataBResampled = curveDataB->calculateResampledCurveData( depthType, curveADepthValues );
|
||||
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;
|
||||
// Verify equal sizes
|
||||
if ( curveADepthValues.size() != curveDataAPropertyValues.size() ) return;
|
||||
if ( curveADepthValues.size() != curveBDepthValuesResampled.size() ) return;
|
||||
if ( curveADepthValues.size() != curveBPropertyValuesResampled.size() ) return;
|
||||
|
||||
std::vector<double> curveDiffDepthValues( curveADepths.size() );
|
||||
// Calculate diff curve
|
||||
std::vector<double> curveDiffDepthValues( curveADepthValues.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];
|
||||
curveDiffDepthValues[i] = curveADepthValues[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( "" ) );
|
||||
const bool isExtractionCurve = false;
|
||||
|
||||
// TODO: NOT VISUALISING IN PLOT!
|
||||
// Set curve data
|
||||
auto depthsMap = std::map<RiaDefines::DepthTypeEnum, std::vector<double>>();
|
||||
depthsMap[depthType] = curveDiffDepthValues;
|
||||
setPropertyValuesAndDepths( curveDiffPropertyValues, depthsMap, 0.0, depthUnit, isExtractionCurve, useLogarithmicScale, propertyUnit );
|
||||
|
||||
// m_plotCurve->setSamplesFromXValuesAndYValues( curveDiffPropertyValues, curveDiffDepthValues, useLogarithmicScale );
|
||||
// Set curve data to plot
|
||||
std::vector<double> xPlotValues = curveData()->propertyValuesByIntervals();
|
||||
std::vector<double> yPlotValues = curveData()->depthValuesByIntervals( depthType, depthUnit );
|
||||
m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, yPlotValues, useLogarithmicScale );
|
||||
updateCurvePresentation( updateParentPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::setAutomaticName()
|
||||
{
|
||||
m_curveName = createCurveAutoName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -158,12 +191,25 @@ QString RimWellLogDiffCurve::wellLogChannelUnits() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimPlotCurve::updateFieldUiState();
|
||||
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Data Source" );
|
||||
group->add( &m_wellLogCurveA );
|
||||
group->add( &m_wellLogCurveB );
|
||||
|
||||
RimStackablePlotCurve::defaultUiOrdering( uiOrdering );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
|
||||
{
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -175,7 +221,7 @@ void RimWellLogDiffCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
{
|
||||
if ( !m_wellLogCurveA() || !m_wellLogCurveB() ) return;
|
||||
|
||||
onLoadDataAndUpdate( false );
|
||||
onLoadDataAndUpdate( true );
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,25 +250,6 @@ QList<caf::PdmOptionItemInfo> RimWellLogDiffCurve::calculateValueOptions( const
|
||||
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;
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
|
||||
protected:
|
||||
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;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
@ -55,6 +56,8 @@ private:
|
||||
virtual QString createCurveAutoName() override;
|
||||
virtual void onLoadDataAndUpdate( bool updateParentPlot ) override;
|
||||
|
||||
void setAutomaticName();
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimCase*> m_case;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user