Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Table subs division #3353

Closed
wants to merge 255 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
255 commits
Select commit Hold shift + click to select a range
59a9bc8
Merge remote-tracking branch 'origin/develop' into feature/dudes/tabl…
arng40 Feb 13, 2024
677fdb6
add log to wellGeneratorBase
arng40 Feb 13, 2024
623b6ad
uncrustify + missing doc
arng40 Feb 13, 2024
37dc5dd
first review with correction
arng40 Feb 14, 2024
8678fc0
constness modification, doc/test updated
arng40 Feb 15, 2024
9475286
const declaration updated
arng40 Feb 15, 2024
1320651
doc + minor restructuring
arng40 Feb 19, 2024
f78bd83
doc + method for row from vector
arng40 Feb 20, 2024
294f075
clean code + doc + add test for rows from vector
arng40 Feb 21, 2024
36dd7a4
doc updated
arng40 Feb 22, 2024
8f74cfa
Merge commit 'c11ad8ecd2d0d0aba5cd0661eb6e72951252409d' into feature/…
arng40 Feb 22, 2024
ebb9fc0
Revert "Merge commit 'c11ad8ecd2d0d0aba5cd0661eb6e72951252409d' into …
arng40 Feb 22, 2024
cb41359
revert last merge and Merge remote-tracking branch 'origin/develop' i…
arng40 Feb 22, 2024
22659ec
Merge remote-tracking branch 'origin/feature/dudes/table-layout' into…
arng40 Feb 22, 2024
ff37ac9
begin pvt tables logs - add write in log bool
arng40 Feb 22, 2024
628f56b
duplication log & csv fixed
arng40 Feb 22, 2024
e11a2bf
CI correction ( uncrustify, missing doc )
arng40 Feb 23, 2024
a8f9271
optionnal added to datatype
arng40 Feb 23, 2024
9ff17b9
update doxygen for ci
arng40 Feb 27, 2024
d90c8b5
more logs added
arng40 Feb 27, 2024
958d542
remove static_assert + constness
arng40 Feb 28, 2024
550ca26
Merge remote-tracking branch 'origin/develop' into feature/dudes/tabl…
arng40 Feb 28, 2024
f67e3d9
remove unused code
arng40 Feb 29, 2024
5b8689a
factorisation log pvt
arng40 Mar 4, 2024
0fa76e3
doxygen added
arng40 Mar 4, 2024
bb1ee01
remove test parent name with constitutive
arng40 Mar 4, 2024
aa2f789
remove unused code + add drawtostring method
arng40 Mar 5, 2024
8ff95c2
uncrustify
arng40 Mar 5, 2024
957c7d7
refacto Table first part
arng40 Mar 8, 2024
70d0a01
refortor still going up (missing doc and some minor refacto)
arng40 Mar 11, 2024
f5251f5
uncrustify + perfo example addded
arng40 Mar 11, 2024
1bec18e
update test + margin correction
arng40 Mar 11, 2024
1e45501
Merge remote-tracking branch 'origin/develop' into feature/dudes/tabl…
arng40 Mar 11, 2024
288f79e
Merge remote-tracking branch 'origin/feature/dudes/table-layout' into…
arng40 Mar 12, 2024
2054bd4
added Formatter function, correction on TableData
arng40 Mar 12, 2024
37e18b4
Delete table..cpp/hpp
arng40 Mar 12, 2024
5ff7c68
small correction
arng40 Mar 12, 2024
b360a16
doc updated
arng40 Mar 13, 2024
dd5f42f
TableData2D small refacto + opti
arng40 Mar 13, 2024
16b4ded
first update for log in table function
arng40 Mar 13, 2024
e8e89c2
Merge remote-tracking branch 'origin/feature/dudes/table-layout' into…
arng40 Mar 13, 2024
769beab
uncrustify + small correction
arng40 Mar 13, 2024
5fa478c
csv format / function correction
arng40 Mar 13, 2024
85494c7
remove dataToString with 2D table parameter
arng40 Mar 13, 2024
46e8d23
code opti
arng40 Mar 13, 2024
c1ba824
add 2D table test
arng40 Mar 13, 2024
14ea4f5
uncrustify
arng40 Mar 13, 2024
1271875
Alignment::middle by center and compile time verifcation added
arng40 Mar 14, 2024
d39fa00
PR review
arng40 Mar 14, 2024
c58be1e
2nd wave of pr review
arng40 Mar 14, 2024
1d4bdb4
update compile time verification for table value
arng40 Mar 15, 2024
0bff847
some update
arng40 Mar 15, 2024
8553441
pvt_log updated
arng40 Mar 15, 2024
7005d57
Merge remote-tracking branch 'origin/feature/dudes/table-layout' into…
arng40 Mar 15, 2024
22b16e9
update pvt log
arng40 Mar 15, 2024
429920c
add missing doc + uncrustify
arng40 Mar 15, 2024
965a972
constness update + refacto on text formatter
arng40 Mar 18, 2024
6e49ebc
PR correction
arng40 Mar 18, 2024
c1fb3dd
move has_formatter to format.hpp, doc correction
arng40 Mar 19, 2024
e0c6ca2
log level correction
arng40 Mar 19, 2024
7221c0f
perfo log correctly displayed
arng40 Mar 20, 2024
82098d8
remove ; to scope bracket
arng40 Mar 21, 2024
75ed072
doc correction format.hpp
arng40 Mar 21, 2024
3469920
format.hpp doc
arng40 Mar 21, 2024
052f1fa
last correction
arng40 Mar 21, 2024
fae723e
Merge remote-tracking branch 'origin/develop' into feature/dudes/tabl…
arng40 Mar 21, 2024
838f36e
cmake fix
arng40 Mar 25, 2024
1139117
test return string
arng40 Mar 25, 2024
13a6d09
fix hpp
arng40 Mar 25, 2024
cfeec17
fix error with string_view
arng40 Mar 25, 2024
f735cd1
uncrustify
arng40 Mar 25, 2024
755805a
Correction melvin PR
arng40 Mar 26, 2024
6264d87
correction review PR
arng40 Mar 27, 2024
21021c7
setMargin private
arng40 Mar 27, 2024
3a34e27
uncrustify
arng40 Mar 27, 2024
76789ba
remove constructor vector string
arng40 Mar 28, 2024
2d1cded
Table Data logs
arng40 Mar 28, 2024
8fedfd8
move table to common + pr correction
arng40 Mar 29, 2024
e5d2d3a
Merge remote-tracking branch 'origin/feature/dudes/table-layout' into…
arng40 Mar 29, 2024
13f975a
correction from merging
arng40 Mar 29, 2024
f7dbdcf
minor correction
arng40 Mar 29, 2024
4f34fc2
gracefully breaking your code :)
MelReyCG Apr 2, 2024
1cb2cc0
improving proposal + added TODOs
MelReyCG Apr 2, 2024
615a16d
Refactor conversion TableData2 => TableData1D
arng40 Apr 3, 2024
0100b33
Merge remote-tracking branch 'origin/feature/rey/transmissibilityOutp…
arng40 Apr 4, 2024
e66074e
Merge remote-tracking branch 'origin/develop' into pvt-logs-cp
arng40 Apr 4, 2024
7375665
refactor method to convert 2Dtable => 1D table
arng40 Apr 4, 2024
d590513
CI correction
arng40 Apr 4, 2024
7f6b79b
move table to fileIO
arng40 Apr 4, 2024
73f8374
update some doc
arng40 Apr 4, 2024
ae4968b
first part test 2D table crash
arng40 Apr 4, 2024
92a1644
add test/warning for table conversion 2D => 1D and warning for fillin…
arng40 Apr 5, 2024
e6b2e6d
ci correction
arng40 Apr 8, 2024
18db533
test ci correction for c++ < 17
arng40 Apr 9, 2024
31126e1
test ci table2D example 1
arng40 Apr 9, 2024
d481454
test ci Table2D test 1 & 2
arng40 Apr 9, 2024
6a7bfe8
test ci Table2D test 1 & 2 & 3
arng40 Apr 9, 2024
e01523b
add virtual destructor TableFormatter + minor variable refacto
arng40 Apr 10, 2024
978674e
bug correction + missing doc + test small refacto
arng40 Apr 10, 2024
da95c91
missig doc ...
arng40 Apr 10, 2024
79acc00
start management logError in table + todo refacto functions in TableF…
arng40 Apr 11, 2024
24f92d9
TableFormatter refacto + clean up
arng40 Apr 12, 2024
5a70c33
uncrustify
arng40 Apr 12, 2024
95f3a9d
small doc update
arng40 Apr 15, 2024
77351b9
some error management update
arng40 Apr 15, 2024
da67c05
renaming & simplifying
arng40 Apr 17, 2024
a9612bb
add case for fill all column in case of table 2D
arng40 Apr 17, 2024
0f1bbe2
Merge remote-tracking branch 'origin/develop' into feature/dudes/tabl…
arng40 Apr 17, 2024
89f859a
simplification
arng40 Apr 17, 2024
ef5085c
code optimization
arng40 Apr 18, 2024
294db78
remove useless std::move
arng40 Apr 18, 2024
9f23f62
refacto build separator + reviews
arng40 Apr 19, 2024
9809699
final review correction
arng40 Apr 19, 2024
66895d6
Merge remote-tracking branch 'origin/feature/dudes/table-layout' into…
arng40 Apr 22, 2024
46a6abe
method display layout added
arng40 Apr 22, 2024
9de9d63
small correction after merge
arng40 Apr 22, 2024
fe80c59
review correction #1
arng40 May 13, 2024
abb994e
variables renamed
arng40 May 17, 2024
c851b38
uncrustify + doc
arng40 May 23, 2024
0ae0c74
doc
arng40 May 23, 2024
86c0130
Merge remote-tracking branch 'origin/develop' into feature/dudes/tabl…
arng40 May 23, 2024
e9639ea
remove unused code
arng40 May 24, 2024
a48feb3
Merge remote-tracking branch 'origin/feature/dudes/table-layout' into…
arng40 May 27, 2024
924d955
syntax correction
arng40 May 27, 2024
5b530f0
Merge branch 'pvt-logs-cp' of https://github.com/GEOS-DEV/GEOS into p…
arng40 May 27, 2024
ac0cec8
variable correction
arng40 May 27, 2024
d6415a7
doc + code clarification
arng40 May 30, 2024
eaa8919
more code simplification
arng40 May 31, 2024
138541b
remove addErrorMsg function
arng40 Jun 3, 2024
3f74746
merge
arng40 Jun 3, 2024
d360dcf
Merge branch 'develop' into feature/dudes/table-layout
arng40 Jun 3, 2024
7aaf7b6
Merge remote-tracking branch 'origin/feature/dudes/table-layout' into…
arng40 Jun 3, 2024
1f24247
uncrustify
arng40 Jun 3, 2024
709c037
Merge remote-tracking branch 'origin/develop' into feature/dudes/pvt-…
arng40 Jun 5, 2024
fb795ba
Merge branch 'feature/dudes/pvt-output' of https://github.com/GEOS-DE…
arng40 Jun 5, 2024
b1ec0d0
begin refacto in table function for more clarity
arng40 Jun 5, 2024
b62161a
continue refato
arng40 Jun 5, 2024
98764af
refacto continuing ( commit works )
arng40 Jun 7, 2024
8091945
missing doxygen
arng40 Jun 7, 2024
1c8d7a9
correction fun name
arng40 Jun 7, 2024
2c17324
missing doc
arng40 Jun 10, 2024
0dddcf5
uncrustify + doc
arng40 Jun 10, 2024
7ee093b
Doxygen check
arng40 Jun 10, 2024
86fe90b
review correction + add pvtOptions struct
arng40 Jun 14, 2024
28b68f0
missing test correction
arng40 Jun 14, 2024
7f1b8ab
pvtOpt struct renaming + fct move to FlashModel
arng40 Jun 14, 2024
3da5e82
xsd/rst generation
arng40 Jun 14, 2024
fd605f7
review pavel
arng40 Jun 17, 2024
5cbaeec
renaming
arng40 Jun 18, 2024
684a405
review update
arng40 Jun 19, 2024
ae86942
revert a modif
arng40 Jun 19, 2024
c69fbee
uncrustify
arng40 Jun 19, 2024
49b52f3
Merge remote-tracking branch 'origin/develop' into feature/dudes/pvt-…
arng40 Jun 19, 2024
fa3218c
melvin review
arng40 Jun 26, 2024
5c808f8
fix
arng40 Jun 26, 2024
b39a84a
Merge remote-tracking branch 'origin/develop' into feature/dudes/pvt-…
arng40 Jun 27, 2024
76ee4dd
Merge remote-tracking branch 'origin/develop' into feature/dudes/pvt-…
arng40 Jul 2, 2024
57c23b2
pr pavel correction
arng40 Jul 4, 2024
4c4a3b8
Merge remote-tracking branch 'origin/develop' into feature/dudes/pvt-…
arng40 Jul 4, 2024
83c80b2
missing doxygen
arng40 Jul 4, 2024
5e8d0af
remove unused code
arng40 Jul 4, 2024
547bf9e
review melvin
arng40 Jul 8, 2024
37482aa
doxygen + uncrustify
arng40 Jul 8, 2024
7e7492d
revert space applied
arng40 Jul 8, 2024
d6c3a8a
uncrustify
arng40 Jul 8, 2024
c0c1d6b
nb character lines fix
arng40 Jul 12, 2024
ace4ce9
Merge remote-tracking branch 'origin/develop' into feature/dudes/pvt-…
arng40 Jul 12, 2024
44d3e8e
Merge branch 'develop' into feature/dudes/pvt-output
MelReyCG Jul 23, 2024
3c0997a
fix print screen level condition
arng40 Jul 25, 2024
45847cd
Merge branch 'feature/dudes/pvt-output' of https://github.com/GEOS-DE…
arng40 Jul 25, 2024
7278d9c
Merge remote-tracking branch 'origin/develop' into feature/dudes/pvt-…
arng40 Jul 25, 2024
003de35
Merge remote-tracking branch 'origin/develop' into feature/dudes/pvt-…
arng40 Aug 21, 2024
53d4ea0
small fix
arng40 Aug 21, 2024
49c939c
small change in path indaction
arng40 Aug 22, 2024
6d2995e
Merge remote-tracking branch 'origin/develop' into feature/dudes/pvt-…
arng40 Aug 28, 2024
b707111
[DRAFT] column fill with subvalues
arng40 Sep 6, 2024
d486a8a
[DRAFT ] subsection draw
arng40 Sep 6, 2024
a184897
[DRAFT] First table sub version, missing spaces
arng40 Sep 6, 2024
eef11e6
[DRAFT] subVales added
arng40 Sep 9, 2024
4cd35f5
Table well formated + some opti
arng40 Sep 10, 2024
111cb13
fix heade + some simplification
arng40 Sep 11, 2024
50512ae
new version with multiples sub column
arng40 Sep 12, 2024
267d065
some opti
arng40 Sep 13, 2024
985c88c
some refactor
arng40 Sep 13, 2024
59e3134
getter margin adjustment
arng40 Sep 13, 2024
b7bdb04
moving code
arng40 Sep 13, 2024
2d50cda
varaible refactor + unused code
arng40 Sep 16, 2024
f0644cd
test passed + hpp doxygen + uncrustify
arng40 Sep 17, 2024
6fc69e3
update test
arng40 Sep 18, 2024
c369b22
update output pre existing
arng40 Sep 18, 2024
c1c3137
some refacto and adding functions
arng40 Sep 18, 2024
6b33bcc
small fix
arng40 Sep 18, 2024
70400cc
missing doxygen
arng40 Sep 18, 2024
4f8002b
small tweaks
arng40 Sep 18, 2024
349f05c
Merge remote-tracking branch 'origin/develop' into table-subs-division
arng40 Sep 18, 2024
f870e67
const variable
arng40 Sep 19, 2024
41fb6d5
small refactor
arng40 Sep 19, 2024
ed6c14b
doxygen improved
arng40 Sep 19, 2024
eb17f42
fix margin if title largest
arng40 Sep 20, 2024
582e168
add init_list constructor
arng40 Sep 20, 2024
5cfe033
adding setMargin + small cleaning
arng40 Sep 23, 2024
674e271
fix unwanted empty space
arng40 Sep 23, 2024
380da9f
test working + log domainPartiton
arng40 Sep 23, 2024
37c9721
uncrustify + some renaming
arng40 Sep 23, 2024
f9f1111
fix default alignment not defined correctly
arng40 Sep 24, 2024
aa98cf2
xsd
arng40 Sep 25, 2024
d7150b2
Merge remote-tracking branch 'origin/develop' into feature/dudes/tabl…
arng40 Oct 2, 2024
db50180
fix after merge
arng40 Oct 2, 2024
377eea9
uncrustify
arng40 Oct 2, 2024
6f70e9b
doc small correction + replace layoutTostring -> toString
arng40 Oct 2, 2024
79cbc8e
missing doc + small adjustment
arng40 Oct 2, 2024
a32cedc
minor update
arng40 Oct 3, 2024
8f74418
xsd
arng40 Oct 3, 2024
7d83833
remove todo
arng40 Oct 3, 2024
24ab8fa
small things forgotten
arng40 Oct 3, 2024
1f1d2b5
fix pvt test
arng40 Oct 4, 2024
04a494b
doxygen & failed test
arng40 Oct 7, 2024
88cf2a3
doxygen
arng40 Oct 7, 2024
cd84b82
variable renaming
arng40 Oct 7, 2024
169ffc8
adding a way to set up alignment for header and values
arng40 Oct 7, 2024
16b4e4e
missing doc
arng40 Oct 8, 2024
1cad750
Merge branch 'develop' into table-subs-division
MelReyCG Oct 8, 2024
5ef16fe
Merge remote-tracking branch 'origin/develop' into feature/dudes/tabl…
arng40 Oct 11, 2024
33e3be1
Merge remote-tracking branch 'origin/develop' into feature/dudes/tabl…
arng40 Oct 17, 2024
6583325
update layout constructor
arng40 Oct 17, 2024
61ffd56
update tableLayout declaration
arng40 Oct 17, 2024
a2a7273
renaming, doxygen, small simpl
arng40 Oct 17, 2024
adb8dc0
missing doc
arng40 Oct 17, 2024
6c06d4d
remove unacessary code
arng40 Oct 17, 2024
e15df11
Merge remote-tracking branch 'origin/develop' into feature/dudes/tabl…
arng40 Oct 18, 2024
b0d731a
xsd
arng40 Oct 21, 2024
f27c101
Delete src/coreComponents/schema/schema.xsd
arng40 Oct 21, 2024
3acc8a1
xsd regenrate
arng40 Oct 21, 2024
76a022c
test ci fix
arng40 Oct 21, 2024
9c1379f
update output domain partition (fix ci)
arng40 Oct 21, 2024
2fafae3
some renaming
arng40 Oct 21, 2024
cb26312
Merge remote-tracking branch 'origin/develop' into feature/dudes/tabl…
arng40 Oct 23, 2024
346d8dc
remove unnecessary code
arng40 Oct 23, 2024
cabdbcb
doc
arng40 Oct 28, 2024
43f9664
missing const
arng40 Oct 29, 2024
2300686
renaming & signature & const
arng40 Oct 29, 2024
e1af681
improve populate table values
arng40 Oct 30, 2024
b87cee9
renaming, some function refactoring & simplification
arng40 Oct 30, 2024
8ea7e56
cout removed, assert added, doc update
arng40 Oct 31, 2024
e893ac7
move assert
arng40 Oct 31, 2024
e77ea50
add idx...
arng40 Oct 31, 2024
ac61e5d
replace string vector on ColumnStructure
arng40 Nov 5, 2024
d81654c
remove code / doc
arng40 Nov 6, 2024
e56d538
add assert for transporse
arng40 Nov 7, 2024
6332366
Merge remote-tracking branch 'origin/develop' into feature/dudes/tabl…
arng40 Nov 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/coreComponents/common/format/table/TableData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ TableData2D::TableDataHolder TableData2D::buildTableData( string_view targetUnit
string_view columnFmt ) const
{
TableData2D::TableDataHolder tableData1D;
std::vector< size_t > rowsLength;

tableData1D.headerNames.push_back( string( targetUnit ) );

Expand All @@ -114,8 +113,7 @@ TableData2D::TableDataHolder TableData2D::buildTableData( string_view targetUnit
currentRowValues.push_back( GEOS_FMT( "{}", cellValue ) );
}

tableData1D.tableData.addRow( std::move( currentRowValues ) );
rowsLength.push_back( currentRowValues.size() );
tableData1D.tableData.addRow( currentRowValues );
}

return tableData1D;
Expand Down
514 changes: 336 additions & 178 deletions src/coreComponents/common/format/table/TableFormatter.cpp

Large diffs are not rendered by default.

154 changes: 86 additions & 68 deletions src/coreComponents/common/format/table/TableFormatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TableFormatter

/**
* @brief Construct a new Table Formatter from a tableLayout
* @param tableLayout Contain all column names and optionnaly the table title
* @param tableLayout Contain all tableColumnData names and optionnaly the table title
*/
TableFormatter( TableLayout const & tableLayout );

Expand All @@ -67,7 +67,7 @@ class TableCSVFormatter : public TableFormatter

/**
* @brief Construct a new Table Formatter from a tableLayout
* @param tableLayout Contain all column names and optionnaly the table title
* @param tableLayout Contain all tableColumnData names and optionnaly the table title
*/
TableCSVFormatter( TableLayout const & tableLayout );

Expand All @@ -77,7 +77,7 @@ class TableCSVFormatter : public TableFormatter
virtual ~TableCSVFormatter() = default;

/**
* @return The string with all column names.
* @return The string with all tableColumnData names.
*/
string headerToString() const;

Expand Down Expand Up @@ -115,7 +115,6 @@ class TableTextFormatter : public TableFormatter
{
public:


/**
* @brief Construct a new TableFormatter
*/
Expand All @@ -125,7 +124,7 @@ class TableTextFormatter : public TableFormatter

/**
* @brief Construct a new TableFormatter from a tableLayout
* @param tableLayout Contain all column names and optionnaly the table title
* @param tableLayout Contain all tableColumnData names and optionnaly the table title
*/
TableTextFormatter( TableLayout const & tableLayout );

Expand All @@ -136,9 +135,10 @@ class TableTextFormatter : public TableFormatter
virtual ~TableTextFormatter() = default;

/**
* @return A TableLayout converted into a formatted representation.
* @return A TableLayout string representation,
* The TableTextFormatter receives hasn't receive any data, so only the header part is returned.
*/
string layoutToString() const;
string toString() const;

/**
* @brief Convert a data source to a table string.
Expand All @@ -156,95 +156,113 @@ class TableTextFormatter : public TableFormatter
static constexpr char m_horizontalLine = '-';

/**
* @brief Fill the vector (m_column) in tableData with values from rows stored in tableData.
* @param columns Vector of columns to be filled.
* @brief Prepare all the tableColumnsData with the appropriate values and formatting separator
* @param tableColumnsData The vector containg all tableColumnsData . Each tableColumnData contains its own
* parameters (such as name, alignment, etc.).
* @param tableData Vector containing all rows filled with values
* @param sectionSeparatingLine Separator string used between sections of the table
* @param topSeparator The table top separator
*/
void fillTableColumnsFromRows( std::vector< TableLayout::Column > & columns,
std::vector< std::vector< string > > & tableData ) const;
void prepareAndBuildTable( std::vector< TableLayout::ColumnStructure > & tableColumnsData,
TableData const & tableData,
string & sectionSeparatingLine,
string & topSeparator ) const;
/**
* @brief Displays the complete table
* @param tableOutput The output stream
* @param tableColumnsData Vector containg all tableColumnsData
* @param sectionSeparatingLine Separator string used between sections of the table
* @param topSeparator The table top separator
*/
void outputTable( std::ostringstream & tableOutput,
std::vector< TableLayout::ColumnStructure > & tableColumnsData,
string_view sectionSeparatingLine,
string_view topSeparator ) const;

/**
* @brief Converts a TableLayout into a formatted representation.
* @param tableOutput The output stream
* @param columns The vector containing all table columns
* @param msgTableError A vector containg all error related to the table
* @param sectionSeparatingLine An empty string for building the section separator
* @brief Populate all the tableColumnData values with values extracted from TableData.
* @param tableColumnsData Vector of tableColumnsData to populate.
* @param tableData Vector containing all rows filled with values
* @param isSubColumn Boolean indicating if the current tableColumnData is a subcolumn
*/
void outputLayout( std::ostringstream & tableOutput,
std::vector< TableLayout::Column > & columns,
std::vector< string > const & msgTableError,
string & sectionSeparatingLine ) const;
void populateColumnsFromTableData( std::vector< TableLayout::ColumnStructure > & tableColumnsData,
std::vector< std::vector< string > > const & tableData ) const;

/**
* @brief Split all header names by detecting the newline \\n character. and
* set the same vector size for each split header and merge it into columns
* @param columns The vector containg all columns
* @param largestHeaderVectorSize The largest split header vector size
* @param splitHeaders A empty vector who will contain all split header names
* set the same vector size for each divided header and merge it into tableColumnsData
* @param tableColumnsData The vector containg all tableColumnsData
* @param allDividedHeaderParts Vector to store the split header names for each tableColumnData
*/
void splitAndSetColumnNames( std::vector< TableLayout::Column > & columns,
size_t & largestHeaderVectorSize,
std::vector< std::vector< string > > & splitHeaders ) const;
void splitAndMergeColumnHeaders( std::vector< TableLayout::ColumnStructure > & tableColumnsData,
std::vector< std::vector< string > > & allDividedHeaderParts ) const;

/**
* @brief For each column find and set the column's longest string
* @param columns The vector containg all columns
* @brief For each tableColumnData find and set the column's longest string
* @param tableColumnData The tableColumnData to process.
* @param maxStringSize Store the longest string(s) for each tableColumnData.
* @param idxColumn The current index of the tableColumnData
*
* @note Compares the longest string from the header with the longest string from the column values.
* If the column contains subcolumns, it recursively applies the same logic to them
*/
void findAndSetMaxStringSize( std::vector< TableLayout::Column > & columns ) const;
void findAndSetLongestColumnString( TableLayout::ColumnStructure & tableColumnData ) const;

/**
* @brief recalculate the largest string size for each columns
* @param columns Vector containing all table columns
* @param extraCharacters Extra characters to be added to \p m_maxStringSize of each columns
* @brief Compute the max table line length, taking into account the length of : title, tableColumnsData header/values
* Increase the size of the tableColumnsData if necessary, then builds the table's separating lines
* @param tableColumnsData Vector of tableColumnData containing containing the largest string for each tableColumnData
* @param sectionSeparatingLine Separator string used between sections of the table
* @param topSeparator The table top separator
*/
void increaseColumnsSize( std::vector< TableLayout::Column > & columns,
integer const extraCharacters ) const;
void computeAndBuildTableSeparator( std::vector< TableLayout::ColumnStructure > & tableColumnsData,
string & sectionSeparatingLine,
string & topSeparator ) const;

/**
* @brief Compute the max table line length, taking into account the length of : title, error, columns header and content
* Increase the size of the columns if necessary
* @param columns Vector of column containing containing the largest string for each column
* @param msgTableError Vector containing all error messages
* @brief Increase each tableColumnData size if the title is larger than all the tableColumnsData
* @param tableColumnsData Vector containing all table tableColumnsData
* @param extraCharacters ExtraCharacters to be distributed between each tableColumnsData
*/
void computeTableWidth( std::vector< TableLayout::Column > & columns,
std::vector< string > const & msgTableError ) const;
void increaseColumnsSize( std::vector< TableLayout::ColumnStructure > & tableColumnsData,
size_t const extraCharacters ) const;

/**
* @brief Build all separators needed from content length contained in the columns vector
* @param columns Vector containing all table columns
* @param topSeparator Top separator to be built
* @param sectionSeparatingLine Line section separator to be built
* @brief Output the title row in the table
* @param topSeparator The top separator string
*/
void buildTableSeparators( std::vector< TableLayout::Column > const & columns,
string & topSeparator,
string & sectionSeparatingLine ) const;
void outputTitleRow( std::ostringstream & tableOutput,
string_view topSeparator ) const;

/**
* @brief Add a row on top of the table
* @brief Output the header rows in the table
* @param tableColumnsData Vector containing all table tableColumnsData
* @param tableOutput The output stream
* @param msg Vector of string(s) to display
* @param topSeparator The top table separator
* @param alignment The aligment for a row
* @param sectionSeparatingLine Separator string used between sections of the table
*/
void outputTopRows( std::ostringstream & tableOutput,
std::vector< string > const & msg,
string_view topSeparator,
TableLayout::Alignment alignment ) const;
void outputHeaderSectionRows( std::vector< TableLayout::ColumnStructure > const & tableColumnsData,
std::ostringstream & tableOutput,
string_view sectionSeparatingLine ) const;

/**
* @brief Output a section by specifying it's type ( header or section )
* @param columns Vector containing all table columns
* @param sectionSeparatingLine Line separator between sections
* @param rows A section row
* @param nbRows Indicates the number of lines in a section
* @param section The section to be built
* @note Add the ending line if there are one or more rows
* @brief Outputs subcolumns for the given row in the table.
* @param tableColumnsData Vector containing the subcolumn values
* @param tableOutput The output stream
* @param idxRow Index of the current row in the table
*/
void outputSubSection( std::vector< TableLayout::ColumnStructure > const & tableColumnsData,
std::ostringstream & tableOutput,
integer idxRow ) const;

/**
* @brief Output the values rows in the table
* @param tableColumnsData Vector containing all table tableColumnsData
* @param tableOutput The output stream
* @param sectionSeparatingLine Separator string used between sections of the table
*/
void outputSectionRows( std::vector< TableLayout::Column > const & columns,
string_view sectionSeparatingLine,
std::ostringstream & rows,
integer const nbRows,
TableLayout::Section const section ) const;
void outputValuesSectionRows( std::vector< TableLayout::ColumnStructure > const & tableColumnsData,
std::ostringstream & tableOutput,
string_view sectionSeparatingLine ) const;
};

/**
Expand Down
90 changes: 72 additions & 18 deletions src/coreComponents/common/format/table/TableLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,51 +16,100 @@
/**
* @file TableData.hpp
*/

#include "TableLayout.hpp"

namespace geos
{

TableLayout::TableLayout( std::vector< string > const & columnNames, string const & title ):
m_tableTitle( title )
void TableLayout::addToColumns( const std::vector< string > & columnNames )
{
setMargin( MarginValue::medium );
m_columns.reserve( columnNames.size() );
for( auto const & name : columnNames )
for( const auto & columnName : columnNames )
{
m_columns.push_back( {TableLayout::ColumnParam{{name}, Alignment::right, true}, {}, ""} );
addToColumns( columnName );
}
}

TableLayout::TableLayout( std::vector< ColumnParam > const & columnParameters, string const & title ):
m_tableTitle( title )
void TableLayout::addToColumns( string_view columnName )
{
m_tableColumnsData.push_back( TableLayout::Column{ columnName } );
}

void TableLayout::addToColumns( Column const & column )
{
setMargin( MarginValue::medium );
m_columns.reserve( columnParameters.size() );
for( auto const & param : columnParameters )
if( !column.subColumnNames.empty())
{
m_columns.push_back( { param, {}, ""} );
std::vector< TableLayout::ColumnStructure > subColumns;
for( const auto & subColumnsName : column.subColumnNames )
{
subColumns.push_back(
TableLayout::ColumnStructure {
TableLayout::Column{ subColumnsName, column.alignmentSettings.headerAlignment }
} );
}
m_tableColumnsData.push_back( TableLayout::ColumnStructure { column, subColumns } );
}
else
{
m_tableColumnsData.push_back( TableLayout::ColumnStructure { column } );
}
}

void TableLayout::setMargin( MarginValue marginValue )
TableLayout & TableLayout::setTitle( string_view title )
{
m_borderMargin = marginValue;
m_tableTitle = title;
return *this;
}

TableLayout & TableLayout::disableLineBreak()
{
m_wrapLine = false;
return *this;
}

TableLayout & TableLayout::setMargin( MarginValue marginValue )
{
m_marginValue = marginValue;
m_borderMargin = marginValue + 1; // margin + border character
m_columnMargin = integer( marginValue ) * 2 + 1;

return *this;
}

TableLayout & TableLayout::setValuesAlignment( TableLayout::Alignment alignment )
{
for( auto & tableColumnData : m_tableColumnsData )
{
tableColumnData.column.alignmentSettings.valueAlignment = alignment;
}
return *this;
}

bool TableLayout::isLineBreakEnabled() const
{
return m_wrapLine;
}

std::vector< TableLayout::Column > const & TableLayout::getColumns() const
void TableLayout::removeSubColumn()

Check warning on line 92 in src/coreComponents/common/format/table/TableLayout.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/common/format/table/TableLayout.cpp#L92

Added line #L92 was not covered by tests
{
return m_columns;
for( auto & column : m_tableColumnsData )

Check warning on line 94 in src/coreComponents/common/format/table/TableLayout.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/common/format/table/TableLayout.cpp#L94

Added line #L94 was not covered by tests
{
if( !column.subColumn.empty() )

Check warning on line 96 in src/coreComponents/common/format/table/TableLayout.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/common/format/table/TableLayout.cpp#L96

Added line #L96 was not covered by tests
{
column.subColumn.clear();

Check warning on line 98 in src/coreComponents/common/format/table/TableLayout.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/common/format/table/TableLayout.cpp#L98

Added line #L98 was not covered by tests
}
}
}

Check warning on line 101 in src/coreComponents/common/format/table/TableLayout.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/common/format/table/TableLayout.cpp#L101

Added line #L101 was not covered by tests

std::vector< TableLayout::ColumnStructure > const & TableLayout::getColumns() const
{
return m_tableColumnsData;
}

string_view TableLayout::getTitle() const
{
return m_tableTitle;
}


integer const & TableLayout::getBorderMargin() const
{
return m_borderMargin;
Expand All @@ -71,6 +120,11 @@
return m_columnMargin;
}

integer const & TableLayout::getMarginValue() const

Check warning on line 123 in src/coreComponents/common/format/table/TableLayout.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/common/format/table/TableLayout.cpp#L123

Added line #L123 was not covered by tests
{
return m_marginValue;

Check warning on line 125 in src/coreComponents/common/format/table/TableLayout.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/common/format/table/TableLayout.cpp#L125

Added line #L125 was not covered by tests
}

integer const & TableLayout::getMarginTitle() const
{
return m_titleMargin;
Expand Down
Loading