2017-05-16 02:43:41 -05:00
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
2018-08-20 08:15:48 -05:00
//
2017-05-16 02:43:41 -05:00
// 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.
2018-08-20 08:15:48 -05:00
//
2017-05-16 02:43:41 -05:00
// 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.
2018-08-20 08:15:48 -05:00
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
2017-05-16 02:43:41 -05:00
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
2017-05-30 07:37:51 -05:00
# include "RicExportCompletionDataSettingsUi.h"
2017-05-16 02:43:41 -05:00
2018-08-20 08:15:48 -05:00
// clang-format off
2017-06-14 08:30:50 -05:00
namespace caf
{
template < >
void RicExportCompletionDataSettingsUi : : ExportSplitType : : setUp ( )
{
addItem ( RicExportCompletionDataSettingsUi : : UNIFIED_FILE , " UNIFIED_FILE " , " Unified File " ) ;
addItem ( RicExportCompletionDataSettingsUi : : SPLIT_ON_WELL , " SPLIT_ON_WELL " , " Split on Well " ) ;
addItem ( RicExportCompletionDataSettingsUi : : SPLIT_ON_WELL_AND_COMPLETION_TYPE , " SPLIT_ON_WELL_AND_COMPLETION_TYPE " , " Split on Well and Completion Type " ) ;
2018-04-30 01:15:55 -05:00
setDefault ( RicExportCompletionDataSettingsUi : : SPLIT_ON_WELL_AND_COMPLETION_TYPE ) ;
2017-06-14 08:30:50 -05:00
}
2017-06-15 04:37:00 -05:00
2017-06-21 03:58:02 -05:00
template < >
void RicExportCompletionDataSettingsUi : : CompdatExportType : : setUp ( )
{
2017-06-21 08:54:18 -05:00
addItem ( RicExportCompletionDataSettingsUi : : TRANSMISSIBILITIES , " TRANSMISSIBILITIES " , " Calculated Transmissibilities " ) ;
2017-06-23 08:45:22 -05:00
addItem ( RicExportCompletionDataSettingsUi : : WPIMULT_AND_DEFAULT_CONNECTION_FACTORS , " WPIMULT_AND_DEFAULT_CONNECTION_FACTORS " , " Default Connection Factors and WPIMULT (Fractures Not Supported) " ) ;
2018-09-11 02:17:20 -05:00
# ifdef _DEBUG
addItem ( RicExportCompletionDataSettingsUi : : NO_COMPLETIONS , " NO_COMPLETIONS " , " None " ) ;
# endif
2017-06-21 03:58:02 -05:00
setDefault ( RicExportCompletionDataSettingsUi : : TRANSMISSIBILITIES ) ;
}
2018-04-13 05:13:27 -05:00
template < >
void RicExportCompletionDataSettingsUi : : CombinationModeType : : setUp ( )
{
addItem ( RicExportCompletionDataSettingsUi : : INDIVIDUALLY , " INDIVIDUALLY " , " Individually " ) ;
addItem ( RicExportCompletionDataSettingsUi : : COMBINED , " COMBINED " , " Combined " ) ;
setDefault ( RicExportCompletionDataSettingsUi : : INDIVIDUALLY ) ;
}
2018-09-14 07:00:27 -05:00
template < >
void RicExportCompletionDataSettingsUi : : TransScalingType : : setUp ( )
{
addItem ( RicExportFractureCompletionsImpl : : NO_SCALING , " NO_SCALING " , " No scaling " ) ;
addItem ( RicExportFractureCompletionsImpl : : MATRIX_TO_FRACTURE_DP_OVER_MAX_DP , " MATFRAC_DP_OVER_MAXDP " , " Matrix to Fracture dP over max dP " ) ;
addItem ( RicExportFractureCompletionsImpl : : MATRIX_TO_FRACTURE_DP_OVER_AVG_DP , " MATFRAC_DP_OVER_AVGDP " , " Matrix to Fracture dP over avg dP " ) ;
addItem ( RicExportFractureCompletionsImpl : : MATRIX_TO_WELL_DP_OVER_INITIAL_DP , " MATWELL_DP_OVER_INITIALDP " , " Matrix to Well dP over initial dP " ) ;
setDefault ( RicExportFractureCompletionsImpl : : NO_SCALING ) ;
}
template < >
void RicExportCompletionDataSettingsUi : : TransScalingCorrection : : setUp ( )
{
addItem ( RicExportFractureCompletionsImpl : : NO_CORRECTION , " NO_CORRECTION " , " No correction " ) ;
addItem ( RicExportFractureCompletionsImpl : : HOGSTOL_CORRECTION , " HOGSTOL_CORRECTION " , " H<EFBFBD> gst<EFBFBD> l Correction " ) ;
setDefault ( RicExportFractureCompletionsImpl : : NO_CORRECTION ) ;
}
2017-06-14 08:30:50 -05:00
}
2018-08-20 08:15:48 -05:00
// clang-format on
2017-06-14 08:30:50 -05:00
2017-05-30 07:37:51 -05:00
CAF_PDM_SOURCE_INIT ( RicExportCompletionDataSettingsUi , " RicExportCompletionDataSettingsUi " ) ;
2017-05-16 02:43:41 -05:00
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
///
2017-05-16 02:43:41 -05:00
//--------------------------------------------------------------------------------------------------
2017-05-30 07:37:51 -05:00
RicExportCompletionDataSettingsUi : : RicExportCompletionDataSettingsUi ( )
2017-05-16 02:43:41 -05:00
{
CAF_PDM_InitObject ( " RimExportCompletionDataSettings " , " " , " " , " " ) ;
2017-06-14 08:30:50 -05:00
CAF_PDM_InitFieldNoDefault ( & fileSplit , " FileSplit " , " File Split " , " " , " " , " " ) ;
2017-12-22 07:42:56 -06:00
2017-06-21 08:54:18 -05:00
CAF_PDM_InitFieldNoDefault ( & compdatExport , " compdatExport " , " Export " , " " , " " , " " ) ;
2017-06-14 08:30:50 -05:00
2018-04-06 05:56:48 -05:00
CAF_PDM_InitField ( & timeStep , " TimeStepIndex " , 0 , " Time Step " , " " , " " , " " ) ;
2018-03-14 03:35:48 -05:00
2018-09-06 02:53:35 -05:00
CAF_PDM_InitField ( & includeMsw , " IncludeMSW " , false , " Include MSW " , " " , " " , " " ) ;
2018-09-07 08:16:38 -05:00
CAF_PDM_InitField ( & useLateralNTG , " UseLateralNTG " , false , " Use NTG Horizontally " , " " , " " , " " ) ;
2017-05-30 08:42:05 -05:00
2018-04-06 05:56:48 -05:00
CAF_PDM_InitField ( & includePerforations , " IncludePerforations " , true , " Perforations " , " " , " " , " " ) ;
CAF_PDM_InitField ( & includeFishbones , " IncludeFishbones " , true , " Fishbones " , " " , " " , " " ) ;
CAF_PDM_InitField ( & includeFractures , " IncludeFractures " , true , " Fractures " , " " , " " , " " ) ;
2017-05-29 06:13:25 -05:00
2018-09-17 03:51:08 -05:00
CAF_PDM_InitFieldNoDefault ( & transScalingType , " TransScalingType " , " Pressure Diff. Depletion Transmissibility Scaling (BETA) " , " " , " " , " " ) ;
CAF_PDM_InitField ( & transScalingWBHPTimeStep , " TransScalingTimeStep " , - 1 , " PDD WBHP from Summary Case Time Step (BETA) " , " " , " " , " " ) ;
CAF_PDM_InitField ( & transScalingWBHP , " TransScalingWBHP " , 200.0 , " PDD Constant WBHP (BETA) " , " " , " " , " " ) ;
CAF_PDM_InitFieldNoDefault ( & transScalingCorrection , " TransScalingCorrection " , " PDD Transmissibility Scaling Correction (BETA) " , " " , " " , " " ) ;
2018-09-14 07:00:27 -05:00
2018-08-20 08:15:48 -05:00
CAF_PDM_InitField ( & m_includeFracturesSummaryHeader ,
" IncludeFracturesSummaryHeader " ,
false ,
2018-09-05 02:47:37 -05:00
" Append Detailed Text Summary (BETA) " ,
2018-08-20 08:15:48 -05:00
" " ,
" " ,
" " ) ;
CAF_PDM_InitField ( & excludeMainBoreForFishbones ,
" ExcludeMainBoreForFishbones " ,
false ,
" Exclude Main Bore Transmissibility " ,
" " ,
" Main bore perforation intervals are defined by start/end MD of each active fishbone sub definition " ,
" " ) ;
CAF_PDM_InitFieldNoDefault (
& m_reportCompletionTypesSeparately , " ReportCompletionTypesSeparately " , " Export Completion Types " , " " , " " , " " ) ;
2018-04-13 05:13:27 -05:00
2017-09-07 13:43:01 -05:00
m_displayForSimWell = true ;
2018-08-20 08:15:48 -05:00
m_fracturesEnabled = true ;
2018-04-09 04:23:14 -05:00
m_perforationsEnabled = true ;
2018-08-20 08:15:48 -05:00
m_fishbonesEnabled = true ;
2017-05-30 08:42:05 -05:00
}
2017-06-12 05:03:42 -05:00
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
///
2017-06-12 05:03:42 -05:00
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi : : showForSimWells ( )
{
m_displayForSimWell = true ;
}
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
///
2017-06-12 05:03:42 -05:00
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi : : showForWellPath ( )
{
m_displayForSimWell = false ;
}
2018-04-09 04:23:14 -05:00
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
///
2018-04-09 04:23:14 -05:00
//--------------------------------------------------------------------------------------------------
2018-04-13 05:13:27 -05:00
void RicExportCompletionDataSettingsUi : : setCombinationMode ( CombinationMode combinationMode )
{
m_reportCompletionTypesSeparately = combinationMode ;
}
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
///
2018-04-13 05:13:27 -05:00
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi : : showFractureInUi ( bool enable )
2018-04-09 04:23:14 -05:00
{
m_fracturesEnabled = enable ;
}
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
///
2018-04-09 04:23:14 -05:00
//--------------------------------------------------------------------------------------------------
2018-04-13 05:13:27 -05:00
void RicExportCompletionDataSettingsUi : : showPerforationsInUi ( bool enable )
2018-04-09 04:23:14 -05:00
{
m_perforationsEnabled = enable ;
}
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
///
2018-04-09 04:23:14 -05:00
//--------------------------------------------------------------------------------------------------
2018-04-13 05:13:27 -05:00
void RicExportCompletionDataSettingsUi : : showFishbonesInUi ( bool enable )
2018-04-09 04:23:14 -05:00
{
m_fishbonesEnabled = enable ;
}
2018-04-13 05:13:27 -05:00
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
///
2018-04-13 05:13:27 -05:00
//--------------------------------------------------------------------------------------------------
bool RicExportCompletionDataSettingsUi : : reportCompletionsTypesIndividually ( ) const
{
return m_reportCompletionTypesSeparately ( ) = = INDIVIDUALLY ;
}
2018-08-09 07:04:59 -05:00
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
///
2018-08-09 07:04:59 -05:00
//--------------------------------------------------------------------------------------------------
bool RicExportCompletionDataSettingsUi : : includeFracturesSummaryHeader ( ) const
{
return m_includeFracturesSummaryHeader ;
}
2017-08-14 15:30:22 -05:00
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
///
2017-08-14 15:30:22 -05:00
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
void RicExportCompletionDataSettingsUi : : fieldChangedByUi ( const caf : : PdmFieldHandle * changedField ,
const QVariant & oldValue ,
const QVariant & newValue )
2017-08-14 15:30:22 -05:00
{
if ( changedField = = & compdatExport )
{
if ( compdatExport = = WPIMULT_AND_DEFAULT_CONNECTION_FACTORS )
{
includeFractures = false ;
}
2018-09-06 02:53:35 -05:00
else if ( compdatExport = = TRANSMISSIBILITIES | | includeMsw )
2017-08-14 15:30:22 -05:00
{
includeFractures = true ;
}
}
2018-09-17 03:51:08 -05:00
else if ( changedField = = & transScalingType )
{
if ( transScalingType = = RicExportFractureCompletionsImpl : : MATRIX_TO_WELL_DP_OVER_INITIAL_DP )
{
transScalingCorrection = RicExportFractureCompletionsImpl : : HOGSTOL_CORRECTION ;
}
else
{
transScalingCorrection = RicExportFractureCompletionsImpl : : NO_CORRECTION ;
}
}
2017-08-14 15:30:22 -05:00
}
2017-05-30 08:42:05 -05:00
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
///
2017-05-30 08:42:05 -05:00
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
QList < caf : : PdmOptionItemInfo >
RicExportCompletionDataSettingsUi : : calculateValueOptions ( const caf : : PdmFieldHandle * fieldNeedingOptions , bool * useOptionsOnly )
2017-05-30 08:42:05 -05:00
{
QList < caf : : PdmOptionItemInfo > options ;
2018-09-17 03:51:08 -05:00
if ( fieldNeedingOptions = = & timeStep | | fieldNeedingOptions = = & transScalingWBHPTimeStep )
2017-05-30 08:42:05 -05:00
{
QStringList timeStepNames ;
if ( caseToApply )
{
timeStepNames = caseToApply - > timeStepStrings ( ) ;
}
2018-09-17 03:51:08 -05:00
options . push_back ( caf : : PdmOptionItemInfo ( " Use Constant WBHP " , - 1 ) ) ;
2017-05-30 08:42:05 -05:00
for ( int i = 0 ; i < timeStepNames . size ( ) ; i + + )
{
options . push_back ( caf : : PdmOptionItemInfo ( timeStepNames [ i ] , i ) ) ;
}
}
else
{
options = RicCaseAndFileExportSettingsUi : : calculateValueOptions ( fieldNeedingOptions , useOptionsOnly ) ;
}
return options ;
2017-05-16 02:43:41 -05:00
}
2017-06-12 05:03:42 -05:00
//--------------------------------------------------------------------------------------------------
2018-08-20 08:15:48 -05:00
///
2017-06-12 05:03:42 -05:00
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi : : defineUiOrdering ( QString uiConfigName , caf : : PdmUiOrdering & uiOrdering )
{
2018-04-09 04:23:14 -05:00
{
2018-09-05 02:47:37 -05:00
caf : : PdmUiGroup * group = uiOrdering . addNewGroup ( " Export Settings " ) ;
2018-08-20 08:15:48 -05:00
2018-09-05 02:47:37 -05:00
group - > add ( & compdatExport ) ;
group - > add ( & useLateralNTG ) ;
2018-09-07 08:16:38 -05:00
group - > add ( & includeMsw ) ;
2018-09-05 02:47:37 -05:00
group - > add ( & caseToApply ) ;
2018-04-09 04:23:14 -05:00
group - > add ( & fileSplit ) ;
2018-04-13 05:13:27 -05:00
group - > add ( & m_reportCompletionTypesSeparately ) ;
2018-09-05 02:47:37 -05:00
group - > add ( & folder ) ;
2018-04-09 04:23:14 -05:00
}
2017-06-12 05:03:42 -05:00
{
2018-09-06 02:53:35 -05:00
caf : : PdmUiGroup * group = uiOrdering . addNewGroup ( " Completions Export Selection " ) ;
2018-04-09 04:23:14 -05:00
if ( ! m_displayForSimWell )
2017-06-23 08:45:22 -05:00
{
2018-04-09 04:23:14 -05:00
if ( m_perforationsEnabled )
{
group - > add ( & includePerforations ) ;
group - > add ( & timeStep ) ;
if ( ! includePerforations )
timeStep . uiCapability ( ) - > setUiReadOnly ( true ) ;
else
timeStep . uiCapability ( ) - > setUiReadOnly ( false ) ;
}
2017-06-23 08:45:22 -05:00
}
2018-04-09 04:23:14 -05:00
if ( m_fracturesEnabled )
2017-06-23 08:45:22 -05:00
{
2018-04-09 04:23:14 -05:00
group - > add ( & includeFractures ) ;
2018-08-09 07:04:59 -05:00
group - > add ( & m_includeFracturesSummaryHeader ) ;
2018-04-09 04:23:14 -05:00
2018-09-17 03:51:08 -05:00
group - > add ( & transScalingType ) ;
group - > add ( & transScalingWBHPTimeStep ) ;
group - > add ( & transScalingWBHP ) ;
group - > add ( & transScalingCorrection ) ;
2018-09-17 04:29:47 -05:00
transScalingWBHPTimeStep . uiCapability ( ) - > setUiReadOnly ( transScalingType ( ) = = RicExportFractureCompletionsImpl : : NO_SCALING ) ;
2018-09-17 03:51:08 -05:00
transScalingWBHP . uiCapability ( ) - > setUiReadOnly ( transScalingWBHPTimeStep . uiCapability ( ) - > isUiReadOnly ( ) | |
transScalingWBHPTimeStep ( ) ! = - 1 ) ;
transScalingCorrection . uiCapability ( ) - > setUiReadOnly ( transScalingType ( ) = = RicExportFractureCompletionsImpl : : NO_SCALING ) ;
2018-09-05 02:47:37 -05:00
// Set visibility
2018-09-06 02:53:35 -05:00
includeFractures . uiCapability ( ) - > setUiHidden ( compdatExport = = WPIMULT_AND_DEFAULT_CONNECTION_FACTORS & & ! includeMsw ) ;
m_includeFracturesSummaryHeader . uiCapability ( ) - > setUiHidden ( compdatExport = = WPIMULT_AND_DEFAULT_CONNECTION_FACTORS ) ;
2017-06-23 08:45:22 -05:00
}
2018-04-13 05:13:27 -05:00
if ( ! m_displayForSimWell )
{
if ( m_fishbonesEnabled )
{
group - > add ( & includeFishbones ) ;
group - > add ( & excludeMainBoreForFishbones ) ;
2018-09-05 02:47:37 -05:00
// Set visibility
2018-04-13 05:13:27 -05:00
if ( ! includeFishbones )
excludeMainBoreForFishbones . uiCapability ( ) - > setUiReadOnly ( true ) ;
else
excludeMainBoreForFishbones . uiCapability ( ) - > setUiReadOnly ( false ) ;
}
}
2017-06-21 09:38:57 -05:00
}
2017-08-14 15:30:22 -05:00
2017-06-12 05:03:42 -05:00
uiOrdering . skipRemainingFields ( ) ;
}