ReFRACtor
FullPhysics::StateVector Class Reference

This handles informing a set of interested objects when the state vector has updated. More...

#include <state_vector.h>

+ Inheritance diagram for FullPhysics::StateVector:
+ Collaboration diagram for FullPhysics::StateVector:

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ StateVector()

FullPhysics::StateVector::StateVector ( )
inline

Definition at line 18 of file state_vector.h.

◆ ~StateVector()

virtual FullPhysics::StateVector::~StateVector ( )
inlinevirtual

Definition at line 22 of file state_vector.h.

Member Function Documentation

◆ add_observer()

virtual void FullPhysics::StateVector::add_observer ( Observer< StateVector > &  Obs)
inlinevirtual

Add an observer.

Implements FullPhysics::Observable< StateVector >.

Definition at line 24 of file state_vector.h.

◆ add_observer_and_keep_reference()

void FullPhysics::Observable< StateVector >::add_observer_and_keep_reference ( boost::shared_ptr< Observer< StateVector > > &  Obs)
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.

◆ add_observer_do() [1/2]

void FullPhysics::Observable< StateVector >::add_observer_do ( Observer< StateVector > &  Obs,
StateVector t 
)
inlineprotectedinherited

Add an observer.

Definition at line 148 of file observer.h.

◆ add_observer_do() [2/2]

void FullPhysics::Observable< StateVector >::add_observer_do ( Observer< StateVector > &  Obs)
inlineprotectedinherited

Definition at line 159 of file observer.h.

◆ clean_dead_ptr()

void FullPhysics::Observable< StateVector >::clean_dead_ptr ( )
inlineprotectedinherited

Remove any dead pointers.

Definition at line 196 of file observer.h.

◆ notify_update_do()

void FullPhysics::Observable< StateVector >::notify_update_do ( const StateVector Self)
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.

◆ observer_claimed_size() [1/2]

int FullPhysics::StateVector::observer_claimed_size ( ) const
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.

◆ observer_claimed_size() [2/2]

void FullPhysics::StateVector::observer_claimed_size ( int  Pstart)
inline

Update claimed size of state vector.

Definition at line 74 of file state_vector.h.

◆ print()

void StateVector::print ( std::ostream &  Os) const
virtual

Definition at line 222 of file state_vector.cc.

◆ print_to_string()

std::string FullPhysics::Printable< StateVector >::print_to_string ( ) const
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.

◆ remove_observer()

virtual void FullPhysics::StateVector::remove_observer ( Observer< StateVector > &  Obs)
inlinevirtual

Remove an observer.

Implements FullPhysics::Observable< StateVector >.

Definition at line 26 of file state_vector.h.

◆ remove_observer_do() [1/2]

void FullPhysics::Observable< StateVector >::remove_observer_do ( Observer< StateVector > &  Obs,
StateVector t 
)
inlineprotectedinherited

Remove an observer.

Definition at line 173 of file observer.h.

◆ remove_observer_do() [2/2]

void FullPhysics::Observable< StateVector >::remove_observer_do ( Observer< StateVector > &  Obs)
inlineprotectedinherited

Definition at line 181 of file observer.h.

◆ state()

const blitz::Array<double, 1>& FullPhysics::StateVector::state ( ) const
inline

Current state vector.

Definition at line 34 of file state_vector.h.

◆ state_covariance()

const blitz::Array<double, 2>& FullPhysics::StateVector::state_covariance ( ) const
inline

Current covariance of the state vector.

Definition at line 53 of file state_vector.h.

◆ state_vector_name()

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.

◆ state_with_derivative()

const ArrayAd<double, 1>& FullPhysics::StateVector::state_with_derivative ( ) const
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.

◆ update_state() [1/2]

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.

◆ update_state() [2/2]

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.

◆ used_flag()

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.

Member Data Documentation

◆ olist

std::list<boost::weak_ptr<Observer<StateVector > > > FullPhysics::Observable< StateVector >::olist
protectedinherited

Definition at line 200 of file observer.h.

◆ ref_list

std::vector<boost::shared_ptr<Observer<StateVector > > > FullPhysics::Observable< StateVector >::ref_list
protectedinherited

Definition at line 201 of file observer.h.


The documentation for this class was generated from the following files:

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