console output update

pull/1/head v0.0.2
Thorsten Liebig 2010-03-15 20:50:49 +01:00
parent 329228e840
commit 37295c02a9
2 changed files with 9 additions and 6 deletions

View File

@ -76,12 +76,11 @@ int main(int argc, char *argv[])
const char* fileHelix="../examples/Helix.xml"; const char* fileHelix="../examples/Helix.xml";
BuildHelix(fileHelix); BuildHelix(fileHelix);
const char* file=fileMSL; const char* file=fileHelix;
// cerr << CSX.ReadFromXML("examples/PlaneWave.xml") << endl; FDTD.DebugMaterial();
#endif #endif
// FDTD.DebugMaterial();
int EC = FDTD.SetupFDTD(file); int EC = FDTD.SetupFDTD(file);
if (EC) return EC; if (EC) return EC;
FDTD.RunFDTD(); FDTD.RunFDTD();

View File

@ -16,6 +16,7 @@
*/ */
#include "openems.h" #include "openems.h"
#include <iomanip>
#include "tools/array_ops.h" #include "tools/array_ops.h"
#include "FDTD/operator.h" #include "FDTD/operator.h"
#include "FDTD/engine.h" #include "FDTD/engine.h"
@ -91,6 +92,9 @@ int openEMS::SetupFDTD(const char* file)
exit(-1); exit(-1);
} }
FDTD_Opts->QueryIntAttribute("NumberOfTimesteps",&NrTS); FDTD_Opts->QueryIntAttribute("NumberOfTimesteps",&NrTS);
FDTD_Opts->QueryDoubleAttribute("endCriteria",&endCrit);
if (endCrit==0)
endCrit=1e-6;
TiXmlElement* Excite = FDTD_Opts->FirstChildElement("Excitation"); TiXmlElement* Excite = FDTD_Opts->FirstChildElement("Excitation");
if (Excite==NULL) if (Excite==NULL)
@ -272,9 +276,9 @@ void openEMS::RunFDTD()
currE = ProcField.CalcTotalEnergy(); currE = ProcField.CalcTotalEnergy();
if ((currE>0) && (currE>maxE)) if ((currE>0) && (currE>maxE))
maxE=currE; maxE=currE;
cout << "Timestep:\t" << currTS << " of " << NrTS << " (" << (double)currTS/(double)NrTS*100.0 << "%)" ; cout << "Timestep: " << setw(12) << currTS << " (" << setw(6) << setprecision(2) << std::fixed << (double)currTS/(double)NrTS*100.0 << "%)" ;
cout << "\t with currently " << speed*(double)(currTS-prevTS)/t_diff << " MCells/s" ; cout << " with currently " << setw(6) << setprecision(1) << std::fixed << speed*(double)(currTS-prevTS)/t_diff << " MCells/s" ;
cout << "\t current Energy estimate: " << currE << " (decrement: " << -10.0*log10(currE/maxE) << "dB)" << endl; cout << " --- Energy: ~" << setw(6) << setprecision(2) << std::scientific << currE << " (decrement: " << setw(6) << setprecision(2) << std::fixed << fabs(10.0*log10(currE/maxE)) << "dB)" << endl;
prevTime=currTime; prevTime=currTime;
prevTS=currTS; prevTS=currTS;
} }