ReFRACtor
sub_state_vector_observer.h
Go to the documentation of this file.
1 #ifndef SUB_STATE_VECTOR_OBSERVER_H
2 #define SUB_STATE_VECTOR_OBSERVER_H
3 
5 
6 namespace FullPhysics {
7 
8 /****************************************************************/
13 public:
15  virtual void notify_update(const StateVector& Sv);
16  virtual void mark_used(const StateVector& Sv,
17  blitz::Array<bool, 1>& Used) const;
18  virtual void state_vector_name(const StateVector& Sv,
19  blitz::Array<std::string, 1>& Sv_name) const;
20 
21 //-----------------------------------------------------------------------
23 //-----------------------------------------------------------------------
24 
25  int state_vector_start_index() const {return pstart; }
26 
27 //-----------------------------------------------------------------------
29 //-----------------------------------------------------------------------
30 
31  int sub_vector_size() const {return plen; }
32 
33 //-----------------------------------------------------------------------
36 //-----------------------------------------------------------------------
37 
38  virtual void update_sub_state(
39  const ArrayAd<double, 1>& Sv_sub,
40  const blitz::Array<double, 2>& Cov_sub) = 0;
41 
42 //-----------------------------------------------------------------------
46 //-----------------------------------------------------------------------
47 
48  virtual void mark_used_sub(blitz::Array<bool, 1>& Used) const
49  { Used = true; }
50 
51 //-----------------------------------------------------------------------
55 //-----------------------------------------------------------------------
56 
57  virtual void state_vector_name_sub(blitz::Array<std::string, 1>& Sv_name)
58  const {}
59  virtual void print(std::ostream& Os) const {Os << "SubStatVectorObserver";}
60  virtual void notify_add(StateVector& Sv)
61  {
62  if(pstart != -1)
63  throw Exception("A SubStateVectorObserver can only be attached to one state vector");
64  pstart = Sv.observer_claimed_size();
65  Sv.observer_claimed_size(pstart + plen);
66  }
67 
68  virtual void notify_remove(StateVector& Sv)
69  {
70  pstart = -1;
71  }
72 protected:
73 //-----------------------------------------------------------------------
81 //-----------------------------------------------------------------------
82 
84  : pstart(-1)
85  {
87  }
88 
89 //-----------------------------------------------------------------------
92 //-----------------------------------------------------------------------
93 
94  SubStateVectorObserver() : pstart(-1), plen(0) {}
95 
96  void state_vector_observer_initialize(int Plen);
97 
98 //-----------------------------------------------------------------------
101 //-----------------------------------------------------------------------
103 
104 //-----------------------------------------------------------------------
107 //-----------------------------------------------------------------------
108  blitz::Array<double, 2> sv_cov_full;
109 
110 //-----------------------------------------------------------------------
114 //-----------------------------------------------------------------------
116 
117 //-----------------------------------------------------------------------
121 //-----------------------------------------------------------------------
122  blitz::Array<double, 2> sv_cov_sub;
123 private:
124  int pstart;
125  int plen;
126 };
127 }
128 
129 #endif
void state_vector_observer_initialize(int Plen)
Take the given number of state vector parameters.
virtual void print(std::ostream &Os) const
virtual void update_sub_state(const ArrayAd< double, 1 > &Sv_sub, const blitz::Array< double, 2 > &Cov_sub)=0
Called by update_state with the subset of the state vector used by this class.
ArrayAd< double, 1 > sv_full
The last full state vector we have been updated with, saved for reference by derived class...
This is the base of the exception hierarchy for Full Physics code.
Definition: fp_exception.h:16
blitz::Array< double, 2 > sv_cov_sub
The subset of cov_full that is "owned" by this class, what was passed through update_sub_state.
This is an observer of a StateVector.
virtual void notify_update(const StateVector &Sv)
Called when the Observed object is updated.
virtual void mark_used_sub(blitz::Array< bool, 1 > &Used) const
Called by mark_used with the subset of the state vector used by this class.
int sub_vector_size() const
Length of the sub set of the state vector used by this object.
ArrayAd< double, 1 > sv_sub
The subset of sv_full that is "owned" by this class, what was passed through update_sub_state.
int state_vector_start_index() const
Starting index of state vector used by this object.
A common StateVectorObserver just "owns" a subset of the StateVector.
This handles informing a set of interested objects when the state vector has updated.
Definition: state_vector.h:16
int observer_claimed_size() const
Total "claimed" size of the state vector.
Definition: state_vector.h:68
virtual void mark_used(const StateVector &Sv, blitz::Array< bool, 1 > &Used) const
Mark elements that we are actively using (i.e., that aren&#39;t ignored).
SubStateVectorObserver(int Plen)
Take the given number of state vector parameters.
virtual void state_vector_name_sub(blitz::Array< std::string, 1 > &Sv_name) const
Called by state_vector_name with the subset of the Sv_name used by this class.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
virtual void state_vector_name(const StateVector &Sv, blitz::Array< std::string, 1 > &Sv_name) const
Update any portion of the list of the state vector names that apply to this object.
virtual void notify_remove(StateVector &Sv)
Called when an object is removed from an Observable.
blitz::Array< double, 2 > sv_cov_full
The last full covariance matrix we have been with, saved for reference by derived class...
virtual void notify_add(StateVector &Sv)
Called when an object is added to an Observable.

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