ReFRACtor
l2_fp_configuration_lua.h
Go to the documentation of this file.
1 #ifndef L2_FP_CONFIGURATION_LUA_H
2 #define L2_FP_CONFIGURATION_LUA_H
3 #include "l2_fp_configuration.h"
4 #include "lua_state.h"
5 
6 namespace FullPhysics {
7 /****************************************************************/
46 public:
47 //-----------------------------------------------------------------------
50 //-----------------------------------------------------------------------
51 
52  L2FpConfigurationLua(const std::string& Fname,
53  const std::string& Out_file = "out.h5")
54  : ls(LuaState::load_file(Fname)), output_name_(Out_file) {}
55 
56 //-----------------------------------------------------------------------
60 //-----------------------------------------------------------------------
61 
63  const std::string& Out_file = "out.h5")
64  : ls(Ls), output_name_(Out_file) {}
65 
66 //-----------------------------------------------------------------------
69 //-----------------------------------------------------------------------
70 
71  L2FpConfigurationLua(int Argc, char** Argv)
72  : ls(LuaState::load_file(Argc > 0 ? Argv[0] : "config.lua")),
73  output_name_(Argc > 1 ? Argv[1] : "out.h5")
74  {
75  }
76  virtual ~L2FpConfigurationLua() {}
78  {
79  return ls->globals()["logger"].value_ptr<LogImp>();
80  }
82  {
83  return ls->globals()["forward_model"].value_ptr<ForwardModel>();
84  }
86  {
87  return ls->globals()["state_vector"].value_ptr<StateVector>();
88  }
90  {
91  if (not ls->globals()["solver"].is_nil())
92  return ls->globals()["solver"].value_ptr<ConnorSolver>();
93  else
95  }
97  {
98  return ls->globals()["initial_guess"].value_ptr<InitialGuess>();
99  }
100  virtual void output(boost::shared_ptr<Output>& Regular_output,
101  boost::shared_ptr<Output>& Error_output) const;
102  virtual void print(std::ostream& Os) const { Os << "L2FpConfigurationLua"; }
103  LuaState& lua_state() {return *ls;}
104 
106  {
107  if (not ls->globals()["iterative_solver"].is_nil())
108  return ls->globals()["iterative_solver"].value_ptr<IterativeSolver>();
110  }
111 
113  {
114  if(not ls->globals()["stat_method_map"].is_nil())
115  return ls->globals()["stat_method_map"].value_ptr<MaxAPosteriori>();
117  }
118 
119 //-----------------------------------------------------------------------
121 //-----------------------------------------------------------------------
122 
123  const std::string& output_name() const {return output_name_;}
124  void output_name(const std::string& F) { output_name_ = F; }
125 private:
127  std::string output_name_;
128  mutable boost::shared_ptr<Output> out_iteration;
129 };
130 }
131 #endif
L2FpConfigurationLua(const boost::shared_ptr< LuaState > &Ls, const std::string &Out_file="out.h5")
Take a LuaState that we&#39;ve already generated the configuration stuff (e.g., this was created in pytho...
virtual boost::shared_ptr< MaxAPosteriori > max_a_posteriori() const
Maximum a posteriori.
void output_name(const std::string &F)
virtual boost::shared_ptr< StateVector > state_vector() const
Before running L2 full physics, we need to create the solver that we will be using, along with registering whatever output we will be generating.
The actual implementation of the Logger.
Definition: logger.h:11
virtual boost::shared_ptr< IterativeSolver > iterative_solver() const
Iterative solver.
The base class for maximum a posteriori estimation.
The forward model represents the encapsulation of modeling spectra from an atmospheric state then app...
Definition: forward_model.h:14
This handles informing a set of interested objects when the state vector has updated.
Definition: state_vector.h:16
virtual boost::shared_ptr< LogImp > logger() const
Logger to use.
const std::string & output_name() const
Output file name.
L2FpConfigurationLua(const std::string &Fname, const std::string &Out_file="out.h5")
Read the given Lua configuration file.
virtual boost::shared_ptr< ForwardModel > forward_model() const
Forward model. Everything should be initialized to the initial guess.
L2FpConfigurationLua(int Argc, char **Argv)
Parse the arguments passed to the executable to set up configuration.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
virtual boost::shared_ptr< ConnorSolver > solver() const
Solver.
This is a light wrapper around the lua_state object.
Definition: lua_state.h:25
The base class for all iterative optimizers.
This is an implementation of L2FpConfiguration that uses Lua.
This gets the initial guess and the apriori state vector values.
Definition: initial_guess.h:12
virtual void print(std::ostream &Os) const
virtual void output(boost::shared_ptr< Output > &Regular_output, boost::shared_ptr< Output > &Error_output) const
Create output, for both a normal run and for an error run (either or both can be null if we don&#39;t wan...
virtual boost::shared_ptr< InitialGuess > initial_guess() const
Initial guess.

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