ParamLog.cpp 907 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*!
  2. @file: optimization/ParamLog.cpp
  3. @author: Esther Wacker
  4. */
  5. #include "optimization/ParamLog.h"
  6. #include <iostream>
  7. using namespace std;
  8. using namespace OPTIMIZATION;
  9. ParamLog::ParamLog( std::string file)
  10. {
  11. // open file
  12. m_stream.open(file.c_str(), ios_base::out);
  13. }
  14. ParamLog::~ParamLog()
  15. {
  16. // close file
  17. m_stream.close();
  18. }
  19. void ParamLog::writeLogError(const char* szMessage)
  20. {
  21. }
  22. void ParamLog::writeLogWarning(const char* szMessage)
  23. {
  24. }
  25. void ParamLog::writeLogTrace(const char* szMessage)
  26. {
  27. }
  28. void ParamLog::writeParamsToFile(OPTIMIZATION::matrix_type& parammatrix)
  29. {
  30. int numParams= parammatrix.rows();
  31. if(m_stream.good())
  32. {
  33. for(int i= 0; i< numParams; ++i)
  34. {
  35. m_stream <<parammatrix(i,0)<<" ";
  36. }
  37. m_stream<<endl;
  38. m_stream.flush();
  39. }
  40. else
  41. {
  42. std::cerr << " the log file stream is bad! " <<endl;
  43. }
  44. }