ReFRACtor
pressure_imp_base.h
Go to the documentation of this file.
1 #ifndef PRESSURE_IMP_BASE_H
2 #define PRESSURE_IMP_BASE_H
3 #include "pressure.h"
5 
6 namespace FullPhysics {
7 /****************************************************************/
26 class PressureImpBase: public SubStateVectorArray<Pressure> {
27 public:
28  virtual ~PressureImpBase() {}
30  { fill_cache(); return pgrid; }
31  virtual boost::shared_ptr<Pressure> clone() const = 0;
32  virtual void update_sub_state_hook()
33  { cache_stale = true; }
34 
35 //-----------------------------------------------------------------------
40 //-----------------------------------------------------------------------
41  virtual void print(std::ostream& Os) const { Os << desc(); }
42 
43 //-----------------------------------------------------------------------
46 //-----------------------------------------------------------------------
47  virtual std::string desc() const { return "PressureImpBase"; }
48 protected:
49 //-----------------------------------------------------------------------
52 //-----------------------------------------------------------------------
53  mutable bool cache_stale;
54 
55 //-----------------------------------------------------------------------
58 //-----------------------------------------------------------------------
60 
61 //-----------------------------------------------------------------------
64 //-----------------------------------------------------------------------
65  virtual void calc_pressure_grid() const = 0;
66 
67 //-----------------------------------------------------------------------
70 //-----------------------------------------------------------------------
71 
72  PressureImpBase() : cache_stale(true) { }
73 
74 //-----------------------------------------------------------------------
76 //-----------------------------------------------------------------------
77  PressureImpBase(const blitz::Array<double, 1>& Coeff,
78  const blitz::Array<bool, 1>& Used_flag)
79  : SubStateVectorArray<Pressure>(Coeff, Used_flag),
80  cache_stale(true) {}
81 private:
82  void fill_cache() const
83  {
84  if(cache_stale) {
87  }
88  cache_stale = false;
89  }
90 
91 };
92 
93 }
94 #endif
virtual boost::shared_ptr< Pressure > clone() const =0
Clone a Pressure object.
void resize_number_variable(int nvar)
Definition: array_ad.h:165
ArrayAdWithUnit< double, 1 > pgrid
The cached pressure grid.
PressureImpBase(const blitz::Array< double, 1 > &Coeff, const blitz::Array< bool, 1 > &Used_flag)
Constructor that sets the coefficient() and used_flag() values.
virtual ArrayAdWithUnit< double, 1 > pressure_grid() const
This returns the pressure grid to use for layer retrieval, along with the gradient of each of the pre...
As a design principle, we have each base class with the absolutely minimum interface needed for use f...
virtual std::string desc() const
Description of object, to be printed to stream.
bool cache_stale
If this is true, the recalculate the pressure_grid the next time we need it.
int number_variable() const
Definition: array_ad.h:376
This class maintains the pressure portion of the state.
Definition: pressure.h:32
It is common to have a class that is an Observable with a set of coefficients, a subset of which are ...
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
virtual void update_sub_state_hook()
Hook for anything a derived class needs to do after coefficient is updated and before notify_update...
PressureImpBase()
Default constructor, derived class should call init if they use this constructor. ...
virtual void print(std::ostream &Os) const
Print to stream.
virtual void calc_pressure_grid() const =0
Derived classes should provide a function to fill in pgrid when this is called.

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