@@ -5572,10 +5572,8 @@ class CConfig {
55725572 string meshFilename = Mesh_FileName;
55735573
55745574 /* --- strip the extension, only if it is .su2 or .cgns ---*/
5575- auto extIndex = meshFilename.rfind (" .su2" );
5576- if (extIndex != std::string::npos) meshFilename.resize (extIndex);
5577- extIndex = meshFilename.rfind (" .cgns" );
5578- if (extIndex != std::string::npos) meshFilename.resize (extIndex);
5575+ PrintingToolbox::TrimExtension (" .su2" ,meshFilename);
5576+ PrintingToolbox::TrimExtension (" .cgns" ,meshFilename);
55795577
55805578 switch (GetMesh_FileFormat ()) {
55815579 case SU2:
@@ -5605,10 +5603,8 @@ class CConfig {
56055603 string meshFilename = Mesh_Out_FileName;
56065604
56075605 /* --- strip the extension, only if it is .su2 or .cgns ---*/
5608- auto extIndex = meshFilename.rfind (" .su2" );
5609- if (extIndex != std::string::npos) meshFilename.resize (extIndex);
5610- extIndex = meshFilename.rfind (" .cgns" );
5611- if (extIndex != std::string::npos) meshFilename.resize (extIndex);
5606+ PrintingToolbox::TrimExtension (" .su2" ,meshFilename);
5607+ PrintingToolbox::TrimExtension (" .cgns" ,meshFilename);
56125608
56135609 return meshFilename;
56145610 }
@@ -5622,10 +5618,8 @@ class CConfig {
56225618 string solutionFilename = Solution_FileName;
56235619
56245620 /* --- strip the extension, only if it is .dat or .csv ---*/
5625- auto extIndex = solutionFilename.rfind (" .dat" );
5626- if (extIndex != std::string::npos) solutionFilename.resize (extIndex);
5627- extIndex = solutionFilename.rfind (" .csv" );
5628- if (extIndex != std::string::npos) solutionFilename.resize (extIndex);
5621+ PrintingToolbox::TrimExtension (" .dat" ,solutionFilename);
5622+ PrintingToolbox::TrimExtension (" .csv" ,solutionFilename);
56295623
56305624 /* --- return the stripped filename base, without extension. ---*/
56315625 return solutionFilename;
@@ -5637,7 +5631,17 @@ class CConfig {
56375631 * \return Name of the file with the solution of the adjoint flow problem with
56385632 * drag objective function.
56395633 */
5640- string GetSolution_AdjFileName (void ) const { return Solution_AdjFileName; }
5634+ string GetSolution_AdjFileName (void ) const {
5635+ /* --- we keep the original Solution_FileName ---*/
5636+ string solutionAdjFilename = Solution_AdjFileName;
5637+
5638+ /* --- strip the extension, only if it is .dat or .csv ---*/
5639+ PrintingToolbox::TrimExtension (" .dat" ,solutionAdjFilename);
5640+ PrintingToolbox::TrimExtension (" .csv" ,solutionAdjFilename);
5641+
5642+ /* --- return the stripped filename base, without extension. ---*/
5643+ return solutionAdjFilename;
5644+ }
56415645
56425646 /* !
56435647 * \brief Get the format of the input/output grid.
@@ -5673,10 +5677,8 @@ class CConfig {
56735677 string historyFilename = Conv_FileName;
56745678
56755679 /* --- strip the extension, only if it is .dat or .csv ---*/
5676- auto extIndex = historyFilename.rfind (" .dat" );
5677- if (extIndex != std::string::npos) historyFilename.resize (extIndex);
5678- extIndex = historyFilename.rfind (" .csv" );
5679- if (extIndex != std::string::npos) historyFilename.resize (extIndex);
5680+ PrintingToolbox::TrimExtension (" .dat" , historyFilename);
5681+ PrintingToolbox::TrimExtension (" .csv" , historyFilename);
56805682
56815683 /* --- Multizone problems require the number of the zone to be appended. ---*/
56825684 if (GetMultizone_Problem ())
@@ -5707,10 +5709,8 @@ class CConfig {
57075709 string inletProfileFilename = Inlet_Filename;
57085710
57095711 /* --- strip the extension, only if it is .dat or .csv ---*/
5710- auto extIndex = inletProfileFilename.rfind (" .dat" );
5711- if (extIndex != std::string::npos) inletProfileFilename.resize (extIndex);
5712- extIndex = inletProfileFilename.rfind (" .csv" );
5713- if (extIndex != std::string::npos) inletProfileFilename.resize (extIndex);
5712+ PrintingToolbox::TrimExtension (" .dat" , inletProfileFilename);
5713+ PrintingToolbox::TrimExtension (" .csv" , inletProfileFilename);
57145714
57155715 /* --- Multizone problems require the number of the zone to be appended. ---*/
57165716 if (GetMultizone_Problem ())
@@ -5800,13 +5800,35 @@ class CConfig {
58005800 * \brief Get the name of the restart file for the flow variables.
58015801 * \return Name of the restart file for the flow variables.
58025802 */
5803- string GetRestart_FileName (void ) const { return Restart_FileName; }
5803+ string GetRestart_FileName (void ) const {
5804+
5805+ /* --- we keep the original Restart_FileName ---*/
5806+ string restartFilename = Restart_FileName;
5807+
5808+ /* --- strip the extension, only if it is .dat or .csv ---*/
5809+ PrintingToolbox::TrimExtension (" .dat" , restartFilename);
5810+ PrintingToolbox::TrimExtension (" .csv" , restartFilename);
5811+
5812+ /* --- return the stripped filename base, without extension. ---*/
5813+ return restartFilename;
5814+ }
58045815
58055816 /* !
58065817 * \brief Get the name of the restart file for the adjoint variables (drag objective function).
58075818 * \return Name of the restart file for the adjoint variables (drag objective function).
58085819 */
5809- string GetRestart_AdjFileName (void ) const { return Restart_AdjFileName; }
5820+ string GetRestart_AdjFileName (void ) const {
5821+
5822+ /* --- we keep the original Restart_FileName ---*/
5823+ string restartAdjFilename = Restart_AdjFileName;
5824+
5825+ /* --- strip the extension, only if it is .dat or .csv ---*/
5826+ PrintingToolbox::TrimExtension (" .dat" , restartAdjFilename);
5827+ PrintingToolbox::TrimExtension (" .csv" , restartAdjFilename);
5828+
5829+ /* --- return the stripped filename base, without extension. ---*/
5830+ return restartAdjFilename;
5831+ }
58105832
58115833 /* !
58125834 * \brief Get the name of the file with the adjoint variables.
@@ -5851,7 +5873,7 @@ class CConfig {
58515873 string GetVolSens_FileName (void ) const { return VolSens_FileName; }
58525874
58535875 /* !
5854- * \brief Augment the input filename with the iteration number for an unsteady file.
5876+ * \brief Append the input filename with the iteration number for an unsteady file.
58555877 * \param[in] val_filename - String value of the base filename.
58565878 * \param[in] val_iter - Unsteady iteration number or time instance.
58575879 * \param[in] ext - the filename extension.
0 commit comments