ReFRACtor
FullPhysics::L2FpConfigurationLua Class Reference

This is an implementation of L2FpConfiguration that uses Lua. More...

#include <l2_fp_configuration_lua.h>

+ Inheritance diagram for FullPhysics::L2FpConfigurationLua:
+ Collaboration diagram for FullPhysics::L2FpConfigurationLua:

Public Member Functions

 L2FpConfigurationLua (const std::string &Fname, const std::string &Out_file="out.h5")
 Read the given Lua configuration file. More...
 
 L2FpConfigurationLua (const boost::shared_ptr< LuaState > &Ls, const std::string &Out_file="out.h5")
 Take a LuaState that we've already generated the configuration stuff (e.g., this was created in python script). More...
 
 L2FpConfigurationLua (int Argc, char **Argv)
 Parse the arguments passed to the executable to set up configuration. More...
 
virtual ~L2FpConfigurationLua ()
 
virtual boost::shared_ptr< ForwardModelforward_model () const
 Forward model. Everything should be initialized to the initial guess. More...
 
virtual boost::shared_ptr< InitialGuessinitial_guess () const
 Initial guess. More...
 
virtual boost::shared_ptr< IterativeSolveriterative_solver () const
 Iterative solver. More...
 
virtual boost::shared_ptr< LogImplogger () const
 Logger to use. More...
 
LuaStatelua_state ()
 
virtual boost::shared_ptr< MaxAPosteriorimax_a_posteriori () const
 Maximum a posteriori. More...
 
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't want output). More...
 
const std::string & output_name () const
 Output file name. More...
 
void output_name (const std::string &F)
 
virtual void print (std::ostream &Os) const
 
std::string print_to_string () const
 Print to string. More...
 
virtual boost::shared_ptr< ConnorSolversolver () const
 Solver. More...
 
virtual boost::shared_ptr< StateVectorstate_vector () const
 

Detailed Description

This is an implementation of L2FpConfiguration that uses Lua.

Note that this class is very specific to the L2 Full Physics main, with a minimal interface. A more general class LuaFile may be of more interest to you unless you are specifically working with L2 main.

The interface is purposely minimal, there are a handleful of global variables that the Lua file need to define. It can do this in any way it wishes.

In practice, our runs tend to be similiar. There is a file config_common.lua and base_config.lua that sets up a "standard" run, you can then create a configuration file that uses these two other files and just specifies what is different from this. But this is merely meant for convience, there is no requirement at all that you use these files. You can do anything you like as long as in the end you produce the set of global variables.

The require variables are:

  • logger - A LogImp
  • forward_model - A ForwardModel
  • solver - A ConnorSolver
  • initial_guess - A InitialGuess
  • number_pressure_level - Integer giving the number of pressure levels. This is used to size the output file, so it should be the maximim pressure
  • number_aerosol - Integer giving number of Aerosol particles. Can be 0. This is used to size the output file.
  • iteration_output - Boolean. True if we should write out iteration output
  • register_output - A std::vector<boost::shared_ptr<RegisterOutputBase> > giving the list of output that should be generated. This list can empty if no output is desired. The Lua type for this is called VectorRegisterOutput (since Lua doesn't have templates).

Definition at line 45 of file l2_fp_configuration_lua.h.

Constructor & Destructor Documentation

◆ L2FpConfigurationLua() [1/3]

FullPhysics::L2FpConfigurationLua::L2FpConfigurationLua ( const std::string &  Fname,
const std::string &  Out_file = "out.h5" 
)
inline

Read the given Lua configuration file.

See the class description for what this file needs to define.

Definition at line 52 of file l2_fp_configuration_lua.h.

◆ L2FpConfigurationLua() [2/3]

FullPhysics::L2FpConfigurationLua::L2FpConfigurationLua ( const boost::shared_ptr< LuaState > &  Ls,
const std::string &  Out_file = "out.h5" 
)
inline

Take a LuaState that we've already generated the configuration stuff (e.g., this was created in python script).

See the class description for what this state needs to define.

Definition at line 62 of file l2_fp_configuration_lua.h.

◆ L2FpConfigurationLua() [3/3]

FullPhysics::L2FpConfigurationLua::L2FpConfigurationLua ( int  Argc,
char **  Argv 
)
inline

Parse the arguments passed to the executable to set up configuration.

Definition at line 71 of file l2_fp_configuration_lua.h.

◆ ~L2FpConfigurationLua()

virtual FullPhysics::L2FpConfigurationLua::~L2FpConfigurationLua ( )
inlinevirtual

Definition at line 76 of file l2_fp_configuration_lua.h.

Member Function Documentation

◆ forward_model()

virtual boost::shared_ptr<ForwardModel> FullPhysics::L2FpConfigurationLua::forward_model ( ) const
inlinevirtual

Forward model. Everything should be initialized to the initial guess.

Implements FullPhysics::L2FpConfiguration.

Definition at line 81 of file l2_fp_configuration_lua.h.

◆ initial_guess()

virtual boost::shared_ptr<InitialGuess> FullPhysics::L2FpConfigurationLua::initial_guess ( ) const
inlinevirtual

Initial guess.

Implements FullPhysics::L2FpConfiguration.

Definition at line 96 of file l2_fp_configuration_lua.h.

◆ iterative_solver()

virtual boost::shared_ptr<IterativeSolver> FullPhysics::L2FpConfigurationLua::iterative_solver ( ) const
inlinevirtual

Iterative solver.

Implements FullPhysics::L2FpConfiguration.

Definition at line 105 of file l2_fp_configuration_lua.h.

◆ logger()

virtual boost::shared_ptr<LogImp> FullPhysics::L2FpConfigurationLua::logger ( ) const
inlinevirtual

Logger to use.

Implements FullPhysics::L2FpConfiguration.

Definition at line 77 of file l2_fp_configuration_lua.h.

◆ lua_state()

LuaState& FullPhysics::L2FpConfigurationLua::lua_state ( )
inline

Definition at line 103 of file l2_fp_configuration_lua.h.

◆ max_a_posteriori()

virtual boost::shared_ptr<MaxAPosteriori> FullPhysics::L2FpConfigurationLua::max_a_posteriori ( ) const
inlinevirtual

Maximum a posteriori.

Implements FullPhysics::L2FpConfiguration.

Definition at line 112 of file l2_fp_configuration_lua.h.

◆ output()

void L2FpConfigurationLua::output ( boost::shared_ptr< Output > &  Regular_output,
boost::shared_ptr< Output > &  Error_output 
) const
virtual

Create output, for both a normal run and for an error run (either or both can be null if we don't want output).

This should have all the RegisterOutputBase applied to it that the configuration says should be.

Implements FullPhysics::L2FpConfiguration.

Definition at line 10 of file l2_fp_configuration_lua.cc.

◆ output_name() [1/2]

const std::string& FullPhysics::L2FpConfigurationLua::output_name ( ) const
inline

Output file name.

Definition at line 123 of file l2_fp_configuration_lua.h.

◆ output_name() [2/2]

void FullPhysics::L2FpConfigurationLua::output_name ( const std::string &  F)
inline

Definition at line 124 of file l2_fp_configuration_lua.h.

◆ print()

virtual void FullPhysics::L2FpConfigurationLua::print ( std::ostream &  Os) const
inlinevirtual

Reimplemented from FullPhysics::L2FpConfiguration.

Definition at line 102 of file l2_fp_configuration_lua.h.

◆ print_to_string()

std::string FullPhysics::Printable< L2FpConfiguration >::print_to_string ( ) const
inlineinherited

Print to string.

This is primarily useful for SWIG wrappers to this class, e.g. a to_s method in ruby.

Definition at line 31 of file printable.h.

◆ solver()

virtual boost::shared_ptr<ConnorSolver> FullPhysics::L2FpConfigurationLua::solver ( ) const
inlinevirtual

Solver.

Implements FullPhysics::L2FpConfiguration.

Definition at line 89 of file l2_fp_configuration_lua.h.

◆ state_vector()

virtual boost::shared_ptr<StateVector> FullPhysics::L2FpConfigurationLua::state_vector ( ) const
inlinevirtual

Definition at line 85 of file l2_fp_configuration_lua.h.


The documentation for this class was generated from the following files:

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