@@ -5571,10 +5571,8 @@ class CConfig {
55715571 string meshFilename = Mesh_FileName;
55725572
55735573 /* --- strip the extension, only if it is .su2 or .cgns ---*/
5574- auto extIndex = meshFilename.rfind (" .su2" );
5575- if (extIndex != std::string::npos) meshFilename.resize (extIndex);
5576- extIndex = meshFilename.rfind (" .cgns" );
5577- if (extIndex != std::string::npos) meshFilename.resize (extIndex);
5574+ PrintingToolbox::TrimExtension (" .su2" ,meshFilename);
5575+ PrintingToolbox::TrimExtension (" .cgns" ,meshFilename);
55785576
55795577 switch (GetMesh_FileFormat ()) {
55805578 case SU2:
@@ -5604,10 +5602,8 @@ class CConfig {
56045602 string meshFilename = Mesh_Out_FileName;
56055603
56065604 /* --- strip the extension, only if it is .su2 or .cgns ---*/
5607- auto extIndex = meshFilename.rfind (" .su2" );
5608- if (extIndex != std::string::npos) meshFilename.resize (extIndex);
5609- extIndex = meshFilename.rfind (" .cgns" );
5610- if (extIndex != std::string::npos) meshFilename.resize (extIndex);
5605+ PrintingToolbox::TrimExtension (" .su2" ,meshFilename);
5606+ PrintingToolbox::TrimExtension (" .cgns" ,meshFilename);
56115607
56125608 return meshFilename;
56135609 }
@@ -5621,10 +5617,8 @@ class CConfig {
56215617 string solutionFilename = Solution_FileName;
56225618
56235619 /* --- strip the extension, only if it is .dat or .csv ---*/
5624- auto extIndex = solutionFilename.rfind (" .dat" );
5625- if (extIndex != std::string::npos) solutionFilename.resize (extIndex);
5626- extIndex = solutionFilename.rfind (" .csv" );
5627- if (extIndex != std::string::npos) solutionFilename.resize (extIndex);
5620+ PrintingToolbox::TrimExtension (" .dat" ,solutionFilename);
5621+ PrintingToolbox::TrimExtension (" .csv" ,solutionFilename);
56285622
56295623 /* --- return the stripped filename base, without extension. ---*/
56305624 return solutionFilename;
@@ -5636,7 +5630,17 @@ class CConfig {
56365630 * \return Name of the file with the solution of the adjoint flow problem with
56375631 * drag objective function.
56385632 */
5639- string GetSolution_AdjFileName (void ) const { return Solution_AdjFileName; }
5633+ string GetSolution_AdjFileName (void ) const {
5634+ /* --- we keep the original Solution_FileName ---*/
5635+ string solutionAdjFilename = Solution_AdjFileName;
5636+
5637+ /* --- strip the extension, only if it is .dat or .csv ---*/
5638+ PrintingToolbox::TrimExtension (" .dat" ,solutionAdjFilename);
5639+ PrintingToolbox::TrimExtension (" .csv" ,solutionAdjFilename);
5640+
5641+ /* --- return the stripped filename base, without extension. ---*/
5642+ return solutionAdjFilename;
5643+ }
56405644
56415645 /* !
56425646 * \brief Get the format of the input/output grid.
@@ -5672,10 +5676,8 @@ class CConfig {
56725676 string historyFilename = Conv_FileName;
56735677
56745678 /* --- strip the extension, only if it is .dat or .csv ---*/
5675- auto extIndex = historyFilename.rfind (" .dat" );
5676- if (extIndex != std::string::npos) historyFilename.resize (extIndex);
5677- extIndex = historyFilename.rfind (" .csv" );
5678- if (extIndex != std::string::npos) historyFilename.resize (extIndex);
5679+ PrintingToolbox::TrimExtension (" .dat" , historyFilename);
5680+ PrintingToolbox::TrimExtension (" .csv" , historyFilename);
56795681
56805682 /* --- Multizone problems require the number of the zone to be appended. ---*/
56815683 if (GetMultizone_Problem ())
@@ -5706,10 +5708,8 @@ class CConfig {
57065708 string inletProfileFilename = Inlet_Filename;
57075709
57085710 /* --- strip the extension, only if it is .dat or .csv ---*/
5709- auto extIndex = inletProfileFilename.rfind (" .dat" );
5710- if (extIndex != std::string::npos) inletProfileFilename.resize (extIndex);
5711- extIndex = inletProfileFilename.rfind (" .csv" );
5712- if (extIndex != std::string::npos) inletProfileFilename.resize (extIndex);
5711+ PrintingToolbox::TrimExtension (" .dat" , inletProfileFilename);
5712+ PrintingToolbox::TrimExtension (" .csv" , inletProfileFilename);
57135713
57145714 /* --- Multizone problems require the number of the zone to be appended. ---*/
57155715 if (GetMultizone_Problem ())
@@ -5799,13 +5799,35 @@ class CConfig {
57995799 * \brief Get the name of the restart file for the flow variables.
58005800 * \return Name of the restart file for the flow variables.
58015801 */
5802- string GetRestart_FileName (void ) const { return Restart_FileName; }
5802+ string GetRestart_FileName (void ) const {
5803+
5804+ /* --- we keep the original Restart_FileName ---*/
5805+ string restartFilename = Restart_FileName;
5806+
5807+ /* --- strip the extension, only if it is .dat or .csv ---*/
5808+ PrintingToolbox::TrimExtension (" .dat" , restartFilename);
5809+ PrintingToolbox::TrimExtension (" .csv" , restartFilename);
5810+
5811+ /* --- return the stripped filename base, without extension. ---*/
5812+ return restartFilename;
5813+ }
58035814
58045815 /* !
58055816 * \brief Get the name of the restart file for the adjoint variables (drag objective function).
58065817 * \return Name of the restart file for the adjoint variables (drag objective function).
58075818 */
5808- string GetRestart_AdjFileName (void ) const { return Restart_AdjFileName; }
5819+ string GetRestart_AdjFileName (void ) const {
5820+
5821+ /* --- we keep the original Restart_FileName ---*/
5822+ string restartAdjFilename = Restart_AdjFileName;
5823+
5824+ /* --- strip the extension, only if it is .dat or .csv ---*/
5825+ PrintingToolbox::TrimExtension (" .dat" , restartAdjFilename);
5826+ PrintingToolbox::TrimExtension (" .csv" , restartAdjFilename);
5827+
5828+ /* --- return the stripped filename base, without extension. ---*/
5829+ return restartAdjFilename;
5830+ }
58095831
58105832 /* !
58115833 * \brief Get the name of the file with the adjoint variables.
@@ -5850,7 +5872,7 @@ class CConfig {
58505872 string GetVolSens_FileName (void ) const { return VolSens_FileName; }
58515873
58525874 /* !
5853- * \brief Augment the input filename with the iteration number for an unsteady file.
5875+ * \brief Append the input filename with the iteration number for an unsteady file.
58545876 * \param[in] val_filename - String value of the base filename.
58555877 * \param[in] val_iter - Unsteady iteration number or time instance.
58565878 * \param[in] ext - the filename extension.
0 commit comments