Skip to content

Commit 77a972e

Browse files
committed
cleanup some SU2 header priting code
1 parent edccf5c commit 77a972e

3 files changed

Lines changed: 44 additions & 47 deletions

File tree

Common/src/CConfig.cpp

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3226,41 +3226,41 @@ bool CConfig::SetRunTime_Parsing(char case_filename[MAX_STRING_SIZE]) {
32263226

32273227
void CConfig::SetHeader(SU2_COMPONENT val_software) const{
32283228

3229-
if ((iZone == 0) && (rank == MASTER_NODE)){
3230-
cout << endl << "-------------------------------------------------------------------------" << endl;
3231-
cout << "| ___ _ _ ___ |" << endl;
3232-
cout << "| / __| | | |_ ) Release 7.5.1 \"Blackbird\" |" << endl;
3233-
cout << "| \\__ \\ |_| |/ / |" << endl;
3229+
if ((iZone == 0) && (rank == MASTER_NODE)) {
3230+
cout << "\n";
3231+
cout << "-------------------------------------------------------------------------\n";
3232+
cout << "| ___ _ _ ___ |\n";
3233+
cout << "| / __| | | |_ ) Release 7.5.1 \"Blackbird\" |\n";
3234+
cout << "| \\__ \\ |_| |/ / |\n";
32343235
switch (val_software) {
3235-
case SU2_COMPONENT::SU2_CFD: cout << "| |___/\\___//___| Suite (Computational Fluid Dynamics Code) |" << endl; break;
3236-
case SU2_COMPONENT::SU2_DEF: cout << "| |___/\\___//___| Suite (Mesh Deformation Code) |" << endl; break;
3237-
case SU2_COMPONENT::SU2_DOT: cout << "| |___/\\___//___| Suite (Gradient Projection Code) |" << endl; break;
3238-
case SU2_COMPONENT::SU2_GEO: cout << "| |___/\\___//___| Suite (Geometry Definition Code) |" << endl; break;
3239-
case SU2_COMPONENT::SU2_SOL: cout << "| |___/\\___//___| Suite (Solution Exporting Code) |" << endl; break;
3240-
}
3241-
3242-
cout << "| |" << endl;
3243-
cout <<"-------------------------------------------------------------------------" << endl;
3244-
cout << "| SU2 Project Website: https://su2code.github.io |" << endl;
3245-
cout << "| |" << endl;
3246-
cout << "| The SU2 Project is maintained by the SU2 Foundation |" << endl;
3247-
cout << "| (http://su2foundation.org) |" << endl;
3248-
cout <<"-------------------------------------------------------------------------" << endl;
3249-
cout << "| Copyright 2012-2023, SU2 Contributors |" << endl;
3250-
cout << "| |" << endl;
3251-
cout << "| SU2 is free software; you can redistribute it and/or |" << endl;
3252-
cout << "| modify it under the terms of the GNU Lesser General Public |" << endl;
3253-
cout << "| License as published by the Free Software Foundation; either |" << endl;
3254-
cout << "| version 2.1 of the License, or (at your option) any later version. |" << endl;
3255-
cout << "| |" << endl;
3256-
cout << "| SU2 is distributed in the hope that it will be useful, |" << endl;
3257-
cout << "| but WITHOUT ANY WARRANTY; without even the implied warranty of |" << endl;
3258-
cout << "| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |" << endl;
3259-
cout << "| Lesser General Public License for more details. |" << endl;
3260-
cout << "| |" << endl;
3261-
cout << "| You should have received a copy of the GNU Lesser General Public |" << endl;
3262-
cout << "| License along with SU2. If not, see <http://www.gnu.org/licenses/>. |" << endl;
3263-
cout <<"-------------------------------------------------------------------------" << endl;
3236+
case SU2_COMPONENT::SU2_CFD: cout << "| |___/\\___//___| Suite (Computational Fluid Dynamics Code) |\n"; break;
3237+
case SU2_COMPONENT::SU2_DEF: cout << "| |___/\\___//___| Suite (Mesh Deformation Code) |\n"; break;
3238+
case SU2_COMPONENT::SU2_DOT: cout << "| |___/\\___//___| Suite (Gradient Projection Code) |\n"; break;
3239+
case SU2_COMPONENT::SU2_GEO: cout << "| |___/\\___//___| Suite (Geometry Definition Code) |\n"; break;
3240+
case SU2_COMPONENT::SU2_SOL: cout << "| |___/\\___//___| Suite (Solution Exporting Code) |\n"; break;
3241+
}
3242+
cout << "| |\n";
3243+
cout << "-------------------------------------------------------------------------\n";
3244+
cout << "| SU2 Project Website: https://su2code.github.io |\n";
3245+
cout << "| |\n";
3246+
cout << "| The SU2 Project is maintained by the SU2 Foundation |\n";
3247+
cout << "| (http://su2foundation.org) |\n";
3248+
cout << "-------------------------------------------------------------------------\n";
3249+
cout << "| Copyright 2012-2023, SU2 Contributors |\n";
3250+
cout << "| |\n";
3251+
cout << "| SU2 is free software; you can redistribute it and/or |\n";
3252+
cout << "| modify it under the terms of the GNU Lesser General Public |\n";
3253+
cout << "| License as published by the Free Software Foundation; either |\n";
3254+
cout << "| version 2.1 of the License, or (at your option) any later version. |\n";
3255+
cout << "| |\n";
3256+
cout << "| SU2 is distributed in the hope that it will be useful, |\n";
3257+
cout << "| but WITHOUT ANY WARRANTY; without even the implied warranty of |\n";
3258+
cout << "| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |\n";
3259+
cout << "| Lesser General Public License for more details. |\n";
3260+
cout << "| |\n";
3261+
cout << "| You should have received a copy of the GNU Lesser General Public |\n";
3262+
cout << "| License along with SU2. If not, see <http://www.gnu.org/licenses/>. |\n";
3263+
cout << "-------------------------------------------------------------------------" << endl;
32643264
}
32653265

32663266
}

SU2_CFD/src/output/CFlowOutput.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ void CFlowOutput::LoadHistoryDataScalar(const CConfig* config, const CSolver* co
12391239

12401240
void CFlowOutput::SetVolumeOutputFieldsScalarSolution(const CConfig* config){
12411241
/*--- Only place outputs of the "SOLUTION" group here. ---*/
1242-
1242+
12431243
switch (TurbModelFamily(config->GetKind_Turb_Model())) {
12441244
case TURB_FAMILY::SA:
12451245
AddVolumeOutput("NU_TILDE", "Nu_Tilde", "SOLUTION", "Spalart-Allmaras variable");
@@ -2594,13 +2594,13 @@ void CFlowOutput::WriteForcesBreakdown(const CConfig* config, const CSolver* flo
25942594
ofstream file;
25952595
file.open(fileName);
25962596

2597-
file << "\n-------------------------------------------------------------------------\n";
2597+
file << "\n";
2598+
file << "-------------------------------------------------------------------------\n";
25982599
file << "| ___ _ _ ___ |\n";
25992600
file << "| / __| | | |_ ) Release 7.5.1 \"Blackbird\" |\n";
26002601
file << "| \\__ \\ |_| |/ / |\n";
26012602
file << "| |___/\\___//___| Suite (Computational Fluid Dynamics Code) |\n";
26022603
file << "| |\n";
2603-
// file << "| Local date and time: " << dt << " |\n";
26042604
file << "-------------------------------------------------------------------------\n";
26052605
file << "| SU2 Project Website: https://su2code.github.io |\n";
26062606
file << "| |\n";

SU2_PY/change_version_number.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,13 @@
112112
for fname in filelist:
113113
lines = open(fname, "r").readlines()
114114
for i, line in enumerate(lines):
115-
if oldvers in line:
116-
# Avoid breaking the formating of some testcase headers
117-
if line.endswith("%\n"):
118-
n = len(newvers) - len(oldvers)
119-
lines[i] = line.replace(
120-
oldvers + " " * max(0, n), newvers + " " * max(0, -n)
121-
)
122-
else:
123-
lines[i] = line.replace(oldvers, newvers)
124-
lines[i] = line.replace(oldvers_q, newvers_q)
115+
for old, new in zip((oldvers, oldvers_q), (newvers, newvers_q)):
116+
# Avoid breaking the formating of some headers
117+
if old + " " in line:
118+
n = len(new) - len(old)
119+
lines[i] = line.replace(old + " " * max(0, n), new + " " * max(0, -n))
120+
if old in line:
121+
lines[i] = line.replace(old, new)
125122
f = open(fname, "w")
126123
f.writelines(lines)
127124
f.close()

0 commit comments

Comments
 (0)