Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
70 changes: 46 additions & 24 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5564,10 +5564,8 @@ class CConfig {
string meshFilename = Mesh_FileName;

/*--- strip the extension, only if it is .su2 or .cgns ---*/
auto extIndex = meshFilename.rfind(".su2");
if (extIndex != std::string::npos) meshFilename.resize(extIndex);
extIndex = meshFilename.rfind(".cgns");
if (extIndex != std::string::npos) meshFilename.resize(extIndex);
PrintingToolbox::TrimExtension(".su2",meshFilename);
PrintingToolbox::TrimExtension(".cgns",meshFilename);

switch (GetMesh_FileFormat()) {
case SU2:
Expand Down Expand Up @@ -5597,10 +5595,8 @@ class CConfig {
string meshFilename = Mesh_Out_FileName;

/*--- strip the extension, only if it is .su2 or .cgns ---*/
auto extIndex = meshFilename.rfind(".su2");
if (extIndex != std::string::npos) meshFilename.resize(extIndex);
extIndex = meshFilename.rfind(".cgns");
if (extIndex != std::string::npos) meshFilename.resize(extIndex);
PrintingToolbox::TrimExtension(".su2",meshFilename);
PrintingToolbox::TrimExtension(".cgns",meshFilename);

return meshFilename;
}
Expand All @@ -5614,10 +5610,8 @@ class CConfig {
string solutionFilename = Solution_FileName;

/*--- strip the extension, only if it is .dat or .csv ---*/
auto extIndex = solutionFilename.rfind(".dat");
if (extIndex != std::string::npos) solutionFilename.resize(extIndex);
extIndex = solutionFilename.rfind(".csv");
if (extIndex != std::string::npos) solutionFilename.resize(extIndex);
PrintingToolbox::TrimExtension(".dat",solutionFilename);
PrintingToolbox::TrimExtension(".csv",solutionFilename);

/*--- return the stripped filename base, without extension. ---*/
return solutionFilename;
Expand All @@ -5629,7 +5623,17 @@ class CConfig {
* \return Name of the file with the solution of the adjoint flow problem with
* drag objective function.
*/
string GetSolution_AdjFileName(void) const { return Solution_AdjFileName; }
string GetSolution_AdjFileName(void) const {
/*--- we keep the original Solution_FileName ---*/
string solutionAdjFilename = Solution_AdjFileName;

/*--- strip the extension, only if it is .dat or .csv ---*/
PrintingToolbox::TrimExtension(".dat",solutionAdjFilename);
PrintingToolbox::TrimExtension(".csv",solutionAdjFilename);

/*--- return the stripped filename base, without extension. ---*/
return solutionAdjFilename;
}

/*!
* \brief Get the format of the input/output grid.
Expand Down Expand Up @@ -5665,10 +5669,8 @@ class CConfig {
string historyFilename = Conv_FileName;

/*--- strip the extension, only if it is .dat or .csv ---*/
auto extIndex = historyFilename.rfind(".dat");
if (extIndex != std::string::npos) historyFilename.resize(extIndex);
extIndex = historyFilename.rfind(".csv");
if (extIndex != std::string::npos) historyFilename.resize(extIndex);
PrintingToolbox::TrimExtension(".dat", historyFilename);
PrintingToolbox::TrimExtension(".csv", historyFilename);

/*--- Multizone problems require the number of the zone to be appended. ---*/
if (GetMultizone_Problem())
Expand Down Expand Up @@ -5699,10 +5701,8 @@ class CConfig {
string inletProfileFilename = Inlet_Filename;

/*--- strip the extension, only if it is .dat or .csv ---*/
auto extIndex = inletProfileFilename.rfind(".dat");
if (extIndex != std::string::npos) inletProfileFilename.resize(extIndex);
extIndex = inletProfileFilename.rfind(".csv");
if (extIndex != std::string::npos) inletProfileFilename.resize(extIndex);
PrintingToolbox::TrimExtension(".dat", inletProfileFilename);
PrintingToolbox::TrimExtension(".csv", inletProfileFilename);

/*--- Multizone problems require the number of the zone to be appended. ---*/
if (GetMultizone_Problem())
Expand Down Expand Up @@ -5792,13 +5792,35 @@ class CConfig {
* \brief Get the name of the restart file for the flow variables.
* \return Name of the restart file for the flow variables.
*/
string GetRestart_FileName(void) const { return Restart_FileName; }
string GetRestart_FileName(void) const {

/*--- we keep the original Restart_FileName ---*/
string restartFilename = Restart_FileName;

/*--- strip the extension, only if it is .dat or .csv ---*/
PrintingToolbox::TrimExtension(".dat", restartFilename);
PrintingToolbox::TrimExtension(".csv", restartFilename);

/*--- return the stripped filename base, without extension. ---*/
return restartFilename;
}

/*!
* \brief Get the name of the restart file for the adjoint variables (drag objective function).
* \return Name of the restart file for the adjoint variables (drag objective function).
*/
string GetRestart_AdjFileName(void) const { return Restart_AdjFileName; }
string GetRestart_AdjFileName(void) const {

/*--- we keep the original Restart_FileName ---*/
string restartAdjFilename = Restart_AdjFileName;

/*--- strip the extension, only if it is .dat or .csv ---*/
PrintingToolbox::TrimExtension(".dat", restartAdjFilename);
PrintingToolbox::TrimExtension(".csv", restartAdjFilename);

/*--- return the stripped filename base, without extension. ---*/
return restartAdjFilename;
}

/*!
* \brief Get the name of the file with the adjoint variables.
Expand Down Expand Up @@ -5843,7 +5865,7 @@ class CConfig {
string GetVolSens_FileName(void) const { return VolSens_FileName; }

/*!
* \brief Augment the input filename with the iteration number for an unsteady file.
* \brief Append the input filename with the iteration number for an unsteady file.
* \param[in] val_filename - String value of the base filename.
* \param[in] val_iter - Unsteady iteration number or time instance.
* \param[in] ext - the filename extension.
Expand Down
3 changes: 1 addition & 2 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8452,8 +8452,7 @@ CConfig::~CConfig() {
string CConfig::GetFilename(string filename, const string& ext, int timeIter) const {

/*--- strip the extension in case it is still there ---*/
auto extIndex = filename.rfind(ext);
if (extIndex != std::string::npos) filename.resize(extIndex);
PrintingToolbox::TrimExtension(ext, filename);

/*--- Append the zone number if multizone problems ---*/
if (Multizone_Problem && Multizone_Adapt_FileName)
Expand Down
2 changes: 1 addition & 1 deletion Common/src/grid_movement/CSurfaceMovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5046,7 +5046,7 @@ void CSurfaceMovement::WriteFFDInfo(CSurfaceMovement** surface_movement, CGeomet
if (rank == MASTER_NODE) {
/*--- Read the name of the output file ---*/

auto str = config[ZONE_0]->GetMesh_Out_FileName();
auto str = config[ZONE_0]->GetMesh_Out_FileName() + ".su2";

output_file.precision(15);
output_file.open(str, ios::out | ios::app);
Expand Down