From d681b75d24f19993a36009c0b54941c5260b1856 Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Tue, 15 Oct 2019 11:30:06 +0200 Subject: [PATCH] Rename RifEclipseOutputDataTable* to RifTextDataTable* --- ...icExportCompletionsWellSegmentsFeature.cpp | 2 +- ...ellPathExportCompletionDataFeatureImpl.cpp | 168 +++++++------- ...cWellPathExportCompletionDataFeatureImpl.h | 6 +- .../RicWellPathExportMswCompletionsImpl.cpp | 118 +++++----- .../RicWellPathExportMswCompletionsImpl.h | 20 +- ...cWellPathFractureTextReportFeatureImpl.cpp | 118 +++++----- ...RicWellPathFractureTextReportFeatureImpl.h | 4 +- .../ExportCommands/RicExportCarfin.cpp | 28 +-- .../ExportCommands/RicExportLgrFeature.cpp | 26 +-- .../RicExportSelectedWellPathsFeature.cpp | 6 +- .../RicCreateMultipleFracturesUi.cpp | 16 +- .../Commands/RicCreateTemporaryLgrFeature.cpp | 2 +- .../FileInterface/CMakeLists_files.cmake | 4 +- .../RifCsvDataTableFormatter.cpp | 10 +- .../FileInterface/RifCsvDataTableFormatter.h | 14 +- ...tter.cpp => RifTextDataTableFormatter.cpp} | 100 ++++----- ...ormatter.h => RifTextDataTableFormatter.h} | 107 +++++---- .../Flow/RimFlowCharacteristicsPlot.cpp | 14 +- .../GridCrossPlots/RimGridCrossPlot.cpp | 4 +- .../RimGridCrossPlotDataSet.cpp | 15 +- .../GridCrossPlots/RimGridCrossPlotDataSet.h | 4 +- .../ProjectDataModel/RimModeledWellPath.cpp | 6 +- .../UnitTests/CMakeLists_files.cmake | 2 +- .../RifCsvDataTableFormatter-Test.cpp | 12 +- .../RifEclipseDataTableFormatter-Test.cpp | 212 ------------------ .../RifTextDataTableFormatter-Test.cpp | 212 ++++++++++++++++++ 26 files changed, 611 insertions(+), 619 deletions(-) rename ApplicationCode/FileInterface/{RifEclipseDataTableFormatter.cpp => RifTextDataTableFormatter.cpp} (82%) rename ApplicationCode/FileInterface/{RifEclipseDataTableFormatter.h => RifTextDataTableFormatter.h} (51%) delete mode 100644 ApplicationCode/UnitTests/RifEclipseDataTableFormatter-Test.cpp create mode 100644 ApplicationCode/UnitTests/RifTextDataTableFormatter-Test.cpp diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionsWellSegmentsFeature.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionsWellSegmentsFeature.cpp index b4fac834ad..18f96b8f59 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionsWellSegmentsFeature.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionsWellSegmentsFeature.cpp @@ -21,7 +21,7 @@ #include "RiaApplication.h" #include "RiaLogging.h" -#include "RifEclipseDataTableFormatter.h" +#include "RifTextDataTableFormatter.h" #include "RicExportFeatureImpl.h" #include "RicMswExportInfo.h" diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp index d710558b3e..fec734bb8a 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp @@ -34,7 +34,7 @@ #include "RicWellPathFractureReportItem.h" #include "RicWellPathFractureTextReportFeatureImpl.h" -#include "RifEclipseDataTableFormatter.h" +#include "RifTextDataTableFormatter.h" #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" @@ -719,22 +719,22 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspecsToFile( RimEclips { QTextStream stream( exportFile.get() ); - RifEclipseDataTableFormatter formatter( stream ); + RifTextDataTableFormatter formatter( stream ); formatter.setColumnSpacing( 2 ); - std::vector header = {RifEclipseOutputTableColumn( "Well" ), - RifEclipseOutputTableColumn( "Grp" ), - RifEclipseOutputTableColumn( "I" ), - RifEclipseOutputTableColumn( "J" ), - RifEclipseOutputTableColumn( "RefDepth" ), - RifEclipseOutputTableColumn( "Type" ), - RifEclipseOutputTableColumn( "DrainRad" ), - RifEclipseOutputTableColumn( "GasInEq" ), - RifEclipseOutputTableColumn( "AutoShut" ), - RifEclipseOutputTableColumn( "XFlow" ), - RifEclipseOutputTableColumn( "FluidPVT" ), - RifEclipseOutputTableColumn( "HydSDens" ), - RifEclipseOutputTableColumn( "FluidInPlReg" )}; + std::vector 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" )}; formatter.keyword( "WELSPECS" ); formatter.header( header ); @@ -784,23 +784,23 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile( { QTextStream stream( exportFile.get() ); - RifEclipseDataTableFormatter formatter( stream ); + RifTextDataTableFormatter formatter( stream ); formatter.setColumnSpacing( 2 ); - std::vector header = {RifEclipseOutputTableColumn( "Well" ), - RifEclipseOutputTableColumn( "Grp" ), - RifEclipseOutputTableColumn( "LGR" ), - RifEclipseOutputTableColumn( "I" ), - RifEclipseOutputTableColumn( "J" ), - RifEclipseOutputTableColumn( "RefDepth" ), - RifEclipseOutputTableColumn( "Type" ), - RifEclipseOutputTableColumn( "DrainRad" ), - RifEclipseOutputTableColumn( "GasInEq" ), - RifEclipseOutputTableColumn( "AutoShut" ), - RifEclipseOutputTableColumn( "XFlow" ), - RifEclipseOutputTableColumn( "FluidPVT" ), - RifEclipseOutputTableColumn( "HydSDens" ), - RifEclipseOutputTableColumn( "FluidInPlReg" )}; + std::vector 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" )}; formatter.keyword( "WELSPECL" ); formatter.header( header ); @@ -931,7 +931,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompdatAndWpimultTables( QTextStream stream( exportFile.get() ); - RifEclipseDataTableFormatter formatter( stream ); + RifTextDataTableFormatter formatter( stream ); formatter.setColumnSpacing( 3 ); for ( const auto& gridCompletions : completionsPerGrid ) @@ -958,56 +958,52 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompdatAndWpimultTables( /// //-------------------------------------------------------------------------------------------------- void RicWellPathExportCompletionDataFeatureImpl::exportCompdatTableUsingFormatter( - RifEclipseDataTableFormatter& formatter, const QString& gridName, const std::vector& completionData ) + RifTextDataTableFormatter& formatter, const QString& gridName, const std::vector& completionData ) { - std::vector header; + std::vector header; if ( gridName.isEmpty() ) { - header = {RifEclipseOutputTableColumn( "Well" ), - RifEclipseOutputTableColumn( "I" ), - RifEclipseOutputTableColumn( "J" ), - RifEclipseOutputTableColumn( "K1" ), - RifEclipseOutputTableColumn( "K2" ), - RifEclipseOutputTableColumn( "Status" ), - RifEclipseOutputTableColumn( "SAT" ), - RifEclipseOutputTableColumn( "TR", - RifEclipseOutputTableDoubleFormatting( - RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC ) ), - RifEclipseOutputTableColumn( "DIAM" ), - RifEclipseOutputTableColumn( "KH", - RifEclipseOutputTableDoubleFormatting( - RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC ) ), - RifEclipseOutputTableColumn( "S" ), - RifEclipseOutputTableColumn( "Df", - RifEclipseOutputTableDoubleFormatting( - RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC ) ), - RifEclipseOutputTableColumn( "DIR" )}; + header = + {RifTextDataTableColumn( "Well" ), + RifTextDataTableColumn( "I" ), + RifTextDataTableColumn( "J" ), + RifTextDataTableColumn( "K1" ), + RifTextDataTableColumn( "K2" ), + RifTextDataTableColumn( "Status" ), + RifTextDataTableColumn( "SAT" ), + RifTextDataTableColumn( "TR", + RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ), + RifTextDataTableColumn( "DIAM" ), + RifTextDataTableColumn( "KH", + RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ), + RifTextDataTableColumn( "S" ), + RifTextDataTableColumn( "Df", + RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ), + RifTextDataTableColumn( "DIR" )}; formatter.keyword( "COMPDAT" ); } else { - header = {RifEclipseOutputTableColumn( "Well" ), - RifEclipseOutputTableColumn( "LgrName" ), - RifEclipseOutputTableColumn( "I" ), - RifEclipseOutputTableColumn( "J" ), - RifEclipseOutputTableColumn( "K1" ), - RifEclipseOutputTableColumn( "K2" ), - RifEclipseOutputTableColumn( "Status" ), - RifEclipseOutputTableColumn( "SAT" ), - RifEclipseOutputTableColumn( "TR", - RifEclipseOutputTableDoubleFormatting( - RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC ) ), - RifEclipseOutputTableColumn( "DIAM" ), - RifEclipseOutputTableColumn( "KH", - RifEclipseOutputTableDoubleFormatting( - RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC ) ), - RifEclipseOutputTableColumn( "S" ), - RifEclipseOutputTableColumn( "Df", - RifEclipseOutputTableDoubleFormatting( - RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC ) ), - RifEclipseOutputTableColumn( "DIR" )}; + header = + {RifTextDataTableColumn( "Well" ), + RifTextDataTableColumn( "LgrName" ), + RifTextDataTableColumn( "I" ), + RifTextDataTableColumn( "J" ), + RifTextDataTableColumn( "K1" ), + RifTextDataTableColumn( "K2" ), + RifTextDataTableColumn( "Status" ), + RifTextDataTableColumn( "SAT" ), + RifTextDataTableColumn( "TR", + RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ), + RifTextDataTableColumn( "DIAM" ), + RifTextDataTableColumn( "KH", + RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ), + RifTextDataTableColumn( "S" ), + RifTextDataTableColumn( "Df", + RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ), + RifTextDataTableColumn( "DIR" )}; formatter.keyword( "COMPDATL" ); } @@ -1098,30 +1094,30 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompdatTableUsingFormatte /// //-------------------------------------------------------------------------------------------------- void RicWellPathExportCompletionDataFeatureImpl::exportWpimultTableUsingFormatter( - RifEclipseDataTableFormatter& formatter, const QString& gridName, const std::vector& completionData ) + RifTextDataTableFormatter& formatter, const QString& gridName, const std::vector& completionData ) { - std::vector header; + std::vector header; if ( gridName.isEmpty() ) { header = { - RifEclipseOutputTableColumn( "Well" ), - RifEclipseOutputTableColumn( "Mult" ), - RifEclipseOutputTableColumn( "I" ), - RifEclipseOutputTableColumn( "J" ), - RifEclipseOutputTableColumn( "K" ), + RifTextDataTableColumn( "Well" ), + RifTextDataTableColumn( "Mult" ), + RifTextDataTableColumn( "I" ), + RifTextDataTableColumn( "J" ), + RifTextDataTableColumn( "K" ), }; formatter.keyword( "WPIMULT" ); } else { header = { - RifEclipseOutputTableColumn( "Well" ), - RifEclipseOutputTableColumn( "LgrName" ), - RifEclipseOutputTableColumn( "Mult" ), - RifEclipseOutputTableColumn( "I" ), - RifEclipseOutputTableColumn( "J" ), - RifEclipseOutputTableColumn( "K" ), + RifTextDataTableColumn( "Well" ), + RifTextDataTableColumn( "LgrName" ), + RifTextDataTableColumn( "Mult" ), + RifTextDataTableColumn( "I" ), + RifTextDataTableColumn( "J" ), + RifTextDataTableColumn( "K" ), }; formatter.keyword( "WPIMULTL" ); } @@ -1727,4 +1723,4 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCarfinForTemporaryLgrs( c { RicExportLgrFeature::exportLgrs( folder, lgrInfoForWell.first, lgrInfoForWell.second ); } -} \ No newline at end of file +} diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h index b4a6aa5ddb..39eab613bb 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h @@ -43,7 +43,7 @@ class RimWellPath; class RimWellPathValve; class RimWellPathFracture; class RimNonDarcyPerforationParameters; -class RifEclipseDataTableFormatter; +class RifTextDataTableFormatter; class RigVirtualPerforationTransmissibilities; class SubSegmentIntersectionInfo; @@ -189,11 +189,11 @@ private: const std::map>& completionsPerGrid, RicExportCompletionDataSettingsUi::CompdatExportType exportType ); - static void exportCompdatTableUsingFormatter( RifEclipseDataTableFormatter& formatter, + static void exportCompdatTableUsingFormatter( RifTextDataTableFormatter& formatter, const QString& gridName, const std::vector& completionData ); - static void exportWpimultTableUsingFormatter( RifEclipseDataTableFormatter& formatter, + static void exportWpimultTableUsingFormatter( RifTextDataTableFormatter& formatter, const QString& gridName, const std::vector& completionData ); diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp index 9ed2aff79c..f4b0562de0 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp @@ -27,7 +27,7 @@ #include "RicMswValveAccumulators.h" #include "RicWellPathExportCompletionsFileTools.h" -#include "RifEclipseDataTableFormatter.h" +#include "RifTextDataTableFormatter.h" #include "RigActiveCellInfo.h" #include "RigEclipseCaseData.h" @@ -190,8 +190,8 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForFractures( RimEcl RicMswExportInfo exportInfo = generateFracturesMswExportInfo( eclipseCase, wellPath, fractures ); - QTextStream stream( exportFile.get() ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( exportFile.get() ); + RifTextDataTableFormatter formatter( stream ); generateWelsegsTable( formatter, exportInfo ); generateCompsegTables( formatter, exportInfo ); } @@ -213,8 +213,8 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForFishbones( RicMswExportInfo exportInfo = generateFishbonesMswExportInfo( eclipseCase, wellPath, fishbonesSubs, true ); - QTextStream stream( exportFile.get() ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( exportFile.get() ); + RifTextDataTableFormatter formatter( stream ); generateWelsegsTable( formatter, exportInfo ); generateCompsegTables( formatter, exportInfo ); @@ -239,8 +239,8 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForPerforations( RicMswExportInfo exportInfo = generatePerforationsMswExportInfo( eclipseCase, wellPath, timeStep, perforationIntervals ); - QTextStream stream( exportFile.get() ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( exportFile.get() ); + RifTextDataTableFormatter formatter( stream ); generateWelsegsTable( formatter, exportInfo ); generateCompsegTables( formatter, exportInfo ); @@ -251,8 +251,8 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForPerforations( //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicWellPathExportMswCompletionsImpl::generateWelsegsTable( RifEclipseDataTableFormatter& formatter, - const RicMswExportInfo& exportInfo ) +void RicWellPathExportMswCompletionsImpl::generateWelsegsTable( RifTextDataTableFormatter& formatter, + const RicMswExportInfo& exportInfo ) { formatter.keyword( "WELSEGS" ); @@ -260,13 +260,13 @@ void RicWellPathExportMswCompletionsImpl::generateWelsegsTable( RifEclipseDataTa double startTVD = exportInfo.initialTVD(); { - std::vector header = { - RifEclipseOutputTableColumn( "Name" ), - RifEclipseOutputTableColumn( "Dep 1" ), - RifEclipseOutputTableColumn( "Tlen 1" ), - RifEclipseOutputTableColumn( "Vol 1" ), - RifEclipseOutputTableColumn( "Len&Dep" ), - RifEclipseOutputTableColumn( "PresDrop" ), + std::vector header = { + RifTextDataTableColumn( "Name" ), + RifTextDataTableColumn( "Dep 1" ), + RifTextDataTableColumn( "Tlen 1" ), + RifTextDataTableColumn( "Vol 1" ), + RifTextDataTableColumn( "Len&Dep" ), + RifTextDataTableColumn( "PresDrop" ), }; formatter.header( header ); @@ -281,15 +281,15 @@ void RicWellPathExportMswCompletionsImpl::generateWelsegsTable( RifEclipseDataTa } { - std::vector header = { - RifEclipseOutputTableColumn( "First Seg" ), - RifEclipseOutputTableColumn( "Last Seg" ), - RifEclipseOutputTableColumn( "Branch Num" ), - RifEclipseOutputTableColumn( "Outlet Seg" ), - RifEclipseOutputTableColumn( "Length" ), - RifEclipseOutputTableColumn( "Depth Change" ), - RifEclipseOutputTableColumn( "Diam" ), - RifEclipseOutputTableColumn( "Rough" ), + std::vector header = { + RifTextDataTableColumn( "First Seg" ), + RifTextDataTableColumn( "Last Seg" ), + RifTextDataTableColumn( "Branch Num" ), + RifTextDataTableColumn( "Outlet Seg" ), + RifTextDataTableColumn( "Length" ), + RifTextDataTableColumn( "Depth Change" ), + RifTextDataTableColumn( "Diam" ), + RifTextDataTableColumn( "Rough" ), }; formatter.header( header ); } @@ -351,7 +351,7 @@ void RicWellPathExportMswCompletionsImpl::generateWelsegsTable( RifEclipseDataTa /// //-------------------------------------------------------------------------------------------------- void RicWellPathExportMswCompletionsImpl::generateWelsegsSegments( - RifEclipseDataTableFormatter& formatter, + RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo, const std::set& exportCompletionTypes ) { @@ -436,7 +436,7 @@ void RicWellPathExportMswCompletionsImpl::generateWelsegsSegments( /// //-------------------------------------------------------------------------------------------------- void RicWellPathExportMswCompletionsImpl::generateWelsegsCompletionCommentHeader( - RifEclipseDataTableFormatter& formatter, RigCompletionData::CompletionType completionType ) + RifTextDataTableFormatter& formatter, RigCompletionData::CompletionType completionType ) { if ( completionType == RigCompletionData::CT_UNDEFINED ) { @@ -465,8 +465,8 @@ void RicWellPathExportMswCompletionsImpl::generateWelsegsCompletionCommentHeader //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicWellPathExportMswCompletionsImpl::generateCompsegTables( RifEclipseDataTableFormatter& formatter, - const RicMswExportInfo& exportInfo ) +void RicWellPathExportMswCompletionsImpl::generateCompsegTables( RifTextDataTableFormatter& formatter, + const RicMswExportInfo& exportInfo ) { /* * TODO: Creating the regular perforation COMPSEGS table should come in here, before the others @@ -509,7 +509,7 @@ void RicWellPathExportMswCompletionsImpl::generateCompsegTables( RifEclipseDataT /// //-------------------------------------------------------------------------------------------------- void RicWellPathExportMswCompletionsImpl::generateCompsegTable( - RifEclipseDataTableFormatter& formatter, + RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo, bool exportSubGridIntersections, const std::set& exportCompletionTypes ) @@ -576,7 +576,7 @@ void RicWellPathExportMswCompletionsImpl::generateCompsegTable( //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicWellPathExportMswCompletionsImpl::generateCompsegHeader( RifEclipseDataTableFormatter& formatter, +void RicWellPathExportMswCompletionsImpl::generateCompsegHeader( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo, RigCompletionData::CompletionType completionType, bool exportSubGridIntersections ) @@ -600,28 +600,28 @@ void RicWellPathExportMswCompletionsImpl::generateCompsegHeader( RifEclipseDataT } { - std::vector header = {RifEclipseOutputTableColumn( "Name" )}; + std::vector header = {RifTextDataTableColumn( "Name" )}; formatter.header( header ); formatter.add( exportInfo.wellPath()->completions()->wellNameForExport() ); formatter.rowCompleted(); } { - std::vector allHeaders; + std::vector allHeaders; if ( exportSubGridIntersections ) { - allHeaders.push_back( RifEclipseOutputTableColumn( "Grid" ) ); + allHeaders.push_back( RifTextDataTableColumn( "Grid" ) ); } - std::vector commonHeaders = {RifEclipseOutputTableColumn( "I" ), - RifEclipseOutputTableColumn( "J" ), - RifEclipseOutputTableColumn( "K" ), - RifEclipseOutputTableColumn( "Branch no" ), - RifEclipseOutputTableColumn( "Start Length" ), - RifEclipseOutputTableColumn( "End Length" ), - RifEclipseOutputTableColumn( "Dir Pen" ), - RifEclipseOutputTableColumn( "End Range" ), - RifEclipseOutputTableColumn( "Connection Depth" )}; + std::vector commonHeaders = {RifTextDataTableColumn( "I" ), + RifTextDataTableColumn( "J" ), + RifTextDataTableColumn( "K" ), + RifTextDataTableColumn( "Branch no" ), + RifTextDataTableColumn( "Start Length" ), + RifTextDataTableColumn( "End Length" ), + RifTextDataTableColumn( "Dir Pen" ), + RifTextDataTableColumn( "End Range" ), + RifTextDataTableColumn( "Connection Depth" )}; allHeaders.insert( allHeaders.end(), commonHeaders.begin(), commonHeaders.end() ); formatter.header( allHeaders ); } @@ -630,8 +630,8 @@ void RicWellPathExportMswCompletionsImpl::generateCompsegHeader( RifEclipseDataT //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicWellPathExportMswCompletionsImpl::generateWsegvalvTable( RifEclipseDataTableFormatter& formatter, - const RicMswExportInfo& exportInfo ) +void RicWellPathExportMswCompletionsImpl::generateWsegvalvTable( RifTextDataTableFormatter& formatter, + const RicMswExportInfo& exportInfo ) { bool foundValve = false; @@ -644,11 +644,11 @@ void RicWellPathExportMswCompletionsImpl::generateWsegvalvTable( RifEclipseDataT if ( !foundValve ) { formatter.keyword( "WSEGVALV" ); - std::vector header = { - RifEclipseOutputTableColumn( "Well Name" ), - RifEclipseOutputTableColumn( "Seg No" ), - RifEclipseOutputTableColumn( "Cv" ), - RifEclipseOutputTableColumn( "Ac" ), + std::vector header = { + RifTextDataTableColumn( "Well Name" ), + RifTextDataTableColumn( "Seg No" ), + RifTextDataTableColumn( "Cv" ), + RifTextDataTableColumn( "Ac" ), }; formatter.header( header ); @@ -682,10 +682,10 @@ void RicWellPathExportMswCompletionsImpl::generateWsegvalvTable( RifEclipseDataT //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicWellPathExportMswCompletionsImpl::generateWsegAicdTable( RifEclipseDataTableFormatter& formatter, - const RicMswExportInfo& exportInfo ) +void RicWellPathExportMswCompletionsImpl::generateWsegAicdTable( RifTextDataTableFormatter& formatter, + const RicMswExportInfo& exportInfo ) { - RifEclipseDataTableFormatter tighterFormatter( formatter ); + RifTextDataTableFormatter tighterFormatter( formatter ); tighterFormatter.setColumnSpacing( 1 ); tighterFormatter.setTableRowPrependText( " " ); @@ -739,14 +739,14 @@ void RicWellPathExportMswCompletionsImpl::generateWsegAicdTable( RifEclipseDataT QString( "%1: %2" ).arg( i + 1, 2, 10, QChar( '0' ) ).arg( columnDescriptions[i] ) ); } - std::vector header; + std::vector header; for ( size_t i = 1; i <= 21; ++i ) { - QString cName = QString( "%1" ).arg( i, 2, 10, QChar( '0' ) ); - RifEclipseOutputTableColumn col( cName, - RifEclipseOutputTableDoubleFormatting( - RifEclipseOutputTableDoubleFormat::RIF_CONSISE ), - RIGHT ); + QString cName = QString( "%1" ).arg( i, 2, 10, QChar( '0' ) ); + RifTextDataTableColumn col( cName, + RifTextDataTableDoubleFormatting( + RifTextDataTableDoubleFormat::RIF_CONSISE ), + RIGHT ); header.push_back( col ); } tighterFormatter.header( header ); diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.h b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.h index ceee35a205..14fa5cd310 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.h @@ -21,7 +21,7 @@ #include "RigCompletionData.h" class RicExportCompletionDataSettingsUi; -class RifEclipseDataTableFormatter; +class RifTextDataTableFormatter; class RimEclipseCase; class RimFishbonesMultipleSubs; class RimPerforationInterval; @@ -76,24 +76,24 @@ private: int timeStep, const std::vector& perforationIntervals ); - static void generateWelsegsTable( RifEclipseDataTableFormatter& formatter, const RicMswExportInfo& exportInfo ); + static void generateWelsegsTable( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo ); - static void generateWelsegsSegments( RifEclipseDataTableFormatter& formatter, + static void generateWelsegsSegments( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo, const std::set& exportCompletionTypes ); - static void generateWelsegsCompletionCommentHeader( RifEclipseDataTableFormatter& formatter, + static void generateWelsegsCompletionCommentHeader( RifTextDataTableFormatter& formatter, RigCompletionData::CompletionType completionType ); - static void generateCompsegTables( RifEclipseDataTableFormatter& formatter, const RicMswExportInfo& exportInfo ); - static void generateCompsegTable( RifEclipseDataTableFormatter& formatter, + static void generateCompsegTables( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo ); + static void generateCompsegTable( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo, bool exportSubGridIntersections, const std::set& exportCompletionTypes ); - static void generateCompsegHeader( RifEclipseDataTableFormatter& formatter, + static void generateCompsegHeader( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo, RigCompletionData::CompletionType completionType, bool exportSubGridIntersections ); - static void generateWsegvalvTable( RifEclipseDataTableFormatter& formatter, const RicMswExportInfo& exportInfo ); - static void generateWsegAicdTable( RifEclipseDataTableFormatter& formatter, const RicMswExportInfo& exportInfo ); + static void generateWsegvalvTable( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo ); + static void generateWsegAicdTable( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo ); private: typedef std::vector> MainBoreSegments; @@ -152,4 +152,4 @@ private: int* branchNum, int* segmentNum ); static void assignBranchAndSegmentNumbers( const RimEclipseCase* caseToApply, RicMswExportInfo* exportInfo ); -}; \ No newline at end of file +}; diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.cpp index 235899cb4a..c2cc5193d7 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.cpp @@ -24,7 +24,7 @@ #include "RicExportFractureCompletionsImpl.h" #include "RicWellPathFractureReportItem.h" -#include "RifEclipseDataTableFormatter.h" +#include "RifTextDataTableFormatter.h" #include "RigCompletionData.h" #include "RigTransmissibilityEquations.h" @@ -55,9 +55,9 @@ QString orientationText( RimFractureTemplate::FracOrientationEnum orientation ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseOutputTableColumn floatNumberColumn( const QString& text ) +RifTextDataTableColumn floatNumberColumn( const QString& text ) { - return RifEclipseOutputTableColumn( text, RifEclipseOutputTableDoubleFormatting( RIF_FLOAT, 3 ), RIGHT ); + return RifTextDataTableColumn( text, RifTextDataTableDoubleFormatting( RIF_FLOAT, 3 ), RIGHT ); } //-------------------------------------------------------------------------------------------------- @@ -233,13 +233,13 @@ QString RicWellPathFractureTextReportFeatureImpl::createWellFileLocationText( co QString tableText; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); configureFormatter( &formatter ); - std::vector header = { - RifEclipseOutputTableColumn( "Well" ), - RifEclipseOutputTableColumn( "Location" ), + std::vector header = { + RifTextDataTableColumn( "Well" ), + RifTextDataTableColumn( "Location" ), }; formatter.header( header ); @@ -275,13 +275,13 @@ QString RicWellPathFractureTextReportFeatureImpl::createStimPlanFileLocationText QString tableText; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); configureFormatter( &formatter ); - std::vector header = { - RifEclipseOutputTableColumn( "StimPlan Name" ), - RifEclipseOutputTableColumn( "Location" ), + std::vector header = { + RifTextDataTableColumn( "StimPlan Name" ), + RifTextDataTableColumn( "Location" ), }; formatter.header( header ); @@ -316,13 +316,13 @@ QString RicWellPathFractureTextReportFeatureImpl::createStimPlanFractureText( RiaEclipseUnitTools::UnitSystem unitSystem = stimPlanTemplates.front()->fractureTemplateUnit(); bool isFieldUnits = unitSystem == RiaEclipseUnitTools::UNITS_FIELD; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); configureFormatter( &formatter ); - std::vector header = { - RifEclipseOutputTableColumn( "StimPlan" ), - RifEclipseOutputTableColumn( " " ), + std::vector header = { + RifTextDataTableColumn( "StimPlan" ), + RifTextDataTableColumn( " " ), floatNumberColumn( "WDiam" ), floatNumberColumn( "Skin" ), }; @@ -368,13 +368,13 @@ QString RicWellPathFractureTextReportFeatureImpl::createEllipseFractureText( RiaEclipseUnitTools::UnitSystem unitSystem = ellipseTemplates.front()->fractureTemplateUnit(); bool isFieldUnits = unitSystem == RiaEclipseUnitTools::UNITS_FIELD; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); configureFormatter( &formatter ); - std::vector header = { - RifEclipseOutputTableColumn( "Ellipse" ), - RifEclipseOutputTableColumn( " " ), + std::vector header = { + RifTextDataTableColumn( "Ellipse" ), + RifTextDataTableColumn( " " ), floatNumberColumn( "Xf" ), floatNumberColumn( "Height" ), floatNumberColumn( "Kf" ), @@ -433,12 +433,12 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureText( QString tableText; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); configureFormatter( &formatter ); - std::vector header = { - RifEclipseOutputTableColumn( " " ), + std::vector header = { + RifTextDataTableColumn( " " ), floatNumberColumn( "Top" ), floatNumberColumn( "Bot" ), floatNumberColumn( "Fault" ), @@ -517,24 +517,23 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureInstancesText( QString tableText; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); configureFormatter( &formatter ); - std::vector header = { - RifEclipseOutputTableColumn( "" ), - RifEclipseOutputTableColumn( "" ), - RifEclipseOutputTableColumn( "" ), + std::vector header = { + RifTextDataTableColumn( "" ), + RifTextDataTableColumn( "" ), + RifTextDataTableColumn( "" ), floatNumberColumn( "MD" ), floatNumberColumn( "Dip" ), floatNumberColumn( "Tilt" ), floatNumberColumn( "LPerf" ), floatNumberColumn( "PerfEff" ), floatNumberColumn( "Wdia" ), - RifEclipseOutputTableColumn( "Dfac", - RifEclipseOutputTableDoubleFormatting( - RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC ), - RIGHT ), + RifTextDataTableColumn( "Dfac", + RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ), + RIGHT ), }; formatter.header( header ); @@ -627,25 +626,25 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureCompletionSummar RiaEclipseUnitTools::UnitSystem unitSystem = wellPathFractureReportItems.front().unitSystem(); bool isFieldUnits = unitSystem == RiaEclipseUnitTools::UNITS_FIELD; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); configureFormatter( &formatter ); const QString meanText = "Mean"; - std::vector header = { - RifEclipseOutputTableColumn( "" ), // Well - RifEclipseOutputTableColumn( "" ), // Fracture - RifEclipseOutputTableColumn( "" ), // Template + std::vector header = { + RifTextDataTableColumn( "" ), // Well + RifTextDataTableColumn( "" ), // Fracture + RifTextDataTableColumn( "" ), // Template floatNumberColumn( "" ), // Tr floatNumberColumn( "" ), //#con floatNumberColumn( "" ), // Fcd - RifEclipseOutputTableColumn( "", RifEclipseOutputTableDoubleFormatting( RIF_FLOAT, 1 ), RIGHT ), // Area - RifEclipseOutputTableColumn( meanText, RifEclipseOutputTableDoubleFormatting( RIF_FLOAT, 1 ), RIGHT ), // KfWf - RifEclipseOutputTableColumn( meanText, RifEclipseOutputTableDoubleFormatting( RIF_FLOAT, 1 ), RIGHT ), // Kf + RifTextDataTableColumn( "", RifTextDataTableDoubleFormatting( RIF_FLOAT, 1 ), RIGHT ), // Area + RifTextDataTableColumn( meanText, RifTextDataTableDoubleFormatting( RIF_FLOAT, 1 ), RIGHT ), // KfWf + RifTextDataTableColumn( meanText, RifTextDataTableDoubleFormatting( RIF_FLOAT, 1 ), RIGHT ), // Kf floatNumberColumn( meanText ), // wf - RifEclipseOutputTableColumn( meanText, RifEclipseOutputTableDoubleFormatting( RIF_FLOAT, 1 ), RIGHT ), // xf - RifEclipseOutputTableColumn( meanText, RifEclipseOutputTableDoubleFormatting( RIF_FLOAT, 1 ), RIGHT ), // H + RifTextDataTableColumn( meanText, RifTextDataTableDoubleFormatting( RIF_FLOAT, 1 ), RIGHT ), // xf + RifTextDataTableColumn( meanText, RifTextDataTableDoubleFormatting( RIF_FLOAT, 1 ), RIGHT ), // H floatNumberColumn( meanText ), // Km }; @@ -724,15 +723,15 @@ QString RicWellPathFractureTextReportFeatureImpl::createFracturePressureDepletio { QString tableText; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); configureFormatter( &formatter ); - std::vector header = {RifEclipseOutputTableColumn( "Well" ), - RifEclipseOutputTableColumn( "Fracture" ), - RifEclipseOutputTableColumn( "Actual WBHP" ), - RifEclipseOutputTableColumn( "Min Pressure Drop" ), - RifEclipseOutputTableColumn( "Max Pressure Drop" )}; + std::vector header = {RifTextDataTableColumn( "Well" ), + RifTextDataTableColumn( "Fracture" ), + RifTextDataTableColumn( "Actual WBHP" ), + RifTextDataTableColumn( "Min Pressure Drop" ), + RifTextDataTableColumn( "Max Pressure Drop" )}; bool createdTable = false; @@ -775,12 +774,11 @@ QString RicWellPathFractureTextReportFeatureImpl::createConnectionsPerWellText( { QString tableText; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); configureFormatter( &formatter ); - std::vector header = {RifEclipseOutputTableColumn( "Well" ), - floatNumberColumn( "ConnCount" )}; + std::vector header = {RifTextDataTableColumn( "Well" ), floatNumberColumn( "ConnCount" )}; formatter.header( header ); formatter.addHorizontalLine( '-' ); @@ -813,7 +811,7 @@ QString RicWellPathFractureTextReportFeatureImpl::createConnectionsPerWellText( //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicWellPathFractureTextReportFeatureImpl::configureFormatter( RifEclipseDataTableFormatter* formatter ) const +void RicWellPathFractureTextReportFeatureImpl::configureFormatter( RifTextDataTableFormatter* formatter ) const { if ( !formatter ) return; diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.h b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.h index 4547499c7d..f755120505 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.h @@ -26,7 +26,7 @@ class RimEclipseCase; class RimFractureTemplate; class RimEllipseFractureTemplate; class RimStimPlanFractureTemplate; -class RifEclipseDataTableFormatter; +class RifTextDataTableFormatter; class RicWellPathFractureReportItem; //================================================================================================== @@ -57,5 +57,5 @@ private: QString createConnectionsPerWellText( const std::vector& wellPathFractureReportItems ) const; - void configureFormatter( RifEclipseDataTableFormatter* formatter ) const; + void configureFormatter( RifTextDataTableFormatter* formatter ) const; }; diff --git a/ApplicationCode/Commands/ExportCommands/RicExportCarfin.cpp b/ApplicationCode/Commands/ExportCommands/RicExportCarfin.cpp index 77792b1648..d092847933 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportCarfin.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicExportCarfin.cpp @@ -25,7 +25,7 @@ #include "RicExportCarfinUi.h" #include "RicExportFeatureImpl.h" -#include "RifEclipseDataTableFormatter.h" +#include "RifTextDataTableFormatter.h" #include "RimDialogData.h" #include "RimEclipseCase.h" @@ -79,20 +79,20 @@ void RicExportCarfin::onActionTriggered( bool isChecked ) return; } - QTextStream stream( &exportFile ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( &exportFile ); + RifTextDataTableFormatter formatter( stream ); - std::vector header = {RifEclipseOutputTableColumn( "I1" ), - RifEclipseOutputTableColumn( "I2" ), - RifEclipseOutputTableColumn( "J1" ), - RifEclipseOutputTableColumn( "J2" ), - RifEclipseOutputTableColumn( "K1" ), - RifEclipseOutputTableColumn( "K2" ), - RifEclipseOutputTableColumn( "NX" ), - RifEclipseOutputTableColumn( "NY" ), - RifEclipseOutputTableColumn( "NZ" ), - RifEclipseOutputTableColumn( "NWMAX" ), - RifEclipseOutputTableColumn( "Parent LGR" )}; + std::vector header = {RifTextDataTableColumn( "I1" ), + RifTextDataTableColumn( "I2" ), + RifTextDataTableColumn( "J1" ), + RifTextDataTableColumn( "J2" ), + RifTextDataTableColumn( "K1" ), + RifTextDataTableColumn( "K2" ), + RifTextDataTableColumn( "NX" ), + RifTextDataTableColumn( "NY" ), + RifTextDataTableColumn( "NZ" ), + RifTextDataTableColumn( "NWMAX" ), + RifTextDataTableColumn( "Parent LGR" )}; formatter.keyword( "CARFIN" ); formatter.header( header ); diff --git a/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp index 7b857a2312..ed86fe6e1a 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp @@ -24,7 +24,7 @@ #include "CompletionExportCommands/RicWellPathExportCompletionDataFeature.h" #include "RicExportLgrUi.h" -#include "RifEclipseDataTableFormatter.h" +#include "RifTextDataTableFormatter.h" #include "RigCaseCellResultsData.h" #include "RigMainGrid.h" @@ -367,19 +367,19 @@ void RicExportLgrFeature::writeLgrs( QTextStream& stream, const std::vectormeasureDepths().front() - mdStepSize; double endMd = wellPathGeom->measureDepths().back(); - RifEclipseDataTableFormatter formatter( stream ); + RifTextDataTableFormatter formatter( stream ); formatter.setCommentPrefix( "# " ); formatter.setTableRowPrependText( " " ); @@ -115,7 +115,7 @@ void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream( QTextStre stream << "WELLNAME: '" << caf::Utils::makeValidFileBasename( exportName ) << "'" << endl; - auto numberFormat = RifEclipseOutputTableDoubleFormatting( RIF_FLOAT, 2 ); + auto numberFormat = RifTextDataTableDoubleFormatting( RIF_FLOAT, 2 ); formatter.header( {{"X", numberFormat, RIGHT}, {"Y", numberFormat, RIGHT}, {"TVDMSL", numberFormat, RIGHT}, diff --git a/ApplicationCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp b/ApplicationCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp index dadc091dee..1b81c16cd8 100644 --- a/ApplicationCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp +++ b/ApplicationCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp @@ -18,7 +18,7 @@ #include "RicCreateMultipleFracturesUi.h" -#include "RifEclipseDataTableFormatter.h" +#include "RifTextDataTableFormatter.h" #include "RigEclipseCaseData.h" #include "RigMainGrid.h" @@ -239,19 +239,19 @@ QString RiuCreateMultipleFractionsUi::summaryText() const QString tableText; { - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); formatter.setTableRowLineAppendText( "" ); formatter.setTableRowPrependText( " " ); - std::vector header; - header.push_back( RifEclipseOutputTableColumn( "Selected Wells" ) ); + std::vector header; + header.push_back( RifTextDataTableColumn( "Selected Wells" ) ); for ( auto fracTemplate : fracTemplateSet ) { - header.push_back( RifEclipseOutputTableColumn( fracTemplate->name(), - RifEclipseOutputTableDoubleFormatting(), - RifEclipseOutputTableAlignment::RIGHT ) ); + header.push_back( RifTextDataTableColumn( fracTemplate->name(), + RifTextDataTableDoubleFormatting(), + RifTextDataTableAlignment::RIGHT ) ); } formatter.header( header ); diff --git a/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.cpp b/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.cpp index 9ae80b6da9..857cc396d8 100644 --- a/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.cpp +++ b/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.cpp @@ -28,7 +28,7 @@ #include "ExportCommands/RicExportLgrUi.h" #include "RicDeleteTemporaryLgrsFeature.h" -#include "RifEclipseDataTableFormatter.h" +#include "RifTextDataTableFormatter.h" #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" diff --git a/ApplicationCode/FileInterface/CMakeLists_files.cmake b/ApplicationCode/FileInterface/CMakeLists_files.cmake index d31d8a7888..4d77824156 100644 --- a/ApplicationCode/FileInterface/CMakeLists_files.cmake +++ b/ApplicationCode/FileInterface/CMakeLists_files.cmake @@ -1,6 +1,6 @@ set (SOURCE_GROUP_HEADER_FILES -${CMAKE_CURRENT_LIST_DIR}/RifEclipseDataTableFormatter.h +${CMAKE_CURRENT_LIST_DIR}/RifTextDataTableFormatter.h ${CMAKE_CURRENT_LIST_DIR}/RifEclipseInputFileTools.h ${CMAKE_CURRENT_LIST_DIR}/RifEclipseOutputFileTools.h ${CMAKE_CURRENT_LIST_DIR}/RifEclipseRestartDataAccess.h @@ -55,7 +55,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RifCsvDataTableFormatter.h ) set (SOURCE_GROUP_SOURCE_FILES -${CMAKE_CURRENT_LIST_DIR}/RifEclipseDataTableFormatter.cpp +${CMAKE_CURRENT_LIST_DIR}/RifTextDataTableFormatter.cpp ${CMAKE_CURRENT_LIST_DIR}/RifEclipseInputFileTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RifEclipseOutputFileTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RifEclipseRestartDataAccess.cpp diff --git a/ApplicationCode/FileInterface/RifCsvDataTableFormatter.cpp b/ApplicationCode/FileInterface/RifCsvDataTableFormatter.cpp index fc5c93089b..fb0d79e698 100644 --- a/ApplicationCode/FileInterface/RifCsvDataTableFormatter.cpp +++ b/ApplicationCode/FileInterface/RifCsvDataTableFormatter.cpp @@ -30,7 +30,7 @@ RifCsvDataTableFormatter::RifCsvDataTableFormatter( QTextStream& out, const QStr //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifCsvDataTableFormatter& RifCsvDataTableFormatter::header( const std::vector& tableHeader ) +RifCsvDataTableFormatter& RifCsvDataTableFormatter::header( const std::vector& tableHeader ) { outputBuffer(); m_columnHeaders = tableHeader; @@ -54,7 +54,7 @@ RifCsvDataTableFormatter& RifCsvDataTableFormatter::add( const QString& str ) RifCsvDataTableFormatter& RifCsvDataTableFormatter::add( double num ) { size_t column = m_lineBuffer.size(); - m_lineBuffer.push_back( RifEclipseDataTableFormatter::format( num, m_columnHeaders[column].doubleFormat ) ); + m_lineBuffer.push_back( RifTextDataTableFormatter::format( num, m_columnHeaders[column].doubleFormat ) ); return *this; } @@ -63,7 +63,7 @@ RifCsvDataTableFormatter& RifCsvDataTableFormatter::add( double num ) //-------------------------------------------------------------------------------------------------- RifCsvDataTableFormatter& RifCsvDataTableFormatter::add( int num ) { - m_lineBuffer.push_back( RifEclipseDataTableFormatter::format( num ) ); + m_lineBuffer.push_back( RifTextDataTableFormatter::format( num ) ); return *this; } @@ -72,7 +72,7 @@ RifCsvDataTableFormatter& RifCsvDataTableFormatter::add( int num ) //-------------------------------------------------------------------------------------------------- RifCsvDataTableFormatter& RifCsvDataTableFormatter::add( size_t num ) { - m_lineBuffer.push_back( RifEclipseDataTableFormatter::format( num ) ); + m_lineBuffer.push_back( RifTextDataTableFormatter::format( num ) ); return *this; } @@ -81,7 +81,7 @@ RifCsvDataTableFormatter& RifCsvDataTableFormatter::add( size_t num ) //-------------------------------------------------------------------------------------------------- void RifCsvDataTableFormatter::rowCompleted() { - RifEclipseOutputTableLine line; + RifTextDataTableLine line; line.data = m_lineBuffer; line.lineType = CONTENTS; line.appendTextSet = false; diff --git a/ApplicationCode/FileInterface/RifCsvDataTableFormatter.h b/ApplicationCode/FileInterface/RifCsvDataTableFormatter.h index adbeb99dc0..cda485c3d5 100644 --- a/ApplicationCode/FileInterface/RifCsvDataTableFormatter.h +++ b/ApplicationCode/FileInterface/RifCsvDataTableFormatter.h @@ -18,7 +18,7 @@ #pragma once -#include "RifEclipseDataTableFormatter.h" +#include "RifTextDataTableFormatter.h" //================================================================================================== // @@ -30,7 +30,7 @@ class RifCsvDataTableFormatter public: RifCsvDataTableFormatter( QTextStream& out, const QString fieldSeparator = "," ); - RifCsvDataTableFormatter& header( const std::vector& tableHeader ); + RifCsvDataTableFormatter& header( const std::vector& tableHeader ); RifCsvDataTableFormatter& add( const QString& str ); RifCsvDataTableFormatter& add( double num ); RifCsvDataTableFormatter& add( int num ); @@ -42,9 +42,9 @@ private: void outputBuffer(); private: - QTextStream& m_out; - std::vector m_columnHeaders; - std::vector m_buffer; - std::vector m_lineBuffer; - QString m_fieldSeparator; + QTextStream& m_out; + std::vector m_columnHeaders; + std::vector m_buffer; + std::vector m_lineBuffer; + QString m_fieldSeparator; }; diff --git a/ApplicationCode/FileInterface/RifEclipseDataTableFormatter.cpp b/ApplicationCode/FileInterface/RifTextDataTableFormatter.cpp similarity index 82% rename from ApplicationCode/FileInterface/RifEclipseDataTableFormatter.cpp rename to ApplicationCode/FileInterface/RifTextDataTableFormatter.cpp index c487c8b1d9..3d54b902f1 100644 --- a/ApplicationCode/FileInterface/RifEclipseDataTableFormatter.cpp +++ b/ApplicationCode/FileInterface/RifTextDataTableFormatter.cpp @@ -16,7 +16,7 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RifEclipseDataTableFormatter.h" +#include "RifTextDataTableFormatter.h" #include "cvfAssert.h" @@ -27,7 +27,7 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseDataTableFormatter::RifEclipseDataTableFormatter( QTextStream& out ) +RifTextDataTableFormatter::RifTextDataTableFormatter( QTextStream& out ) : m_out( out ) , m_colSpacing( 5 ) , m_tableRowPrependText( " " ) @@ -40,7 +40,7 @@ RifEclipseDataTableFormatter::RifEclipseDataTableFormatter( QTextStream& out ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseDataTableFormatter::RifEclipseDataTableFormatter( const RifEclipseDataTableFormatter& rhs ) +RifTextDataTableFormatter::RifTextDataTableFormatter( const RifTextDataTableFormatter& rhs ) : m_out( rhs.m_out ) , m_colSpacing( rhs.m_colSpacing ) , m_tableRowPrependText( rhs.m_tableRowPrependText ) @@ -53,7 +53,7 @@ RifEclipseDataTableFormatter::RifEclipseDataTableFormatter( const RifEclipseData //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseDataTableFormatter::~RifEclipseDataTableFormatter() +RifTextDataTableFormatter::~RifTextDataTableFormatter() { CVF_ASSERT( m_buffer.empty() ); CVF_ASSERT( m_columns.empty() ); @@ -62,7 +62,7 @@ RifEclipseDataTableFormatter::~RifEclipseDataTableFormatter() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RifEclipseDataTableFormatter::columnSpacing() const +int RifTextDataTableFormatter::columnSpacing() const { return m_colSpacing; } @@ -70,7 +70,7 @@ int RifEclipseDataTableFormatter::columnSpacing() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseDataTableFormatter::setColumnSpacing( int spacing ) +void RifTextDataTableFormatter::setColumnSpacing( int spacing ) { m_colSpacing = spacing; } @@ -78,7 +78,7 @@ void RifEclipseDataTableFormatter::setColumnSpacing( int spacing ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RifEclipseDataTableFormatter::tableRowPrependText() const +QString RifTextDataTableFormatter::tableRowPrependText() const { return m_tableRowPrependText; } @@ -86,7 +86,7 @@ QString RifEclipseDataTableFormatter::tableRowPrependText() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RifEclipseDataTableFormatter::tableRowAppendText() const +QString RifTextDataTableFormatter::tableRowAppendText() const { return m_tableRowAppendText; } @@ -94,7 +94,7 @@ QString RifEclipseDataTableFormatter::tableRowAppendText() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseDataTableFormatter::setTableRowPrependText( const QString& text ) +void RifTextDataTableFormatter::setTableRowPrependText( const QString& text ) { m_tableRowPrependText = text; } @@ -102,7 +102,7 @@ void RifEclipseDataTableFormatter::setTableRowPrependText( const QString& text ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseDataTableFormatter::setTableRowLineAppendText( const QString& text ) +void RifTextDataTableFormatter::setTableRowLineAppendText( const QString& text ) { m_tableRowAppendText = text; } @@ -110,7 +110,7 @@ void RifEclipseDataTableFormatter::setTableRowLineAppendText( const QString& tex //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RifEclipseDataTableFormatter::commentPrefix() const +QString RifTextDataTableFormatter::commentPrefix() const { return m_commentPrefix; } @@ -118,7 +118,7 @@ QString RifEclipseDataTableFormatter::commentPrefix() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseDataTableFormatter::setCommentPrefix( const QString& commentPrefix ) +void RifTextDataTableFormatter::setCommentPrefix( const QString& commentPrefix ) { m_commentPrefix = commentPrefix; } @@ -126,7 +126,7 @@ void RifEclipseDataTableFormatter::setCommentPrefix( const QString& commentPrefi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseDataTableFormatter::setUnlimitedDataRowWidth() +void RifTextDataTableFormatter::setUnlimitedDataRowWidth() { m_maxDataRowWidth = std::numeric_limits::max(); } @@ -134,7 +134,7 @@ void RifEclipseDataTableFormatter::setUnlimitedDataRowWidth() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RifEclipseDataTableFormatter::maxDataRowWidth() const +int RifTextDataTableFormatter::maxDataRowWidth() const { return m_maxDataRowWidth; } @@ -142,7 +142,7 @@ int RifEclipseDataTableFormatter::maxDataRowWidth() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseDataTableFormatter::outputBuffer() +void RifTextDataTableFormatter::outputBuffer() { if ( !m_columns.empty() && !isAllHeadersEmpty( m_columns ) ) { @@ -196,7 +196,7 @@ void RifEclipseDataTableFormatter::outputBuffer() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseDataTableFormatter::outputComment( RifEclipseOutputTableLine& comment ) +void RifTextDataTableFormatter::outputComment( RifTextDataTableLine& comment ) { m_out << m_commentPrefix << comment.data[0] << "\n"; } @@ -204,7 +204,7 @@ void RifEclipseDataTableFormatter::outputComment( RifEclipseOutputTableLine& com //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseDataTableFormatter::outputHorizontalLine( RifEclipseOutputTableLine& comment ) +void RifTextDataTableFormatter::outputHorizontalLine( RifTextDataTableLine& comment ) { if ( comment.lineType == HORIZONTAL_LINE ) { @@ -230,7 +230,7 @@ void RifEclipseDataTableFormatter::outputHorizontalLine( RifEclipseOutputTableLi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RifEclipseDataTableFormatter::isAllHeadersEmpty( const std::vector& headers ) +bool RifTextDataTableFormatter::isAllHeadersEmpty( const std::vector& headers ) { for ( auto& header : headers ) { @@ -242,7 +242,7 @@ bool RifEclipseDataTableFormatter::isAllHeadersEmpty( const std::vector header ) +RifTextDataTableFormatter& RifTextDataTableFormatter::header( const std::vector header ) { outputBuffer(); m_columns = header; @@ -293,9 +293,9 @@ RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::header( const std::v //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::comment( const QString& comment ) +RifTextDataTableFormatter& RifTextDataTableFormatter::comment( const QString& comment ) { - RifEclipseOutputTableLine line; + RifTextDataTableLine line; line.data.push_back( comment ); line.lineType = COMMENT; line.appendTextSet = false; @@ -313,10 +313,10 @@ RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::comment( const QStri //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::addHorizontalLine( const QChar& character ) +RifTextDataTableFormatter& RifTextDataTableFormatter::addHorizontalLine( const QChar& character ) { - RifEclipseOutputTableLine line; - QString data; + RifTextDataTableLine line; + QString data; data += character; line.data.push_back( data ); line.lineType = HORIZONTAL_LINE; @@ -335,7 +335,7 @@ RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::addHorizontalLine( c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::add( const QString& str ) +RifTextDataTableFormatter& RifTextDataTableFormatter::add( const QString& str ) { size_t column = m_lineBuffer.size(); CVF_ASSERT( column < m_columns.size() ); @@ -347,7 +347,7 @@ RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::add( const QString& //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::add( double num ) +RifTextDataTableFormatter& RifTextDataTableFormatter::add( double num ) { size_t column = m_lineBuffer.size(); CVF_ASSERT( column < m_columns.size() ); @@ -359,7 +359,7 @@ RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::add( double num ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::add( int num ) +RifTextDataTableFormatter& RifTextDataTableFormatter::add( int num ) { size_t column = m_lineBuffer.size(); CVF_ASSERT( column < m_columns.size() ); @@ -371,7 +371,7 @@ RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::add( int num ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::add( size_t num ) +RifTextDataTableFormatter& RifTextDataTableFormatter::add( size_t num ) { size_t column = m_lineBuffer.size(); CVF_ASSERT( column < m_columns.size() ); @@ -383,7 +383,7 @@ RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::add( size_t num ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::addOneBasedCellIndex( size_t zeroBasedIndex ) +RifTextDataTableFormatter& RifTextDataTableFormatter::addOneBasedCellIndex( size_t zeroBasedIndex ) { size_t column = m_lineBuffer.size(); CVF_ASSERT( column < m_columns.size() ); @@ -399,7 +399,7 @@ RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::addOneBasedCellIndex //-------------------------------------------------------------------------------------------------- /// Add default marker if the value equals the defaultValue, otherwise add value. //-------------------------------------------------------------------------------------------------- -RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::addValueOrDefaultMarker( double value, double defaultValue ) +RifTextDataTableFormatter& RifTextDataTableFormatter::addValueOrDefaultMarker( double value, double defaultValue ) { if ( value == defaultValue ) { @@ -411,9 +411,9 @@ RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::addValueOrDefaultMar //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseDataTableFormatter::rowCompleted() +void RifTextDataTableFormatter::rowCompleted() { - RifEclipseOutputTableLine line; + RifTextDataTableLine line; line.data = m_lineBuffer; line.lineType = CONTENTS; line.appendTextSet = false; @@ -424,9 +424,9 @@ void RifEclipseDataTableFormatter::rowCompleted() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseDataTableFormatter::rowCompleted( const QString& appendText ) +void RifTextDataTableFormatter::rowCompleted( const QString& appendText ) { - RifEclipseOutputTableLine line; + RifTextDataTableLine line; line.data = m_lineBuffer; line.lineType = CONTENTS; line.appendTextSet = true; @@ -438,7 +438,7 @@ void RifEclipseDataTableFormatter::rowCompleted( const QString& appendText ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RifEclipseDataTableFormatter::measure( const QString str ) +int RifTextDataTableFormatter::measure( const QString str ) { return str.length(); } @@ -446,7 +446,7 @@ int RifEclipseDataTableFormatter::measure( const QString str ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RifEclipseDataTableFormatter::measure( double num, RifEclipseOutputTableDoubleFormatting doubleFormat ) +int RifTextDataTableFormatter::measure( double num, RifTextDataTableDoubleFormatting doubleFormat ) { return format( num, doubleFormat ).length(); } @@ -454,7 +454,7 @@ int RifEclipseDataTableFormatter::measure( double num, RifEclipseOutputTableDoub //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RifEclipseDataTableFormatter::measure( int num ) +int RifTextDataTableFormatter::measure( int num ) { return format( num ).length(); } @@ -462,7 +462,7 @@ int RifEclipseDataTableFormatter::measure( int num ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RifEclipseDataTableFormatter::measure( size_t num ) +int RifTextDataTableFormatter::measure( size_t num ) { return format( num ).length(); } @@ -470,7 +470,7 @@ int RifEclipseDataTableFormatter::measure( size_t num ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RifEclipseDataTableFormatter::tableWidth() const +int RifTextDataTableFormatter::tableWidth() const { int characterCount = m_tableRowPrependText.length(); @@ -486,15 +486,15 @@ int RifEclipseDataTableFormatter::tableWidth() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RifEclipseDataTableFormatter::format( double num, RifEclipseOutputTableDoubleFormatting doubleFormat ) +QString RifTextDataTableFormatter::format( double num, RifTextDataTableDoubleFormatting doubleFormat ) { switch ( doubleFormat.format ) { - case RifEclipseOutputTableDoubleFormat::RIF_FLOAT: + case RifTextDataTableDoubleFormat::RIF_FLOAT: return QString( "%1" ).arg( num, 0, 'f', doubleFormat.precision ); - case RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC: + case RifTextDataTableDoubleFormat::RIF_SCIENTIFIC: return QString( "%1" ).arg( num, 0, 'E' ); - case RifEclipseOutputTableDoubleFormat::RIF_CONSISE: + case RifTextDataTableDoubleFormat::RIF_CONSISE: return QString::number( num, 'g', doubleFormat.precision ); default: return QString( "%1" ); @@ -504,7 +504,7 @@ QString RifEclipseDataTableFormatter::format( double num, RifEclipseOutputTableD //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RifEclipseDataTableFormatter::format( int num ) +QString RifTextDataTableFormatter::format( int num ) { return QString( "%1" ).arg( num ); } @@ -512,7 +512,7 @@ QString RifEclipseDataTableFormatter::format( int num ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RifEclipseDataTableFormatter::format( size_t num ) +QString RifTextDataTableFormatter::format( size_t num ) { return QString( "%1" ).arg( num ); } @@ -520,9 +520,9 @@ QString RifEclipseDataTableFormatter::format( size_t num ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RifEclipseDataTableFormatter::formatColumn( const QString str, size_t columnIndex ) const +QString RifTextDataTableFormatter::formatColumn( const QString str, size_t columnIndex ) const { - const RifEclipseOutputTableColumn& column = m_columns[columnIndex]; + const RifTextDataTableColumn& column = m_columns[columnIndex]; if ( column.alignment == LEFT ) { diff --git a/ApplicationCode/FileInterface/RifEclipseDataTableFormatter.h b/ApplicationCode/FileInterface/RifTextDataTableFormatter.h similarity index 51% rename from ApplicationCode/FileInterface/RifEclipseDataTableFormatter.h rename to ApplicationCode/FileInterface/RifTextDataTableFormatter.h index d35d0a7e0c..a01e9d0f22 100644 --- a/ApplicationCode/FileInterface/RifEclipseDataTableFormatter.h +++ b/ApplicationCode/FileInterface/RifTextDataTableFormatter.h @@ -26,7 +26,7 @@ //================================================================================================== // //================================================================================================== -enum RifEclipseOutputTableLineType +enum RifTextDataTableLineType { COMMENT, CONTENTS, @@ -36,7 +36,7 @@ enum RifEclipseOutputTableLineType //================================================================================================== // //================================================================================================== -enum RifEclipseOutputTableAlignment +enum RifTextDataTableAlignment { LEFT, RIGHT @@ -45,7 +45,7 @@ enum RifEclipseOutputTableAlignment //================================================================================================== // //================================================================================================== -enum RifEclipseOutputTableDoubleFormat +enum RifTextDataTableDoubleFormat { RIF_SCIENTIFIC, RIF_FLOAT, @@ -55,39 +55,38 @@ enum RifEclipseOutputTableDoubleFormat //================================================================================================== // //================================================================================================== -struct RifEclipseOutputTableLine +struct RifTextDataTableLine { - RifEclipseOutputTableLineType lineType; - std::vector data; - bool appendTextSet; - QString appendText; + RifTextDataTableLineType lineType; + std::vector data; + bool appendTextSet; + QString appendText; }; //================================================================================================== // //================================================================================================== -struct RifEclipseOutputTableDoubleFormatting +struct RifTextDataTableDoubleFormatting { - RifEclipseOutputTableDoubleFormatting( RifEclipseOutputTableDoubleFormat format = RIF_FLOAT, int precision = 5 ) + RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat format = RIF_FLOAT, int precision = 5 ) : format( format ) , precision( precision ) { } - RifEclipseOutputTableDoubleFormat format; - int precision; + RifTextDataTableDoubleFormat format; + int precision; }; //================================================================================================== // //================================================================================================== -struct RifEclipseOutputTableColumn +struct RifTextDataTableColumn { - RifEclipseOutputTableColumn( - const QString& title, - RifEclipseOutputTableDoubleFormatting doubleFormat = RifEclipseOutputTableDoubleFormatting(), - RifEclipseOutputTableAlignment alignment = LEFT, - int width = -1 ) + RifTextDataTableColumn( const QString& title, + RifTextDataTableDoubleFormatting doubleFormat = RifTextDataTableDoubleFormatting(), + RifTextDataTableAlignment alignment = LEFT, + int width = -1 ) : title( title ) , doubleFormat( doubleFormat ) , alignment( alignment ) @@ -95,22 +94,22 @@ struct RifEclipseOutputTableColumn { } - QString title; - RifEclipseOutputTableDoubleFormatting doubleFormat; - RifEclipseOutputTableAlignment alignment; - int width; + QString title; + RifTextDataTableDoubleFormatting doubleFormat; + RifTextDataTableAlignment alignment; + int width; }; //================================================================================================== // //================================================================================================== -class RifEclipseDataTableFormatter +class RifTextDataTableFormatter { public: - RifEclipseDataTableFormatter( QTextStream& out ); - RifEclipseDataTableFormatter( const RifEclipseDataTableFormatter& rhs ); + RifTextDataTableFormatter( QTextStream& out ); + RifTextDataTableFormatter( const RifTextDataTableFormatter& rhs ); - virtual ~RifEclipseDataTableFormatter(); + virtual ~RifTextDataTableFormatter(); int columnSpacing() const; void setColumnSpacing( int spacing ); @@ -123,20 +122,20 @@ public: void setUnlimitedDataRowWidth(); int maxDataRowWidth() const; - RifEclipseDataTableFormatter& keyword( const QString& keyword ); - RifEclipseDataTableFormatter& header( std::vector tableHeader ); - RifEclipseDataTableFormatter& add( const QString& str ); - RifEclipseDataTableFormatter& add( double num ); - RifEclipseDataTableFormatter& add( int num ); - RifEclipseDataTableFormatter& add( size_t num ); - RifEclipseDataTableFormatter& addOneBasedCellIndex( size_t zeroBasedIndex ); - RifEclipseDataTableFormatter& addValueOrDefaultMarker( double value, double defaultValue ); - RifEclipseDataTableFormatter& comment( const QString& str ); - RifEclipseDataTableFormatter& addHorizontalLine( const QChar& str ); - void rowCompleted(); - void rowCompleted( const QString& appendText ); - void tableCompleted(); - void tableCompleted( const QString& appendText, bool appendNewline ); + RifTextDataTableFormatter& keyword( const QString& keyword ); + RifTextDataTableFormatter& header( std::vector tableHeader ); + RifTextDataTableFormatter& add( const QString& str ); + RifTextDataTableFormatter& add( double num ); + RifTextDataTableFormatter& add( int num ); + RifTextDataTableFormatter& add( size_t num ); + RifTextDataTableFormatter& addOneBasedCellIndex( size_t zeroBasedIndex ); + RifTextDataTableFormatter& addValueOrDefaultMarker( double value, double defaultValue ); + RifTextDataTableFormatter& comment( const QString& str ); + RifTextDataTableFormatter& addHorizontalLine( const QChar& str ); + void rowCompleted(); + void rowCompleted( const QString& appendText ); + void tableCompleted(); + void tableCompleted( const QString& appendText, bool appendNewline ); int tableWidth() const; @@ -144,29 +143,29 @@ protected: friend class RifCsvDataTableFormatter; int measure( const QString str ); - int measure( double num, RifEclipseOutputTableDoubleFormatting doubleFormat ); + int measure( double num, RifTextDataTableDoubleFormatting doubleFormat ); int measure( int num ); int measure( size_t num ); - static QString format( double num, RifEclipseOutputTableDoubleFormatting doubleFormat ); + static QString format( double num, RifTextDataTableDoubleFormatting doubleFormat ); static QString format( int num ); static QString format( size_t num ); QString formatColumn( const QString str, size_t columnIndex ) const; void outputBuffer(); - void outputComment( RifEclipseOutputTableLine& comment ); - void outputHorizontalLine( RifEclipseOutputTableLine& comment ); + void outputComment( RifTextDataTableLine& comment ); + void outputHorizontalLine( RifTextDataTableLine& comment ); - bool isAllHeadersEmpty( const std::vector& headers ); + bool isAllHeadersEmpty( const std::vector& headers ); private: - std::vector m_columns; - std::vector m_buffer; - std::vector m_lineBuffer; - QTextStream& m_out; - int m_colSpacing; - QString m_tableRowPrependText; - QString m_tableRowAppendText; - QString m_commentPrefix; - int m_maxDataRowWidth; + std::vector m_columns; + std::vector m_buffer; + std::vector m_lineBuffer; + QTextStream& m_out; + int m_colSpacing; + QString m_tableRowPrependText; + QString m_tableRowAppendText; + QString m_commentPrefix; + int m_maxDataRowWidth; }; diff --git a/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp index f166dc0986..36b660f272 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp @@ -774,13 +774,13 @@ QString RimFlowCharacteristicsPlot::curveDataAsText() const QTextStream stream( &tableText ); RifCsvDataTableFormatter formatter( stream, fieldSeparator ); - std::vector header = { - RifEclipseOutputTableColumn( "Date" ), - RifEclipseOutputTableColumn( "StorageCapacity" ), - RifEclipseOutputTableColumn( "FlowCapacity" ), - RifEclipseOutputTableColumn( "SweepEfficiency" ), - RifEclipseOutputTableColumn( "DimensionlessTime" ), - RifEclipseOutputTableColumn( "LorentzCoefficient" ), + std::vector header = { + RifTextDataTableColumn( "Date" ), + RifTextDataTableColumn( "StorageCapacity" ), + RifTextDataTableColumn( "FlowCapacity" ), + RifTextDataTableColumn( "SweepEfficiency" ), + RifTextDataTableColumn( "DimensionlessTime" ), + RifTextDataTableColumn( "LorentzCoefficient" ), }; formatter.header( header ); diff --git a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index 57c3df28f8..8b332a43c8 100644 --- a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -21,7 +21,7 @@ #include "RiaFontCache.h" #include "RiaPreferences.h" -#include "RifEclipseDataTableFormatter.h" +#include "RifTextDataTableFormatter.h" #include "RiuGridCrossQwtPlot.h" #include "RiuPlotMainWindowTools.h" #include "RiuQwtPlotTools.h" @@ -604,7 +604,7 @@ QString RimGridCrossPlot::asciiDataForPlotExport( int dataSetIndex ) const QString asciiData; QTextStream stringStream( &asciiData ); - RifEclipseDataTableFormatter formatter( stringStream ); + RifTextDataTableFormatter formatter( stringStream ); formatter.setCommentPrefix( "" ); formatter.setTableRowPrependText( "" ); formatter.setTableRowLineAppendText( "" ); diff --git a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp index 5aba6b7c2a..b868c2fec2 100644 --- a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp +++ b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp @@ -22,7 +22,7 @@ #include "RiaColorTables.h" #include "RiaLogging.h" -#include "RifEclipseDataTableFormatter.h" +#include "RifTextDataTableFormatter.h" #include "RigActiveCellInfo.h" #include "RigActiveCellsResultAccessor.h" @@ -1093,7 +1093,7 @@ void RimGridCrossPlotDataSet::swapAxisProperties( bool updatePlot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::exportFormattedData( RifEclipseDataTableFormatter& formatter ) const +void RimGridCrossPlotDataSet::exportFormattedData( RifTextDataTableFormatter& formatter ) const { if ( m_groupedResults.empty() ) return; @@ -1102,17 +1102,16 @@ void RimGridCrossPlotDataSet::exportFormattedData( RifEclipseDataTableFormatter& if ( m_grouping != NO_GROUPING ) { - std::vector header = {RifEclipseOutputTableColumn( xTitle ), - RifEclipseOutputTableColumn( yTitle ), - RifEclipseOutputTableColumn( "Group Index" ), - RifEclipseOutputTableColumn( "Group Description" )}; + std::vector header = {RifTextDataTableColumn( xTitle ), + RifTextDataTableColumn( yTitle ), + RifTextDataTableColumn( "Group Index" ), + RifTextDataTableColumn( "Group Description" )}; formatter.header( header ); } else { - std::vector header = {RifEclipseOutputTableColumn( xTitle ), - RifEclipseOutputTableColumn( yTitle )}; + std::vector header = {RifTextDataTableColumn( xTitle ), RifTextDataTableColumn( yTitle )}; formatter.header( header ); } diff --git a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h index 68cab15177..ebeb26270f 100644 --- a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h +++ b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h @@ -38,7 +38,7 @@ #include #include -class RifEclipseDataTableFormatter; +class RifTextDataTableFormatter; class RimCase; class RimGridCrossPlotCurve; class RimGridView; @@ -122,7 +122,7 @@ public: bool groupingByCategoryResult() const; bool groupingEnabled() const; void swapAxisProperties( bool updatePlot ); - void exportFormattedData( RifEclipseDataTableFormatter& formatter ) const; + void exportFormattedData( RifTextDataTableFormatter& formatter ) const; bool isXAxisLogarithmic() const; bool isYAxisLogarithmic() const; diff --git a/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp b/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp index bd7a5aa426..c765564a02 100644 --- a/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp +++ b/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp @@ -24,7 +24,7 @@ #include "RigWellPath.h" #include "RiaCompletionTypeCalculationScheduler.h" -#include "RifEclipseDataTableFormatter.h" +#include "RifTextDataTableFormatter.h" #include "RimIntersection.h" #include "RimPlotCurve.h" #include "RimWellPath.h" @@ -120,12 +120,12 @@ QString RimModeledWellPath::wellPlanText() QString planText; QTextStream qtxtStream( &planText ); - RifEclipseDataTableFormatter formatter( qtxtStream ); + RifTextDataTableFormatter formatter( qtxtStream ); formatter.setUnlimitedDataRowWidth(); formatter.setTableRowPrependText( "" ); formatter.setTableRowLineAppendText( "" ); - std::vector tableHeader; + std::vector tableHeader; tableHeader.push_back( {"MDRKB"} ); tableHeader.push_back( {"CL"} ); tableHeader.push_back( {"Inc"} ); diff --git a/ApplicationCode/UnitTests/CMakeLists_files.cmake b/ApplicationCode/UnitTests/CMakeLists_files.cmake index ba3413d9a2..b34b4eaa27 100644 --- a/ApplicationCode/UnitTests/CMakeLists_files.cmake +++ b/ApplicationCode/UnitTests/CMakeLists_files.cmake @@ -47,7 +47,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RifEclipseSummaryAddress-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaTimeHistoryCurveTools-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/SolveSpaceSolver-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaPolyArcLineSampler-Test.cpp -${CMAKE_CURRENT_LIST_DIR}/RifEclipseDataTableFormatter-Test.cpp +${CMAKE_CURRENT_LIST_DIR}/RifTextDataTableFormatter-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaWeightedMean-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaWeightedGeometricMeanCalculator-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaWeightedHarmonicMeanCalculator-Test.cpp diff --git a/ApplicationCode/UnitTests/RifCsvDataTableFormatter-Test.cpp b/ApplicationCode/UnitTests/RifCsvDataTableFormatter-Test.cpp index 932a56efa3..2065ed7e75 100644 --- a/ApplicationCode/UnitTests/RifCsvDataTableFormatter-Test.cpp +++ b/ApplicationCode/UnitTests/RifCsvDataTableFormatter-Test.cpp @@ -11,12 +11,12 @@ TEST( RifCsvDataTableFormatter, BasicUsage ) QTextStream stream( &tableText ); RifCsvDataTableFormatter formatter( stream, ";" ); - std::vector header = { - RifEclipseOutputTableColumn( "Well" ), - RifEclipseOutputTableColumn( "Integer Number" ), - RifEclipseOutputTableColumn( "sci", RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC ), - RifEclipseOutputTableColumn( "float", RifEclipseOutputTableDoubleFormat::RIF_FLOAT ), - RifEclipseOutputTableColumn( "consise", RifEclipseOutputTableDoubleFormat::RIF_CONSISE ), + std::vector header = { + RifTextDataTableColumn( "Well" ), + RifTextDataTableColumn( "Integer Number" ), + RifTextDataTableColumn( "sci", RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ), + RifTextDataTableColumn( "float", RifTextDataTableDoubleFormat::RIF_FLOAT ), + RifTextDataTableColumn( "consise", RifTextDataTableDoubleFormat::RIF_CONSISE ), }; formatter.header( header ); diff --git a/ApplicationCode/UnitTests/RifEclipseDataTableFormatter-Test.cpp b/ApplicationCode/UnitTests/RifEclipseDataTableFormatter-Test.cpp deleted file mode 100644 index 0af75b43ca..0000000000 --- a/ApplicationCode/UnitTests/RifEclipseDataTableFormatter-Test.cpp +++ /dev/null @@ -1,212 +0,0 @@ -#include "gtest/gtest.h" - -#include "RifEclipseDataTableFormatter.h" - -#include -#include - -TEST( RifEclipseDataTableFormatter, BasicUsage ) -{ - QString tableText; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); - - std::vector header = { - RifEclipseOutputTableColumn( "Well" ), - RifEclipseOutputTableColumn( "Integer Number" ), - RifEclipseOutputTableColumn( "IntNumer 2" ), - RifEclipseOutputTableColumn( "IntNumer 3" ), - }; - - formatter.header( header ); - - formatter.add( "well a" ); - formatter.add( 1 ); - formatter.add( 2 ); - formatter.add( 3 ); - formatter.rowCompleted(); - - formatter.add( "well B" ); - formatter.add( 12 ); - formatter.add( 23 ); - formatter.add( 233 ); - formatter.rowCompleted(); - - formatter.tableCompleted(); - - std::cout << tableText.toStdString(); -} - -TEST( RifEclipseDataTableFormatter, NoPrefix ) -{ - QString tableText; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); - - formatter.setTableRowPrependText( " " ); - formatter.setTableRowLineAppendText( "" ); - - std::vector header = { - RifEclipseOutputTableColumn( "Well" ), - RifEclipseOutputTableColumn( "Integer Number", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "IntNumer 2", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "IntNumer 3", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - }; - - formatter.header( header ); - - formatter.add( "well a" ); - formatter.add( 1 ); - formatter.add( 2 ); - formatter.add( 3 ); - formatter.rowCompleted(); - - formatter.add( "well B" ); - formatter.add( 12 ); - formatter.add( 231 ); - formatter.add( 23123 ); - formatter.rowCompleted(); - - formatter.tableCompleted(); - - std::cout << tableText.toStdString(); -} - -TEST( RifEclipseDataTableFormatter, LongLine ) -{ - QString tableText; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); - - std::vector header = { - RifEclipseOutputTableColumn( "50 Character Well Name" ), - RifEclipseOutputTableColumn( "10 Int #1", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #2", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #3", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #4", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #5", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #6", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #7", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #8", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - }; - - formatter.header( header ); - QString fiftyCharacterWellName = "01234567890123456789012345678901234567890123456789"; - formatter.add( fiftyCharacterWellName ); - for ( int i = 0; i < 8; ++i ) - { - formatter.add( std::numeric_limits::max() ); // 10 characters - } - int fullLineLength = formatter.tableRowPrependText().length() + 9 * formatter.columnSpacing() + 50 + 8 * 10 + - formatter.tableRowAppendText().length(); - int tableWidth = formatter.tableWidth(); - EXPECT_EQ( tableWidth, fullLineLength ); - EXPECT_GT( tableWidth, formatter.maxDataRowWidth() ); - - formatter.rowCompleted(); - formatter.tableCompleted(); - - QStringList tableLines = tableText.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts ); - for ( QString line : tableLines ) - { - std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl; - if ( !line.startsWith( formatter.commentPrefix() ) ) - { - EXPECT_LE( line.length(), formatter.maxDataRowWidth() ); - } - } -} - -TEST( RifEclipseDataTableFormatter, LongLine132 ) -{ - QString tableText; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); - - std::vector header = { - RifEclipseOutputTableColumn( "10 Char" ), - RifEclipseOutputTableColumn( "10 Int #1", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #2", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #3", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #4", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #5", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #6", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #7", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "I", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - }; - - formatter.header( header ); - QString tenCharacterWellName = "0123456789"; - formatter.add( tenCharacterWellName ); - for ( int i = 0; i < 7; ++i ) - { - formatter.add( std::numeric_limits::max() ); // 10 characters - } - formatter.add( 11 ); - - int fullLineLength = formatter.tableRowPrependText().length() + 9 * formatter.columnSpacing() + 10 + 7 * 10 + 2 + - formatter.tableRowAppendText().length(); - int tableWidth = formatter.tableWidth(); - EXPECT_GE( tableWidth, fullLineLength ); - EXPECT_EQ( formatter.maxDataRowWidth(), fullLineLength ); - - formatter.rowCompleted(); - formatter.tableCompleted(); - - QStringList tableLines = tableText.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts ); - for ( QString line : tableLines ) - { - std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl; - if ( line.startsWith( "0" ) ) - { - EXPECT_EQ( line.length(), formatter.maxDataRowWidth() ); - } - } -} - -TEST( RifEclipseDataTableFormatter, LongLine133 ) -{ - QString tableText; - QTextStream stream( &tableText ); - RifEclipseDataTableFormatter formatter( stream ); - - std::vector header = { - RifEclipseOutputTableColumn( "10 Char" ), - RifEclipseOutputTableColumn( "10 Int #1", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #2", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #3", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #4", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #5", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #6", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "10 Int #7", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - RifEclipseOutputTableColumn( "I", RifEclipseOutputTableDoubleFormatting(), RIGHT ), - }; - - formatter.header( header ); - QString fiftyCharacterWellName = "0123456789"; - formatter.add( fiftyCharacterWellName ); - for ( int i = 0; i < 7; ++i ) - { - formatter.add( std::numeric_limits::max() ); // 10 characters - } - formatter.add( 111 ); - - int fullLineLength = formatter.tableRowPrependText().length() + 9 * formatter.columnSpacing() + 10 + 7 * 10 + 3 + - formatter.tableRowAppendText().length(); - int tableWidth = formatter.tableWidth(); - EXPECT_GE( tableWidth, fullLineLength ); - EXPECT_LT( formatter.maxDataRowWidth(), fullLineLength ); - - formatter.rowCompleted(); - formatter.tableCompleted(); - - QStringList tableLines = tableText.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts ); - for ( QString line : tableLines ) - { - std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl; - if ( line.startsWith( "0" ) ) - { - EXPECT_LE( line.length(), formatter.maxDataRowWidth() ); - } - } -} \ No newline at end of file diff --git a/ApplicationCode/UnitTests/RifTextDataTableFormatter-Test.cpp b/ApplicationCode/UnitTests/RifTextDataTableFormatter-Test.cpp new file mode 100644 index 0000000000..cec32b3c31 --- /dev/null +++ b/ApplicationCode/UnitTests/RifTextDataTableFormatter-Test.cpp @@ -0,0 +1,212 @@ +#include "gtest/gtest.h" + +#include "RifTextDataTableFormatter.h" + +#include +#include + +TEST( RifTextDataTableFormatter, BasicUsage ) +{ + QString tableText; + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); + + std::vector header = { + RifTextDataTableColumn( "Well" ), + RifTextDataTableColumn( "Integer Number" ), + RifTextDataTableColumn( "IntNumer 2" ), + RifTextDataTableColumn( "IntNumer 3" ), + }; + + formatter.header( header ); + + formatter.add( "well a" ); + formatter.add( 1 ); + formatter.add( 2 ); + formatter.add( 3 ); + formatter.rowCompleted(); + + formatter.add( "well B" ); + formatter.add( 12 ); + formatter.add( 23 ); + formatter.add( 233 ); + formatter.rowCompleted(); + + formatter.tableCompleted(); + + std::cout << tableText.toStdString(); +} + +TEST( RifTextDataTableFormatter, NoPrefix ) +{ + QString tableText; + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); + + formatter.setTableRowPrependText( " " ); + formatter.setTableRowLineAppendText( "" ); + + std::vector header = { + RifTextDataTableColumn( "Well" ), + RifTextDataTableColumn( "Integer Number", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "IntNumer 2", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "IntNumer 3", RifTextDataTableDoubleFormatting(), RIGHT ), + }; + + formatter.header( header ); + + formatter.add( "well a" ); + formatter.add( 1 ); + formatter.add( 2 ); + formatter.add( 3 ); + formatter.rowCompleted(); + + formatter.add( "well B" ); + formatter.add( 12 ); + formatter.add( 231 ); + formatter.add( 23123 ); + formatter.rowCompleted(); + + formatter.tableCompleted(); + + std::cout << tableText.toStdString(); +} + +TEST( RifTextDataTableFormatter, LongLine ) +{ + QString tableText; + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); + + std::vector header = { + RifTextDataTableColumn( "50 Character Well Name" ), + RifTextDataTableColumn( "10 Int #1", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #2", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #3", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #4", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #5", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #6", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #7", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #8", RifTextDataTableDoubleFormatting(), RIGHT ), + }; + + formatter.header( header ); + QString fiftyCharacterWellName = "01234567890123456789012345678901234567890123456789"; + formatter.add( fiftyCharacterWellName ); + for ( int i = 0; i < 8; ++i ) + { + formatter.add( std::numeric_limits::max() ); // 10 characters + } + int fullLineLength = formatter.tableRowPrependText().length() + 9 * formatter.columnSpacing() + 50 + 8 * 10 + + formatter.tableRowAppendText().length(); + int tableWidth = formatter.tableWidth(); + EXPECT_EQ( tableWidth, fullLineLength ); + EXPECT_GT( tableWidth, formatter.maxDataRowWidth() ); + + formatter.rowCompleted(); + formatter.tableCompleted(); + + QStringList tableLines = tableText.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts ); + for ( QString line : tableLines ) + { + std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl; + if ( !line.startsWith( formatter.commentPrefix() ) ) + { + EXPECT_LE( line.length(), formatter.maxDataRowWidth() ); + } + } +} + +TEST( RifTextDataTableFormatter, LongLine132 ) +{ + QString tableText; + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); + + std::vector header = { + RifTextDataTableColumn( "10 Char" ), + RifTextDataTableColumn( "10 Int #1", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #2", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #3", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #4", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #5", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #6", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #7", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "I", RifTextDataTableDoubleFormatting(), RIGHT ), + }; + + formatter.header( header ); + QString tenCharacterWellName = "0123456789"; + formatter.add( tenCharacterWellName ); + for ( int i = 0; i < 7; ++i ) + { + formatter.add( std::numeric_limits::max() ); // 10 characters + } + formatter.add( 11 ); + + int fullLineLength = formatter.tableRowPrependText().length() + 9 * formatter.columnSpacing() + 10 + 7 * 10 + 2 + + formatter.tableRowAppendText().length(); + int tableWidth = formatter.tableWidth(); + EXPECT_GE( tableWidth, fullLineLength ); + EXPECT_EQ( formatter.maxDataRowWidth(), fullLineLength ); + + formatter.rowCompleted(); + formatter.tableCompleted(); + + QStringList tableLines = tableText.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts ); + for ( QString line : tableLines ) + { + std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl; + if ( line.startsWith( "0" ) ) + { + EXPECT_EQ( line.length(), formatter.maxDataRowWidth() ); + } + } +} + +TEST( RifTextDataTableFormatter, LongLine133 ) +{ + QString tableText; + QTextStream stream( &tableText ); + RifTextDataTableFormatter formatter( stream ); + + std::vector header = { + RifTextDataTableColumn( "10 Char" ), + RifTextDataTableColumn( "10 Int #1", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #2", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #3", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #4", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #5", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #6", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "10 Int #7", RifTextDataTableDoubleFormatting(), RIGHT ), + RifTextDataTableColumn( "I", RifTextDataTableDoubleFormatting(), RIGHT ), + }; + + formatter.header( header ); + QString fiftyCharacterWellName = "0123456789"; + formatter.add( fiftyCharacterWellName ); + for ( int i = 0; i < 7; ++i ) + { + formatter.add( std::numeric_limits::max() ); // 10 characters + } + formatter.add( 111 ); + + int fullLineLength = formatter.tableRowPrependText().length() + 9 * formatter.columnSpacing() + 10 + 7 * 10 + 3 + + formatter.tableRowAppendText().length(); + int tableWidth = formatter.tableWidth(); + EXPECT_GE( tableWidth, fullLineLength ); + EXPECT_LT( formatter.maxDataRowWidth(), fullLineLength ); + + formatter.rowCompleted(); + formatter.tableCompleted(); + + QStringList tableLines = tableText.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts ); + for ( QString line : tableLines ) + { + std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl; + if ( line.startsWith( "0" ) ) + { + EXPECT_LE( line.length(), formatter.maxDataRowWidth() ); + } + } +}