ReFRACtor
absorber_vmr_level.cc
Go to the documentation of this file.
1 #include <boost/bind.hpp>
2 #include "absorber_vmr_level.h"
3 #include "ostream_pad.h"
4 #include "linear_interpolate.h"
5 using namespace FullPhysics;
6 using namespace blitz;
7 
8 #ifdef HAVE_LUA
9 #include "register_lua.h"
11 .def(luabind::constructor<const boost::shared_ptr<Pressure>&,
12  const blitz::Array<double, 1>&,
13  const blitz::Array<bool, 1>&,
14  const std::string&>())
16 #endif
17 
18 //-----------------------------------------------------------------------
20 //-----------------------------------------------------------------------
21 
24  const blitz::Array<double, 1>& Vmr,
25  const blitz::Array<bool, 1>& Vmr_flag,
26  const std::string& Gas_name)
27 : AbsorberVmrImpBase(Gas_name, Vmr, Vmr_flag, Press, false)
28 {
29 }
30 
32 (const boost::shared_ptr<Pressure>& Press) const
33 {
35  (new AbsorberVmrLevel(Press, coeff.value(),used_flag,
36  gas_name()));
37 }
38 
40 {
41  std::vector<AutoDerivative<double> > plist;
42  std::vector<AutoDerivative<double> > vmrlist;
43  for(int i = 0; i < press->pressure_grid().rows(); ++i) {
44  vmrlist.push_back(coeff(i));
45  plist.push_back(press->pressure_grid()(i).value);
46  }
48  lin_type;
50  (new lin_type(plist.begin(), plist.end(), vmrlist.begin()));
51  vmr = boost::bind(&lin_type::operator(), lin, _1);
52 }
53 
54 void AbsorberVmrLevel::print(std::ostream& Os) const
55 {
56  OstreamPad opad(Os, " ");
57  Os << "AbsorberVmrLevel:\n"
58  << " Gas name: " << gas_name() << "\n"
59  << " Coefficient:\n";
60  opad << coeff.value() << "\n";
61  opad.strict_sync();
62  Os << " Retrieval Flag:\n";
63  opad << used_flag << "\n";
64  opad.strict_sync();
65 }
This is a filtering stream that adds a pad to the front of every line written out.
Definition: ostream_pad.h:32
This class takes a set of points and values, and linearly interpolates between those values...
AbsorberVmrLevel(const boost::shared_ptr< Pressure > &Press, const blitz::Array< double, 1 > &Vmr, const blitz::Array< bool, 1 > &Vmr_flag, const std::string &Gas_name)
Constructor.
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
Definition: register_lua.h:136
As a design principle, we have each base class with the absolutely minimum interface needed for use f...
virtual boost::shared_ptr< AbsorberVmr > clone() const
Clone a AbsorberVmr object.
Apply value function to a blitz array.
This class maps the state vector to the absorber VMR on each level.
virtual void calc_vmr() const
Derived classes should provide a function to fill in vmr when this is called.
This gives the Gas Absorber Volumn mixing ratio for a single gas.
Definition: absorber_vmr.h:17
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 void print(std::ostream &Os) const
Print to stream.
double value(const FullPhysics::AutoDerivative< double > &Ad)

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