ReFRACtor
spectral_range.h
Go to the documentation of this file.
1 #ifndef SPECTRAL_RANGE_H
2 #define SPECTRAL_RANGE_H
3 #include "printable.h"
4 #include "unit.h"
5 #include "array_with_unit.h"
6 #include "array_ad.h"
7 
8 namespace FullPhysics {
9 /****************************************************************/
34 class SpectralRange: public Printable<SpectralRange> {
35 public:
37  : data_(Data.value), units_(Data.units) {}
39  const Unit& U)
40  : data_(Data), units_(U) {}
41  SpectralRange(const blitz::Array<double, 1>& Data,
42  const Unit& U)
43  : data_(Data), units_(U) {}
44  SpectralRange(const blitz::Array<double, 1>& Data,
45  const Unit& U,
46  const blitz::Array<double, 1>& Uncertainty)
47  : data_(Data), units_(U),
48  uncertainty_(Uncertainty) {}
50  const Unit& U,
51  const blitz::Array<double, 1>& Uncertainty)
52  : data_(Data), units_(U),
53  uncertainty_(Uncertainty) {}
54 
55 //-----------------------------------------------------------------------
57 //-----------------------------------------------------------------------
58 
60  {
61  data_.reference(V.data_ad().copy());
62  units_ = V.units();
63  uncertainty_.reference(V.uncertainty().copy());
64  return *this;
65  }
66 
67 //-----------------------------------------------------------------------
69 //-----------------------------------------------------------------------
70 
71  const blitz::Array<double, 1>& data() const {return data_.value(); }
72 
73 //-----------------------------------------------------------------------
75 //-----------------------------------------------------------------------
76 
77  blitz::Array<double, 1>& data() {return data_.value(); }
78 
79 //-----------------------------------------------------------------------
82 //-----------------------------------------------------------------------
83 
84  const ArrayAd<double, 1>& data_ad() const {return data_; }
85 
86 
87 //-----------------------------------------------------------------------
90 //-----------------------------------------------------------------------
91 
92  ArrayAd<double, 1>& data_ad() {return data_; }
93 
94 //-----------------------------------------------------------------------
97 //-----------------------------------------------------------------------
98 
99  const blitz::Array<double, 1>& uncertainty() const {return uncertainty_;}
100 
101 //-----------------------------------------------------------------------
103 //-----------------------------------------------------------------------
104 
105  const SpectralRange clone() const { return SpectralRange(data_.copy(), units_, uncertainty_.copy()); }
106 
107 //-----------------------------------------------------------------------
109 //-----------------------------------------------------------------------
110  const Unit& units() const {return units_;}
111  SpectralRange convert(const Unit& R) const;
112  void print(std::ostream& Os) const { Os << "SpectralRange";}
113 
116 
117 private:
118  ArrayAd<double, 1> data_;
119  Unit units_;
120  blitz::Array<double, 1> uncertainty_;
121 };
122 }
123 #endif
SpectralRange & operator=(const SpectralRange &V)
Assignment operator so internals are correctly set.
SpectralRange()
Default constructor needed for SWIG.
SpectralRange(const ArrayWithUnit< double, 1 > &Data)
SpectralRange(const ArrayAd< double, 1 > &Data, const Unit &U)
SpectralRange(const blitz::Array< double, 1 > &Data, const Unit &U, const blitz::Array< double, 1 > &Uncertainty)
This is a Mixin for classes that can be printed.
Definition: printable.h:24
blitz::Array< double, 1 > & data()
Underlying data.
const blitz::Array< T, D > & value() const
Definition: array_ad.h:306
const Unit & units() const
Units of data.
const blitz::Array< double, 1 > & uncertainty() const
Uncertainty.
ArrayAd< T, D > copy() const
Definition: array_ad.h:374
We have a number of different spectrums that appear in different parts of the code.
const ArrayAd< double, 1 > & data_ad() const
Underlying data, possibly with a Jacobian.
ArrayAd< double, 1 > & data_ad()
Underlying data, possibly with a Jacobian.
void reference(const ArrayAd< T, D > &V)
Definition: array_ad.h:372
Libraries such as boost::units allow unit handling where we know the units at compile time...
Definition: unit.h:25
void print(std::ostream &Os) const
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
SpectralRange(const blitz::Array< double, 1 > &Data, const Unit &U)
const SpectralRange clone() const
Clones object into a new copy.
double value(const FullPhysics::AutoDerivative< double > &Ad)
SpectralRange convert(const Unit &R) const
Convert to given units.
const blitz::Array< double, 1 > & data() const
Underlying data.
SpectralRange(const ArrayAd< double, 1 > &Data, const Unit &U, const blitz::Array< double, 1 > &Uncertainty)

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