ReFRACtor
sub_state_vector_proxy.cc
Go to the documentation of this file.
2 #include "ostream_pad.h"
3 
4 using namespace FullPhysics;
5 using namespace blitz;
6 
7 //-----------------------------------------------------------------------
11 //-----------------------------------------------------------------------
12 
14 {
15  proxied_observers = Proxied;
16 
17  int plen = 0;
18  BOOST_FOREACH(boost::shared_ptr<SubStateVectorObserver> curr_obs, proxied_observers) {
19  plen += curr_obs->sub_vector_size();
20  }
21  state_vector_observer_initialize(plen);
22 }
23 
24 //-----------------------------------------------------------------------
27 //-----------------------------------------------------------------------
28 
29 void SubStateVectorProxy::update_sub_state(const ArrayAd<double, 1>& Sv_sub, const blitz::Array<double, 2>& Cov_sub)
30 {
31  int offset = 0;
32  BOOST_FOREACH(boost::shared_ptr<SubStateVectorObserver> curr_obs, proxied_observers) {
33  Range prox_range(offset, offset + curr_obs->sub_vector_size() - 1);
34  curr_obs->update_sub_state(Sv_sub(prox_range), Cov_sub(prox_range, prox_range) );
35  offset += curr_obs->sub_vector_size();
36  }
37 }
38 
39 //-----------------------------------------------------------------------
42 //-----------------------------------------------------------------------
43 
44 void SubStateVectorProxy::mark_used_sub(blitz::Array<bool, 1>& Used) const
45 {
46  int offset = 0;
47  BOOST_FOREACH(boost::shared_ptr<SubStateVectorObserver> curr_obs, proxied_observers) {
48  Range prox_range(offset, offset + curr_obs->sub_vector_size() - 1);
49  Array<bool, 1> prox_used(Used(prox_range));
50  curr_obs->mark_used_sub(prox_used);
51  offset += curr_obs->sub_vector_size();
52  }
53 }
54 
55 //-----------------------------------------------------------------------
58 //-----------------------------------------------------------------------
59 
60 
61 void SubStateVectorProxy::state_vector_name_sub(blitz::Array<std::string, 1>& Sv_name) const
62 {
63  int offset = 0;
64  BOOST_FOREACH(boost::shared_ptr<SubStateVectorObserver> curr_obs, proxied_observers) {
65  Range prox_range(offset, offset + curr_obs->sub_vector_size() - 1);
66  blitz::Array<std::string, 1> prox_name(Sv_name(prox_range));
67  curr_obs->state_vector_name_sub(prox_name);
68  offset += curr_obs->sub_vector_size();
69  }
70 }
71 
72 //-----------------------------------------------------------------------
74 //-----------------------------------------------------------------------
75 
76 void SubStateVectorProxy::print(std::ostream& Os) const
77 {
78  OstreamPad opad(Os, " ");
79  Os << "SubStateVectorProxy";
80  BOOST_FOREACH(boost::shared_ptr<SubStateVectorObserver> curr_obs, proxied_observers) {
81  curr_obs->print(opad);
82  }
83  opad.strict_sync();
84 }
void initialize(const std::vector< boost::shared_ptr< SubStateVectorObserver > > &Proxied)
Registers the classes that will be proxied.
This is a filtering stream that adds a pad to the front of every line written out.
Definition: ostream_pad.h:32
virtual void state_vector_name_sub(blitz::Array< std::string, 1 > &Sv_name) const
Extracts the relevant portions of the passed arrays and passes them to the proxied objects...
virtual void print(std::ostream &Os) const
Output the print results from the proxied classes.
Apply value function to a blitz array.
virtual void mark_used_sub(blitz::Array< bool, 1 > &Used) const
Extracts the relevant portions of the passed arrays and passes them to the proxied objects...
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
virtual void update_sub_state(const ArrayAd< double, 1 > &Sv_sub, const blitz::Array< double, 2 > &Cov_sub)
Extracts the relevant portions of the passed arrays and passes them to the proxied objects...

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