@@ -912,34 +912,9 @@ bool COutput::Convergence_Monitoring(CConfig *config, unsigned long Iteration) {
912912
913913 /* --- Apply the same convergence criteria to all the processors ---*/
914914
915- #ifdef HAVE_MPI
916-
917- unsigned short *sbuf_conv = NULL , *rbuf_conv = NULL ;
918- sbuf_conv = new unsigned short [1 ]; sbuf_conv[0 ] = 0 ;
919- rbuf_conv = new unsigned short [1 ]; rbuf_conv[0 ] = 0 ;
920-
921- /* --- Convergence criteria ---*/
922-
923- sbuf_conv[0 ] = convergence;
924- SU2_MPI::Reduce (sbuf_conv, rbuf_conv, 1 , MPI_UNSIGNED_SHORT, MPI_SUM, MASTER_NODE, SU2_MPI::GetComm ());
925-
926- /* -- Compute global convergence criteria in the master node --*/
927-
928- sbuf_conv[0 ] = 0 ;
929- if (rank == MASTER_NODE) {
930- if (rbuf_conv[0 ] == size) sbuf_conv[0 ] = 1 ;
931- else sbuf_conv[0 ] = 0 ;
932- }
933-
934- SU2_MPI::Bcast (sbuf_conv, 1 , MPI_UNSIGNED_SHORT, MASTER_NODE, SU2_MPI::GetComm ());
935-
936- if (sbuf_conv[0 ] == 1 ) { convergence = true ; }
937- else { convergence = false ; }
938-
939- delete [] sbuf_conv;
940- delete [] rbuf_conv;
941-
942- #endif
915+ unsigned short local = convergence, global = 0 ;
916+ SU2_MPI::Allreduce (&local, &global, 1 , MPI_UNSIGNED_SHORT, MPI_MAX, SU2_MPI::GetComm ());
917+ convergence = global > 0 ;
943918
944919 return convergence;
945920}
@@ -1149,49 +1124,49 @@ void COutput::SetScreen_Output(CConfig *config) {
11491124
11501125void COutput::PreprocessHistoryOutput (CConfig *config, bool wrt){
11511126
1152- noWriting = !wrt;
1153-
1154- /* --- Set the common output fields ---*/
1127+ noWriting = !wrt;
11551128
1156- SetCommonHistoryFields (config);
1129+ /* --- Set the common output fields --- */
11571130
1158- /* --- Set the History output fields using a virtual function call to the child implementation --- */
1131+ SetCommonHistoryFields (config);
11591132
1160- SetHistoryOutputFields (config);
1133+ /* --- Set the History output fields using a virtual function call to the child implementation --- */
11611134
1162- /* --- Postprocess the history fields. Creates new fields based on the ones set in the child classes --- */
1135+ SetHistoryOutputFields (config);
11631136
1164- Postprocess_HistoryFields (config);
1137+ /* --- Postprocess the history fields. Creates new fields based on the ones set in the child classes --- */
11651138
1166- /* --- We use a fixed size of the file output summary table --- */
1139+ Postprocess_HistoryFields (config);
11671140
1168- int total_width = 72 ;
1169- fileWritingTable->AddColumn (" File Writing Summary" , (total_width)/2 -1 );
1170- fileWritingTable->AddColumn (" Filename" , total_width/2 -1 );
1171- fileWritingTable->SetAlign (PrintingToolbox::CTablePrinter::LEFT);
1141+ /* --- We use a fixed size of the file output summary table ---*/
11721142
1173- /* --- Check for consistency and remove fields that are requested but not available --- */
1143+ int total_width = 72 ;
1144+ fileWritingTable->AddColumn (" File Writing Summary" , (total_width)/2 -1 );
1145+ fileWritingTable->AddColumn (" Filename" , total_width/2 -1 );
1146+ fileWritingTable->SetAlign (PrintingToolbox::CTablePrinter::LEFT);
11741147
1175- CheckHistoryOutput ();
1148+ /* --- Check for consistency and remove fields that are requested but not available --- */
11761149
1177- if (rank == MASTER_NODE && !noWriting){
1150+ CheckHistoryOutput ();
11781151
1179- /* --- Open history file and print the header ---*/
1180- if (!config->GetMultizone_Problem () || config->GetWrt_ZoneHist ())
1181- PrepareHistoryFile (config);
1152+ if (rank == MASTER_NODE && !noWriting){
11821153
1183- total_width = nRequestedScreenFields*fieldWidth + (nRequestedScreenFields-1 );
1154+ /* --- Open history file and print the header ---*/
1155+ if (!config->GetMultizone_Problem () || config->GetWrt_ZoneHist ())
1156+ PrepareHistoryFile (config);
11841157
1185- /* --- Set the multizone screen header --- */
1158+ total_width = nRequestedScreenFields*fieldWidth + (nRequestedScreenFields- 1 );
11861159
1187- if (config->GetMultizone_Problem ()){
1188- multiZoneHeaderTable->AddColumn (multiZoneHeaderString, total_width);
1189- multiZoneHeaderTable->SetAlign (PrintingToolbox::CTablePrinter::CENTER);
1190- multiZoneHeaderTable->SetPrintHeaderBottomLine (false );
1191- }
1160+ /* --- Set the multizone screen header ---*/
11921161
1162+ if (config->GetMultizone_Problem ()){
1163+ multiZoneHeaderTable->AddColumn (multiZoneHeaderString, total_width);
1164+ multiZoneHeaderTable->SetAlign (PrintingToolbox::CTablePrinter::CENTER);
1165+ multiZoneHeaderTable->SetPrintHeaderBottomLine (false );
11931166 }
11941167
1168+ }
1169+
11951170}
11961171
11971172void COutput::PreprocessMultizoneHistoryOutput (COutput **output, CConfig **config, CConfig* driver_config, bool wrt){
0 commit comments