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: Log refactor - Output PVT #3149

Merged
merged 195 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 190 commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
751a919
Table function creation
arng40 Feb 9, 2024
c84a06e
add title off case
arng40 Feb 9, 2024
57bc055
setMargin function added
arng40 Feb 12, 2024
6255f9b
add comments + test for tiny table
arng40 Feb 12, 2024
601a2c5
value default optionnal variable changed
arng40 Feb 13, 2024
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
7a4822b
Merge remote-tracking branch 'origin/develop' into feature/dudes/pvt-…
arng40 Aug 29, 2024
ca6188e
fix after merge
arng40 Aug 29, 2024
e6b63ca
move outputPvt to tableFunction
arng40 Sep 4, 2024
f45679f
uppercase correction
arng40 Sep 4, 2024
4ea8034
removing dead code
arng40 Sep 5, 2024
3f35dc7
remove unused code
arng40 Sep 5, 2024
231bad7
missing import
arng40 Sep 5, 2024
8879152
Merge remote-tracking branch 'origin/develop' into feature/dudes/pvt-…
arng40 Sep 5, 2024
c069c2c
Merge branch 'develop' into feature/dudes/pvt-output
MelReyCG Sep 9, 2024
d9bd822
Merge remote-tracking branch 'origin/develop' into feature/dudes/pvt-…
arng40 Sep 9, 2024
fb7db66
Merge remote-tracking branch 'origin/develop' into feature/dudes/pvt-…
arng40 Sep 24, 2024
57f3a45
xsd
arng40 Sep 24, 2024
f97a068
Merge branch 'develop' into feature/dudes/pvt-output
rrsettgast Sep 30, 2024
eb3729e
update test baselines. removed stale rst files. added instructions to…
rrsettgast Oct 1, 2024
a537cdd
fix error in sphinx
rrsettgast Oct 1, 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
39 changes: 35 additions & 4 deletions src/coreComponents/common/format/table/TableData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,42 @@
return m_errorsMsg;
}

TableData2D::Conversion1D TableData2D::buildTableData( string_view targetUnit,
string_view rowFmt,
string_view columnFmt ) const
void TableData2D::collectTableValues( arraySlice1d< real64 const > rowAxisValues,
arraySlice1d< real64 const > columnAxisValues,
arrayView1d< real64 const > values )
{
TableData2D::Conversion1D tableData1D;
integer const nX = rowAxisValues.size();
integer const nY = columnAxisValues.size();

for( integer i = 0; i < nX; i++ )
{
for( integer y = 0; y < nY; y++ )
{
addCell( rowAxisValues[i], columnAxisValues[y], values[ y*nX + i ] );
}
}
}

TableData2D::TableDataHolder TableData2D::convertTable2D( arrayView1d< real64 const > const values,
units::Unit const valueUnit,
ArrayOfArraysView< real64 const > const coordinates,
string_view rowAxisDescription,
string_view columnAxisDescription )
{
string const rowFmt = GEOS_FMT( "{} = {{}}", rowAxisDescription );
string const columnFmt = GEOS_FMT( "{} = {{}}", columnAxisDescription );

Check warning on line 77 in src/coreComponents/common/format/table/TableData.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/common/format/table/TableData.cpp#L77

Added line #L77 was not covered by tests

collectTableValues( coordinates[0], coordinates[1], values );
return buildTableData( string( units::getDescription( valueUnit )),
rowFmt,
columnFmt );
}

TableData2D::TableDataHolder TableData2D::buildTableData( string_view targetUnit,
string_view rowFmt,
string_view columnFmt ) const
{
TableData2D::TableDataHolder tableData1D;
std::vector< size_t > rowsLength;

tableData1D.headerNames.push_back( string( targetUnit ) );
Expand Down
31 changes: 29 additions & 2 deletions src/coreComponents/common/format/table/TableData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#ifndef GEOS_COMMON_FORMAT_TABLE_TABLEDATA_HPP
#define GEOS_COMMON_FORMAT_TABLE_TABLEDATA_HPP

#include "common/Units.hpp"
#include "common/DataTypes.hpp"
#include "common/format/Format.hpp"

Expand Down Expand Up @@ -85,9 +86,10 @@ class TableData2D
using ColumnType = real64;

/// Struct containing conversion informations
struct Conversion1D
struct TableDataHolder
{
/// Vector containing all columns names
/// A header value is presented as "pressure [K] = {}"
std::vector< string > headerNames;
/// TableData to be built
TableData tableData;
Expand All @@ -103,6 +105,30 @@ class TableData2D
template< typename T >
void addCell( RowType rowValue, ColumnType columnValue, T const & value );

/**
* @brief Collects all the values needed to build the table
* @param rowAxisValues Vector containing all row axis values
* @param columnAxisValues Vector containing all column axis values
* @param values Vector containing all table values
*/
void collectTableValues( arraySlice1d< real64 const > rowAxisValues,
arraySlice1d< real64 const > columnAxisValues,
arrayView1d< real64 const > values );

/**
* @param values Vector containing all table values
* @param valueUnit The table unit value
* @param coordinates Array containing row/column axis values
* @param rowAxisDescription The description for a row unit value
* @param columnAxisDescription The description for a column unit value
* @return A struct containing the tableData converted and all header values ;
*/
TableData2D::TableDataHolder convertTable2D( arrayView1d< real64 const > const values,
units::Unit const valueUnit,
ArrayOfArraysView< real64 const > const coordinates,
string_view rowAxisDescription,
string_view columnAxisDescription );

/**
* @return Convert and return a struct containing a 1D Table, the column names list from a TableData2D and any errors related to the table
* @param dataDescription The table dataDescription shown at the top left side
Expand All @@ -112,7 +138,8 @@ class TableData2D
* By default it displays the axis value.
* I.E to display a customized axis to show the pressures in y axis, a rowFmt value can be : "pressure [K] = {}"
*/
Conversion1D buildTableData( string_view dataDescription, string_view rowFmt = "{}", string_view columnFmt = "{}" ) const;
TableDataHolder buildTableData( string_view dataDescription,
string_view rowFmt = "{}", string_view columnFmt = "{}" ) const;

private:
/// @brief all cell values by their [ row ][ column ]
Expand Down
8 changes: 6 additions & 2 deletions src/coreComponents/common/format/table/TableFormatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @file TableFormatter.cpp
*/

#include "TableFormatter.hpp"
#include <numeric>
#include "common/format/StringUtilities.hpp"
#include "TableFormatter.hpp"
Expand Down Expand Up @@ -67,7 +68,8 @@
return oss.str();
}

string TableCSVFormatter::toString( TableData const & tableData ) const
template<>
string TableCSVFormatter::toString< TableData >( TableData const & tableData ) const

Check warning on line 72 in src/coreComponents/common/format/table/TableFormatter.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/common/format/table/TableFormatter.cpp#L72

Added line #L72 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the benefit of the template specialization here vs overload?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting with a TableFunction is very different from formatting with a normal data source and is heavily coupled to TableFunctions, I did that to avoid to add dependancies to TableFunction

{
return headerToString() + dataToString( tableData );
}
Expand Down Expand Up @@ -155,7 +157,8 @@
return tableOutput.str();
}

string TableTextFormatter::toString( TableData const & tableData ) const
template<>
string TableTextFormatter::toString< TableData >( TableData const & tableData ) const
{
std::ostringstream tableOutput;
string sectionSeparatingLine;
Expand Down Expand Up @@ -403,4 +406,5 @@
tableOutput << GEOS_FMT( "{}\n", sectionSeparatingLine );
}
}

}
55 changes: 46 additions & 9 deletions src/coreComponents/common/format/table/TableFormatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class TableFormatter
/// Layout for a table
TableLayout m_tableLayout;

TableFormatter() = default;

/**
* @brief Construct a new Table Formatter from a tableLayout
* @param tableLayout Contain all column names and optionnaly the table title
Expand All @@ -56,6 +58,13 @@ class TableCSVFormatter : public TableFormatter
{
public:

/**
* @brief Construct a new Table Formatter
*/
TableCSVFormatter():
TableFormatter( TableLayout() )
{}

/**
* @brief Construct a new Table Formatter from a tableLayout
* @param tableLayout Contain all column names and optionnaly the table title
Expand All @@ -80,28 +89,47 @@ class TableCSVFormatter : public TableFormatter
string dataToString( TableData const & tableData ) const;

/**
* @brief Convert the TableData to a table string.
* @param tableData The TableData to convert.
* @return The table string representation of the TableData.
* @brief Convert a data source to a CSV string.
* @tparam DATASOURCE The source to convert
* @param tableData The data source to convert
* @return The CSV string representation of a data source.
*/
string toString( TableData const & tableData ) const;
template< typename DATASOURCE >
string toString( DATASOURCE const & tableData ) const;

};

/**
* @brief Convert the TableData to a CSV string.
* @param tableData The TableData to convert.
* @return The CSV string representation of the TableData.
*/
template<>
string TableCSVFormatter::toString< TableData >( TableData const & tableData ) const;


/**
* @brief class for log formatting
*/
class TableTextFormatter : public TableFormatter
{

public:


/**
* @brief Construct a new TableFormatter
*/
TableTextFormatter():
TableFormatter( TableLayout() )
{}

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


/**
* @brief Destroy the Table Text Formatter object
*/
Expand All @@ -113,11 +141,12 @@ class TableTextFormatter : public TableFormatter
string layoutToString() const;

/**
* @brief Convert the TableData to a table string.
* @param tableData The TableData to convert.
* @brief Convert a data source to a table string.
* @param tableData The data source to convert.
* @return The table string representation of the TableData.
*/
string toString( TableData const & tableData ) const;
template< typename DATASOURCE >
string toString( DATASOURCE const & tableData ) const;

private:

Expand All @@ -126,7 +155,7 @@ class TableTextFormatter : public TableFormatter
/// for the extremity of a row
static constexpr char m_horizontalLine = '-';

/**F
/**
* @brief Fill the vector (m_column) in tableData with values from rows stored in tableData.
* @param columns Vector of columns to be filled.
* @param tableData Vector containing all rows filled with values
Expand Down Expand Up @@ -217,6 +246,14 @@ class TableTextFormatter : public TableFormatter
integer const nbRows,
TableLayout::Section const section ) const;
};

/**
* @brief Convert a TableData to a table string.
* @param tableData The TableData to convert.
* @return The table string representation of the TableData.
*/
template<>
string TableTextFormatter::toString< TableData >( TableData const & tableData ) const;
}

#endif /* GEOS_COMMON_FORMAT_TABLE_TABLEFORMATTER_HPP */
2 changes: 2 additions & 0 deletions src/coreComponents/common/format/table/TableLayout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class TableLayout
string m_maxStringSize;
};

TableLayout() = default;

/**
* @brief Construct a new Table object, all values in the table are centered by default
* @param columnNames The names of the columns
Expand Down
15 changes: 7 additions & 8 deletions src/coreComponents/common/format/table/unitTests/testTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ TEST( testTable, table2DTable )
//convert
string const rowFmt = GEOS_FMT( "{} = {{}}", "Temperature" );
string const columnFmt = GEOS_FMT( "{} = {{}}", "Pression" );
TableData2D::Conversion1D tableconverted = tableData.buildTableData( "Viscosity kg*s",
rowFmt,
columnFmt );
TableData2D::TableDataHolder tableconverted = tableData.buildTableData( "Viscosity kg*s",
rowFmt,
columnFmt );

//format
TableLayout const tableLayout( tableconverted.headerNames );
Expand Down Expand Up @@ -248,9 +248,9 @@ TEST( testTable, table2DColumnMismatch )
//convert
string const rowFmt = GEOS_FMT( "{} = {{}}", "Temperature" );
string const columnFmt = GEOS_FMT( "{} = {{}}", "Pression" );
TableData2D::Conversion1D tableConverted = tableData.buildTableData( "Viscosity kg*s",
rowFmt,
columnFmt );
TableData2D::TableDataHolder tableConverted = tableData.buildTableData( "Viscosity kg*s",
rowFmt,
columnFmt );

//format
TableLayout const tableLayout( tableConverted.headerNames );
Expand All @@ -274,11 +274,10 @@ TEST( testTable, table2DColumnMismatch )
TEST( testTable, layoutTable )
{
string filename = "fluid1_phaseModel1_PhillipsBrineDensity_table";
//2. format

string log = GEOS_FMT( "The {} PVT table exceeding 500 rows.\nTo visualize the tables, go to the generated csv \n", filename );
TableLayout const tableLayoutInfos( {TableLayout::ColumnParam{{log}, TableLayout::Alignment::left}}, filename );

//3. log
TableTextFormatter const tableLog( tableLayoutInfos );
EXPECT_EQ( tableLog.layoutToString(),
"\n-------------------------------------------------------------------------------------\n"
Expand Down
10 changes: 9 additions & 1 deletion src/coreComponents/constitutive/ConstitutiveBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ namespace constitutive
ConstitutiveBase::ConstitutiveBase( string const & name,
Group * const parent ):
Group( name, parent ),
m_numQuadraturePoints( 1 )
m_numQuadraturePoints( 1 ),
m_isClone( false )
{
setInputFlags( InputFlags::OPTIONAL_NONUNIQUE );
}
Expand Down Expand Up @@ -72,6 +73,11 @@ void ConstitutiveBase::allocateConstitutiveData( dataRepository::Group & parent,
this->resize( parent.size() );
}

void ConstitutiveBase::setIsClone( bool const newState )
{
m_isClone = newState;
}

std::unique_ptr< ConstitutiveBase >
ConstitutiveBase::deliverClone( string const & name,
Group * const parent ) const
Expand All @@ -84,6 +90,8 @@ ConstitutiveBase::deliverClone( string const & name,
wrapper.copyWrapper( this->getWrapperBase( wrapper.getName() ) );
} );

newModel->setIsClone( true );

return newModel;
}

Expand Down
14 changes: 14 additions & 0 deletions src/coreComponents/constitutive/ConstitutiveBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ class ConstitutiveBase : public dataRepository::Group

localIndex numQuadraturePoints() const { return m_numQuadraturePoints; }

/**
* @return true if the instance has been produced with deliverClone()
*/
bool isClone() const { return m_isClone; }

virtual std::vector< string > getSubRelationNames() const { return {}; }

/**
Expand Down Expand Up @@ -162,7 +167,16 @@ class ConstitutiveBase : public dataRepository::Group

private:

/**
* @brief Set a isClone state boolean
* @param newState The state of the new constitutive model
*/
void setIsClone( bool const newState );

localIndex m_numQuadraturePoints;

/// Indicate if this constitutive model a clone
bool m_isClone;
};

}
Expand Down
Loading
Loading