ReFRACtor
stokes_coefficient_imp_base.h
Go to the documentation of this file.
1 #ifndef STOKES_COEFFICIENT_IMP_BASE_H
2 #define STOKES_COEFFICIENT_IMP_BASE_H
3 #include "stokes_coefficient.h"
5 
6 namespace FullPhysics {
7 /****************************************************************/
26 class StokesCoefficientImpBase: public SubStateVectorArray<StokesCoefficient> {
27 public:
30  { fill_cache(); return stokes_coeff; }
31  virtual boost::shared_ptr<StokesCoefficient> 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 "StokesCoefficientImpBase"; }
48 protected:
49 //-----------------------------------------------------------------------
52 //-----------------------------------------------------------------------
53  mutable bool cache_stale;
54 
55 //-----------------------------------------------------------------------
58 //-----------------------------------------------------------------------
60 
61 //-----------------------------------------------------------------------
64 //-----------------------------------------------------------------------
65  virtual void calc_stokes_coeff() const = 0;
66 
67 //-----------------------------------------------------------------------
70 //-----------------------------------------------------------------------
71 
72  StokesCoefficientImpBase() : cache_stale(true) { }
73 
74 //-----------------------------------------------------------------------
76 //-----------------------------------------------------------------------
77  StokesCoefficientImpBase(const blitz::Array<double, 1>& Coeff,
78  const blitz::Array<bool, 1>& Used_flag)
79  : SubStateVectorArray<StokesCoefficient>(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 #endif
void resize_number_variable(int nvar)
Definition: array_ad.h:165
virtual void calc_stokes_coeff() const =0
Derived classes should provide a function to fill in pgrid when this is called.
bool cache_stale
If this is true, the recalculate the stokes_coeff the next time we need it.
This class maintains the stokes coefficient portion of the state.
virtual void print(std::ostream &Os) const
Print to stream.
ArrayAd< double, 2 > stokes_coeff
The cached stokes coefficient.
virtual void update_sub_state_hook()
Hook for anything a derived class needs to do after coefficient is updated and before notify_update...
int number_variable() const
Definition: array_ad.h:376
StokesCoefficientImpBase(const blitz::Array< double, 1 > &Coeff, const blitz::Array< bool, 1 > &Used_flag)
Constructor that sets the coefficient() and used_flag() values.
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.
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
StokesCoefficientImpBase()
Default constructor, derived class should call init if they use this constructor. ...
virtual ArrayAd< double, 2 > stokes_coefficient() const
Return Stokes coefficients used to go from Stokes vector to scalar reflectance.
virtual boost::shared_ptr< StokesCoefficient > clone() const =0
Clone a StokesCoefficient object.

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