ParamLog.cpp 874 B

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