Skip to content

Commit

Permalink
Replaced frequently called std::cout with ScreenMessage to suppress l…
Browse files Browse the repository at this point in the history
…og in MPI
  • Loading branch information
wenqing committed Feb 4, 2019
1 parent 6311af5 commit 7194971
Show file tree
Hide file tree
Showing 20 changed files with 378 additions and 445 deletions.
6 changes: 5 additions & 1 deletion FEM/fem_ele_std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
//#include <iostream>
//#include <limits> // PCH to better use system max and min
#include "memory.h"

#include "display.h"

// Method
#include "mathlib.h"
// Problems
Expand Down Expand Up @@ -499,7 +502,8 @@ CFiniteElementStd::CFiniteElementStd(CRFProcess* Pcs, const int C_Sys_Flad,
if (!done)
{
done = true;
std::cout << "-> Gass flow is formulated as mass balance." << '\n';
Display::ScreenMessage(
"-> Gass flow is formulated as mass balance.\n");
}
}
#if defined(USE_PETSC) // || defined(other parallel libs)//03~04.3012. WW
Expand Down
42 changes: 21 additions & 21 deletions FEM/par_ddc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ double time_ele_paral;

// FEM-Makros
#include "makros.h"

#include "display.h"

#ifndef NEW_EQS // WW. 11.2008
#include "matrix_routines.h"
#endif
Expand Down Expand Up @@ -114,7 +117,7 @@ bool SubKeywordFound(string line)
void DOMRead(string file_base_name)
{
//----------------------------------------------------------------------
cout << "DOMRead: ";
Display::ScreenMessage("DOMRead: ");
//----------------------------------------------------------------------
CPARDomain* m_dom = NULL;
char line[MAX_ZEILE];
Expand All @@ -128,8 +131,7 @@ void DOMRead(string file_base_name)
ifstream ddc_file(ddc_file_name.data(), ios::in);
if (!ddc_file.good())
{
cout << "no DDC file"
<< "\n";
Display::ScreenMessage("no DDC file\n");
return;
}
ddc_file.seekg(0L, ios::beg);
Expand All @@ -150,8 +152,7 @@ void DOMRead(string file_base_name)
} // keyword found
} // eof
//----------------------------------------------------------------------
cout << dom_vector.size() << " domains"
<< "\n";
Display::ScreenMessage("%d domains\n", dom_vector.size());
//----------------------------------------------------------------------
}

Expand Down Expand Up @@ -250,8 +251,8 @@ void DOMCreate()

//----------------------------------------------------------------------
// Create domain nodes
cout << "->Create DOM"
<< "\n";
Display::ScreenMessage("->Create Sub-Domains\n");

/* // Comment by WW
for(i=0;i<no_domains;i++){
m_dom = dom_vector[i];
Expand All @@ -261,23 +262,21 @@ void DOMCreate()

//----------------------------------------------------------------------
// Create domain nodes
cout << " Create domain nodes"
<< "\n";
Display::ScreenMessage(" Create domain nodes\n");
for (i = 0; i < no_domains; i++)
{
m_dom = dom_vector[i];
m_dom->m_msh = m_pcs->m_msh;
cout << " Domain:" << m_dom->ID << "\n";
Display::ScreenMessageNoMPIRank(" Domain: %d\n", m_dom->ID);
m_dom->CreateNodes();
}
//----------------------------------------------------------------------
// Create domain elements
cout << " Create domain elements"
<< "\n";
Display::ScreenMessage(" Create domain elements\n");
for (i = 0; i < no_domains; i++)
{
m_dom = dom_vector[i];
cout << " Domain:" << m_dom->ID << "\n";
Display::ScreenMessageNoMPIRank(" Domain: %d\n", m_dom->ID);
m_dom->CreateElements(quadr);
}
// For find nodes connected to node WW
Expand All @@ -295,11 +294,10 @@ void DOMCreate()
//
// Find nodes of all neighbors of each node. // WW
// Local topology. WW
cout << " Find nodes on borders"
<< "\n";
Display::ScreenMessage(" Find nodes on borders\n");
FindNodesOnInterface(m_pcs->m_msh, quadr);
cout << " Find the connected nodes for each node"
<< "\n";

Display::ScreenMessage(" Find the connected nodes for each node\n");
#ifndef USE_MPI // WW
for (i = 0; i < no_domains; i++)
{
Expand All @@ -313,16 +311,18 @@ void DOMCreate()
#endif
//----------------------------------------------------------------------
// Create domain EQS
cout << " Create domain EQS"
<< "\n";
Display::ScreenMessage(" Create domain EQS\n");

#ifdef USE_MPI
i = myrank;
#else
for (i = 0; i < no_domains; i++)
{
#endif
m_dom = dom_vector[i];
cout << " Domain:" << m_dom->ID << "\n";
m_dom = dom_vector[i];

Display::ScreenMessageNoMPIRank(" Domain: %d\n", m_dom->ID);

#ifdef NEW_EQS
m_dom->CreateEQS();
#else
Expand Down
Loading

0 comments on commit 7194971

Please sign in to comment.