#5001 Move RimWellMeasurementCollection from RimWellPath to

RimWellPathCollection.

Also add filtering of measurements by well path.
This commit is contained in:
Kristian Bendiksen 2019-11-25 12:18:39 +01:00
parent ea534cace6
commit b4fea5f00a
10 changed files with 147 additions and 63 deletions

View File

@ -84,25 +84,16 @@ void RicImportWellMeasurementsFeature::onActionTriggered( bool isChecked )
RimWellMeasurement* lastWellMeasurement = nullptr;
for ( auto& measurement : wellMeasurements )
{
RimWellPath* wellPath = wellPathCollection->tryFindMatchingWellPath( measurement.wellName );
if ( wellPath == nullptr )
{
RiaLogging::warning( QString( "Import Well Measurements : Imported file contains unknown well path '%1'." )
.arg( measurement.wellName ) );
}
else
{
RimWellMeasurement* wellMeasurement = new RimWellMeasurement;
wellMeasurement->setWellName( measurement.wellName );
wellMeasurement->setMD( measurement.MD );
wellMeasurement->setValue( measurement.value );
wellMeasurement->setDate( measurement.date );
wellMeasurement->setQuality( measurement.quality );
wellMeasurement->setKind( measurement.kind );
wellMeasurement->setRemark( measurement.remark );
wellPath->measurementCollection()->appendMeasurement( wellMeasurement );
lastWellMeasurement = wellMeasurement;
}
RimWellMeasurement* wellMeasurement = new RimWellMeasurement;
wellMeasurement->setWellName( measurement.wellName );
wellMeasurement->setMD( measurement.MD );
wellMeasurement->setValue( measurement.value );
wellMeasurement->setDate( measurement.date );
wellMeasurement->setQuality( measurement.quality );
wellMeasurement->setKind( measurement.kind );
wellMeasurement->setRemark( measurement.remark );
wellPathCollection->measurementCollection()->appendMeasurement( wellMeasurement );
lastWellMeasurement = wellMeasurement;
}
wellPathCollection->uiCapability()->updateConnectedEditors();

View File

@ -37,16 +37,17 @@
#include "RimFishbonesMultipleSubs.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimTools.h"
#include "RimWellMeasurement.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellMeasurementFilter.h"
#include "RimWellPath.h"
#include "RimWellPathAttribute.h"
#include "RimWellPathAttributeCollection.h"
#include "RimWellPathCollection.h"
#include "RimWellPathValve.h"
#include "RimWellPathFracture.h"
#include "RimWellPathFractureCollection.h"
#include "RimWellPathValve.h"
#include "Riv3dWellLogPlanePartMgr.h"
#include "RivFishbonesSubsPartMgr.h"
@ -287,10 +288,17 @@ void RivWellPathPartMgr::appendWellMeasurementsToModel( cvf::ModelBasicList*
{
if ( !m_rimWellPath ) return;
if ( !m_rimWellPath->measurementCollection()->isChecked() ) return;
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
if ( !wellPathCollection ) return;
RimWellMeasurementCollection* wellMeasurementCollection = wellPathCollection->measurementCollection();
if ( !wellMeasurementCollection ) return;
RivPipeGeometryGenerator geoGenerator;
std::vector<RimWellMeasurement*> wellMeasurements = m_rimWellPath->measurementCollection()->measurements();
std::vector<RimWellMeasurement*> wellMeasurements =
RimWellMeasurementFilter::filterMeasurements( wellMeasurementCollection->measurements(),
*wellPathCollection,
*m_rimWellPath );
for ( RimWellMeasurement* wellMeasurement : wellMeasurements )
{

View File

@ -144,6 +144,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.h
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementFilter.h
)
@ -292,6 +293,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.cpp
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementFilter.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -29,6 +29,7 @@
#include "RimWellLogTrack.h"
#include "RimWellMeasurement.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellMeasurementFilter.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPlotTools.h"
@ -81,14 +82,20 @@ void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot )
firstAncestorOrThisOfType( wellLogPlot );
CVF_ASSERT( wellLogPlot );
if ( m_wellPath && !m_measurementKind().isEmpty() && m_wellPath->measurementCollection() )
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
if ( m_wellPath && !m_measurementKind().isEmpty() && wellPathCollection )
{
const RimWellMeasurementCollection* measurementCollection = m_wellPath->measurementCollection();
const RimWellMeasurementCollection* measurementCollection = wellPathCollection->measurementCollection();
std::vector<RimWellMeasurement*> measurements =
RimWellMeasurementFilter::filterMeasurements( measurementCollection->measurements(),
*wellPathCollection,
*m_wellPath );
// Extract the values for this measurement kind
std::vector<double> values;
std::vector<double> measuredDepthValues;
for ( auto& measurement : measurementCollection->measurements() )
for ( auto& measurement : measurements )
{
if ( measurement->kind() == measurementKind() )
{

View File

@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellMeasurementFilter.h"
#include "RimWellMeasurement.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellMeasurement*>
RimWellMeasurementFilter::filterMeasurements( const std::vector<RimWellMeasurement*>& measurements,
const RimWellPathCollection& wellPathCollection,
const RimWellPath& wellPath )
{
std::vector<RimWellMeasurement*> filteredMeasurements;
for ( auto& measurement : measurements )
{
RimWellPath* matchedWellPath = wellPathCollection.tryFindMatchingWellPath( measurement->wellName() );
if ( matchedWellPath && matchedWellPath == &wellPath )
{
filteredMeasurements.push_back( measurement );
}
}
return filteredMeasurements;
}

View File

@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <vector>
class RimWellPath;
class RimWellMeasurement;
class RimWellPathCollection;
class RimWellMeasurementFilter
{
public:
static std::vector<RimWellMeasurement*> filterMeasurements( const std::vector<RimWellMeasurement*>& measurements,
const RimWellPathCollection& wellPathCollection,
const RimWellPath& rimWellPath );
private:
RimWellMeasurementFilter();
};

View File

@ -42,7 +42,6 @@
#include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellPathAttributeCollection.h"
#include "RimWellPathCollection.h"
#include "RimWellPathCompletions.h"
@ -129,10 +128,6 @@ RimWellPath::RimWellPath()
m_wellPathAttributes = new RimWellPathAttributeCollection;
m_wellPathAttributes->uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitFieldNoDefault( &m_wellMeasurements, "WellMeasurements", "Measurements", "", "", "" );
m_wellMeasurements = new RimWellMeasurementCollection;
m_wellMeasurements->uiCapability()->setUiTreeHidden( true );
m_wellPath = nullptr;
}
@ -496,24 +491,6 @@ const RimWellPathAttributeCollection* RimWellPath::attributeCollection() const
return m_wellPathAttributes;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellMeasurementCollection* RimWellPath::measurementCollection()
{
return m_wellMeasurements;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimWellMeasurementCollection* RimWellPath::measurementCollection() const
{
return m_wellMeasurements;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -630,11 +607,6 @@ void RimWellPath::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
uiTreeOrdering.add( m_wellPathAttributes() );
}
if ( !m_wellMeasurements->measurements().empty() )
{
uiTreeOrdering.add( m_wellMeasurements() );
}
uiTreeOrdering.skipRemainingChildren( true );
}

View File

@ -49,7 +49,6 @@ class RimFishboneWellPathCollection;
class RimFishbonesCollection;
class RimPerforationCollection;
class RimWellPathAttributeCollection;
class RimWellMeasurementCollection;
class RimWellPathCompletions;
class RigWellPathFormations;
@ -111,8 +110,6 @@ public:
const RimWellPathFractureCollection* fractureCollection() const;
RimWellPathAttributeCollection* attributeCollection();
const RimWellPathAttributeCollection* attributeCollection() const;
RimWellMeasurementCollection* measurementCollection();
const RimWellMeasurementCollection* measurementCollection() const;
bool showWellPathLabel() const;
bool showWellPath() const;
@ -174,7 +171,6 @@ private:
caf::PdmChildField<Rim3dWellLogCurveCollection*> m_3dWellLogCurves;
caf::PdmChildField<RimWellPathCompletions*> m_completions;
caf::PdmChildField<RimWellPathAttributeCollection*> m_wellPathAttributes;
caf::PdmChildField<RimWellMeasurementCollection*> m_wellMeasurements;
private:
static size_t simulationWellBranchCount( const QString& simWellName );

View File

@ -38,6 +38,7 @@
#include "RimPerforationCollection.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellPath.h"
#include "Riu3DMainWindowTools.h"
@ -103,9 +104,12 @@ RimWellPathCollection::RimWellPathCollection()
CAF_PDM_InitField( &wellPathClipZDistance, "WellPathClipZDistance", 100, "Well Path Clipping Depth Distance", "", "", "" );
CAF_PDM_InitFieldNoDefault( &wellPaths, "WellPaths", "Well Paths", "", "", "" );
wellPaths.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_wellMeasurements, "WellMeasurements", "Measurements", "", "", "" );
m_wellMeasurements = new RimWellMeasurementCollection;
m_wellMeasurements->uiCapability()->setUiTreeHidden( true );
m_wellPathImporter = new RifWellPathImporter;
m_wellPathFormationsImporter = new RifWellPathFormationsImporter;
m_mostRecentlyUpdatedWellPath = nullptr;
@ -221,7 +225,8 @@ std::vector<RimFileWellPath*> RimWellPathCollection::addWellPaths( QStringList f
QString s2 = f2.fileName();
if ( s1 == s2 )
{
// printf("Attempting to open well path JSON file that is already open:\n %s\n", (const char*) filePath.toLocal8Bit());
// printf("Attempting to open well path JSON file that is already open:\n %s\n", (const char*)
// filePath.toLocal8Bit());
alreadyOpen = true;
errorMessages->push_back( QString( "%1 is already loaded" ).arg( filePath ) );
break;
@ -654,3 +659,21 @@ RiaEclipseUnitTools::UnitSystemType RimWellPathCollection::findUnitSystemForWell
}
return RiaEclipseUnitTools::UNITS_UNKNOWN;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellMeasurementCollection* RimWellPathCollection::measurementCollection()
{
return m_wellMeasurements;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimWellMeasurementCollection* RimWellPathCollection::measurementCollection() const
{
return m_wellMeasurements;
}

View File

@ -42,6 +42,7 @@ class RimProject;
class RimWellLogFile;
class RimWellPath;
class RifWellPathFormationsImporter;
class RimWellMeasurementCollection;
class QString;
namespace cvf
@ -111,6 +112,9 @@ public:
bool anyWellsContainingPerforationIntervals() const;
size_t modelledWellPathCount() const;
RimWellMeasurementCollection* measurementCollection();
const RimWellMeasurementCollection* measurementCollection() const;
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
@ -125,7 +129,8 @@ private:
RiaEclipseUnitTools::UnitSystemType findUnitSystemForWellPath( const RimWellPath* wellPath );
RifWellPathImporter* m_wellPathImporter;
RifWellPathFormationsImporter* m_wellPathFormationsImporter;
caf::PdmPointer<RimWellPath> m_mostRecentlyUpdatedWellPath;
RifWellPathImporter* m_wellPathImporter;
RifWellPathFormationsImporter* m_wellPathFormationsImporter;
caf::PdmPointer<RimWellPath> m_mostRecentlyUpdatedWellPath;
caf::PdmChildField<RimWellMeasurementCollection*> m_wellMeasurements;
};