From acb72b3cdead82dfe726229ec0112a8b55eb8731 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 9 Aug 2024 22:00:49 +0200 Subject: [PATCH] suffix in subfunctions --- Common/src/CConfig.cpp | 44 +++++++++++++++++++------ QuickStart/inv_NACA0012.cfg | 8 ++--- SU2_CFD/src/output/COutput.cpp | 10 +++--- SU2_CFD/src/solvers/CBaselineSolver.cpp | 5 +-- config_template.cfg | 8 ++--- 5 files changed, 51 insertions(+), 24 deletions(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 4e7a651d07a..ab55fa20df5 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -8262,9 +8262,8 @@ string CConfig::GetFilename(string filename, const string& ext, int timeIter) co filename = GetMultiInstance_FileName(filename, GetiInst(), ext); /*--- Append the iteration number for unsteady problems ---*/ - if (GetTime_Domain()){ + if (GetTime_Domain()) filename = GetUnsteady_FileName(filename, timeIter, ext); - } return filename; } @@ -8281,6 +8280,11 @@ string CConfig::GetUnsteady_FileName(string val_filename, int val_iter, const st string UnstExt, UnstFilename = std::move(val_filename); char buffer[50]; + /*--- Note that we always call this routine wit the extension already attached, so + we remove it. ---*/ + unsigned short lastindex = UnstFilename.find_last_of('.'); + UnstFilename = UnstFilename.substr(0, lastindex); + /*--- Check that a positive value iteration is requested (for now). ---*/ if (val_iter < 0) { @@ -8309,6 +8313,11 @@ string CConfig::GetMultizone_FileName(string val_filename, int val_iZone, const string multizone_filename = std::move(val_filename); char buffer[50]; + /*--- Note that we always call this routine wit the extension already attached, so + we remove it. ---*/ + unsigned short lastindex = multizone_filename.find_last_of('.'); + multizone_filename = multizone_filename.substr(0, lastindex); + if (Multizone_Problem) { SPRINTF (buffer, "_%d", SU2_TYPE::Int(val_iZone)); multizone_filename.append(string(buffer)); @@ -8320,15 +8329,20 @@ string CConfig::GetMultizone_FileName(string val_filename, int val_iZone, const string CConfig::GetMultizone_HistoryFileName(string val_filename, int val_iZone, const string& ext) const { - string multizone_filename = std::move(val_filename); - char buffer[50]; + string multizone_filename = std::move(val_filename); + char buffer[50]; - if (Multizone_Problem) { - SPRINTF (buffer, "_%d", SU2_TYPE::Int(val_iZone)); - multizone_filename.append(string(buffer)); - } - multizone_filename += ext; - return multizone_filename; + /*--- Note that we always call this routine wit the extension already attached, so + we remove it. ---*/ + unsigned short lastindex = multizone_filename.find_last_of('.'); + multizone_filename = multizone_filename.substr(0, lastindex); + + if (Multizone_Problem) { + SPRINTF (buffer, "_%d", SU2_TYPE::Int(val_iZone)); + multizone_filename.append(string(buffer)); + } + multizone_filename += ext; + return multizone_filename; } string CConfig::GetMultiInstance_FileName(string val_filename, int val_iInst, const string& ext) const { @@ -8336,6 +8350,11 @@ string CConfig::GetMultiInstance_FileName(string val_filename, int val_iInst, co string multizone_filename = std::move(val_filename); char buffer[50]; + /*--- Note that we always call this routine wit the extension already attached, so + we remove it. ---*/ + unsigned short lastindex = multizone_filename.find_last_of('.'); + multizone_filename = multizone_filename.substr(0, lastindex); + SPRINTF (buffer, "_%d", SU2_TYPE::Int(val_iInst)); multizone_filename.append(string(buffer)); multizone_filename += ext; @@ -8347,6 +8366,11 @@ string CConfig::GetMultiInstance_HistoryFileName(string val_filename, int val_iI string multizone_filename = std::move(val_filename); char buffer[50]; + /*--- Note that we always call this routine wit the extension already attached, so + we remove it. ---*/ + unsigned short lastindex = multizone_filename.find_last_of('.'); + multizone_filename = multizone_filename.substr(0, lastindex); + SPRINTF (buffer, "_%d", SU2_TYPE::Int(val_iInst)); multizone_filename.append(string(buffer)); multizone_filename += ext; diff --git a/QuickStart/inv_NACA0012.cfg b/QuickStart/inv_NACA0012.cfg index 27047c9f60a..393469ed3f5 100644 --- a/QuickStart/inv_NACA0012.cfg +++ b/QuickStart/inv_NACA0012.cfg @@ -250,10 +250,10 @@ MESH_FORMAT= SU2 MESH_OUT_FILENAME= mesh_out.su2 % % Restart flow input file -SOLUTION_FILENAME= solution_flow.dat +SOLUTION_FILENAME= solution_flow % % Restart adjoint input file -SOLUTION_ADJ_FILENAME= solution_adj.dat +SOLUTION_ADJ_FILENAME= solution_adj % % Output file format (TECPLOT, CSV) TABULAR_FORMAT= CSV @@ -262,10 +262,10 @@ TABULAR_FORMAT= CSV CONV_FILENAME= history % % Output file restart flow -RESTART_FILENAME= restart_flow.dat +RESTART_FILENAME= restart_flow % % Output file restart adjoint -RESTART_ADJ_FILENAME= restart_adj.dat +RESTART_ADJ_FILENAME= restart_adj % % Output file flow (w/o extension) variables VOLUME_FILENAME= flow diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index d0155abeae7..887cee9688a 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -70,15 +70,17 @@ COutput::COutput(const CConfig *config, unsigned short ndim, bool fem_output): volumeFilename = "volume"; restartFilename = "restart"; - /*--- Retrieve the history filename ---*/ - historyFilename = config->GetConv_FileName(); /*--- Add the correct file extension depending on the file format ---*/ string hist_ext = ".csv"; if (config->GetTabular_FileFormat() == TAB_OUTPUT::TAB_TECPLOT) hist_ext = ".dat"; + /*--- Retrieve the history filename ---*/ + + historyFilename = config->GetConv_FileName() + string(hist_ext); + /*--- Append the zone ID ---*/ historyFilename = config->GetMultizone_HistoryFileName(historyFilename, config->GetiZone(), hist_ext); @@ -169,7 +171,7 @@ COutput::COutput(const CConfig *config, unsigned short ndim, bool fem_output): volumeDataSorter = nullptr; surfaceDataSorter = nullptr; - headerNeeded = false; + headerNeeded = false; } COutput::~COutput() { @@ -233,7 +235,7 @@ void COutput::SetHistoryOutput(CGeometry ****geometry, CSolver *****solver, CCon if (config[ZONE_0]->GetMultizone_Problem()) Iter = OuterIter; - + /*--- Turbomachinery Performance Screen summary output---*/ if (Iter%100 == 0 && rank == MASTER_NODE) { SetTurboPerformance_Output(TurboPerf, config[val_iZone], TimeIter, OuterIter, InnerIter); diff --git a/SU2_CFD/src/solvers/CBaselineSolver.cpp b/SU2_CFD/src/solvers/CBaselineSolver.cpp index 411cce58397..6effc2e57cf 100644 --- a/SU2_CFD/src/solvers/CBaselineSolver.cpp +++ b/SU2_CFD/src/solvers/CBaselineSolver.cpp @@ -91,8 +91,8 @@ void CBaselineSolver::SetOutputVariables(CGeometry *geometry, CConfig *config) { } else { filename = config->GetSolution_FileName(); } - - + //nijso + cout << "filename = "<GetRead_Binary_Restart()) { @@ -100,6 +100,7 @@ void CBaselineSolver::SetOutputVariables(CGeometry *geometry, CConfig *config) { /*--- Multizone problems require the number of the zone to be appended. ---*/ filename = config->GetFilename(filename, ".dat", config->GetTimeIter()); + cout << "filename = "<