ReFRACtor
connor_iteration_log.cc
Go to the documentation of this file.
1 #include "connor_iteration_log.h"
2 
3 using namespace FullPhysics;
4 using namespace blitz;
5 
7  solver.add_observer(iter_log);
8 }
9 
10 #ifdef HAVE_LUA
11 #include "register_lua.h"
13 .def(luabind::constructor<const boost::shared_ptr<StateVector>&>())
14 .def("add_as_observer", &iter_log_add_as_observer)
16 #endif
17 
19 {
20  blitz::Array<std::string, 1> sv_names = sv_obj->state_vector_name();
21  blitz::Array<double, 1> dx(solver.x_update().copy());
22  blitz::Array<double, 1> sv_prev(solver.x_solution().copy());
23  sv_prev -= dx; // What it was before the dx update
24 
25  std::stringstream fit_log;
26  fit_log << std::endl
27  << solver.fit_statistic();
28  Logger::info() << fit_log.str();
29 
30  std::stringstream sv_log;
31  sv_log << std::endl
32  << std::setw(SV_PRINT_WIDTH)
33  << "State Vector"
34  << std::setw(SV_PRINT_WIDTH)
35  << "Dx"
36  << " Name" << std::endl;
37  for(int sv_idx = 0; sv_idx < sv_prev.rows(); sv_idx++)
38  sv_log << std::setprecision(SV_PRINT_WIDTH-7) // leave room for -/+, ., exponent and space, etc
39  << std::setw(SV_PRINT_WIDTH)
40  << sv_prev(sv_idx)
41  << std::setw(SV_PRINT_WIDTH)
42  << dx(sv_idx) << " "
43  << sv_names(sv_idx)
44  << std::endl;
45  Logger::info() << sv_log.str();
46 }
static LogHelper info()
Definition: logger.h:109
This is an observer of the ConnorSolver that writes out the state vector values in a nicely formated ...
blitz::Array< double, 1 > x_update() const
void notify_update(const ConnorSolver &solver)
Called when the Observed object is updated.
virtual FitStatistic fit_statistic() const
Return fit results for solution to last problem solved.
#define REGISTER_LUA_CLASS(X)
Definition: register_lua.h:116
Apply value function to a blitz array.
void iter_log_add_as_observer(ConnorIterationLog &iter_log, ConnorSolver &solver)
virtual void add_observer(Observer< ConnorSolver > &Obs)
Add an observer.
Definition: connor_solver.h:77
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
#define REGISTER_LUA_END()
Definition: register_lua.h:134
virtual blitz::Array< double, 1 > x_solution() const

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:08