mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Displacement curves fault faces (#10243)
This commit is contained in:
parent
9a219ddcb2
commit
b83fe73395
@ -31,6 +31,7 @@
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimWellLogCurveCommonDataSource.h"
|
||||
#include "RimWellLogDiffCurve.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogFileChannel.h"
|
||||
@ -581,3 +582,29 @@ RimWellMeasurementCurve* RicWellLogTools::addWellMeasurementCurve( RimWellLogTra
|
||||
|
||||
return curve;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogDiffCurve* RicWellLogTools::addWellLogDiffCurve( RimWellLogTrack* plotTrack, bool showPlotWindow )
|
||||
{
|
||||
CVF_ASSERT( plotTrack );
|
||||
|
||||
RimWellLogDiffCurve* curve = new RimWellLogDiffCurve();
|
||||
const cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() );
|
||||
curve->setColor( curveColor );
|
||||
|
||||
plotTrack->addCurve( curve );
|
||||
plotTrack->updateConnectedEditors();
|
||||
|
||||
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( curve );
|
||||
|
||||
if ( showPlotWindow )
|
||||
{
|
||||
// Make sure the summary plot window is visible
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
}
|
||||
|
||||
return curve;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ class RimWellPath;
|
||||
class RimWellMeasurementCurve;
|
||||
class RimSummaryCase;
|
||||
class RimWellLogCurve;
|
||||
class RimWellLogDiffCurve;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -72,6 +73,7 @@ public:
|
||||
bool showPlotWindow = true );
|
||||
static RimWellMeasurementCurve*
|
||||
addWellMeasurementCurve( RimWellLogTrack* plotTrack, RimWellPath* wellPath, const QString& measurementName, bool showPlotWindow = true );
|
||||
static RimWellLogDiffCurve* addWellLogDiffCurve( RimWellLogTrack* plotTrack, bool showPlotWindow = true );
|
||||
|
||||
static RimWellLogCurve* addSummaryRftCurve( RimWellLogTrack* plotTrack, RimSummaryCase* rimCase );
|
||||
static RimWellLogRftCurve* addSummaryRftSegmentCurve( RimWellLogTrack* plotTrack,
|
||||
|
@ -30,6 +30,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRftWellLogPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRftSegmentWellLogPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPhaseRftSegmentPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogDiffCurveFeature.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@ -64,6 +65,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRftWellLogPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRftSegmentWellLogPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPhaseRftSegmentPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogDiffCurveFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
@ -0,0 +1,82 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicNewWellLogDiffCurveFeature.h"
|
||||
|
||||
#include "RicWellLogTools.h"
|
||||
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimWellLogDiffCurve.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QIcon>
|
||||
|
||||
#include <vector>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewWellLogDiffCurveFeature, "RicNewWellLogDiffCurveFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewWellLogDiffCurveFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimWellLogCurve*> wellLogCurves;
|
||||
caf::SelectionManager::instance()->objectsByType( &wellLogCurves );
|
||||
|
||||
return ( caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>() != nullptr || wellLogCurves.size() == 2 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellLogDiffCurveFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimWellLogTrack* wellLogTrack = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>();
|
||||
if ( wellLogTrack )
|
||||
{
|
||||
RicWellLogTools::addWellLogDiffCurve( wellLogTrack );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<RimWellLogCurve*> wellLogCurves;
|
||||
caf::SelectionManager::instance()->objectsByType( &wellLogCurves );
|
||||
if ( wellLogCurves.size() != 2 ) return;
|
||||
|
||||
RimWellLogTrack* wellLogTrack = wellLogCurves[0]->firstAncestorOrThisOfType<RimWellLogTrack>();
|
||||
if ( !wellLogTrack ) return;
|
||||
|
||||
RimWellLogDiffCurve* newCurve = RicWellLogTools::addWellLogDiffCurve( wellLogTrack );
|
||||
newCurve->setWellLogCurves( wellLogCurves[0], wellLogCurves[1] );
|
||||
newCurve->updateConnectedEditors();
|
||||
}
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellLogDiffCurveFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New Well Log Diff Curve" );
|
||||
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewWellLogDiffCurveFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
private:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -104,6 +104,8 @@ add_library(
|
||||
RigFemPartResultCalculatorKIndices.cpp
|
||||
RimGeoMechGeometrySelectionItem.h
|
||||
RimGeoMechGeometrySelectionItem.cpp
|
||||
RigFemPartResultCalculatorNodalDisplacement.h
|
||||
RigFemPartResultCalculatorNodalDisplacement.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
@ -477,16 +477,16 @@ cvf::BoundingBox RigFemPart::boundingBox() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPart::findIntersectingCells( const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices ) const
|
||||
void RigFemPart::findIntersectingElementIndices( const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices ) const
|
||||
{
|
||||
ensureIntersectionSearchTreeIsBuilt();
|
||||
findIntersectingCellsWithExistingSearchTree( inputBB, elementIndices );
|
||||
findIntersectingElementsWithExistingSearchTree( inputBB, elementIndices );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPart::findIntersectingCellsWithExistingSearchTree( const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices ) const
|
||||
void RigFemPart::findIntersectingElementsWithExistingSearchTree( const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices ) const
|
||||
{
|
||||
CVF_ASSERT( m_elementSearchTree.notNull() );
|
||||
m_elementSearchTree->findIntersections( inputBB, elementIndices );
|
||||
|
@ -83,8 +83,8 @@ public:
|
||||
cvf::BoundingBox boundingBox() const;
|
||||
float characteristicElementSize() const;
|
||||
const std::vector<int>& possibleGridCornerElements() const;
|
||||
void findIntersectingCells( const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices ) const;
|
||||
void findIntersectingCellsWithExistingSearchTree( const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices ) const;
|
||||
void findIntersectingElementIndices( const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices ) const;
|
||||
void findIntersectingElementsWithExistingSearchTree( const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices ) const;
|
||||
|
||||
void ensureIntersectionSearchTreeIsBuilt() const;
|
||||
|
||||
|
@ -127,7 +127,7 @@ cvf::BoundingBox RigFemPartCollection::boundingBox() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// convert from global element index to part and part-local index
|
||||
/// Get part id and local part element index from global element index
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<int, size_t> RigFemPartCollection::partIdAndElementIndex( size_t globalIndex ) const
|
||||
{
|
||||
@ -147,7 +147,7 @@ std::pair<int, size_t> RigFemPartCollection::partIdAndElementIndex( size_t globa
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// convert from global element index to part and part-local index
|
||||
/// Get part and local part element index from global element index
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<const RigFemPart*, size_t> RigFemPartCollection::partAndElementIndex( size_t globalIndex ) const
|
||||
{
|
||||
@ -156,13 +156,31 @@ std::pair<const RigFemPart*, size_t> RigFemPartCollection::partAndElementIndex(
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// convert from part and part-local index to global index
|
||||
/// Get global element index from part id and local part element index
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigFemPartCollection::globalIndex( int partId, size_t localIndex ) const
|
||||
size_t RigFemPartCollection::globalElementIndex( int partId, size_t localIndex ) const
|
||||
{
|
||||
return localIndex + m_partElementOffset[partId];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Find intersecting global element indexes for a given bounding box
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartCollection::findIntersectingGlobalElementIndices( const cvf::BoundingBox& intersectingBB,
|
||||
std::vector<size_t>* intersectedGlobalElementIndices ) const
|
||||
{
|
||||
for ( const auto& part : m_femParts )
|
||||
{
|
||||
std::vector<size_t> foundElements;
|
||||
part->findIntersectingElementIndices( intersectingBB, &foundElements );
|
||||
for ( const auto& foundElement : foundElements )
|
||||
{
|
||||
const size_t globalIdx = globalElementIndex( part->elementPartId(), foundElement );
|
||||
intersectedGlobalElementIndices->push_back( globalIdx );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -40,9 +40,10 @@ public:
|
||||
|
||||
std::pair<int, size_t> partIdAndElementIndex( size_t globalIndex ) const;
|
||||
std::pair<const RigFemPart*, size_t> partAndElementIndex( size_t globalIndex ) const;
|
||||
size_t globalIndex( int partId, size_t localIndex ) const;
|
||||
size_t globalElementIndex( int partId, size_t localIndex ) const;
|
||||
|
||||
std::pair<int, size_t> partIdAndNodeIndex( size_t globalNodeIndex ) const;
|
||||
void findIntersectingGlobalElementIndices( const cvf::BoundingBox& intersectingBB,
|
||||
std::vector<size_t>* intersectedGlobalElementIndices ) const;
|
||||
|
||||
int nodeIdxFromElementNodeResultIdx( size_t globalResultIdx ) const;
|
||||
|
||||
|
@ -164,7 +164,7 @@ void findReferenceElementForNode( const RigFemPart& part, size_t nodeIdx, size_t
|
||||
bb.add( p2 );
|
||||
|
||||
std::vector<size_t> refElementCandidates;
|
||||
part.findIntersectingCells( bb, &refElementCandidates );
|
||||
part.findIntersectingElementIndices( bb, &refElementCandidates );
|
||||
|
||||
const RigFemPartGrid* grid = part.getOrCreateStructGrid();
|
||||
|
||||
|
@ -0,0 +1,128 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RigFemPartResultCalculatorNodalDisplacement.h"
|
||||
|
||||
#include "RigFemPart.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigFemResultAddress.h"
|
||||
#include "RigFemScalarResultFrames.h"
|
||||
#include "RigHexGradientTools.h"
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFemPartResultCalculatorNodalDisplacement::RigFemPartResultCalculatorNodalDisplacement( RigFemPartResultsCollection& collection )
|
||||
: RigFemPartResultCalculator( collection )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFemPartResultCalculatorNodalDisplacement::~RigFemPartResultCalculatorNodalDisplacement()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigFemPartResultCalculatorNodalDisplacement::isMatching( const RigFemResultAddress& resVarAddr ) const
|
||||
{
|
||||
return ( ( resVarAddr.resultPosType == RIG_NODAL ) && ( resVarAddr.fieldName == "U" ) && ( resVarAddr.componentName == "U_LENGTH" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFemScalarResultFrames* RigFemPartResultCalculatorNodalDisplacement::calculate( int partIndex, const RigFemResultAddress& resVarAddr )
|
||||
{
|
||||
CVF_ASSERT( resVarAddr.fieldName == "U" );
|
||||
CVF_ASSERT( resVarAddr.componentName == "U_LENGTH" );
|
||||
|
||||
// Why calculating by 5?
|
||||
caf::ProgressInfo stepCountProgress( m_resultCollection->timeStepCount() * 5, "" );
|
||||
stepCountProgress.setProgressDescription( "Calculating vector length: " +
|
||||
QString::fromStdString( resVarAddr.fieldName + ": " + resVarAddr.componentName ) );
|
||||
stepCountProgress.setNextProgressIncrement( m_resultCollection->timeStepCount() );
|
||||
|
||||
const RigFemScalarResultFrames* srcFramesU1 =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_NODAL, resVarAddr.fieldName, "U1" ) );
|
||||
stepCountProgress.incrementProgress();
|
||||
stepCountProgress.setNextProgressIncrement( m_resultCollection->timeStepCount() );
|
||||
|
||||
const RigFemScalarResultFrames* srcFramesU2 =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_NODAL, resVarAddr.fieldName, "U2" ) );
|
||||
stepCountProgress.incrementProgress();
|
||||
stepCountProgress.setNextProgressIncrement( m_resultCollection->timeStepCount() );
|
||||
|
||||
const RigFemScalarResultFrames* srcFramesU3 =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_NODAL, resVarAddr.fieldName, "U3" ) );
|
||||
stepCountProgress.incrementProgress();
|
||||
stepCountProgress.setNextProgressIncrement( m_resultCollection->timeStepCount() );
|
||||
|
||||
CVF_ASSERT( srcFramesU1->timeStepCount() == srcFramesU2->timeStepCount() && srcFramesU2->timeStepCount() == srcFramesU3->timeStepCount() );
|
||||
|
||||
RigFemResultAddress dstVarAddrULength( RIG_NODAL, resVarAddr.fieldName, resVarAddr.componentName );
|
||||
RigFemScalarResultFrames* dstFramesULength = m_resultCollection->createScalarResult( partIndex, dstVarAddrULength );
|
||||
|
||||
stepCountProgress.incrementProgress();
|
||||
|
||||
const RigFemPart* femPart = m_resultCollection->parts()->part( partIndex );
|
||||
constexpr float inf = std::numeric_limits<float>::infinity();
|
||||
const int timeStepCount = m_resultCollection->timeStepCount();
|
||||
for ( int tIdx = 0; tIdx < timeStepCount; ++tIdx )
|
||||
{
|
||||
const int frameCount = m_resultCollection->frameCount( tIdx );
|
||||
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
||||
{
|
||||
std::vector<float>& dstFrameDataULength = dstFramesULength->frameData( tIdx, fIdx );
|
||||
const std::vector<float>& srcFrameDataU1 = srcFramesU1->frameData( tIdx, fIdx );
|
||||
const std::vector<float>& srcFrameDataU2 = srcFramesU2->frameData( tIdx, fIdx );
|
||||
const std::vector<float>& srcFrameDataU3 = srcFramesU3->frameData( tIdx, fIdx );
|
||||
|
||||
// Create empty results if:
|
||||
// - One or more vector components are missing
|
||||
// - Vector components are not of equal size
|
||||
if ( srcFrameDataU1.empty() || srcFrameDataU2.empty() || srcFrameDataU3.empty() ||
|
||||
( srcFrameDataU1.size() != srcFrameDataU2.size() || srcFrameDataU2.size() != srcFrameDataU3.size() ) )
|
||||
{
|
||||
dstFrameDataULength.clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
dstFrameDataULength.resize( srcFrameDataU1.size(), 0.0 );
|
||||
#pragma omp parallel for
|
||||
for ( int i = 0; i < static_cast<int>( dstFrameDataULength.size() ); ++i )
|
||||
{
|
||||
const float u1 = srcFrameDataU1[i];
|
||||
const float u2 = srcFrameDataU2[i];
|
||||
const float u3 = srcFrameDataU3[i];
|
||||
const float uLength = sqrt( u1 * u1 + u2 * u2 + u3 * u3 );
|
||||
dstFrameDataULength[i] = uLength;
|
||||
}
|
||||
}
|
||||
stepCountProgress.incrementProgress();
|
||||
}
|
||||
return dstFramesULength;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RigFemPartResultCalculator.h"
|
||||
|
||||
class RigFemPartResultsCollection;
|
||||
class RigFemScalarResultFrames;
|
||||
class RigFemResultAddress;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigFemPartResultCalculatorNodalDisplacement : public RigFemPartResultCalculator
|
||||
{
|
||||
public:
|
||||
explicit RigFemPartResultCalculatorNodalDisplacement( RigFemPartResultsCollection& collection );
|
||||
~RigFemPartResultCalculatorNodalDisplacement() override;
|
||||
bool isMatching( const RigFemResultAddress& resVarAddr ) const override;
|
||||
RigFemScalarResultFrames* calculate( int partIndex, const RigFemResultAddress& resVarAddr ) override;
|
||||
};
|
@ -41,6 +41,7 @@
|
||||
#include "RigFemPartResultCalculatorKIndices.h"
|
||||
#include "RigFemPartResultCalculatorMudWeightWindow.h"
|
||||
#include "RigFemPartResultCalculatorNE.h"
|
||||
#include "RigFemPartResultCalculatorNodalDisplacement.h"
|
||||
#include "RigFemPartResultCalculatorNodalGradients.h"
|
||||
#include "RigFemPartResultCalculatorNormalSE.h"
|
||||
#include "RigFemPartResultCalculatorNormalST.h"
|
||||
@ -197,6 +198,7 @@ RigFemPartResultsCollection::RigFemPartResultsCollection( RifGeoMechReaderInterf
|
||||
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorShearSlipIndicator( *this ) ) );
|
||||
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorFormationIndices( *this ) ) );
|
||||
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorKIndices( *this ) ) );
|
||||
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorNodalDisplacement( *this ) ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -452,16 +454,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult( i
|
||||
currentFrames->enableAsSingleStepResult();
|
||||
currentFrames->frameData( 0, 0 ).swap( values );
|
||||
}
|
||||
|
||||
frames = m_femPartResults[partIndex]->findScalarResult( resVarAddr );
|
||||
if ( frames )
|
||||
{
|
||||
return frames;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_femPartResults[partIndex]->createScalarResult( resVarAddr );
|
||||
}
|
||||
return m_femPartResults[partIndex]->createScalarResult( resVarAddr );
|
||||
}
|
||||
|
||||
// We need to read the data as bulk fields, and populate the correct scalar caches
|
||||
@ -567,6 +560,7 @@ std::map<std::string, std::vector<std::string>> RigFemPartResultsCollection::sca
|
||||
if ( resPos == RIG_NODAL )
|
||||
{
|
||||
fieldCompNames = m_readerInterface->scalarNodeFieldAndComponentNames();
|
||||
if ( fieldCompNames.contains( "U" ) ) fieldCompNames["U"].push_back( "U_LENGTH" );
|
||||
fieldCompNames["POR-Bar"];
|
||||
fieldCompNames[FIELD_NAME_COMPACTION];
|
||||
}
|
||||
@ -650,14 +644,14 @@ std::map<std::string, std::vector<std::string>> RigFemPartResultsCollection::sca
|
||||
fieldCompNames["MUD-WEIGHT"].push_back( "UMWL" );
|
||||
fieldCompNames["MUD-WEIGHT"].push_back( "LMWL" );
|
||||
|
||||
if ( fieldCompNames.count( "LE" ) > 0 )
|
||||
if ( fieldCompNames.contains( "LE" ) )
|
||||
{
|
||||
fieldCompNames["LE"].push_back( "LE1" );
|
||||
fieldCompNames["LE"].push_back( "LE2" );
|
||||
fieldCompNames["LE"].push_back( "LE3" );
|
||||
}
|
||||
|
||||
if ( fieldCompNames.count( "PE" ) > 0 )
|
||||
if ( fieldCompNames.contains( "PE" ) )
|
||||
{
|
||||
fieldCompNames["PE"].push_back( "PE1" );
|
||||
fieldCompNames["PE"].push_back( "PE2" );
|
||||
@ -756,14 +750,14 @@ std::map<std::string, std::vector<std::string>> RigFemPartResultsCollection::sca
|
||||
fieldCompNames["MUD-WEIGHT"].push_back( "UMWL" );
|
||||
fieldCompNames["MUD-WEIGHT"].push_back( "LMWL" );
|
||||
|
||||
if ( fieldCompNames.count( "LE" ) > 0 )
|
||||
if ( fieldCompNames.contains( "LE" ) )
|
||||
{
|
||||
fieldCompNames["LE"].push_back( "LE1" );
|
||||
fieldCompNames["LE"].push_back( "LE2" );
|
||||
fieldCompNames["LE"].push_back( "LE3" );
|
||||
}
|
||||
|
||||
if ( fieldCompNames.count( "PE" ) > 0 )
|
||||
if ( fieldCompNames.contains( "PE" ) )
|
||||
{
|
||||
fieldCompNames["PE"].push_back( "PE1" );
|
||||
fieldCompNames["PE"].push_back( "PE2" );
|
||||
|
@ -53,18 +53,12 @@ cvf::BoundingBox RivFemIntersectionGrid::boundingBox() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemIntersectionGrid::findIntersectingCells( const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells ) const
|
||||
{
|
||||
for ( int i = 0; i < m_femParts->partCount(); i++ )
|
||||
{
|
||||
const RigFemPart* part = m_femParts->part( i );
|
||||
std::vector<size_t> foundElements;
|
||||
part->findIntersectingCells( intersectingBB, &foundElements );
|
||||
// For FEM models the term element is used instead of cell.
|
||||
// Each FEM part has a local element index which is transformed into global index for a FEM part collection.
|
||||
std::vector<size_t> intersectedGlobalElementIndices;
|
||||
m_femParts->findIntersectingGlobalElementIndices( intersectingBB, &intersectedGlobalElementIndices );
|
||||
|
||||
for ( size_t t = 0; t < foundElements.size(); t++ )
|
||||
{
|
||||
size_t globalIdx = m_femParts->globalIndex( i, foundElements[t] );
|
||||
intersectedCells->push_back( globalIdx );
|
||||
}
|
||||
}
|
||||
*intersectedCells = intersectedGlobalElementIndices;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -9,6 +9,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechContourMapViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechPartCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechPart.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechFaultReactivationResult.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@ -22,6 +23,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechContourMapViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechPartCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechPart.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechFaultReactivationResult.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
@ -441,7 +441,7 @@ RimGridView* RimGeoMechContourMapProjection::baseView() const
|
||||
std::vector<size_t> RimGeoMechContourMapProjection::findIntersectingCells( const cvf::BoundingBox& bbox ) const
|
||||
{
|
||||
std::vector<size_t> allCellIndices;
|
||||
m_femPart->findIntersectingCellsWithExistingSearchTree( bbox, &allCellIndices );
|
||||
m_femPart->findIntersectingElementsWithExistingSearchTree( bbox, &allCellIndices );
|
||||
return allCellIndices;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,394 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimGeoMechFaultReactivationResult.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RicWellLogTools.h"
|
||||
#include "WellLogCommands/RicNewWellLogPlotFeatureImpl.h"
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigReservoirGridTools.h"
|
||||
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
#include "RimWellLogDiffCurve.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimGeoMechFaultReactivationResult, "RimGeoMechFaultReactivationResult" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechFaultReactivationResult::RimGeoMechFaultReactivationResult()
|
||||
{
|
||||
// TODO: Update icon
|
||||
CAF_PDM_InitObject( "Fault Reactivation Result", ":/GeoMechCase24x24.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_intersection, "Intersection", "Intersection" );
|
||||
|
||||
CAF_PDM_InitField( &m_distanceFromIntersection, "FaceDistanceFromIntersection", 0.0, "Face Distance From Intersection" );
|
||||
CAF_PDM_InitField( &m_widthOutsideIntersection, "FaceWidthOutsideIntersection", 0.0, "Face Width Outside Intersection" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_createFaultReactivationResult, "CreateReactivationResult", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &m_createFaultReactivationResult );
|
||||
|
||||
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 );
|
||||
|
||||
CAF_PDM_InitField( &m_faceAWellPathPartIndex, "FaceAWellPathPartIndex", 0, "Face A Well Path Part Index" );
|
||||
m_faceAWellPathPartIndex.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitField( &m_faceBWellPathPartIndex, "FaceBWellPathPartIndex", 0, "Face B Well Path Part Index" );
|
||||
m_faceBWellPathPartIndex.uiCapability()->setUiHidden( true );
|
||||
|
||||
setDeletable( false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechFaultReactivationResult::~RimGeoMechFaultReactivationResult()
|
||||
{
|
||||
delete m_faceAWellPath;
|
||||
delete m_faceBWellPath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechFaultReactivationResult::onLoadDataAndUpdate()
|
||||
{
|
||||
createWellGeometry();
|
||||
createWellLogCurves();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimGeoMechFaultReactivationResult::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_intersection )
|
||||
{
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
if ( !activeView || !activeView->intersectionCollection() ) return options;
|
||||
|
||||
for ( auto* intersection : activeView->intersectionCollection()->intersections() )
|
||||
{
|
||||
// Only utilize polyline intersections with two points
|
||||
if ( intersection && intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE &&
|
||||
!intersection->polyLines().empty() && intersection->polyLines()[0].size() == 2 )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( intersection->name(), intersection ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechFaultReactivationResult::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Fault Reactivation Result" );
|
||||
group->add( &m_intersection );
|
||||
group->add( &m_distanceFromIntersection );
|
||||
group->add( &m_widthOutsideIntersection );
|
||||
group->add( &m_createFaultReactivationResult );
|
||||
group->add( &m_faceAWellPath );
|
||||
group->add( &m_faceBWellPath );
|
||||
group->add( &m_faceAWellPathPartIndex );
|
||||
group->add( &m_faceBWellPathPartIndex );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechFaultReactivationResult::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_distanceFromIntersection || changedField == &m_widthOutsideIntersection )
|
||||
{
|
||||
createWellGeometry();
|
||||
}
|
||||
if ( changedField == &m_createFaultReactivationResult && m_intersection() )
|
||||
{
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechFaultReactivationResult::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_createFaultReactivationResult )
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
{
|
||||
attrib->m_buttonText = "Create";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechFaultReactivationResult::createWellGeometry()
|
||||
{
|
||||
RimGeoMechCase* geomCase = firstAncestorOrThisOfTypeAsserted<RimGeoMechCase>();
|
||||
if ( !geomCase || !geomCase->geoMechData() ) return;
|
||||
RigFemPartCollection* geoMechPartCollection = geomCase->geoMechData()->femParts();
|
||||
if ( !geoMechPartCollection ) return;
|
||||
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" );
|
||||
m_faceAWellPath->setShowWellPath( false );
|
||||
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" );
|
||||
m_faceBWellPath->setShowWellPath( false );
|
||||
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> points = { polyLines[0][0], polyLines[0][1] };
|
||||
|
||||
// Create vector for well path defined by point a and b
|
||||
const cvf::Vec3d a = points[0];
|
||||
const cvf::Vec3d b = points[1];
|
||||
const cvf::Vec3d wellVector = b - a;
|
||||
|
||||
// Cross product of 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() );
|
||||
|
||||
// Create well points for face A and B
|
||||
const std::pair<cvf::Vec3d, cvf::Vec3d> faceAWellStartAndEnd = { widthAdjustedA + distanceVector, widthAdjustedB + distanceVector };
|
||||
const std::pair<cvf::Vec3d, cvf::Vec3d> faceBWellStartAndEnd = { widthAdjustedA - distanceVector, widthAdjustedB - distanceVector };
|
||||
|
||||
// Get center point between face well points to detect which part fault faces are in
|
||||
auto centerpoint = []( const cvf::Vec3d& a, const cvf::Vec3d& b ) -> cvf::Vec3d { return ( a + b ) / 2.0; };
|
||||
const cvf::Vec3d faceAWellPathCenter = centerpoint( faceAWellStartAndEnd.first, faceAWellStartAndEnd.second );
|
||||
const cvf::Vec3d faceBWellPathCenter = centerpoint( faceBWellStartAndEnd.first, faceBWellStartAndEnd.second );
|
||||
|
||||
// Update the well path target values
|
||||
const std::vector<cvf::Vec3d> faceAWellPoints = { faceAWellStartAndEnd.first, faceAWellPathCenter, faceAWellStartAndEnd.second };
|
||||
const std::vector<cvf::Vec3d> faceBWellPoints = { faceBWellStartAndEnd.first, faceBWellPathCenter, faceBWellStartAndEnd.second };
|
||||
m_faceAWellPath->geometryDefinition()->createAndInsertTargets( faceAWellPoints );
|
||||
m_faceBWellPath->geometryDefinition()->createAndInsertTargets( faceBWellPoints );
|
||||
m_faceAWellPath->geometryDefinition()->setUseAutoGeneratedTargetAtSeaLevel( false );
|
||||
m_faceBWellPath->geometryDefinition()->setUseAutoGeneratedTargetAtSeaLevel( false );
|
||||
m_faceAWellPath->createWellPathGeometry();
|
||||
m_faceBWellPath->createWellPathGeometry();
|
||||
|
||||
// Detect which part well path centers are in
|
||||
m_faceAWellPathPartIndex = getPartIndexFromPoint( geoMechPartCollection, faceAWellPathCenter );
|
||||
m_faceBWellPathPartIndex = getPartIndexFromPoint( geoMechPartCollection, faceBWellPathCenter );
|
||||
|
||||
// Update UI
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechFaultReactivationResult::createWellLogCurves()
|
||||
{
|
||||
RimGeoMechCase* geomCase = firstAncestorOrThisOfTypeAsserted<RimGeoMechCase>();
|
||||
if ( !geomCase ) return;
|
||||
Rim3dView* view = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
if ( !view ) return;
|
||||
|
||||
// Create Plot
|
||||
const bool showAfterCreation = true;
|
||||
const QString name = plotDescription();
|
||||
RimWellLogPlot* newPlot = RicNewWellLogPlotFeatureImpl::createWellLogPlot( showAfterCreation, name );
|
||||
newPlot->setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM );
|
||||
newPlot->nameConfig()->setCustomName( name );
|
||||
|
||||
// Create curve tracks
|
||||
const bool doUpdateAfter = true;
|
||||
RimWellLogTrack* wellLogExtractionDisplacementTrack =
|
||||
RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( doUpdateAfter, QString( "Fault Reactivation Displacement Curves" ), newPlot );
|
||||
RimWellLogTrack* wellLogDiffTrack =
|
||||
RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( doUpdateAfter, QString( "Fault Reactivation Displacement Diff" ), newPlot );
|
||||
RimWellLogTrack* wellLogExtractionFaultmobTrack =
|
||||
RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( doUpdateAfter, QString( "Fault Reactivation Faultmob Curves" ), newPlot );
|
||||
|
||||
// Well log extraction displacement curves
|
||||
RigFemResultAddress wellLogExtractionDisplacementResult( RigFemResultPosEnum::RIG_NODAL, "U", "U_LENGTH" );
|
||||
auto* faceADisplacementCurve = createWellLogExtractionCurveAndAddToTrack( wellLogExtractionDisplacementTrack,
|
||||
wellLogExtractionDisplacementResult,
|
||||
m_faceAWellPath(),
|
||||
m_faceAWellPathPartIndex() );
|
||||
auto* faceBDisplacementCurve = createWellLogExtractionCurveAndAddToTrack( wellLogExtractionDisplacementTrack,
|
||||
wellLogExtractionDisplacementResult,
|
||||
m_faceBWellPath(),
|
||||
m_faceBWellPathPartIndex() );
|
||||
|
||||
if ( !faceADisplacementCurve || !faceBDisplacementCurve )
|
||||
{
|
||||
RiaLogging::error( "Failed to create well log extraction displacement curves" );
|
||||
return;
|
||||
}
|
||||
|
||||
// Create well log diff curve for m_faceAWellPath and m_faceBWellPath
|
||||
RimWellLogDiffCurve* faceWellLogDiffCurve = RicWellLogTools::addWellLogDiffCurve( wellLogDiffTrack );
|
||||
faceWellLogDiffCurve->setWellLogCurves( faceADisplacementCurve, faceBDisplacementCurve );
|
||||
faceWellLogDiffCurve->loadDataAndUpdate( true );
|
||||
faceWellLogDiffCurve->updateConnectedEditors();
|
||||
|
||||
// Well log extraction faultmob curves
|
||||
RigFemResultAddress wellLogExtractionFaultmobResult( RigFemResultPosEnum::RIG_ELEMENT_NODAL_FACE, "SE", "FAULTMOB" );
|
||||
createWellLogExtractionCurveAndAddToTrack( wellLogExtractionFaultmobTrack,
|
||||
wellLogExtractionFaultmobResult,
|
||||
m_faceAWellPath(),
|
||||
m_faceAWellPathPartIndex() );
|
||||
createWellLogExtractionCurveAndAddToTrack( wellLogExtractionFaultmobTrack,
|
||||
wellLogExtractionFaultmobResult,
|
||||
m_faceBWellPath(),
|
||||
m_faceBWellPathPartIndex() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimGeoMechFaultReactivationResult::getPartIndexFromPoint( const RigFemPartCollection* const partCollection, const cvf::Vec3d& point ) const
|
||||
{
|
||||
int idx = 0;
|
||||
if ( !partCollection ) return idx;
|
||||
|
||||
const cvf::BoundingBox intersectingBb( point, point );
|
||||
std::vector<size_t> intersectedGlobalElementIndices;
|
||||
partCollection->findIntersectingGlobalElementIndices( intersectingBb, &intersectedGlobalElementIndices );
|
||||
|
||||
if ( intersectedGlobalElementIndices.empty() ) return idx;
|
||||
|
||||
// Utilize first intersected element to detect part for point
|
||||
const auto [partId, elementIndex] = partCollection->partIdAndElementIndex( intersectedGlobalElementIndices.front() );
|
||||
idx = partId;
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogExtractionCurve* RimGeoMechFaultReactivationResult::createWellLogExtractionCurveAndAddToTrack( RimWellLogTrack* track,
|
||||
const RigFemResultAddress& resultAddress,
|
||||
RimModeledWellPath* wellPath,
|
||||
int partId )
|
||||
{
|
||||
RimGeoMechCase* geomCase = firstAncestorOrThisOfTypeAsserted<RimGeoMechCase>();
|
||||
if ( !geomCase ) return nullptr;
|
||||
Rim3dView* view = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
if ( !view ) return nullptr;
|
||||
|
||||
const int branchIndex = -1;
|
||||
const bool useBranchDetection = false;
|
||||
const bool updateParentPlot = true;
|
||||
|
||||
RimWellLogExtractionCurve* wellLogExtractionCurve =
|
||||
RicWellLogTools::addWellLogExtractionCurve( track, geomCase, view, wellPath, nullptr, branchIndex, useBranchDetection );
|
||||
wellLogExtractionCurve->setGeoMechResultAddress( resultAddress );
|
||||
wellLogExtractionCurve->setGeoMechPart( partId );
|
||||
wellLogExtractionCurve->updateConnectedEditors();
|
||||
wellLogExtractionCurve->loadDataAndUpdate( updateParentPlot );
|
||||
|
||||
return wellLogExtractionCurve;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGeoMechFaultReactivationResult::plotDescription() const
|
||||
{
|
||||
RimWellLogPlotCollection* wellLogPlotCollection = RimMainPlotCollection::current()->wellLogPlotCollection();
|
||||
QString plotDescription = "Fault Reactivation Plot";
|
||||
|
||||
if ( !wellLogPlotCollection ) return plotDescription;
|
||||
|
||||
int count = 0;
|
||||
for ( const auto& plot : wellLogPlotCollection->wellLogPlots() )
|
||||
{
|
||||
if ( plot->description().startsWith( plotDescription ) ) ++count;
|
||||
}
|
||||
|
||||
return count == 0 ? plotDescription : QString( "%1 %2" ).arg( plotDescription ).arg( count );
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RimCheckableNamedObject.h"
|
||||
#include "RimExtrudedCurveIntersection.h"
|
||||
#include "RimIntersectionResultsDefinitionCollection.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RigFemPartCollection;
|
||||
class RigFemResultAddress;
|
||||
|
||||
class RimModeledWellPath;
|
||||
class RimWellLogTrack;
|
||||
class RimWellLogExtractionCurve;
|
||||
|
||||
class RimGeoMechFaultReactivationResult : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimGeoMechFaultReactivationResult();
|
||||
~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();
|
||||
|
||||
int getPartIndexFromPoint( const RigFemPartCollection* const partCollection, const cvf::Vec3d& point ) const;
|
||||
|
||||
RimWellLogExtractionCurve* createWellLogExtractionCurveAndAddToTrack( RimWellLogTrack* track,
|
||||
const RigFemResultAddress& resultAddress,
|
||||
RimModeledWellPath* wellPath,
|
||||
int partId );
|
||||
|
||||
QString plotDescription() const;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimExtrudedCurveIntersection*> m_intersection;
|
||||
|
||||
caf::PdmField<bool> m_createFaultReactivationResult;
|
||||
|
||||
caf::PdmField<double> m_distanceFromIntersection; // To move wells to each side of intersection
|
||||
caf::PdmField<double> m_widthOutsideIntersection; // To stretch well points outside intersection
|
||||
|
||||
caf::PdmPtrField<RimModeledWellPath*> m_faceAWellPath;
|
||||
caf::PdmPtrField<RimModeledWellPath*> m_faceBWellPath;
|
||||
|
||||
caf::PdmField<int> m_faceAWellPathPartIndex;
|
||||
caf::PdmField<int> m_faceBWellPathPartIndex;
|
||||
};
|
@ -37,6 +37,7 @@
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechFaultReactivationResult.h"
|
||||
#include "RimGeoMechPart.h"
|
||||
#include "RimGeoMechPartCollection.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
@ -98,6 +99,9 @@ RimGeoMechView::RimGeoMechView()
|
||||
m_tensorResults = new RimTensorResults();
|
||||
m_tensorResults.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_faultReactivationResult, "FaultReactivationResult", "Fault Reactivation Result" );
|
||||
m_faultReactivationResult = new RimGeoMechFaultReactivationResult();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_propertyFilterCollection, "PropertyFilters", "Property Filters" );
|
||||
m_propertyFilterCollection = new RimGeoMechPropertyFilterCollection();
|
||||
m_propertyFilterCollection.uiCapability()->setUiTreeHidden( true );
|
||||
@ -132,6 +136,7 @@ RimGeoMechView::~RimGeoMechView()
|
||||
delete m_tensorResults;
|
||||
delete cellResult;
|
||||
delete m_propertyFilterCollection;
|
||||
delete m_faultReactivationResult;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1050,6 +1055,7 @@ void RimGeoMechView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
|
||||
uiTreeOrdering.add( m_tensorResults() );
|
||||
uiTreeOrdering.add( m_cellFilterCollection() );
|
||||
uiTreeOrdering.add( m_propertyFilterCollection() );
|
||||
uiTreeOrdering.add( m_faultReactivationResult() );
|
||||
|
||||
addRequiredUiTreeObjects( uiTreeOrdering );
|
||||
|
||||
|
@ -37,6 +37,7 @@ class Rim3dOverlayInfoConfig;
|
||||
class RimCellRangeFilterCollection;
|
||||
class RimGeoMechCase;
|
||||
class RimGeoMechCellColors;
|
||||
class RimGeoMechFaultReactivationResult;
|
||||
class RimGeoMechPartCollection;
|
||||
class RimGeoMechPropertyFilterCollection;
|
||||
class RimGeoMechResultDefinition;
|
||||
@ -150,6 +151,7 @@ private:
|
||||
|
||||
caf::PdmChildField<RimTensorResults*> m_tensorResults;
|
||||
caf::PdmChildField<RimGeoMechPropertyFilterCollection*> m_propertyFilterCollection;
|
||||
caf::PdmChildField<RimGeoMechFaultReactivationResult*> m_faultReactivationResult;
|
||||
caf::PdmPointer<RimGeoMechPropertyFilterCollection> m_overridePropertyFilterCollection;
|
||||
caf::PdmChildField<RimGeoMechPartCollection*> m_partsCollection;
|
||||
caf::PdmPointer<RimGeoMechCase> m_geomechCase;
|
||||
|
@ -638,6 +638,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicNewWellLogRftCurveFeature";
|
||||
menuBuilder << "RicNewWellLogFileCurveFeature";
|
||||
menuBuilder << "RicNewWellMeasurementCurveFeature";
|
||||
menuBuilder << "RicNewWellLogDiffCurveFeature";
|
||||
menuBuilder << "RicNewEnsembleWellLogCurveSetFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicDeleteSubPlotFeature";
|
||||
@ -1243,6 +1244,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
}
|
||||
else if ( dynamic_cast<RimWellLogCurve*>( firstUiItem ) || dynamic_cast<RimWellLogTrack*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewWellLogDiffCurveFeature";
|
||||
menuBuilder << "RicExportToLasFileFeature";
|
||||
menuBuilder << "RicChangeDataSourceFeature";
|
||||
}
|
||||
|
@ -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,300 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RiaLogging.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"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellLogDiffCurve, "WellLogDiffCurve" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogDiffCurve::RimWellLogDiffCurve()
|
||||
{
|
||||
CAF_PDM_InitObject( "Well Log Diff Curve", ":/WellLogCurve16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_firstWellLogCurve, "FirstWellLogCurve", "First Well Log Curve" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_secondWellLogCurve, "SecondWellLogCurve", "Second Well Log Curve" );
|
||||
|
||||
setNamingMethod( RiaDefines::ObjectNamingMethod::AUTO );
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogDiffCurve::~RimWellLogDiffCurve()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::setWellLogCurves( RimWellLogCurve* firstWellLogCurve, RimWellLogCurve* secondWellLogCurve )
|
||||
{
|
||||
disconnectWellLogCurveChangedFromSlots( m_firstWellLogCurve );
|
||||
disconnectWellLogCurveChangedFromSlots( m_secondWellLogCurve );
|
||||
if ( firstWellLogCurve )
|
||||
{
|
||||
m_firstWellLogCurve = firstWellLogCurve;
|
||||
connectWellLogCurveChangedToSlots( m_firstWellLogCurve );
|
||||
}
|
||||
if ( secondWellLogCurve )
|
||||
{
|
||||
m_secondWellLogCurve = secondWellLogCurve;
|
||||
connectWellLogCurveChangedToSlots( m_secondWellLogCurve );
|
||||
}
|
||||
|
||||
if ( m_namingMethod() == RiaDefines::ObjectNamingMethod::AUTO )
|
||||
{
|
||||
setAutomaticName();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogDiffCurve::createCurveAutoName()
|
||||
{
|
||||
if ( !m_firstWellLogCurve() || !m_secondWellLogCurve() ) return QString( "Not able to find source curves for difference curve" );
|
||||
return QString( "Diff (%1 - %2)" ).arg( m_firstWellLogCurve->curveName() ).arg( m_secondWellLogCurve->curveName() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
if ( !m_firstWellLogCurve() || !m_secondWellLogCurve() ) return;
|
||||
|
||||
if ( m_namingMethod() == RiaDefines::ObjectNamingMethod::AUTO )
|
||||
{
|
||||
setAutomaticName();
|
||||
}
|
||||
|
||||
// Use well A as reference for resampled curve data
|
||||
auto* firstCurveData = m_firstWellLogCurve()->curveData();
|
||||
auto* secondCurveData = m_secondWellLogCurve()->curveData();
|
||||
|
||||
if ( !firstCurveData || !secondCurveData ) return;
|
||||
if ( firstCurveData->depthUnit() != secondCurveData->depthUnit() )
|
||||
{
|
||||
RiaLogging::warning( "Well log curve depth units are not the same" );
|
||||
}
|
||||
if ( firstCurveData->propertyValueUnit() != secondCurveData->propertyValueUnit() )
|
||||
{
|
||||
RiaLogging::warning( "Well log curve property value units are not the same" );
|
||||
}
|
||||
|
||||
const auto depthUnit = firstCurveData->depthUnit();
|
||||
const auto depthType = RiaDefines::DepthTypeEnum::MEASURED_DEPTH;
|
||||
const auto propertyUnit = firstCurveData->propertyValueUnit();
|
||||
|
||||
// Get curve A depths and property values
|
||||
const auto firstCurveDepthValues = firstCurveData->depths( depthType );
|
||||
const auto firstCurvePropertyValues = firstCurveData->propertyValues();
|
||||
|
||||
// Resample curve B to curve A
|
||||
cvf::ref<RigWellLogCurveData> secondCurveDataResampled = secondCurveData->calculateResampledCurveData( depthType, firstCurveDepthValues );
|
||||
auto secondCurveDepthValuesResampled = secondCurveDataResampled->depths( depthType );
|
||||
auto secondCurvePropertyValuesResampled = secondCurveDataResampled->propertyValues();
|
||||
|
||||
// Verify equal sizes
|
||||
if ( firstCurveDepthValues.size() != firstCurvePropertyValues.size() ) return;
|
||||
if ( firstCurveDepthValues.size() != secondCurveDepthValuesResampled.size() ) return;
|
||||
if ( firstCurveDepthValues.size() != secondCurvePropertyValuesResampled.size() ) return;
|
||||
|
||||
// Calculate diff curve
|
||||
std::vector<double> curveDiffDepthValues( firstCurveDepthValues.size() );
|
||||
std::vector<double> curveDiffPropertyValues( firstCurvePropertyValues.size() );
|
||||
for ( size_t i = 0; i < firstCurvePropertyValues.size(); ++i )
|
||||
{
|
||||
curveDiffPropertyValues[i] = firstCurvePropertyValues[i] - secondCurvePropertyValuesResampled[i];
|
||||
curveDiffDepthValues[i] = firstCurveDepthValues[i];
|
||||
}
|
||||
|
||||
const bool useLogarithmicScale = false;
|
||||
const bool isExtractionCurve = false;
|
||||
|
||||
// Set curve data
|
||||
auto depthsMap = std::map<RiaDefines::DepthTypeEnum, std::vector<double>>();
|
||||
depthsMap[depthType] = curveDiffDepthValues;
|
||||
setPropertyValuesAndDepths( curveDiffPropertyValues, depthsMap, 0.0, depthUnit, isExtractionCurve, useLogarithmicScale, propertyUnit );
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::onWellLogCurveChanged( const SignalEmitter* emitter )
|
||||
{
|
||||
onLoadDataAndUpdate( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::connectWellLogCurveChangedToSlots( RimWellLogCurve* wellLogCurve )
|
||||
{
|
||||
if ( !wellLogCurve ) return;
|
||||
|
||||
wellLogCurve->dataChanged.connect( this, &RimWellLogDiffCurve::onWellLogCurveChanged );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::disconnectWellLogCurveChangedFromSlots( RimWellLogCurve* wellLogCurve )
|
||||
{
|
||||
if ( !wellLogCurve ) return;
|
||||
|
||||
wellLogCurve->dataChanged.disconnect( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogDiffCurve::wellName() const
|
||||
{
|
||||
return m_curveName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogDiffCurve::wellLogChannelUiName() const
|
||||
{
|
||||
return m_curveName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogDiffCurve::wellLogChannelUnits() const
|
||||
{
|
||||
CAF_ASSERT( "TO BE IMPLEMETNED!" );
|
||||
|
||||
if ( m_firstWellLogCurve->wellLogChannelUnits() != m_secondWellLogCurve->wellLogChannelUnits() )
|
||||
{
|
||||
return QString( "%1 - %2" ).arg( m_firstWellLogCurve->wellLogChannelUnits() ).arg( m_secondWellLogCurve->wellLogChannelUnits() );
|
||||
}
|
||||
return m_firstWellLogCurve->wellLogChannelUnits();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimPlotCurve::updateFieldUiState();
|
||||
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Data Source" );
|
||||
group->add( &m_firstWellLogCurve );
|
||||
group->add( &m_secondWellLogCurve );
|
||||
|
||||
RimStackablePlotCurve::defaultUiOrdering( uiOrdering );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
|
||||
{
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogDiffCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
RimWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_firstWellLogCurve || changedField == &m_secondWellLogCurve )
|
||||
{
|
||||
if ( !m_firstWellLogCurve() || !m_secondWellLogCurve() ) return;
|
||||
|
||||
PdmObjectHandle* prevValue = oldValue.value<caf::PdmPointer<PdmObjectHandle>>().rawPtr();
|
||||
auto* prevWellLogCurve = dynamic_cast<RimWellLogCurve*>( prevValue );
|
||||
disconnectWellLogCurveChangedFromSlots( prevWellLogCurve );
|
||||
|
||||
if ( changedField == &m_firstWellLogCurve ) connectWellLogCurveChangedToSlots( m_firstWellLogCurve );
|
||||
if ( changedField == &m_secondWellLogCurve ) connectWellLogCurveChangedToSlots( m_firstWellLogCurve );
|
||||
|
||||
onLoadDataAndUpdate( true );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimWellLogDiffCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions );
|
||||
if ( !options.empty() ) return options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_firstWellLogCurve || fieldNeedingOptions == &m_secondWellLogCurve )
|
||||
{
|
||||
RimWellLogPlotCollection* wellLogPlotCollection = RimMainPlotCollection::current()->wellLogPlotCollection();
|
||||
|
||||
if ( !wellLogPlotCollection ) return {};
|
||||
|
||||
// Find each well log plot in collection
|
||||
std::vector<RimWellLogCurve*> wellLogCurves = wellLogPlotCollection->descendantsOfType<RimWellLogCurve>();
|
||||
for ( RimWellLogCurve* curve : wellLogCurves )
|
||||
{
|
||||
if ( !curve || curve == this ) continue;
|
||||
options.push_back( caf::PdmOptionItemInfo( curve->curveName(), curve ) );
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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* firstWellLogCurve, RimWellLogCurve* secondWellLogCurve );
|
||||
|
||||
// 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 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;
|
||||
|
||||
private:
|
||||
// Inherited via RimWellLogCurve
|
||||
virtual QString createCurveAutoName() override;
|
||||
virtual void onLoadDataAndUpdate( bool updateParentPlot ) override;
|
||||
|
||||
void setAutomaticName();
|
||||
|
||||
void onWellLogCurveChanged( const SignalEmitter* emitter );
|
||||
void connectWellLogCurveChangedToSlots( RimWellLogCurve* wellLogCurve );
|
||||
void disconnectWellLogCurveChangedFromSlots( RimWellLogCurve* wellLogCurve );
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimCase*> m_case;
|
||||
|
||||
caf::PdmPtrField<RimWellLogCurve*> m_firstWellLogCurve;
|
||||
caf::PdmPtrField<RimWellLogCurve*> m_secondWellLogCurve;
|
||||
};
|
@ -67,11 +67,11 @@ int RimWellIADataAccess::elementIndex( cvf::Vec3d position )
|
||||
cvf::BoundingBox bb;
|
||||
bb.add( position );
|
||||
|
||||
std::vector<size_t> closeCells;
|
||||
m_caseData->femParts()->part( 0 )->findIntersectingCells( bb, &closeCells );
|
||||
if ( closeCells.size() == 0 ) return -1;
|
||||
std::vector<size_t> closeElements;
|
||||
m_caseData->femParts()->part( 0 )->findIntersectingElementIndices( bb, &closeElements );
|
||||
if ( closeElements.size() == 0 ) return -1;
|
||||
|
||||
return (int)closeCells[0];
|
||||
return (int)closeElements[0];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -639,6 +639,14 @@ bool RimWellPath::showWellPath() const
|
||||
return m_showWellPath();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::setShowWellPath( bool showWellPath )
|
||||
{
|
||||
m_showWellPath = showWellPath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -139,6 +139,7 @@ public:
|
||||
|
||||
bool showWellPathLabel() const;
|
||||
bool showWellPath() const;
|
||||
void setShowWellPath( bool showWellPath );
|
||||
|
||||
cvf::Color3f wellPathColor() const;
|
||||
void setWellPathColor( const cvf::Color3f& color );
|
||||
|
@ -236,7 +236,7 @@ void RimWellPathGeometryDef::setFixedMeasuredDepths( const std::vector<double>&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellPathTarget*> RimWellPathGeometryDef::createTargets( const std::vector<cvf::Vec3d>& points )
|
||||
std::vector<RimWellPathTarget*> RimWellPathGeometryDef::createAndInsertTargets( const std::vector<cvf::Vec3d>& points )
|
||||
{
|
||||
CAF_ASSERT( points.size() >= 2u );
|
||||
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
void setFixedWellPathPoints( const std::vector<cvf::Vec3d>& points );
|
||||
void setFixedMeasuredDepths( const std::vector<double>& mds );
|
||||
|
||||
std::vector<RimWellPathTarget*> createTargets( const std::vector<cvf::Vec3d>& points );
|
||||
std::vector<RimWellPathTarget*> createAndInsertTargets( const std::vector<cvf::Vec3d>& points );
|
||||
|
||||
std::pair<RimWellPathTarget*, RimWellPathTarget*> findActiveTargetsAroundInsertionPoint( const RimWellPathTarget* targetToInsertBefore );
|
||||
|
||||
|
@ -160,7 +160,7 @@ void RigCaseToCaseCellMapper::calculateEclToGeomCellMapping( RigMainGrid* master
|
||||
elmBBox.add( geoMechConvertedEclCell[i] );
|
||||
|
||||
std::vector<size_t> closeElements;
|
||||
dependentFemPart->findIntersectingCells( elmBBox, &closeElements );
|
||||
dependentFemPart->findIntersectingElementIndices( elmBBox, &closeElements );
|
||||
|
||||
for ( size_t ccIdx = 0; ccIdx < closeElements.size(); ++ccIdx )
|
||||
{
|
||||
|
@ -383,7 +383,7 @@ RigCaseToCaseRangeFilterMapper::CellMatchType RigCaseToCaseRangeFilterMapper::fi
|
||||
elmBBox.add( geoMechConvertedEclCell[i] );
|
||||
|
||||
std::vector<size_t> closeElements;
|
||||
dependentFemPart->findIntersectingCells( elmBBox, &closeElements );
|
||||
dependentFemPart->findIntersectingElementIndices( elmBBox, &closeElements );
|
||||
|
||||
cvf::Vec3d elmCorners[8];
|
||||
int elmIdxToBestMatch = -1;
|
||||
|
@ -1033,7 +1033,7 @@ std::vector<size_t> RigGeoMechWellLogExtractor::findCloseCells( const cvf::Bound
|
||||
|
||||
if ( m_caseData->femParts()->partCount() )
|
||||
{
|
||||
m_caseData->femParts()->part( m_partId )->findIntersectingCells( bb, &closeCells );
|
||||
m_caseData->femParts()->part( m_partId )->findIntersectingElementIndices( bb, &closeCells );
|
||||
}
|
||||
return closeCells;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user