Skip to content

Commit

Permalink
suffix in subfunctions
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfooted committed Aug 9, 2024
1 parent 92cc9cc commit acb72b3
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 24 deletions.
44 changes: 34 additions & 10 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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));
Expand All @@ -8320,22 +8329,32 @@ 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 {

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;
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions QuickStart/inv_NACA0012.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 6 additions & 4 deletions SU2_CFD/src/output/COutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions SU2_CFD/src/solvers/CBaselineSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,16 @@ void CBaselineSolver::SetOutputVariables(CGeometry *geometry, CConfig *config) {
} else {
filename = config->GetSolution_FileName();
}


//nijso
cout << "filename = "<<filename << endl;
/*--- Read only the number of variables in the restart file. ---*/

if (config->GetRead_Binary_Restart()) {

/*--- Multizone problems require the number of the zone to be appended. ---*/

filename = config->GetFilename(filename, ".dat", config->GetTimeIter());
cout << "filename = "<<filename << endl;

char fname[100];
strcpy(fname, filename.c_str());
Expand Down
8 changes: 4 additions & 4 deletions config_template.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2346,10 +2346,10 @@ MESH_BOX_OFFSET= (0.0, 0.0, 0.0)
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 tabular file format (TECPLOT, CSV)
TABULAR_FORMAT= CSV
Expand All @@ -2371,10 +2371,10 @@ CONV_FILENAME= history
BREAKDOWN_FILENAME= forces_breakdown.dat
%
% 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
Expand Down

0 comments on commit acb72b3

Please sign in to comment.