@@ -57,19 +57,21 @@ class COutput {
5757
5858 /* ----------------------------- General ----------------------------*/
5959
60- int rank, /* !< \brief MPI Rank. */
61- size; /* !< \brief MPI Size. */
60+ const int rank; /* !< \brief MPI Rank. */
61+ const int size; /* !< \brief MPI Size. */
6262
63- unsigned short nDim; /* !< \brief Physical Dimension */
63+ const unsigned short nDim; /* !< \brief Physical Dimension */
6464
65- bool multiZone, /* !< \brief Boolean to store whether we are running a multizone problem */
66- gridMovement, /* !< \brief Boolean to store whether we have grid movement enabled */
67- femOutput; /* !< \brief Boolean to store whether we should use the FEM routines */
65+ const bool multiZone; /* !< \brief Boolean to store whether we are running a multizone problem */
66+ const bool gridMovement; /* !< \brief Boolean to store whether we have grid movement enabled */
67+ const bool femOutput; /* !< \brief Boolean to store whether we should use the FEM routines */
68+ const bool si_units;
69+ const bool us_units;
6870
6971 /* ----------------------------- Screen and history output ----------------------------*/
7072
73+ const unsigned short fieldWidth = 12 ; /* !< \brief Width of each column for the screen output (hardcoded for now) */
7174 string historySep; /* !< \brief Character which separates values in the history file */
72- unsigned short fieldWidth; /* !< \brief Width of each column for the screen output (hardcoded for now) */
7375 bool noWriting; /* !< \brief Boolean indicating whether a screen/history output should be written */
7476 unsigned long curTimeIter, /* !< \brief Current value of the time iteration index */
7577 curAbsTimeIter, /* !< \brief Current value of the time iteration index */
@@ -250,7 +252,7 @@ class COutput {
250252 /* !
251253 * \brief Constructor of the class.
252254 */
253- COutput (CConfig *config, unsigned short nDim, bool femOutput);
255+ COutput (const CConfig *config, unsigned short nDim, bool femOutput);
254256
255257 /* !
256258 * \brief Preprocess the volume output by setting the requested volume output fields.
@@ -532,8 +534,9 @@ class COutput {
532534 * \param[in] value - The new value of this field.
533535 */
534536 inline void SetHistoryOutputValue (string name, su2double value){
535- if (historyOutput_Map.count (name) > 0 ){
536- historyOutput_Map[name].value = value;
537+ auto it = historyOutput_Map.find (name);
538+ if (it != historyOutput_Map.end ()){
539+ it->second .value = value;
537540 } else {
538541 SU2_MPI::Error (string (" Cannot find output field with name " ) + name, CURRENT_FUNCTION);
539542 }
@@ -549,13 +552,16 @@ class COutput {
549552 * \param[in] field_type - The type of the field (::HistoryFieldType).
550553 */
551554 inline void AddHistoryOutputPerSurface (string name, string field_name, ScreenOutputFormat format,
552- string groupname, vector<string> marker_names,
553- HistoryFieldType field_type = HistoryFieldType::DEFAULT){
554- if (marker_names.size () != 0 ) {
555+ string groupname, const vector<string>& marker_names,
556+ HistoryFieldType field_type = HistoryFieldType::DEFAULT) {
557+ if (! marker_names.empty ()) {
555558 historyOutputPerSurface_List.push_back (name);
556- for (unsigned short i = 0 ; i < marker_names.size (); i++){
557- historyOutputPerSurface_Map[name].push_back (HistoryOutputField (field_name+" (" +marker_names[i]+" )" , format, groupname, field_type, " " ));
559+ vector<HistoryOutputField> fields;
560+ fields.reserve (marker_names.size ());
561+ for (const auto & marker : marker_names) {
562+ fields.push_back (HistoryOutputField (field_name+" (" +marker+" )" , format, groupname, field_type, " " ));
558563 }
564+ historyOutputPerSurface_Map[name] = std::move (fields);
559565 }
560566 }
561567
@@ -565,9 +571,10 @@ class COutput {
565571 * \param[in] value - The new value of this field.
566572 * \param[in] iMarker - The index of the marker.
567573 */
568- inline void SetHistoryOutputPerSurfaceValue (string name, su2double value, unsigned short iMarker){
569- if (historyOutputPerSurface_Map.count (name) > 0 ){
570- historyOutputPerSurface_Map[name][iMarker].value = value;
574+ inline void SetHistoryOutputPerSurfaceValue (string name, su2double value, unsigned short iMarker) {
575+ auto it = historyOutputPerSurface_Map.find (name);
576+ if (it != historyOutputPerSurface_Map.end ()) {
577+ it->second [iMarker].value = value;
571578 } else {
572579 SU2_MPI::Error (string (" Cannot find output field with name " ) + name, CURRENT_FUNCTION);
573580 }
0 commit comments