#6754: Fracture Model: support non-net layers

This commit is contained in:
Kristian Bendiksen 2020-10-12 14:36:51 +02:00
parent a31f6deb0c
commit f4631e7f9d
5 changed files with 334 additions and 0 deletions

View File

@ -169,6 +169,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimFractureModelStressCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimAbstractPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimFractureModelPropertyCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimFaciesProperties.h
${CMAKE_CURRENT_LIST_DIR}/RimNonNetLayers.h
)
@ -340,6 +341,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertiesCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimLayerCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFractureModelStressCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFaciesProperties.cpp
${CMAKE_CURRENT_LIST_DIR}/RimNonNetLayers.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -42,6 +42,7 @@
#include "RimEllipseFractureTemplate.h"
#include "RimFaciesProperties.h"
#include "RimFractureModelPlot.h"
#include "RimNonNetLayers.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimTools.h"
@ -164,6 +165,11 @@ RimFractureModelTemplate::RimFractureModelTemplate()
m_faciesProperties.uiCapability()->setUiHidden( true );
m_faciesProperties.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitScriptableFieldNoDefault( &m_nonNetLayers, "NonNetLayers", "Non-Net Layers", "", "", "" );
m_nonNetLayers.uiCapability()->setUiHidden( true );
m_nonNetLayers.uiCapability()->setUiTreeHidden( true );
setNonNetLayers( new RimNonNetLayers );
setDeletable( true );
}
@ -349,6 +355,36 @@ void RimFractureModelTemplate::setFaciesProperties( RimFaciesProperties* faciesP
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFractureModelTemplate::setNonNetLayers( RimNonNetLayers* nonNetLayers )
{
if ( m_nonNetLayers )
{
m_nonNetLayers->changed.disconnect( this );
}
m_nonNetLayers = nonNetLayers;
if ( m_nonNetLayers )
{
m_nonNetLayers->changed.connect( this, &RimFractureModelTemplate::nonNetLayersChanged );
RimEclipseCase* eclipseCase = getEclipseCase();
if ( !eclipseCase ) return;
m_nonNetLayers->setEclipseCase( eclipseCase );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimNonNetLayers* RimFractureModelTemplate::nonNetLayers() const
{
return m_nonNetLayers;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -379,6 +415,14 @@ void RimFractureModelTemplate::elasticPropertiesChanged( const caf::SignalEmitte
changed.send();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFractureModelTemplate::nonNetLayersChanged( const caf::SignalEmitter* emitter )
{
changed.send();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -33,6 +33,7 @@ class RimEclipseCase;
class RimElasticProperties;
class RigEclipseCaseData;
class RimFaciesProperties;
class RimNonNetLayers;
//==================================================================================================
///
@ -90,6 +91,9 @@ public:
void setFaciesProperties( RimFaciesProperties* faciesProperties );
RimFaciesProperties* faciesProperties() const;
void setNonNetLayers( RimNonNetLayers* nonNetLayers );
RimNonNetLayers* nonNetLayers() const;
void updateReferringPlots();
protected:
@ -107,6 +111,7 @@ private:
void faciesPropertiesChanged( const caf::SignalEmitter* emitter );
void elasticPropertiesChanged( const caf::SignalEmitter* emitter );
void nonNetLayersChanged( const caf::SignalEmitter* emitter );
static double computeDefaultStressDepth();
@ -133,4 +138,5 @@ private:
caf::PdmField<double> m_underburdenFluidDensity;
caf::PdmChildField<RimElasticProperties*> m_elasticProperties;
caf::PdmChildField<RimFaciesProperties*> m_faciesProperties;
caf::PdmChildField<RimNonNetLayers*> m_nonNetLayers;
};

View File

@ -0,0 +1,211 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- 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 "RimNonNetLayers.h"
#include "RigFormationNames.h"
#include "RimColorLegend.h"
#include "RimColorLegendItem.h"
#include "RimEclipseCase.h"
#include "RimEclipseResultDefinition.h"
#include "RimFaciesProperties.h"
#include "RimFractureModelTemplate.h"
#include "RimProject.h"
#include "RimRegularLegendConfig.h"
#include "RimTools.h"
#include "RigEclipseCaseData.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiTextEditor.h"
CAF_PDM_SOURCE_INIT( RimNonNetLayers, "NonNetLayers" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimNonNetLayers::RimNonNetLayers()
: changed( this )
{
CAF_PDM_InitScriptableObject( "RimNonNetLayers", "", "", "" );
CAF_PDM_InitScriptableField( &m_cutOff, "Cutoff", 0.5, "Cutoff", "", "", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_formation, "Formation", "Formation", "", "", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_facies, "Facies", "Facies", "", "", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_resultDefinition, "FaciesDefinition", "", "", "", "" );
m_resultDefinition.uiCapability()->setUiHidden( true );
m_resultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
m_resultDefinition = new RimEclipseResultDefinition;
m_resultDefinition->findField( "MResultType" )->uiCapability()->setUiName( "Facies Definiton" );
setUiName( "Non-Net Layers" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimNonNetLayers::~RimNonNetLayers()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimNonNetLayers::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_formation )
{
std::vector<QString> formationNames = getFormationNames();
for ( const QString& formationName : formationNames )
{
options.push_back( caf::PdmOptionItemInfo( formationName, formationName ) );
}
}
else if ( fieldNeedingOptions == &m_facies )
{
RimColorLegend* faciesColors = getFaciesColorLegend();
if ( !faciesColors ) return options;
for ( RimColorLegendItem* item : faciesColors->colorLegendItems() )
{
options.push_back( caf::PdmOptionItemInfo( item->categoryName(), item->categoryName() ) );
}
}
// QList<caf::PdmOptionItemInfo> options;
// if ( fieldNeedingOptions == &m_colorLegend )
// {
// RimTools::colorLegendOptionItems( &options );
// }
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimNonNetLayers::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* resultDefinitionGroup = uiOrdering.addNewGroup( "Facies Definition" );
m_resultDefinition->uiOrdering( uiConfigName, *resultDefinitionGroup );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimNonNetLayers::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
changed.send();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimNonNetLayers::setEclipseCase( RimEclipseCase* eclipseCase )
{
m_resultDefinition->setEclipseCase( eclipseCase );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimEclipseResultDefinition* RimNonNetLayers::resultDefinition() const
{
return m_resultDefinition.value();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimNonNetLayers::cutOff() const
{
return m_cutOff;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString& RimNonNetLayers::formation() const
{
return m_formation();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString& RimNonNetLayers::facies() const
{
return m_facies();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimColorLegend* RimNonNetLayers::getFaciesColorLegend()
{
RimFractureModelTemplate* fractureModelTemplate;
firstAncestorOrThisOfType( fractureModelTemplate );
if ( !fractureModelTemplate ) return nullptr;
RimFaciesProperties* faciesProperties = fractureModelTemplate->faciesProperties();
if ( !faciesProperties ) return nullptr;
return faciesProperties->colorLegend();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimNonNetLayers::getFormationNames()
{
RigEclipseCaseData* eclipseCaseData = getEclipseCaseData();
if ( !eclipseCaseData ) return std::vector<QString>();
return eclipseCaseData->formationNames();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RimNonNetLayers::getEclipseCase()
{
// Find an eclipse case
RimProject* proj = RimProject::current();
if ( proj->eclipseCases().empty() ) return nullptr;
return proj->eclipseCases()[0];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseCaseData* RimNonNetLayers::getEclipseCaseData()
{
// Find an eclipse case
RimEclipseCase* eclipseCase = getEclipseCase();
if ( !eclipseCase ) return nullptr;
return eclipseCase->eclipseCaseData();
}

View File

@ -0,0 +1,71 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- 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 "cafFilePath.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include <QString>
#include <vector>
class RimEclipseResultDefinition;
class RimEclipseCase;
class RimColorLegend;
class RigEclipseCaseData;
//==================================================================================================
///
//==================================================================================================
class RimNonNetLayers : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimNonNetLayers();
~RimNonNetLayers() override;
caf::Signal<> changed;
void setEclipseCase( RimEclipseCase* eclipseCase );
const RimEclipseResultDefinition* resultDefinition() const;
double cutOff() const;
const QString& formation() const;
const QString& facies() const;
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
RimColorLegend* getFaciesColorLegend();
static std::vector<QString> getFormationNames();
static RimEclipseCase* getEclipseCase();
static RigEclipseCaseData* getEclipseCaseData();
private:
caf::PdmField<double> m_cutOff;
caf::PdmChildField<RimEclipseResultDefinition*> m_resultDefinition;
caf::PdmField<QString> m_formation;
caf::PdmField<QString> m_facies;
};