Skip to content

Commit 62fd167

Browse files
Merge branch 'develop' into feature_preconditioning
2 parents 982b649 + 3acda87 commit 62fd167

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
@@ -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.

Common/src/CConfig.cpp

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

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

84618460
/*--- Append the zone number if multizone problems ---*/
84628461
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)