@@ -5564,10 +5564,8 @@ class CConfig {
55645564 string meshFilename = Mesh_FileName;
55655565
55665566 /* --- strip the extension, only if it is .su2 or .cgns ---*/
5567- auto extIndex = meshFilename.rfind (" .su2" );
5568- if (extIndex != std::string::npos) meshFilename.resize (extIndex);
5569- extIndex = meshFilename.rfind (" .cgns" );
5570- if (extIndex != std::string::npos) meshFilename.resize (extIndex);
5567+ PrintingToolbox::TrimExtension (" .su2" ,meshFilename);
5568+ PrintingToolbox::TrimExtension (" .cgns" ,meshFilename);
55715569
55725570 switch (GetMesh_FileFormat ()) {
55735571 case SU2:
@@ -5597,10 +5595,8 @@ class CConfig {
55975595 string meshFilename = Mesh_Out_FileName;
55985596
55995597 /* --- strip the extension, only if it is .su2 or .cgns ---*/
5600- auto extIndex = meshFilename.rfind (" .su2" );
5601- if (extIndex != std::string::npos) meshFilename.resize (extIndex);
5602- extIndex = meshFilename.rfind (" .cgns" );
5603- if (extIndex != std::string::npos) meshFilename.resize (extIndex);
5598+ PrintingToolbox::TrimExtension (" .su2" ,meshFilename);
5599+ PrintingToolbox::TrimExtension (" .cgns" ,meshFilename);
56045600
56055601 return meshFilename;
56065602 }
@@ -5614,10 +5610,8 @@ class CConfig {
56145610 string solutionFilename = Solution_FileName;
56155611
56165612 /* --- strip the extension, only if it is .dat or .csv ---*/
5617- auto extIndex = solutionFilename.rfind (" .dat" );
5618- if (extIndex != std::string::npos) solutionFilename.resize (extIndex);
5619- extIndex = solutionFilename.rfind (" .csv" );
5620- if (extIndex != std::string::npos) solutionFilename.resize (extIndex);
5613+ PrintingToolbox::TrimExtension (" .dat" ,solutionFilename);
5614+ PrintingToolbox::TrimExtension (" .csv" ,solutionFilename);
56215615
56225616 /* --- return the stripped filename base, without extension. ---*/
56235617 return solutionFilename;
@@ -5629,7 +5623,17 @@ class CConfig {
56295623 * \return Name of the file with the solution of the adjoint flow problem with
56305624 * drag objective function.
56315625 */
5632- string GetSolution_AdjFileName (void ) const { return Solution_AdjFileName; }
5626+ string GetSolution_AdjFileName (void ) const {
5627+ /* --- we keep the original Solution_FileName ---*/
5628+ string solutionAdjFilename = Solution_AdjFileName;
5629+
5630+ /* --- strip the extension, only if it is .dat or .csv ---*/
5631+ PrintingToolbox::TrimExtension (" .dat" ,solutionAdjFilename);
5632+ PrintingToolbox::TrimExtension (" .csv" ,solutionAdjFilename);
5633+
5634+ /* --- return the stripped filename base, without extension. ---*/
5635+ return solutionAdjFilename;
5636+ }
56335637
56345638 /* !
56355639 * \brief Get the format of the input/output grid.
@@ -5665,10 +5669,8 @@ class CConfig {
56655669 string historyFilename = Conv_FileName;
56665670
56675671 /* --- strip the extension, only if it is .dat or .csv ---*/
5668- auto extIndex = historyFilename.rfind (" .dat" );
5669- if (extIndex != std::string::npos) historyFilename.resize (extIndex);
5670- extIndex = historyFilename.rfind (" .csv" );
5671- if (extIndex != std::string::npos) historyFilename.resize (extIndex);
5672+ PrintingToolbox::TrimExtension (" .dat" , historyFilename);
5673+ PrintingToolbox::TrimExtension (" .csv" , historyFilename);
56725674
56735675 /* --- Multizone problems require the number of the zone to be appended. ---*/
56745676 if (GetMultizone_Problem ())
@@ -5699,10 +5701,8 @@ class CConfig {
56995701 string inletProfileFilename = Inlet_Filename;
57005702
57015703 /* --- strip the extension, only if it is .dat or .csv ---*/
5702- auto extIndex = inletProfileFilename.rfind (" .dat" );
5703- if (extIndex != std::string::npos) inletProfileFilename.resize (extIndex);
5704- extIndex = inletProfileFilename.rfind (" .csv" );
5705- if (extIndex != std::string::npos) inletProfileFilename.resize (extIndex);
5704+ PrintingToolbox::TrimExtension (" .dat" , inletProfileFilename);
5705+ PrintingToolbox::TrimExtension (" .csv" , inletProfileFilename);
57065706
57075707 /* --- Multizone problems require the number of the zone to be appended. ---*/
57085708 if (GetMultizone_Problem ())
@@ -5792,13 +5792,35 @@ class CConfig {
57925792 * \brief Get the name of the restart file for the flow variables.
57935793 * \return Name of the restart file for the flow variables.
57945794 */
5795- string GetRestart_FileName (void ) const { return Restart_FileName; }
5795+ string GetRestart_FileName (void ) const {
5796+
5797+ /* --- we keep the original Restart_FileName ---*/
5798+ string restartFilename = Restart_FileName;
5799+
5800+ /* --- strip the extension, only if it is .dat or .csv ---*/
5801+ PrintingToolbox::TrimExtension (" .dat" , restartFilename);
5802+ PrintingToolbox::TrimExtension (" .csv" , restartFilename);
5803+
5804+ /* --- return the stripped filename base, without extension. ---*/
5805+ return restartFilename;
5806+ }
57965807
57975808 /* !
57985809 * \brief Get the name of the restart file for the adjoint variables (drag objective function).
57995810 * \return Name of the restart file for the adjoint variables (drag objective function).
58005811 */
5801- string GetRestart_AdjFileName (void ) const { return Restart_AdjFileName; }
5812+ string GetRestart_AdjFileName (void ) const {
5813+
5814+ /* --- we keep the original Restart_FileName ---*/
5815+ string restartAdjFilename = Restart_AdjFileName;
5816+
5817+ /* --- strip the extension, only if it is .dat or .csv ---*/
5818+ PrintingToolbox::TrimExtension (" .dat" , restartAdjFilename);
5819+ PrintingToolbox::TrimExtension (" .csv" , restartAdjFilename);
5820+
5821+ /* --- return the stripped filename base, without extension. ---*/
5822+ return restartAdjFilename;
5823+ }
58025824
58035825 /* !
58045826 * \brief Get the name of the file with the adjoint variables.
@@ -5843,7 +5865,7 @@ class CConfig {
58435865 string GetVolSens_FileName (void ) const { return VolSens_FileName; }
58445866
58455867 /* !
5846- * \brief Augment the input filename with the iteration number for an unsteady file.
5868+ * \brief Append the input filename with the iteration number for an unsteady file.
58475869 * \param[in] val_filename - String value of the base filename.
58485870 * \param[in] val_iter - Unsteady iteration number or time instance.
58495871 * \param[in] ext - the filename extension.
0 commit comments