-
Notifications
You must be signed in to change notification settings - Fork 106
feat: Additional information on the table log perforation #3966
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
base: develop
Are you sure you want to change the base?
Changes from 76 commits
d764bca
87a4eec
5638062
3b7ade4
dbee251
b6f5ca6
f10caa5
7dcac44
f29df71
673eae7
c09f8bf
66863a1
d6128ee
254f20e
4600be3
bbae597
77b28da
863e969
2b80760
ff7e66d
ef3e09c
0261d8f
86e5cd7
6d1a918
9c9fdd1
805c7b1
7400922
d2925fb
ebdadd8
b0eb0f6
57d5802
ec41004
a06b548
763103a
bfdf8c5
d15042d
44ac609
824deb6
d340530
78db217
6f3c199
bd75852
d47c187
642c3b5
17deec4
341ad11
ff68563
ccfbccf
52cc123
1eb61c0
d79852f
b045e50
552229b
47013b2
e7f1439
ae56cb4
632edd7
73c7a37
49d72e0
c567f23
79c9ee2
ecef467
bdc15ec
81a96b2
7d6249d
935d117
a302088
1181253
23a5694
17538bd
0d22428
ba863d7
ee7d7da
55aff05
dfe0619
b962b2c
854c07d
1e1176e
eefa8aa
f83574c
6a671b6
86720a2
d315944
3381ad8
62f55f7
ee8f95f
3c048ad
97c698c
418014b
611a331
51c47ad
aff99d5
1eea4d9
60b85ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -59,7 +59,81 @@ TableData & TableData::operator=( TableData const & other ) | |||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| bool TableData::operator<( TableData const & other ) const | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| return m_rows < other.m_rows; | ||||||||||||||||||||||||||||||||||||||||||||||
| if( other.getCellsData().size()!= getCellsData().size()) | ||||||||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need a comment in the function doc ?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarified the documentation, and reimplemented those two comparison operators to match the described logic. |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| for( size_t i = 0; i < getCellsData().size(); i++ ) | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| if( getCellsData()[i].data()->value > other.getCellsData()[i].data()->value ) | ||||||||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| bool TableData::operator==( TableData const & comparingTable ) const | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| if( comparingTable.getCellsData().size()!= getCellsData().size()) | ||||||||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||||||||
| for( size_t i = 0; i < getCellsData().size(); i++ ) | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| if( getCellsData()[i].data()->value != comparingTable.getCellsData()[i].data()->value ) | ||||||||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| void TableData::CellData::serialize( stdVector< buffer_unit_type > & out ) const | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| basicSerialization::serializePrimitive( type, out ); | ||||||||||||||||||||||||||||||||||||||||||||||
| basicSerialization::serializeString( value, out ); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| size_t TableData::CellData::getSerializedSize() const | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| return basicSerialization::sizeOfPrimitive( type ) + basicSerialization::sizeOfString( value ); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| size_t TableData::getSerializedSize() const | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| size_t totalSize =0; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| if( m_rows.empty()) | ||||||||||||||||||||||||||||||||||||||||||||||
| return totalSize; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| for( auto & row : m_rows ) | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| size_t rowSize = 0; | ||||||||||||||||||||||||||||||||||||||||||||||
| for( auto & cell : row ) | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| rowSize += cell.getSerializedSize(); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| totalSize += sizeof(size_t) + rowSize; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| return totalSize; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| void TableData::serialize( stdVector< buffer_unit_type > & serializedTableData ) const | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| if( m_rows.empty()) | ||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| for( auto & row : m_rows ) | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| { // pack row size; | ||||||||||||||||||||||||||||||||||||||||||||||
| size_t rowSize = 0; | ||||||||||||||||||||||||||||||||||||||||||||||
| for( auto const & cell : row ) | ||||||||||||||||||||||||||||||||||||||||||||||
| rowSize += cell.getSerializedSize(); | ||||||||||||||||||||||||||||||||||||||||||||||
| basicSerialization::serializePrimitive( rowSize, serializedTableData ); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| { // pack cells | ||||||||||||||||||||||||||||||||||||||||||||||
| for( auto const & cell : row ) | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| cell.serialize( serializedTableData ); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -180,4 +254,63 @@ TableData2D::TableDataHolder TableData2D::buildTableData( string_view targetUnit | |||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| return tableData1D; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| void basicSerialization::serializeString ( string const & data, stdVector< buffer_unit_type > & out ) | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| basicSerialization::serializePrimitive( data.size(), out ); | ||||||||||||||||||||||||||||||||||||||||||||||
| auto * begin = data.data(); | ||||||||||||||||||||||||||||||||||||||||||||||
| auto * end = begin + data.size(); | ||||||||||||||||||||||||||||||||||||||||||||||
| out.insert( out.end(), begin, end ); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| void basicSerialization::deserializeString( string & str, buffer_unit_type const * & ptr, buffer_unit_type const * end ) | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| string::size_type strSize = 0; | ||||||||||||||||||||||||||||||||||||||||||||||
| basicSerialization::deserializePrimitive( strSize, ptr, end ); | ||||||||||||||||||||||||||||||||||||||||||||||
| if( static_cast< long >(strSize) > std::distance( ptr, end ) ) | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| throw std::runtime_error( "buffer overflow reading string" ); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| str.assign( ptr, ptr + strSize ); | ||||||||||||||||||||||||||||||||||||||||||||||
| ptr += str.size(); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| bool tableDataSorting::positiveNumberStringComp( string_view s1, string_view s2 ) | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| auto split = []( string_view s, string & intPart, string & decPart ) | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| size_t dotPos = s.find( '.' ); | ||||||||||||||||||||||||||||||||||||||||||||||
| if( dotPos == string::npos ) | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| intPart = s; | ||||||||||||||||||||||||||||||||||||||||||||||
| decPart = ""; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| intPart = s.substr( 0, dotPos ); | ||||||||||||||||||||||||||||||||||||||||||||||
| decPart = s.substr( dotPos + 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| string s1Int, s1Dec, s2Int, s2Dec; | ||||||||||||||||||||||||||||||||||||||||||||||
| split( s1, s1Int, s1Dec ); | ||||||||||||||||||||||||||||||||||||||||||||||
| split( s2, s2Int, s2Dec ); | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| if( s1Int.length() != s2Int.length()) | ||||||||||||||||||||||||||||||||||||||||||||||
| return s1Int.length() < s2Int.length(); | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| if( s1Int != s2Int ) | ||||||||||||||||||||||||||||||||||||||||||||||
| return s1Int < s2Int; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| size_t minLen = std::min( s1Dec.length(), s2Dec.length()); | ||||||||||||||||||||||||||||||||||||||||||||||
| for( size_t i = 0; i < minLen; ++i ) | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| if( s1Dec[i] != s2Dec[i] ) | ||||||||||||||||||||||||||||||||||||||||||||||
| return s1Dec[i] < s2Dec[i]; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you show an example of how to use addRow when the number of arguments is runtime defined ?
For example reporting a table of phase / component / phase component properties...
where number of phases and components is runtime defined
.and row would have labels water density, gas density , comp1_massfrac, comp2_massfrac, comp3_massfrac , phasecompfrac_water_comp1,, phasecompfrac_water_comp2, phasecompfrac_comp3, ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got one here ->
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. What about reporting quantities at the newton iteration level ?