-
Notifications
You must be signed in to change notification settings - Fork 89
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
PVT Tables logging improvements #3003
Conversation
…dudes/table-layout
…feature/dudes/table-layout" This reverts commit 8f74cfa.
…nto feature/dudes/table-layout
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.
Some refactor suggestions
|
||
if( printInCsv || ( printInLog && m_CO2EnthalpyTable->numDimensions() >= 3 ) ) | ||
{ | ||
m_CO2EnthalpyTable->printInCSV( m_CO2EnthalpyTable->getName() ); | ||
m_brineEnthalpyTable->printInCSV( m_brineEnthalpyTable->getName() ); | ||
} | ||
if( printInLog && m_CO2EnthalpyTable->numDimensions() <= 2 ) | ||
{ | ||
m_CO2EnthalpyTable->print( m_CO2EnthalpyTable->getName() ); | ||
m_brineEnthalpyTable->print( m_brineEnthalpyTable->getName() ); | ||
m_CO2EnthalpyTable->printInLog( m_CO2EnthalpyTable->getName() ); | ||
m_brineEnthalpyTable->printInLog( m_brineEnthalpyTable->getName() ); | ||
} |
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.
Here, you are assuming that m_CO2EnthalpyTable
and m_brineEnthalpyTable
have the same dimensions. m_CO2EnthalpyTable
is "choosing" the formatting for m_brineEnthalpyTable
.
But this assomption is wrong, they does not have the same layout !
You could do two if
for each tables, or you could create a function that factorize this choice, something like TableFunction::print( bool printInCsv, bool printInLog )
.
Factorizing can be a good thing as there we need 13 of these conditions.
bool isClone = true; | ||
if( getParent().getName() == "Constitutive" ) | ||
{ | ||
string sectionOutput; | ||
string sectionName = "Section : PVT Table generation"; | ||
|
||
sectionOutput = GEOS_FMT( "\n{:=^{}}\n", "=", sectionName.size() + 5 ); | ||
sectionOutput += GEOS_FMT( "{:^{}}\n", sectionName, sectionName.size() + 5 ); | ||
sectionOutput += GEOS_FMT( "{:=^{}}\n\n", "=", sectionName.size() + 5 ); | ||
|
||
std::cout << sectionOutput; | ||
|
||
isClone = 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.
Can we do this job without this if ? The relation with the "Constitutive" parent is external to this class. If possible, I think that doing with your isClone
parameter is clearer and more maintainable.
string sectionName = "Section : PVT Table generation"; | ||
|
||
sectionOutput = GEOS_FMT( "\n{:=^{}}\n", "=", sectionName.size() + 5 ); | ||
sectionOutput += GEOS_FMT( "{:^{}}\n", sectionName, sectionName.size() + 5 ); | ||
sectionOutput += GEOS_FMT( "{:=^{}}\n\n", "=", sectionName.size() + 5 ); | ||
|
||
std::cout << sectionOutput; |
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.
Just a reminder to keep that in mind, those sections layout will need to be factorized in a dedicated PR.
This PR follows the #2984 that aim to standardize logs.
Currently PVT tables are only accessible throught .csv files.
In this PR, logs will indicate which csv files are generated along with their associate path
In addition to csv files, PVT Tables with dimensions n <= 2 can be written in log by meetings 2 conditions :