ReFRACtor
|
This handles informing a set of interested objects when the state vector has updated. More...
#include <state_vector.h>
Public Member Functions | |
StateVector () | |
virtual | ~StateVector () |
virtual void | add_observer (Observer< StateVector > &Obs) |
Add an observer. More... | |
void | add_observer_and_keep_reference (boost::shared_ptr< Observer< StateVector > > &Obs) |
Add an observer and keep a reference to it. More... | |
int | observer_claimed_size () const |
Total "claimed" size of the state vector. More... | |
void | observer_claimed_size (int Pstart) |
Update claimed size of state vector. More... | |
virtual void | print (std::ostream &Os) const |
std::string | print_to_string () const |
Print to string. More... | |
virtual void | remove_observer (Observer< StateVector > &Obs) |
Remove an observer. More... | |
const blitz::Array< double, 1 > & | state () const |
Current state vector. More... | |
const blitz::Array< double, 2 > & | state_covariance () const |
Current covariance of the state vector. More... | |
blitz::Array< std::string, 1 > | state_vector_name () const |
Return name of each state vector element. More... | |
const ArrayAd< double, 1 > & | state_with_derivative () const |
Return the state vector as state() does, but also make each value a AutoDerivative. More... | |
void | update_state (const blitz::Array< double, 1 > &X) |
Update the state vector. More... | |
void | update_state (const blitz::Array< double, 1 > &X, const blitz::Array< double, 2 > &Cov) |
Update the state vector and covariance. More... | |
blitz::Array< bool, 1 > | used_flag () const |
Return a Array of boolean values. More... | |
Protected Member Functions | |
void | add_observer_do (Observer< StateVector > &Obs, StateVector &t) |
Add an observer. More... | |
void | add_observer_do (Observer< StateVector > &Obs) |
void | clean_dead_ptr () |
Remove any dead pointers. More... | |
void | notify_update_do (const StateVector &Self) |
Function to call to notify Observers of a state change. More... | |
void | remove_observer_do (Observer< StateVector > &Obs, StateVector &t) |
Remove an observer. More... | |
void | remove_observer_do (Observer< StateVector > &Obs) |
Protected Attributes | |
std::list< boost::weak_ptr< Observer< StateVector > > > | olist |
std::vector< boost::shared_ptr< Observer< StateVector > > > | ref_list |
This handles informing a set of interested objects when the state vector has updated.
Those objects then update their internal state to account for the new state vector.
Definition at line 16 of file state_vector.h.
|
inline |
Definition at line 18 of file state_vector.h.
|
inlinevirtual |
Definition at line 22 of file state_vector.h.
|
inlinevirtual |
Add an observer.
Implements FullPhysics::Observable< StateVector >.
Definition at line 24 of file state_vector.h.
|
inlineinherited |
Add an observer and keep a reference to it.
See the discussion in the Observer class description for details.
Definition at line 107 of file observer.h.
|
inlineprotectedinherited |
Add an observer.
Definition at line 148 of file observer.h.
|
inlineprotectedinherited |
Definition at line 159 of file observer.h.
|
inlineprotectedinherited |
Remove any dead pointers.
Definition at line 196 of file observer.h.
|
inlineprotectedinherited |
Function to call to notify Observers of a state change.
The object should pass itself to this function, so it can be passed to the Observers.
Definition at line 121 of file observer.h.
|
inline |
Total "claimed" size of the state vector.
For observers that register an interest in a portion of the state vector, we add all of the portions of interest. Note that an actual state vector isn't constrained to this size, it might be larger (with presumably portions ignored), or if the observers handle it correctly it could be smaller.
Definition at line 68 of file state_vector.h.
|
inline |
Update claimed size of state vector.
Definition at line 74 of file state_vector.h.
|
virtual |
Definition at line 222 of file state_vector.cc.
|
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.
|
inlinevirtual |
Remove an observer.
Implements FullPhysics::Observable< StateVector >.
Definition at line 26 of file state_vector.h.
|
inlineprotectedinherited |
Remove an observer.
Definition at line 173 of file observer.h.
|
inlineprotectedinherited |
Definition at line 181 of file observer.h.
|
inline |
Current state vector.
Definition at line 34 of file state_vector.h.
|
inline |
Current covariance of the state vector.
Definition at line 53 of file state_vector.h.
Array< std::string, 1 > StateVector::state_vector_name | ( | ) | const |
Return name of each state vector element.
Definition at line 203 of file state_vector.cc.
|
inline |
Return the state vector as state() does, but also make each value a AutoDerivative.
The derivative is with respect to the state vector, i.e., we treat the state vector as the independent variables. This means the first value has a gradient all 0's except for 1 in the first index, the second value all zeros except for 1 in the second index, etc.
Definition at line 45 of file state_vector.h.
void StateVector::update_state | ( | const blitz::Array< double, 1 > & | X | ) |
Update the state vector.
This version sets the covariance to a dummy identity matrix that is the same size as state().
Definition at line 128 of file state_vector.cc.
void StateVector::update_state | ( | const blitz::Array< double, 1 > & | X, |
const blitz::Array< double, 2 > & | Cov | ||
) |
Update the state vector and covariance.
Definition at line 156 of file state_vector.cc.
blitz::Array< bool, 1 > StateVector::used_flag | ( | ) | const |
Return a Array of boolean values.
The value (i) is true if the state vector element X(i) is being used. This can be used to determine parameters that are being ignored, e.g. the number of active levels in an Aerosol is less that the size of the state vector for it.
Definition at line 184 of file state_vector.cc.
|
protectedinherited |
Definition at line 200 of file observer.h.
|
protectedinherited |
Definition at line 201 of file observer.h.