Skip to content

Commit 1ec9a81

Browse files
Merge branch 'develop' into feature_conductivity
2 parents 716c3b2 + 3acda87 commit 1ec9a81

File tree

3 files changed

+48
-27
lines changed

3 files changed

+48
-27
lines changed

Common/include/CConfig.hpp

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5616,10 +5616,8 @@ class CConfig {
56165616
string meshFilename = Mesh_FileName;
56175617

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

56245622
switch (GetMesh_FileFormat()) {
56255623
case SU2:
@@ -5649,10 +5647,8 @@ class CConfig {
56495647
string meshFilename = Mesh_Out_FileName;
56505648

56515649
/*--- strip the extension, only if it is .su2 or .cgns ---*/
5652-
auto extIndex = meshFilename.rfind(".su2");
5653-
if (extIndex != std::string::npos) meshFilename.resize(extIndex);
5654-
extIndex = meshFilename.rfind(".cgns");
5655-
if (extIndex != std::string::npos) meshFilename.resize(extIndex);
5650+
PrintingToolbox::TrimExtension(".su2",meshFilename);
5651+
PrintingToolbox::TrimExtension(".cgns",meshFilename);
56565652

56575653
return meshFilename;
56585654
}
@@ -5666,10 +5662,8 @@ class CConfig {
56665662
string solutionFilename = Solution_FileName;
56675663

56685664
/*--- strip the extension, only if it is .dat or .csv ---*/
5669-
auto extIndex = solutionFilename.rfind(".dat");
5670-
if (extIndex != std::string::npos) solutionFilename.resize(extIndex);
5671-
extIndex = solutionFilename.rfind(".csv");
5672-
if (extIndex != std::string::npos) solutionFilename.resize(extIndex);
5665+
PrintingToolbox::TrimExtension(".dat",solutionFilename);
5666+
PrintingToolbox::TrimExtension(".csv",solutionFilename);
56735667

56745668
/*--- return the stripped filename base, without extension. ---*/
56755669
return solutionFilename;
@@ -5681,7 +5675,17 @@ class CConfig {
56815675
* \return Name of the file with the solution of the adjoint flow problem with
56825676
* drag objective function.
56835677
*/
5684-
string GetSolution_AdjFileName(void) const { return Solution_AdjFileName; }
5678+
string GetSolution_AdjFileName(void) const {
5679+
/*--- we keep the original Solution_FileName ---*/
5680+
string solutionAdjFilename = Solution_AdjFileName;
5681+
5682+
/*--- strip the extension, only if it is .dat or .csv ---*/
5683+
PrintingToolbox::TrimExtension(".dat",solutionAdjFilename);
5684+
PrintingToolbox::TrimExtension(".csv",solutionAdjFilename);
5685+
5686+
/*--- return the stripped filename base, without extension. ---*/
5687+
return solutionAdjFilename;
5688+
}
56855689

56865690
/*!
56875691
* \brief Get the format of the input/output grid.
@@ -5717,10 +5721,8 @@ class CConfig {
57175721
string historyFilename = Conv_FileName;
57185722

57195723
/*--- strip the extension, only if it is .dat or .csv ---*/
5720-
auto extIndex = historyFilename.rfind(".dat");
5721-
if (extIndex != std::string::npos) historyFilename.resize(extIndex);
5722-
extIndex = historyFilename.rfind(".csv");
5723-
if (extIndex != std::string::npos) historyFilename.resize(extIndex);
5724+
PrintingToolbox::TrimExtension(".dat", historyFilename);
5725+
PrintingToolbox::TrimExtension(".csv", historyFilename);
57245726

57255727
/*--- Multizone problems require the number of the zone to be appended. ---*/
57265728
if (GetMultizone_Problem())
@@ -5751,10 +5753,8 @@ class CConfig {
57515753
string inletProfileFilename = Inlet_Filename;
57525754

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

57595759
/*--- Multizone problems require the number of the zone to be appended. ---*/
57605760
if (GetMultizone_Problem())
@@ -5844,13 +5844,35 @@ class CConfig {
58445844
* \brief Get the name of the restart file for the flow variables.
58455845
* \return Name of the restart file for the flow variables.
58465846
*/
5847-
string GetRestart_FileName(void) const { return Restart_FileName; }
5847+
string GetRestart_FileName(void) const {
5848+
5849+
/*--- we keep the original Restart_FileName ---*/
5850+
string restartFilename = Restart_FileName;
5851+
5852+
/*--- strip the extension, only if it is .dat or .csv ---*/
5853+
PrintingToolbox::TrimExtension(".dat", restartFilename);
5854+
PrintingToolbox::TrimExtension(".csv", restartFilename);
5855+
5856+
/*--- return the stripped filename base, without extension. ---*/
5857+
return restartFilename;
5858+
}
58485859

58495860
/*!
58505861
* \brief Get the name of the restart file for the adjoint variables (drag objective function).
58515862
* \return Name of the restart file for the adjoint variables (drag objective function).
58525863
*/
5853-
string GetRestart_AdjFileName(void) const { return Restart_AdjFileName; }
5864+
string GetRestart_AdjFileName(void) const {
5865+
5866+
/*--- we keep the original Restart_FileName ---*/
5867+
string restartAdjFilename = Restart_AdjFileName;
5868+
5869+
/*--- strip the extension, only if it is .dat or .csv ---*/
5870+
PrintingToolbox::TrimExtension(".dat", restartAdjFilename);
5871+
PrintingToolbox::TrimExtension(".csv", restartAdjFilename);
5872+
5873+
/*--- return the stripped filename base, without extension. ---*/
5874+
return restartAdjFilename;
5875+
}
58545876

58555877
/*!
58565878
* \brief Get the name of the file with the adjoint variables.
@@ -5895,7 +5917,7 @@ class CConfig {
58955917
string GetVolSens_FileName(void) const { return VolSens_FileName; }
58965918

58975919
/*!
5898-
* \brief Augment the input filename with the iteration number for an unsteady file.
5920+
* \brief Append the input filename with the iteration number for an unsteady file.
58995921
* \param[in] val_filename - String value of the base filename.
59005922
* \param[in] val_iter - Unsteady iteration number or time instance.
59015923
* \param[in] ext - the filename extension.

Common/src/CConfig.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8448,8 +8448,7 @@ CConfig::~CConfig() {
84488448
string CConfig::GetFilename(string filename, const string& ext, int timeIter) const {
84498449

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

84548453
/*--- Append the zone number if multizone problems ---*/
84558454
if (Multizone_Problem && Multizone_Adapt_FileName)

Common/src/grid_movement/CSurfaceMovement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5046,7 +5046,7 @@ void CSurfaceMovement::WriteFFDInfo(CSurfaceMovement** surface_movement, CGeomet
50465046
if (rank == MASTER_NODE) {
50475047
/*--- Read the name of the output file ---*/
50485048

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

50515051
output_file.precision(15);
50525052
output_file.open(str, ios::out | ios::app);

0 commit comments

Comments
 (0)