console output cleanup: use verbose level ('-v') for old verbose style

This commit is contained in:
Thorsten Liebig 2011-11-08 11:49:14 +01:00
parent 1bb34a8d35
commit 830f7494c8
10 changed files with 54 additions and 18 deletions

View File

@ -87,7 +87,7 @@ void Engine::SortExtensionByPriority()
stable_sort(m_Eng_exts.begin(),m_Eng_exts.end(), CompareExtensions);
reverse(m_Eng_exts.begin(),m_Eng_exts.end());
if (g_settings.GetVerboseLevel()>0)
if (g_settings.GetVerboseLevel()>1)
{
cout << "--- Engine::SortExtensionByPriority() ---" << endl;
for (size_t n=0; n<m_Eng_exts.size(); ++n)

View File

@ -99,7 +99,8 @@ void Engine_Multithread::Init()
vector<unsigned int> m_Stop_Lines;
m_Op_MT->CalcStartStopLines( m_numThreads, m_Start_Lines, m_Stop_Lines );
cout << "Multithreaded engine using " << m_numThreads << " threads. Utilization: (";
if (g_settings.GetVerboseLevel()>0)
cout << "Multithreaded engine using " << m_numThreads << " threads. Utilization: (";
m_IterateBarrier = new boost::barrier(m_numThreads); // numThread workers
m_startBarrier = new boost::barrier(m_numThreads+1); // numThread workers + 1 controller
@ -117,10 +118,12 @@ void Engine_Multithread::Init()
{
// last thread
stop_h = stop-1;
cout << stop-start+1 << ")" << endl;
if (g_settings.GetVerboseLevel()>0)
cout << stop-start+1 << ")" << endl;
}
else
cout << stop-start+1 << ";";
if (g_settings.GetVerboseLevel()>0)
cout << stop-start+1 << ";";
// NS_Engine_Multithread::DBG().cout() << "###DEBUG## Thread " << n << ": start=" << start << " stop=" << stop << " stop_h=" << stop_h << std::endl;
boost::thread *t = new boost::thread( NS_Engine_Multithread::thread(this,start,stop,stop_h,n) );
m_thread_group.add_thread( t );

View File

@ -193,7 +193,8 @@ bool Operator_Cylinder::SetupCSXGrid(CSRectGrid* grid)
double minmaxA = fabs(alphaLines[alphaNum-1]-alphaLines[0]);
if (fabs(minmaxA-2*PI) < OPERATOR_CYLINDER_CLOSED_ALPHA_THRESHOLD)
{
cout << "Operator_Cylinder::SetupCSXGrid: Alpha is a full 2*PI => closed Cylinder..." << endl;
if (g_settings.GetVerboseLevel()>0)
cout << "Operator_Cylinder::SetupCSXGrid: Alpha is a full 2*PI => closed Cylinder..." << endl;
CC_closedAlpha = true;
grid->SetLine(1,alphaNum-1,2*PI+alphaLines[0]);
grid->AddDiscLine(1,2*PI+alphaLines[1]);
@ -218,7 +219,8 @@ bool Operator_Cylinder::SetupCSXGrid(CSRectGrid* grid)
}
else if (grid->GetLine(0,0)==0.0)
{
cout << "Operator_Cylinder::SetupCSXGrid: r=0 included..." << endl;
if (g_settings.GetVerboseLevel()>0)
cout << "Operator_Cylinder::SetupCSXGrid: r=0 included..." << endl;
CC_R0_included = CC_closedAlpha; //needed for correct ec-calculation, deactivate if closed cylinder is false... --> E_r = 0 anyways
}

View File

@ -129,7 +129,7 @@ void Operator_MPI::Init()
m_Processor_Name = new char[MPI_MAX_PROCESSOR_NAME];
MPI::Get_processor_name(m_Processor_Name,namelen);
if (m_MPI_Enabled)
if ((m_MPI_Enabled) && (g_settings.GetVerboseLevel()>0))
cerr << "Operator_MPI::Init(): Running on " << m_Processor_Name << endl;
}

View File

@ -113,7 +113,8 @@ int Operator_Multithread::CalcECOperator( DebugFlags debugFlags )
vector<unsigned int> m_Stop_Lines;
CalcStartStopLines( m_numThreads, m_Start_Lines, m_Stop_Lines );
cout << "Multithreaded operator using " << m_numThreads << " threads." << std::endl;
if (g_settings.GetVerboseLevel()>0)
cout << "Multithreaded operator using " << m_numThreads << " threads." << std::endl;
m_thread_group.join_all();
delete m_CalcEC_Start;

View File

@ -156,7 +156,8 @@ bool Operator_SSE_Compressed::CompareOperators(unsigned int pos1[3], unsigned in
bool Operator_SSE_Compressed::CompressOperator()
{
cout << "Compressing the FDTD operator... this may take a while..." << endl;
if (g_settings.GetVerboseLevel()>0)
cout << "Compressing the FDTD operator... this may take a while..." << endl;
map<SSE_coeff,unsigned int> lookUpMap;

View File

@ -18,6 +18,7 @@
#include "openems.h"
#include <iomanip>
#include "tools/array_ops.h"
#include "tools/useful.h"
#include "FDTD/operator_cylinder.h"
#include "FDTD/operator_cylindermultigrid.h"
#include "FDTD/engine_multithread.h"
@ -294,7 +295,8 @@ Engine_Interface_FDTD* openEMS::NewEngineInterface()
bool openEMS::SetupProcessing()
{
//*************** setup processing ************//
cout << "Setting up processing..." << endl;
if (g_settings.GetVerboseLevel()>0)
cout << "Setting up processing..." << endl;
unsigned int Nyquist = FDTD_Op->Exc->GetNyquistNum();
PA = new ProcessingArray(Nyquist);
@ -527,7 +529,8 @@ int openEMS::SetupFDTD(const char* file)
if (file==NULL) return -1;
Reset();
cout << "Read openEMS xml file: " << file << " ..." << endl;
if (g_settings.GetVerboseLevel()>0)
cout << "Read openEMS xml file: " << file << " ..." << endl;
timeval startTime;
gettimeofday(&startTime,NULL);
@ -540,7 +543,8 @@ int openEMS::SetupFDTD(const char* file)
exit(-1);
}
cout << "Read openEMS Settings..." << endl;
if (g_settings.GetVerboseLevel()>0)
cout << "Read openEMS Settings..." << endl;
TiXmlElement* openEMSxml = doc.FirstChildElement("openEMS");
if (openEMSxml==NULL)
{
@ -588,7 +592,8 @@ int openEMS::SetupFDTD(const char* file)
exit(-3);
}
cout << "Read Geometry..." << endl;
if (g_settings.GetVerboseLevel()>0)
cout << "Read Geometry..." << endl;
m_CSX = new ContinuousStructure();
string EC(m_CSX->ReadFromXML(openEMSxml));
if (EC.empty()==false)
@ -597,7 +602,7 @@ int openEMS::SetupFDTD(const char* file)
// return(-2);
}
if (g_settings.GetVerboseLevel()>0)
if (g_settings.GetVerboseLevel()>1)
m_CSX->ShowPropertyStatus(cerr);
if (CylinderCoords)
@ -659,10 +664,17 @@ int openEMS::SetupFDTD(const char* file)
timeval OpDoneTime;
gettimeofday(&OpDoneTime,NULL);
FDTD_Op->ShowStat();
FDTD_Op->ShowExtStat();
if (g_settings.GetVerboseLevel()>0)
{
FDTD_Op->ShowStat();
FDTD_Op->ShowExtStat();
cout << "Creation time for operator: " << CalcDiffTime(OpDoneTime,startTime) << " s" << endl;
}
cout << "FDTD timestep is: " <<FDTD_Op->GetTimestep() << " s; Nyquist rate: " << FDTD_Op->Exc->GetNyquistNum() << " timesteps @" << CalcNyquistFrequency(FDTD_Op->Exc->GetNyquistNum(),FDTD_Op->GetTimestep()) << " Hz" << endl;
cout << "Excitation signal length is: " << FDTD_Op->Exc->Length << " timesteps (" << FDTD_Op->Exc->Length*FDTD_Op->GetTimestep() << "s)" << endl;
cout << "Creation time for operator: " << CalcDiffTime(OpDoneTime,startTime) << " s" << endl;
if (FDTD_Op->Exc->GetNyquistNum()>1000)
cerr << "openEMS::SetupFDTD: Warning, the timestep seems to be very small --> long simulation. Check your mesh!?" << endl;
if (m_no_simulation)
{

View File

@ -34,7 +34,8 @@ Global::Global()
void Global::ShowArguments(ostream& ostr, string front)
{
ostr << front << "--showProbeDiscretization\tShow probe discretization information" << endl;
ostr << front << "--nativeFieldDumps\tDump all fields using the native field components" << endl;
ostr << front << "--nativeFieldDumps\t\tDump all fields using the native field components" << endl;
ostr << front << "-v(v)\t\t\t\tSet debug level to 1(2)" << endl;
}
//! \brief This function initializes the object
@ -61,5 +62,11 @@ bool Global::parseCommandLineArgument( const char *argv )
m_VerboseLevel = 1;
return true;
}
else if (strcmp(argv,"-vv")==0)
{
cout << "openEMS - verbose level 2" << endl;
m_VerboseLevel = 2;
return true;
}
return false;
}

View File

@ -32,6 +32,13 @@ unsigned int CalcNyquistNum(double fmax, double dT)
return floor(T0/2/dT);
}
double CalcNyquistFrequency(unsigned int nyquist, double dT)
{
if (nyquist==0) return 0;
if (dT==0) return 0;
return floor(1/(double)nyquist/2/dT);
}
std::vector<unsigned int> AssignJobs2Threads(unsigned int jobs, unsigned int nrThreads, bool RemoveEmpty)
{
std::vector<unsigned int> jpt; //jobs per thread

View File

@ -23,6 +23,9 @@
//! Calc the nyquist number of timesteps for a given frequency and timestep
unsigned int CalcNyquistNum(double fmax, double dT);
//! Calc the highest frequency allowed for a given nyquist number of timesteps and timestep
double CalcNyquistFrequency(unsigned int nyquist, double dT);
//! Calculate an optimal job distribution to a given number of threads. Will return a vector with the jobs for each thread.
std::vector<unsigned int> AssignJobs2Threads(unsigned int jobs, unsigned int nrThreads, bool RemoveEmpty=false);