mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Completion Export : Add option to control export of comments
This commit is contained in:
@@ -38,6 +38,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfNewWellBoreStabilityPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfImportWellLogFiles.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfImportFormationNames.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellLogPlotData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfEnableDataSourceAsComment.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -79,6 +80,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfCreateWellBoreStabilityPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfImportWellLogFiles.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfImportFormationNames.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellLogPlotData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfEnableDataSourceAsComment.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@@ -46,6 +46,7 @@ void RicfCommandFileExecutor::ExportTypeEnum::setUp()
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandFileExecutor::RicfCommandFileExecutor()
|
||||
: m_exportDataSourceAsComment( true )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -149,6 +150,22 @@ QString RicfCommandFileExecutor::getLastProjectPath() const
|
||||
return m_lastProjectPath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCommandFileExecutor::setExportDataSouceAsComment( bool enable )
|
||||
{
|
||||
m_exportDataSourceAsComment = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicfCommandFileExecutor::exportDataSouceAsComment() const
|
||||
{
|
||||
return m_exportDataSourceAsComment;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -57,6 +57,9 @@ public:
|
||||
void setLastProjectPath( const QString& path );
|
||||
QString getLastProjectPath() const;
|
||||
|
||||
void setExportDataSouceAsComment( bool enable );
|
||||
bool exportDataSouceAsComment() const;
|
||||
|
||||
static RicfCommandFileExecutor* instance();
|
||||
|
||||
static std::vector<RicfCommandObject*>
|
||||
@@ -67,4 +70,5 @@ private:
|
||||
|
||||
std::map<ExportType, QString> m_exportPaths;
|
||||
QString m_lastProjectPath;
|
||||
bool m_exportDataSourceAsComment;
|
||||
};
|
||||
|
@@ -0,0 +1,52 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021 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 "RicfEnableDataSourceAsComment.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfEnableDataSourceAsComment, "enableDataSourceAsComment" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfEnableDataSourceAsComment::RicfEnableDataSourceAsComment()
|
||||
{
|
||||
CAF_PDM_InitScriptableField( &m_enableDataSourceAsComment,
|
||||
"enableDataSourceAsComment",
|
||||
true,
|
||||
"Enable Data Source as Comment",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmScriptResponse RicfEnableDataSourceAsComment::execute()
|
||||
{
|
||||
RicfCommandFileExecutor* executor = RicfCommandFileExecutor::instance();
|
||||
executor->setExportDataSouceAsComment( m_enableDataSourceAsComment );
|
||||
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021 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 "RicfCommandObject.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfEnableDataSourceAsComment : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfEnableDataSourceAsComment();
|
||||
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_enableDataSourceAsComment;
|
||||
};
|
@@ -80,12 +80,12 @@ caf::PdmScriptResponse RicfExportSimWellFractureCompletions::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
RimProject* project = RimProject::current();
|
||||
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
|
||||
RicExportCompletionDataSettingsUi exportSettings;
|
||||
|
||||
exportSettings->timeStep = m_timeStep;
|
||||
exportSettings->fileSplit = m_fileSplit;
|
||||
exportSettings->compdatExport = m_compdatExport;
|
||||
exportSettings.timeStep = m_timeStep;
|
||||
exportSettings.fileSplit = m_fileSplit;
|
||||
exportSettings.compdatExport = m_compdatExport;
|
||||
exportSettings.setExportDataSourceAsComment( RicfCommandFileExecutor::instance()->exportDataSouceAsComment() );
|
||||
|
||||
{
|
||||
auto eclipseCase = TOOLS::caseFromId( m_caseId() );
|
||||
@@ -95,7 +95,7 @@ caf::PdmScriptResponse RicfExportSimWellFractureCompletions::execute()
|
||||
RiaLogging::error( error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
exportSettings->caseToApply = eclipseCase;
|
||||
exportSettings.caseToApply = eclipseCase;
|
||||
}
|
||||
|
||||
QString exportFolder =
|
||||
@@ -104,10 +104,10 @@ caf::PdmScriptResponse RicfExportSimWellFractureCompletions::execute()
|
||||
{
|
||||
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath( "completions" );
|
||||
}
|
||||
exportSettings->folder = exportFolder;
|
||||
exportSettings.folder = exportFolder;
|
||||
|
||||
std::vector<RimEclipseView*> views;
|
||||
for ( Rim3dView* v : exportSettings->caseToApply->views() )
|
||||
for ( Rim3dView* v : exportSettings.caseToApply->views() )
|
||||
{
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( v );
|
||||
if ( eclipseView && ( eclipseView->id() == m_viewId() || eclipseView->name() == m_viewName() ) )
|
||||
@@ -169,7 +169,7 @@ caf::PdmScriptResponse RicfExportSimWellFractureCompletions::execute()
|
||||
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
|
||||
RicWellPathExportCompletionDataFeatureImpl::exportCompletions( wellPaths, simWells, *exportSettings );
|
||||
RicWellPathExportCompletionDataFeatureImpl::exportCompletions( wellPaths, simWells, exportSettings );
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@@ -119,33 +119,33 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
RimProject* project = RimProject::current();
|
||||
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
|
||||
RicExportCompletionDataSettingsUi exportSettings;
|
||||
|
||||
if ( m_timeStep < 0 )
|
||||
{
|
||||
exportSettings->timeStep = 0;
|
||||
exportSettings.timeStep = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
exportSettings->timeStep = m_timeStep;
|
||||
exportSettings.timeStep = m_timeStep;
|
||||
}
|
||||
|
||||
exportSettings->fileSplit = m_fileSplit;
|
||||
exportSettings->compdatExport = m_compdatExport;
|
||||
exportSettings.fileSplit = m_fileSplit;
|
||||
exportSettings.compdatExport = m_compdatExport;
|
||||
exportSettings.setExportDataSourceAsComment( RicfCommandFileExecutor::instance()->exportDataSouceAsComment() );
|
||||
|
||||
exportSettings->performTransScaling = m_performTransScaling;
|
||||
exportSettings->transScalingTimeStep = m_transScalingTimeStep;
|
||||
exportSettings->transScalingWBHPSource = m_transScalingInitialWBHP;
|
||||
exportSettings->transScalingWBHP = m_transScalingWBHP;
|
||||
exportSettings.performTransScaling = m_performTransScaling;
|
||||
exportSettings.transScalingTimeStep = m_transScalingTimeStep;
|
||||
exportSettings.transScalingWBHPSource = m_transScalingInitialWBHP;
|
||||
exportSettings.transScalingWBHP = m_transScalingWBHP;
|
||||
|
||||
exportSettings->useLateralNTG = m_useLateralNTG;
|
||||
exportSettings->includePerforations = m_includePerforations;
|
||||
exportSettings->includeFishbones = m_includeFishbones;
|
||||
exportSettings->excludeMainBoreForFishbones = m_excludeMainBoreForFishbones;
|
||||
exportSettings->includeFractures = m_includeFractures;
|
||||
exportSettings.useLateralNTG = m_useLateralNTG;
|
||||
exportSettings.includePerforations = m_includePerforations;
|
||||
exportSettings.includeFishbones = m_includeFishbones;
|
||||
exportSettings.excludeMainBoreForFishbones = m_excludeMainBoreForFishbones;
|
||||
exportSettings.includeFractures = m_includeFractures;
|
||||
|
||||
exportSettings->setCombinationMode( m_combinationMode() );
|
||||
exportSettings.setCombinationMode( m_combinationMode() );
|
||||
|
||||
{
|
||||
auto eclipseCase = TOOLS::caseFromId( m_caseId() );
|
||||
@@ -155,7 +155,7 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
|
||||
RiaLogging::error( error );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
exportSettings->caseToApply = eclipseCase;
|
||||
exportSettings.caseToApply = eclipseCase;
|
||||
}
|
||||
|
||||
QString exportFolder =
|
||||
@@ -164,7 +164,7 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
|
||||
{
|
||||
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath( "completions" );
|
||||
}
|
||||
exportSettings->folder = exportFolder;
|
||||
exportSettings.folder = exportFolder;
|
||||
|
||||
caf::PdmScriptResponse response;
|
||||
|
||||
@@ -201,7 +201,7 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
|
||||
|
||||
std::vector<RimSimWellInView*> simWells;
|
||||
|
||||
RicWellPathExportCompletionDataFeatureImpl::exportCompletions( wellPaths, simWells, *exportSettings );
|
||||
RicWellPathExportCompletionDataFeatureImpl::exportCompletions( wellPaths, simWells, exportSettings );
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@@ -112,6 +112,16 @@ RicExportCompletionDataSettingsUi::RicExportCompletionDataSettingsUi()
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitField( &m_exportDataSourceAsComment,
|
||||
"ExportDataSourceAsComment",
|
||||
true,
|
||||
"Export Data Source In Comment",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitField( &m_exportWelspec, "ExportWelspec", true, "Export WELSPEC keyword", "", "", "" );
|
||||
|
||||
m_displayForSimWell = true;
|
||||
|
||||
m_fracturesEnabled = true;
|
||||
@@ -151,6 +161,14 @@ void RicExportCompletionDataSettingsUi::setCombinationMode( CombinationMode comb
|
||||
m_reportCompletionTypesSeparately = combinationMode;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportCompletionDataSettingsUi::setExportDataSourceAsComment( bool enable )
|
||||
{
|
||||
m_exportDataSourceAsComment = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -183,6 +201,22 @@ bool RicExportCompletionDataSettingsUi::reportCompletionsTypesIndividually() con
|
||||
return m_reportCompletionTypesSeparately() == INDIVIDUALLY;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExportCompletionDataSettingsUi::exportDataSourceAsComment() const
|
||||
{
|
||||
return m_exportDataSourceAsComment;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExportCompletionDataSettingsUi::exportWelspec() const
|
||||
{
|
||||
return m_exportWelspec;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -296,6 +330,8 @@ void RicExportCompletionDataSettingsUi::defineUiOrdering( QString uiConfigName,
|
||||
group->add( &caseToApply );
|
||||
group->add( &useLateralNTG );
|
||||
group->add( &includeMsw );
|
||||
group->add( &m_exportDataSourceAsComment );
|
||||
group->add( &m_exportWelspec );
|
||||
}
|
||||
|
||||
{
|
||||
|
@@ -89,12 +89,15 @@ public:
|
||||
void showForWellPath();
|
||||
|
||||
void setCombinationMode( CombinationMode combinationMode );
|
||||
void setExportDataSourceAsComment( bool enable );
|
||||
|
||||
void showFractureInUi( bool enable );
|
||||
void showPerforationsInUi( bool enable );
|
||||
void showFishbonesInUi( bool enable );
|
||||
|
||||
bool reportCompletionsTypesIndividually() const;
|
||||
bool exportDataSourceAsComment() const;
|
||||
bool exportWelspec() const;
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
@@ -107,6 +110,8 @@ protected:
|
||||
|
||||
private:
|
||||
caf::PdmField<CombinationModeType> m_reportCompletionTypesSeparately;
|
||||
caf::PdmField<bool> m_exportDataSourceAsComment;
|
||||
caf::PdmField<bool> m_exportWelspec;
|
||||
|
||||
bool m_displayForSimWell;
|
||||
bool m_fracturesEnabled;
|
||||
|
@@ -277,7 +277,9 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
||||
fileName,
|
||||
completions,
|
||||
fractureDataReportItems,
|
||||
exportSettings.compdatExport );
|
||||
exportSettings.compdatExport,
|
||||
exportSettings.exportDataSourceAsComment(),
|
||||
exportSettings.exportWelspec() );
|
||||
progress.incrementProgress();
|
||||
}
|
||||
else if ( exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL )
|
||||
@@ -310,7 +312,9 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
||||
fileName,
|
||||
completionsForWell,
|
||||
reportItemsForWell,
|
||||
exportSettings.compdatExport );
|
||||
exportSettings.compdatExport,
|
||||
exportSettings.exportDataSourceAsComment(),
|
||||
exportSettings.exportWelspec() );
|
||||
progress.incrementProgress();
|
||||
}
|
||||
}
|
||||
@@ -365,7 +369,9 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
||||
fileName,
|
||||
completionsForWell,
|
||||
reportItemsForWell,
|
||||
exportSettings.compdatExport );
|
||||
exportSettings.compdatExport,
|
||||
exportSettings.exportDataSourceAsComment(),
|
||||
exportSettings.exportWelspec() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -375,7 +381,9 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
||||
fileName,
|
||||
completionsForWell,
|
||||
emptyReportItemVector,
|
||||
exportSettings.compdatExport );
|
||||
exportSettings.compdatExport,
|
||||
exportSettings.exportDataSourceAsComment(),
|
||||
exportSettings.exportWelspec() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,7 +415,9 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
||||
fileName,
|
||||
wellCompletions,
|
||||
fractureDataReportItems,
|
||||
exportSettings.compdatExport );
|
||||
exportSettings.compdatExport,
|
||||
exportSettings.exportDataSourceAsComment(),
|
||||
exportSettings.exportWelspec() );
|
||||
|
||||
progress.incrementProgress();
|
||||
}
|
||||
@@ -711,29 +721,33 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWellPathFractureReport(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportCompletionDataFeatureImpl::exportWelspecsToFile( RimEclipseCase* gridCase,
|
||||
QFilePtr exportFile,
|
||||
const std::vector<RigCompletionData>& completions )
|
||||
const std::vector<RigCompletionData>& completions,
|
||||
bool exportDataSourceAsComment )
|
||||
{
|
||||
QTextStream stream( exportFile.get() );
|
||||
|
||||
RifTextDataTableFormatter formatter( stream );
|
||||
formatter.setColumnSpacing( 2 );
|
||||
formatter.setOptionalComment( exportDataSourceAsComment );
|
||||
|
||||
std::vector<RifTextDataTableColumn> header = { RifTextDataTableColumn( "Well" ),
|
||||
RifTextDataTableColumn( "Grp" ),
|
||||
RifTextDataTableColumn( "I" ),
|
||||
RifTextDataTableColumn( "J" ),
|
||||
RifTextDataTableColumn( "RefDepth" ),
|
||||
RifTextDataTableColumn( "Type" ),
|
||||
RifTextDataTableColumn( "DrainRad" ),
|
||||
RifTextDataTableColumn( "GasInEq" ),
|
||||
RifTextDataTableColumn( "AutoShut" ),
|
||||
RifTextDataTableColumn( "XFlow" ),
|
||||
RifTextDataTableColumn( "FluidPVT" ),
|
||||
RifTextDataTableColumn( "HydSDens" ),
|
||||
RifTextDataTableColumn( "FluidInPlReg" ) };
|
||||
std::vector<RifTextDataTableColumn> header = {
|
||||
RifTextDataTableColumn( "WELL", "NAME" ), // well
|
||||
RifTextDataTableColumn( "GROUP", "NAME" ), // group
|
||||
RifTextDataTableColumn( "", "I" ), // I
|
||||
RifTextDataTableColumn( "", "J" ), // J
|
||||
RifTextDataTableColumn( "BHP", "DEPTH" ), // RefDepth
|
||||
RifTextDataTableColumn( "PHASE", "FLUID" ), // Type
|
||||
RifTextDataTableColumn( "DRAIN", "AREA" ), // DrainRad
|
||||
RifTextDataTableColumn( "INFLOW", "EQUANS" ), // GasInEq
|
||||
RifTextDataTableColumn( "OPEN", "SHUT" ), // AutoShut
|
||||
RifTextDataTableColumn( "CROSS", "FLOW" ), // XFlow
|
||||
RifTextDataTableColumn( "PVT", "TABLE" ), // FluidPVT
|
||||
RifTextDataTableColumn( "HYDS", "DENS" ), // HydrDens
|
||||
RifTextDataTableColumn( "FIP", "REGN" ) // FluidInPla) };
|
||||
};
|
||||
|
||||
formatter.keyword( "WELSPECS" );
|
||||
formatter.header( header );
|
||||
formatter.keyword( "WELSPECS" );
|
||||
|
||||
std::set<const RimWellPath*> wellPathSet;
|
||||
|
||||
@@ -785,23 +799,25 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile(
|
||||
RifTextDataTableFormatter formatter( stream );
|
||||
formatter.setColumnSpacing( 2 );
|
||||
|
||||
std::vector<RifTextDataTableColumn> header = { RifTextDataTableColumn( "Well" ),
|
||||
RifTextDataTableColumn( "Grp" ),
|
||||
RifTextDataTableColumn( "LGR" ),
|
||||
RifTextDataTableColumn( "I" ),
|
||||
RifTextDataTableColumn( "J" ),
|
||||
RifTextDataTableColumn( "RefDepth" ),
|
||||
RifTextDataTableColumn( "Type" ),
|
||||
RifTextDataTableColumn( "DrainRad" ),
|
||||
RifTextDataTableColumn( "GasInEq" ),
|
||||
RifTextDataTableColumn( "AutoShut" ),
|
||||
RifTextDataTableColumn( "XFlow" ),
|
||||
RifTextDataTableColumn( "FluidPVT" ),
|
||||
RifTextDataTableColumn( "HydSDens" ),
|
||||
RifTextDataTableColumn( "FluidInPlReg" ) };
|
||||
std::vector<RifTextDataTableColumn> header = {
|
||||
RifTextDataTableColumn( "WELL", "NAME" ), // well
|
||||
RifTextDataTableColumn( "GROUP", "NAME" ), // group
|
||||
RifTextDataTableColumn( "", "LGR" ),
|
||||
RifTextDataTableColumn( "", "I" ), // I
|
||||
RifTextDataTableColumn( "", "J" ), // J
|
||||
RifTextDataTableColumn( "BHP", "DEPTH" ), // RefDepth
|
||||
RifTextDataTableColumn( "PHASE", "FLUID" ), // Type
|
||||
RifTextDataTableColumn( "DRAIN", "AREA" ), // DrainRad
|
||||
RifTextDataTableColumn( "INFLOW", "EQUANS" ), // GasInEq
|
||||
RifTextDataTableColumn( "OPEN", "SHUT" ), // AutoShut
|
||||
RifTextDataTableColumn( "CROSS", "FLOW" ), // XFlow
|
||||
RifTextDataTableColumn( "PVT", "TABLE" ), // FluidPVT
|
||||
RifTextDataTableColumn( "HYDS", "DENS" ), // HydrDens
|
||||
RifTextDataTableColumn( "FIP", "REGN" ) // FluidInPla) };
|
||||
};
|
||||
|
||||
formatter.keyword( "WELSPECL" );
|
||||
formatter.header( header );
|
||||
formatter.keyword( "WELSPECL" );
|
||||
|
||||
std::map<const RimWellPath*, std::set<QString>> wellPathToLgrNameMap;
|
||||
|
||||
@@ -871,7 +887,9 @@ void RicWellPathExportCompletionDataFeatureImpl::sortAndExportCompletionsToFile(
|
||||
const QString& fileName,
|
||||
const std::vector<RigCompletionData>& completions,
|
||||
const std::vector<RicWellPathFractureReportItem>& wellPathFractureReportItems,
|
||||
RicExportCompletionDataSettingsUi::CompdatExportType exportType )
|
||||
RicExportCompletionDataSettingsUi::CompdatExportType exportType,
|
||||
bool exportDataSourceAsComment,
|
||||
bool exportWelspec )
|
||||
{
|
||||
// Sort completions based on grid they belong to
|
||||
std::vector<RigCompletionData> completionsForMainGrid = mainGridCompletions( completions );
|
||||
@@ -888,8 +906,11 @@ void RicWellPathExportCompletionDataFeatureImpl::sortAndExportCompletionsToFile(
|
||||
completionsForGrid.insert( std::pair<QString, std::vector<RigCompletionData>>( "", completionsForMainGrid ) );
|
||||
|
||||
exportWellPathFractureReport( eclipseCase, exportFile, wellPathFractureReportItems );
|
||||
exportWelspecsToFile( eclipseCase, exportFile, completionsForMainGrid );
|
||||
exportCompdatAndWpimultTables( eclipseCase, exportFile, completionsForGrid, exportType );
|
||||
if ( exportWelspec )
|
||||
{
|
||||
exportWelspecsToFile( eclipseCase, exportFile, completionsForMainGrid, exportDataSourceAsComment );
|
||||
}
|
||||
exportCompdatAndWpimultTables( eclipseCase, exportFile, completionsForGrid, exportType, exportDataSourceAsComment );
|
||||
}
|
||||
catch ( RicWellPathExportCompletionsFileTools::OpenFileException )
|
||||
{
|
||||
@@ -905,8 +926,11 @@ void RicWellPathExportCompletionDataFeatureImpl::sortAndExportCompletionsToFile(
|
||||
RicWellPathExportCompletionsFileTools::openFileForExport( folderName, lgrFileName );
|
||||
|
||||
exportWellPathFractureReport( eclipseCase, exportFile, wellPathFractureReportItems );
|
||||
exportWelspeclToFile( eclipseCase, exportFile, completionsForSubGrids );
|
||||
exportCompdatAndWpimultTables( eclipseCase, exportFile, completionsForSubGrids, exportType );
|
||||
if ( exportWelspec )
|
||||
{
|
||||
exportWelspeclToFile( eclipseCase, exportFile, completionsForSubGrids );
|
||||
}
|
||||
exportCompdatAndWpimultTables( eclipseCase, exportFile, completionsForSubGrids, exportType, exportDataSourceAsComment );
|
||||
}
|
||||
catch ( RicWellPathExportCompletionsFileTools::OpenFileException )
|
||||
{
|
||||
@@ -921,7 +945,8 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompdatAndWpimultTables(
|
||||
RimEclipseCase* sourceCase,
|
||||
QFilePtr exportFile,
|
||||
const std::map<QString, std::vector<RigCompletionData>>& completionsPerGrid,
|
||||
RicExportCompletionDataSettingsUi::CompdatExportType exportType )
|
||||
RicExportCompletionDataSettingsUi::CompdatExportType exportType,
|
||||
bool exportDataSourceAsComment )
|
||||
{
|
||||
if ( completionsPerGrid.empty() ) return;
|
||||
|
||||
@@ -929,6 +954,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompdatAndWpimultTables(
|
||||
|
||||
RifTextDataTableFormatter formatter( stream );
|
||||
formatter.setColumnSpacing( 3 );
|
||||
formatter.setOptionalComment( exportDataSourceAsComment );
|
||||
|
||||
for ( const auto& gridCompletions : completionsPerGrid )
|
||||
{
|
||||
@@ -958,54 +984,59 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompdatTableUsingFormatte
|
||||
const QString& gridName,
|
||||
const std::vector<RigCompletionData>& completionData )
|
||||
{
|
||||
std::vector<RifTextDataTableColumn> header;
|
||||
|
||||
if ( gridName.isEmpty() )
|
||||
{
|
||||
header =
|
||||
{ RifTextDataTableColumn( "Well" ),
|
||||
RifTextDataTableColumn( "I" ),
|
||||
RifTextDataTableColumn( "J" ),
|
||||
RifTextDataTableColumn( "K1" ),
|
||||
RifTextDataTableColumn( "K2" ),
|
||||
RifTextDataTableColumn( "Status" ),
|
||||
RifTextDataTableColumn( "SAT" ),
|
||||
RifTextDataTableColumn( "TR",
|
||||
std::vector<RifTextDataTableColumn> header =
|
||||
{ RifTextDataTableColumn( "WELL", "NAME" ),
|
||||
RifTextDataTableColumn( "", "I" ),
|
||||
RifTextDataTableColumn( "", "J" ),
|
||||
RifTextDataTableColumn( "", "K1" ),
|
||||
RifTextDataTableColumn( "", "K2" ),
|
||||
RifTextDataTableColumn( "OPEN", "SHUT" ),
|
||||
RifTextDataTableColumn( "SAT", "TAB" ),
|
||||
RifTextDataTableColumn( "CONN",
|
||||
"FACT",
|
||||
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ),
|
||||
RifTextDataTableColumn( "DIAM" ),
|
||||
RifTextDataTableColumn( "WELL", "DIA" ),
|
||||
RifTextDataTableColumn( "KH",
|
||||
"FACT",
|
||||
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ),
|
||||
RifTextDataTableColumn( "S" ),
|
||||
RifTextDataTableColumn( "Df",
|
||||
RifTextDataTableColumn( "SKIN", "FACT" ),
|
||||
RifTextDataTableColumn( "D",
|
||||
"FACT",
|
||||
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ),
|
||||
RifTextDataTableColumn( "DIR" ) };
|
||||
RifTextDataTableColumn( "DIR", "PEN" ) };
|
||||
|
||||
formatter.header( header );
|
||||
formatter.keyword( "COMPDAT" );
|
||||
}
|
||||
else
|
||||
{
|
||||
header =
|
||||
{ RifTextDataTableColumn( "Well" ),
|
||||
RifTextDataTableColumn( "LgrName" ),
|
||||
RifTextDataTableColumn( "I" ),
|
||||
RifTextDataTableColumn( "J" ),
|
||||
RifTextDataTableColumn( "K1" ),
|
||||
RifTextDataTableColumn( "K2" ),
|
||||
RifTextDataTableColumn( "Status" ),
|
||||
RifTextDataTableColumn( "SAT" ),
|
||||
RifTextDataTableColumn( "TR",
|
||||
std::vector<RifTextDataTableColumn> header =
|
||||
{ RifTextDataTableColumn( "WELL", "NAME" ),
|
||||
RifTextDataTableColumn( "LGR", "NAME" ),
|
||||
RifTextDataTableColumn( "", "I" ),
|
||||
RifTextDataTableColumn( "", "J" ),
|
||||
RifTextDataTableColumn( "", "K1" ),
|
||||
RifTextDataTableColumn( "", "K2" ),
|
||||
RifTextDataTableColumn( "OPEN", "SHUT" ),
|
||||
RifTextDataTableColumn( "SAT", "TAB" ),
|
||||
RifTextDataTableColumn( "CONN",
|
||||
"FACT",
|
||||
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ),
|
||||
RifTextDataTableColumn( "DIAM" ),
|
||||
RifTextDataTableColumn( "WELL", "DIA" ),
|
||||
RifTextDataTableColumn( "KH",
|
||||
"FACT",
|
||||
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ),
|
||||
RifTextDataTableColumn( "S" ),
|
||||
RifTextDataTableColumn( "Df",
|
||||
RifTextDataTableColumn( "SKIN", "FACT" ),
|
||||
RifTextDataTableColumn( "D",
|
||||
"FACT",
|
||||
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ),
|
||||
RifTextDataTableColumn( "DIR" ) };
|
||||
RifTextDataTableColumn( "DIR", "PEN" ) };
|
||||
|
||||
formatter.header( header );
|
||||
formatter.keyword( "COMPDATL" );
|
||||
}
|
||||
formatter.header( header );
|
||||
|
||||
RigCompletionData::CompletionType currentCompletionType = RigCompletionData::CT_UNDEFINED;
|
||||
|
||||
@@ -1020,14 +1051,14 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompdatTableUsingFormatte
|
||||
if ( data.completionType() == RigCompletionData::FRACTURE ) txt = "Fracture";
|
||||
if ( data.completionType() == RigCompletionData::PERFORATION ) txt = "Perforation";
|
||||
|
||||
formatter.comment( "---- Completions for completion type " + txt + " ----" );
|
||||
formatter.addOptionalComment( "---- Completions for completion type " + txt + " ----" );
|
||||
|
||||
currentCompletionType = data.completionType();
|
||||
}
|
||||
|
||||
for ( const RigCompletionMetaData& metadata : data.metadata() )
|
||||
{
|
||||
formatter.comment( QString( "%1 : %2" ).arg( metadata.name ).arg( metadata.comment ) );
|
||||
formatter.addOptionalComment( QString( "%1 : %2" ).arg( metadata.name ).arg( metadata.comment ) );
|
||||
}
|
||||
|
||||
if ( data.transmissibility() == 0.0 || data.wpimult() == 0.0 )
|
||||
|
@@ -155,7 +155,8 @@ private:
|
||||
|
||||
static void exportWelspecsToFile( RimEclipseCase* gridCase,
|
||||
QFilePtr exportFile,
|
||||
const std::vector<RigCompletionData>& completions );
|
||||
const std::vector<RigCompletionData>& completions,
|
||||
bool exportDataSourceAsComment );
|
||||
|
||||
static void exportWelspeclToFile( RimEclipseCase* gridCase,
|
||||
QFilePtr exportFile,
|
||||
@@ -166,12 +167,15 @@ private:
|
||||
const QString& fileName,
|
||||
const std::vector<RigCompletionData>& completions,
|
||||
const std::vector<RicWellPathFractureReportItem>& wellPathFractureReportItems,
|
||||
RicExportCompletionDataSettingsUi::CompdatExportType exportType );
|
||||
RicExportCompletionDataSettingsUi::CompdatExportType exportType,
|
||||
bool exportDataSourceAsComment,
|
||||
bool exportWelspec );
|
||||
|
||||
static void exportCompdatAndWpimultTables( RimEclipseCase* sourceCase,
|
||||
QFilePtr exportFile,
|
||||
const std::map<QString, std::vector<RigCompletionData>>& completionsPerGrid,
|
||||
RicExportCompletionDataSettingsUi::CompdatExportType exportType );
|
||||
RicExportCompletionDataSettingsUi::CompdatExportType exportType,
|
||||
bool exportDataSourceAsComment );
|
||||
|
||||
static void exportCompdatTableUsingFormatter( RifTextDataTableFormatter& formatter,
|
||||
const QString& gridName,
|
||||
|
@@ -117,7 +117,10 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions(
|
||||
fractureExportFile =
|
||||
RicWellPathExportCompletionsFileTools::openFileForExport( exportSettings.folder, fileName );
|
||||
}
|
||||
exportWellSegmentsForFractures( exportSettings.caseToApply, fractureExportFile, wellPath );
|
||||
exportWellSegmentsForFractures( exportSettings.caseToApply,
|
||||
fractureExportFile,
|
||||
wellPath,
|
||||
exportSettings.exportDataSourceAsComment() );
|
||||
}
|
||||
|
||||
if ( exportPerforations )
|
||||
@@ -137,7 +140,8 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions(
|
||||
exportWellSegmentsForPerforations( exportSettings.caseToApply,
|
||||
perforationsExportFile,
|
||||
wellPath,
|
||||
exportSettings.timeStep );
|
||||
exportSettings.timeStep,
|
||||
exportSettings.exportDataSourceAsComment() );
|
||||
}
|
||||
|
||||
if ( exportFishbones )
|
||||
@@ -154,7 +158,10 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions(
|
||||
fishbonesExportFile =
|
||||
RicWellPathExportCompletionsFileTools::openFileForExport( exportSettings.folder, fileName );
|
||||
}
|
||||
exportWellSegmentsForFishbones( exportSettings.caseToApply, fishbonesExportFile, wellPath );
|
||||
exportWellSegmentsForFishbones( exportSettings.caseToApply,
|
||||
fishbonesExportFile,
|
||||
wellPath,
|
||||
exportSettings.exportDataSourceAsComment() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,7 +171,8 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForFractures( RimEclipseCase* eclipseCase,
|
||||
std::shared_ptr<QFile> exportFile,
|
||||
const RimWellPath* wellPath )
|
||||
const RimWellPath* wellPath,
|
||||
bool exportDataSourceAsComment )
|
||||
{
|
||||
auto fractures = wellPath->fractureCollection()->activeFractures();
|
||||
|
||||
@@ -179,6 +187,7 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForFractures( RimEcl
|
||||
|
||||
QTextStream stream( exportFile.get() );
|
||||
RifTextDataTableFormatter formatter( stream );
|
||||
formatter.setOptionalComment( exportDataSourceAsComment );
|
||||
|
||||
double maxSegmentLength = wellPath->completionSettings()->mswParameters()->maxSegmentLength();
|
||||
|
||||
@@ -191,7 +200,8 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForFractures( RimEcl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForFishbones( RimEclipseCase* eclipseCase,
|
||||
std::shared_ptr<QFile> exportFile,
|
||||
const RimWellPath* wellPath )
|
||||
const RimWellPath* wellPath,
|
||||
bool exportDataSourceAsComment )
|
||||
{
|
||||
auto fishbonesSubs = wellPath->fishbonesCollection()->activeFishbonesSubs();
|
||||
|
||||
@@ -232,6 +242,7 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForFishbones( RimEcl
|
||||
|
||||
QTextStream stream( exportFile.get() );
|
||||
RifTextDataTableFormatter formatter( stream );
|
||||
formatter.setOptionalComment( exportDataSourceAsComment );
|
||||
|
||||
double maxSegmentLength = wellPath->completionSettings()->mswParameters()->maxSegmentLength();
|
||||
|
||||
@@ -246,7 +257,8 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForFishbones( RimEcl
|
||||
void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForPerforations( RimEclipseCase* eclipseCase,
|
||||
std::shared_ptr<QFile> exportFile,
|
||||
const RimWellPath* wellPath,
|
||||
int timeStep )
|
||||
int timeStep,
|
||||
bool exportDataSourceAsComment )
|
||||
{
|
||||
RiaDefines::EclipseUnitSystem unitSystem = eclipseCase->eclipseCaseData()->unitsType();
|
||||
|
||||
@@ -365,7 +377,7 @@ void RicWellPathExportMswCompletionsImpl::writeWelsegsSegmentsRecursively( RifTe
|
||||
++it; // skip segment below
|
||||
}
|
||||
|
||||
formatter.comment( QString( "Segments on branch %1" ).arg( branch->label() ) );
|
||||
formatter.addOptionalComment( QString( "Segments on branch %1" ).arg( branch->label() ) );
|
||||
|
||||
for ( ; it != branchSegments.end(); ++it )
|
||||
{
|
||||
@@ -375,7 +387,7 @@ void RicWellPathExportMswCompletionsImpl::writeWelsegsSegmentsRecursively( RifTe
|
||||
if ( segment->subIndex() != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
QString comment = segment->label() + QString( ", sub %1" ).arg( segment->subIndex() );
|
||||
formatter.comment( comment );
|
||||
formatter.addOptionalComment( comment );
|
||||
}
|
||||
|
||||
writeWelsegsSegment( segment, outletSegment, formatter, exportInfo, maxSegmentLength, branch, segmentNumber );
|
||||
@@ -414,25 +426,25 @@ void RicWellPathExportMswCompletionsImpl::writeWelsegsCompletionCommentHeader( R
|
||||
{
|
||||
if ( completionType == RigCompletionData::CT_UNDEFINED )
|
||||
{
|
||||
formatter.comment( "Main stem" );
|
||||
formatter.addOptionalComment( "Main stem" );
|
||||
}
|
||||
else if ( completionType == RigCompletionData::FISHBONES_ICD )
|
||||
{
|
||||
formatter.comment( "Fishbone Laterals" );
|
||||
formatter.comment( "Diam: MSW - Tubing Radius" );
|
||||
formatter.comment( "Rough: MSW - Open Hole Roughness Factor" );
|
||||
formatter.addOptionalComment( "Fishbone Laterals" );
|
||||
formatter.addOptionalComment( "Diam: MSW - Tubing Radius" );
|
||||
formatter.addOptionalComment( "Rough: MSW - Open Hole Roughness Factor" );
|
||||
}
|
||||
else if ( RigCompletionData::isPerforationValve( completionType ) )
|
||||
{
|
||||
formatter.comment( "Perforation Valve Segments" );
|
||||
formatter.comment( "Diam: MSW - Tubing Radius" );
|
||||
formatter.comment( "Rough: MSW - Open Hole Roughness Factor" );
|
||||
formatter.addOptionalComment( "Perforation Valve Segments" );
|
||||
formatter.addOptionalComment( "Diam: MSW - Tubing Radius" );
|
||||
formatter.addOptionalComment( "Rough: MSW - Open Hole Roughness Factor" );
|
||||
}
|
||||
else if ( completionType == RigCompletionData::FRACTURE )
|
||||
{
|
||||
formatter.comment( "Fracture Segments" );
|
||||
formatter.comment( "Diam: MSW - Default Dummy" );
|
||||
formatter.comment( "Rough: MSW - Default Dummy" );
|
||||
formatter.addOptionalComment( "Fracture Segments" );
|
||||
formatter.addOptionalComment( "Diam: MSW - Default Dummy" );
|
||||
formatter.addOptionalComment( "Rough: MSW - Default Dummy" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -696,7 +708,7 @@ void RicWellPathExportMswCompletionsImpl::generateWsegvalvTable( RifTextDataTabl
|
||||
if ( wsegValve->completionType() == RigCompletionData::PERFORATION_ICD ||
|
||||
wsegValve->completionType() == RigCompletionData::PERFORATION_ICV )
|
||||
{
|
||||
formatter.comment( wsegValve->label() );
|
||||
formatter.addOptionalComment( wsegValve->label() );
|
||||
}
|
||||
formatter.add( exportInfo.mainBoreBranch()->wellPath()->completionSettings()->wellNameForExport() );
|
||||
formatter.add( firstSubSegment->segmentNumber() );
|
||||
@@ -1978,7 +1990,7 @@ void RicWellPathExportMswCompletionsImpl::writeValveWelsegsSegment( const RicMsw
|
||||
CVF_ASSERT( !valve->label().isEmpty() );
|
||||
CVF_ASSERT( valve->wellPath() );
|
||||
|
||||
formatter.comment( valve->label() );
|
||||
formatter.addOptionalComment( valve->label() );
|
||||
|
||||
auto segments = valve->segments();
|
||||
|
||||
@@ -2047,11 +2059,12 @@ void RicWellPathExportMswCompletionsImpl::writeCompletionWelsegsSegments( gsl::n
|
||||
|
||||
if ( completion->completionType() == RigCompletionData::FISHBONES )
|
||||
{
|
||||
formatter.comment( QString( "Sub index %1 - %2" ).arg( outletSegment->subIndex() ).arg( completion->label() ) );
|
||||
formatter.addOptionalComment(
|
||||
QString( "Sub index %1 - %2" ).arg( outletSegment->subIndex() ).arg( completion->label() ) );
|
||||
}
|
||||
else if ( completion->completionType() == RigCompletionData::FRACTURE )
|
||||
{
|
||||
formatter.comment(
|
||||
formatter.addOptionalComment(
|
||||
QString( "%1 connected to segment %2" ).arg( completion->label() ).arg( outletSegment->segmentNumber() ) );
|
||||
}
|
||||
|
||||
|
@@ -69,16 +69,19 @@ public:
|
||||
|
||||
static void exportWellSegmentsForFractures( RimEclipseCase* eclipseCase,
|
||||
std::shared_ptr<QFile> exportFile,
|
||||
const RimWellPath* wellPath );
|
||||
const RimWellPath* wellPath,
|
||||
bool exportDataSourceAsComment );
|
||||
|
||||
static void exportWellSegmentsForFishbones( RimEclipseCase* eclipseCase,
|
||||
std::shared_ptr<QFile> exportFile,
|
||||
const RimWellPath* wellPath );
|
||||
const RimWellPath* wellPath,
|
||||
bool exportDataSourceAsComment );
|
||||
|
||||
static void exportWellSegmentsForPerforations( RimEclipseCase* eclipseCase,
|
||||
std::shared_ptr<QFile> exportFile,
|
||||
const RimWellPath* wellPath,
|
||||
int timeStep );
|
||||
int timeStep,
|
||||
bool exportDataSourceAsComment );
|
||||
|
||||
static void generateFishbonesMswExportInfo( const RimEclipseCase* caseToApply,
|
||||
const RimWellPath* wellPath,
|
||||
|
@@ -106,7 +106,7 @@ void RifCsvDataTableFormatter::outputBuffer()
|
||||
{
|
||||
for ( size_t i = 0; i < m_columnHeaders.size(); i++ )
|
||||
{
|
||||
m_out << m_columnHeaders[i].title;
|
||||
m_out << m_columnHeaders[i].title();
|
||||
|
||||
if ( i < m_columnHeaders.size() - 1 )
|
||||
{
|
||||
|
@@ -36,6 +36,7 @@ RifTextDataTableFormatter::RifTextDataTableFormatter( QTextStream& out )
|
||||
, m_headerPrefix( "-- " )
|
||||
, m_maxDataRowWidth( MAX_ECLIPSE_DATA_ROW_WIDTH )
|
||||
, m_defaultMarker( "1*" )
|
||||
, m_isOptionalCommentEnabled( true )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -51,6 +52,7 @@ RifTextDataTableFormatter::RifTextDataTableFormatter( const RifTextDataTableForm
|
||||
, m_headerPrefix( rhs.m_headerPrefix )
|
||||
, m_maxDataRowWidth( rhs.m_maxDataRowWidth )
|
||||
, m_defaultMarker( rhs.m_defaultMarker )
|
||||
, m_isOptionalCommentEnabled( rhs.isOptionalCommentEnabled() )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -175,6 +177,22 @@ QString RifTextDataTableFormatter::defaultMarker() const
|
||||
return m_defaultMarker;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifTextDataTableFormatter::setOptionalComment( bool enable )
|
||||
{
|
||||
m_isOptionalCommentEnabled = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifTextDataTableFormatter::isOptionalCommentEnabled() const
|
||||
{
|
||||
return m_isOptionalCommentEnabled;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -182,12 +200,26 @@ void RifTextDataTableFormatter::outputBuffer()
|
||||
{
|
||||
if ( !m_columns.empty() && !isAllHeadersEmpty( m_columns ) )
|
||||
{
|
||||
m_out << m_headerPrefix;
|
||||
size_t maxSubTitleCount = 0;
|
||||
for ( size_t i = 0u; i < m_columns.size(); ++i )
|
||||
{
|
||||
m_out << formatColumn( m_columns[i].title, i );
|
||||
maxSubTitleCount = std::max( maxSubTitleCount, m_columns[i].titles.size() );
|
||||
}
|
||||
|
||||
for ( size_t subTitleIndex = 0; subTitleIndex < maxSubTitleCount; subTitleIndex++ )
|
||||
{
|
||||
m_out << m_headerPrefix;
|
||||
for ( size_t i = 0u; i < m_columns.size(); ++i )
|
||||
{
|
||||
QString subTitle;
|
||||
if ( subTitleIndex < m_columns[i].titles.size() )
|
||||
{
|
||||
subTitle = m_columns[i].titles[subTitleIndex];
|
||||
}
|
||||
m_out << formatColumn( subTitle, i );
|
||||
}
|
||||
m_out << "\n";
|
||||
}
|
||||
m_out << "\n";
|
||||
}
|
||||
|
||||
for ( auto line : m_buffer )
|
||||
@@ -200,6 +232,10 @@ void RifTextDataTableFormatter::outputBuffer()
|
||||
{
|
||||
outputHorizontalLine( line );
|
||||
}
|
||||
else if ( line.lineType == KEYWORD )
|
||||
{
|
||||
outputKeyword( line );
|
||||
}
|
||||
else if ( line.lineType == CONTENTS )
|
||||
{
|
||||
QString lineText = m_tableRowPrependText;
|
||||
@@ -232,24 +268,38 @@ void RifTextDataTableFormatter::outputBuffer()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifTextDataTableFormatter::outputComment( const RifTextDataTableLine& comment )
|
||||
void RifTextDataTableFormatter::outputKeyword( const RifTextDataTableLine& keyword )
|
||||
{
|
||||
m_out << m_commentPrefix << comment.data[0] << "\n";
|
||||
QString text;
|
||||
if ( !keyword.data.empty() ) text = keyword.data.front();
|
||||
|
||||
m_out << text << "\n";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifTextDataTableFormatter::outputHorizontalLine( RifTextDataTableLine& comment )
|
||||
void RifTextDataTableFormatter::outputComment( const RifTextDataTableLine& comment )
|
||||
{
|
||||
if ( comment.lineType == HORIZONTAL_LINE )
|
||||
QString text;
|
||||
if ( !comment.data.empty() ) text = comment.data.front();
|
||||
|
||||
m_out << m_commentPrefix << text << "\n";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifTextDataTableFormatter::outputHorizontalLine( RifTextDataTableLine& horizontalLine )
|
||||
{
|
||||
if ( horizontalLine.lineType == HORIZONTAL_LINE )
|
||||
{
|
||||
int charCount = tableWidth();
|
||||
|
||||
QChar fillChar = ' ';
|
||||
if ( !comment.data.empty() )
|
||||
if ( !horizontalLine.data.empty() )
|
||||
{
|
||||
QString firstString = comment.data[0];
|
||||
QString firstString = horizontalLine.data[0];
|
||||
if ( !firstString.isEmpty() )
|
||||
{
|
||||
fillChar = firstString[0];
|
||||
@@ -270,7 +320,7 @@ bool RifTextDataTableFormatter::isAllHeadersEmpty( const std::vector<RifTextData
|
||||
{
|
||||
for ( auto& header : headers )
|
||||
{
|
||||
if ( !header.title.isEmpty() ) return false;
|
||||
if ( !header.titles.empty() ) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -305,9 +355,18 @@ void RifTextDataTableFormatter::tableCompleted( const QString& appendText, bool
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifTextDataTableFormatter& RifTextDataTableFormatter::keyword( const QString& keyword )
|
||||
{
|
||||
CVF_ASSERT( m_buffer.empty() );
|
||||
CVF_ASSERT( m_columns.empty() );
|
||||
m_out << keyword << "\n";
|
||||
RifTextDataTableLine line;
|
||||
line.data.push_back( keyword );
|
||||
line.lineType = KEYWORD;
|
||||
if ( m_columns.empty() )
|
||||
{
|
||||
outputKeyword( line );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_buffer.push_back( line );
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -321,7 +380,12 @@ RifTextDataTableFormatter& RifTextDataTableFormatter::header( const std::vector<
|
||||
|
||||
for ( size_t colNumber = 0u; colNumber < m_columns.size(); ++colNumber )
|
||||
{
|
||||
m_columns[colNumber].width = measure( m_columns[colNumber].title );
|
||||
int maxWidth = 0;
|
||||
for ( const auto& subTitle : m_columns[colNumber].titles )
|
||||
{
|
||||
maxWidth = std::max( maxWidth, measure( subTitle ) );
|
||||
}
|
||||
m_columns[colNumber].width = maxWidth;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -346,6 +410,19 @@ RifTextDataTableFormatter& RifTextDataTableFormatter::comment( const QString& co
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifTextDataTableFormatter& RifTextDataTableFormatter::addOptionalComment( const QString& str )
|
||||
{
|
||||
if ( m_isOptionalCommentEnabled )
|
||||
{
|
||||
return comment( str );
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -30,7 +30,8 @@ enum RifTextDataTableLineType
|
||||
{
|
||||
COMMENT,
|
||||
CONTENTS,
|
||||
HORIZONTAL_LINE
|
||||
HORIZONTAL_LINE,
|
||||
KEYWORD
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
@@ -87,17 +88,52 @@ struct RifTextDataTableColumn
|
||||
RifTextDataTableDoubleFormatting doubleFormat = RifTextDataTableDoubleFormatting(),
|
||||
RifTextDataTableAlignment alignment = LEFT,
|
||||
int width = -1 )
|
||||
: title( title )
|
||||
, doubleFormat( doubleFormat )
|
||||
: doubleFormat( doubleFormat )
|
||||
, alignment( alignment )
|
||||
, width( width )
|
||||
{
|
||||
titles.push_back( title );
|
||||
}
|
||||
|
||||
RifTextDataTableColumn( const QString& title,
|
||||
const QString& subTitle,
|
||||
RifTextDataTableDoubleFormatting doubleFormat = RifTextDataTableDoubleFormatting(),
|
||||
RifTextDataTableAlignment alignment = LEFT,
|
||||
int width = -1 )
|
||||
: doubleFormat( doubleFormat )
|
||||
, alignment( alignment )
|
||||
, width( width )
|
||||
{
|
||||
titles.push_back( title );
|
||||
titles.push_back( subTitle );
|
||||
}
|
||||
|
||||
RifTextDataTableColumn( const QString& title,
|
||||
const QString& subTitle1,
|
||||
const QString& subTitle2,
|
||||
RifTextDataTableDoubleFormatting doubleFormat = RifTextDataTableDoubleFormatting(),
|
||||
RifTextDataTableAlignment alignment = LEFT,
|
||||
int width = -1 )
|
||||
: doubleFormat( doubleFormat )
|
||||
, alignment( alignment )
|
||||
, width( width )
|
||||
{
|
||||
titles.push_back( title );
|
||||
titles.push_back( subTitle1 );
|
||||
titles.push_back( subTitle2 );
|
||||
}
|
||||
|
||||
QString title() const
|
||||
{
|
||||
if ( !titles.empty() ) return titles.front();
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
QString title;
|
||||
RifTextDataTableDoubleFormatting doubleFormat;
|
||||
RifTextDataTableAlignment alignment;
|
||||
int width;
|
||||
std::vector<QString> titles;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
@@ -126,6 +162,9 @@ public:
|
||||
void setDefaultMarker( const QString& defaultMarker );
|
||||
QString defaultMarker() const;
|
||||
|
||||
void setOptionalComment( bool enable );
|
||||
bool isOptionalCommentEnabled() const;
|
||||
|
||||
RifTextDataTableFormatter& keyword( const QString& keyword );
|
||||
RifTextDataTableFormatter& header( std::vector<RifTextDataTableColumn> tableHeader );
|
||||
RifTextDataTableFormatter& add( const QString& str );
|
||||
@@ -135,6 +174,7 @@ public:
|
||||
RifTextDataTableFormatter& addOneBasedCellIndex( size_t zeroBasedIndex );
|
||||
RifTextDataTableFormatter& addValueOrDefaultMarker( double value, double defaultValue );
|
||||
RifTextDataTableFormatter& comment( const QString& str );
|
||||
RifTextDataTableFormatter& addOptionalComment( const QString& str );
|
||||
RifTextDataTableFormatter& addHorizontalLine( const QChar& str );
|
||||
void rowCompleted();
|
||||
void rowCompleted( const QString& appendText );
|
||||
@@ -157,8 +197,9 @@ protected:
|
||||
QString formatColumn( const QString str, size_t columnIndex ) const;
|
||||
|
||||
void outputBuffer();
|
||||
void outputKeyword( const RifTextDataTableLine& keyword );
|
||||
void outputComment( const RifTextDataTableLine& comment );
|
||||
void outputHorizontalLine( RifTextDataTableLine& comment );
|
||||
void outputHorizontalLine( RifTextDataTableLine& horizontalLine );
|
||||
|
||||
bool isAllHeadersEmpty( const std::vector<RifTextDataTableColumn>& headers );
|
||||
|
||||
@@ -174,4 +215,5 @@ private:
|
||||
QString m_headerPrefix;
|
||||
int m_maxDataRowWidth;
|
||||
QString m_defaultMarker;
|
||||
bool m_isOptionalCommentEnabled;
|
||||
};
|
||||
|
@@ -210,3 +210,133 @@ TEST( RifTextDataTableFormatter, LongLine133 )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST( RifTextDataTableFormatter, TwoHeaderRowsWithDifferentColSpan )
|
||||
{
|
||||
std::vector<RifTextDataTableColumn> header = {
|
||||
RifTextDataTableColumn( "WELL", "NAME" ), // well
|
||||
RifTextDataTableColumn( "GROUP", "NAME" ), // group
|
||||
RifTextDataTableColumn( "", "I" ), // I
|
||||
RifTextDataTableColumn( "", "J" ), // J
|
||||
RifTextDataTableColumn( "BHP", "DEPTH" ), // RefDepth
|
||||
RifTextDataTableColumn( "PHASE", "FLUID" ), // Type
|
||||
RifTextDataTableColumn( "DRAIN", "AREA", "[cm2]" ), // DrainRad
|
||||
RifTextDataTableColumn( "INFLOW", "EQUANS" ), // GasInEq
|
||||
RifTextDataTableColumn( "OPEN", "SHUT" ), // AutoShut
|
||||
RifTextDataTableColumn( "CROSS", "FLOW" ), // XFlow
|
||||
RifTextDataTableColumn( "PVT", "TABLE" ), // FluidPVT
|
||||
RifTextDataTableColumn( "HYDS", "DENS" ), // HydrDens
|
||||
RifTextDataTableColumn( "FIP", "REGN" ) // FluidInPla) };
|
||||
};
|
||||
|
||||
{
|
||||
QString tableText;
|
||||
QTextStream stream( &tableText );
|
||||
|
||||
RifTextDataTableFormatter formatter( stream );
|
||||
formatter.setColumnSpacing( 2 );
|
||||
|
||||
formatter.header( header );
|
||||
// Test with keyword after header
|
||||
formatter.keyword( "WELSPECS" );
|
||||
|
||||
formatter.add( "OP-01" );
|
||||
formatter.add( "PLATFORM" );
|
||||
formatter.add( "45" );
|
||||
formatter.add( "99" );
|
||||
formatter.add( "1*" );
|
||||
formatter.add( "OIL" );
|
||||
formatter.add( "0.0" );
|
||||
formatter.add( "STD" );
|
||||
formatter.add( "STOP" );
|
||||
formatter.add( "YES" );
|
||||
formatter.add( "0" );
|
||||
formatter.add( "SEG" );
|
||||
formatter.add( "0" );
|
||||
formatter.rowCompleted();
|
||||
|
||||
formatter.add( "OP-02ST" );
|
||||
formatter.add( "PLATFORM" );
|
||||
formatter.add( "60" );
|
||||
formatter.add( "91" );
|
||||
formatter.add( "1*" );
|
||||
formatter.add( "OIL" );
|
||||
formatter.add( "0.0" );
|
||||
formatter.add( "STD" );
|
||||
formatter.add( "STOP" );
|
||||
formatter.add( "YES" );
|
||||
formatter.add( "0" );
|
||||
formatter.add( "SEG" );
|
||||
formatter.add( "0" );
|
||||
formatter.rowCompleted();
|
||||
|
||||
formatter.tableCompleted();
|
||||
|
||||
const QString textForCompare =
|
||||
R"(-- WELL GROUP BHP PHASE DRAIN INFLOW OPEN CROSS PVT HYDS FIP
|
||||
-- NAME NAME I J DEPTH FLUID AREA EQUANS SHUT FLOW TABLE DENS REGN
|
||||
-- [cm2]
|
||||
WELSPECS
|
||||
OP-01 PLATFORM 45 99 1* OIL 0.0 STD STOP YES 0 SEG 0 /
|
||||
OP-02ST PLATFORM 60 91 1* OIL 0.0 STD STOP YES 0 SEG 0 /
|
||||
/
|
||||
)";
|
||||
|
||||
EXPECT_STREQ( textForCompare.toStdString().data(), tableText.toStdString().data() );
|
||||
}
|
||||
|
||||
{
|
||||
QString tableText;
|
||||
QTextStream stream( &tableText );
|
||||
|
||||
RifTextDataTableFormatter formatter( stream );
|
||||
formatter.setColumnSpacing( 2 );
|
||||
|
||||
// Test with keyword before header
|
||||
formatter.keyword( "WELSPECS" );
|
||||
formatter.header( header );
|
||||
|
||||
formatter.add( "OP-01" );
|
||||
formatter.add( "PLATFORM" );
|
||||
formatter.add( "45" );
|
||||
formatter.add( "99" );
|
||||
formatter.add( "1*" );
|
||||
formatter.add( "OIL" );
|
||||
formatter.add( "0.0" );
|
||||
formatter.add( "STD" );
|
||||
formatter.add( "STOP" );
|
||||
formatter.add( "YES" );
|
||||
formatter.add( "0" );
|
||||
formatter.add( "SEG" );
|
||||
formatter.add( "0" );
|
||||
formatter.rowCompleted();
|
||||
|
||||
formatter.add( "OP-02ST" );
|
||||
formatter.add( "PLATFORM" );
|
||||
formatter.add( "60" );
|
||||
formatter.add( "91" );
|
||||
formatter.add( "1*" );
|
||||
formatter.add( "OIL" );
|
||||
formatter.add( "0.0" );
|
||||
formatter.add( "STD" );
|
||||
formatter.add( "STOP" );
|
||||
formatter.add( "YES" );
|
||||
formatter.add( "0" );
|
||||
formatter.add( "SEG" );
|
||||
formatter.add( "0" );
|
||||
formatter.rowCompleted();
|
||||
|
||||
formatter.tableCompleted();
|
||||
|
||||
const QString textForCompare = R"(WELSPECS
|
||||
-- WELL GROUP BHP PHASE DRAIN INFLOW OPEN CROSS PVT HYDS FIP
|
||||
-- NAME NAME I J DEPTH FLUID AREA EQUANS SHUT FLOW TABLE DENS REGN
|
||||
-- [cm2]
|
||||
OP-01 PLATFORM 45 99 1* OIL 0.0 STD STOP YES 0 SEG 0 /
|
||||
OP-02ST PLATFORM 60 91 1* OIL 0.0 STD STOP YES 0 SEG 0 /
|
||||
/
|
||||
)";
|
||||
|
||||
EXPECT_STREQ( textForCompare.toStdString().data(), tableText.toStdString().data() );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user