rl_raylib  1.1.10
rl_DielectricData.h
1 #ifndef rl_DielectricData_h_INCLUDED
2 #define rl_DielectricData_h_INCLUDED
3 
4 // File: rl_DielectricData.h
5 // Author: Terry Gaetz
6 
7 /* --8<--8<--8<--8<--
8  *
9  * Copyright (C) 2006, 2007 Smithsonian Astrophysical Observatory
10  *
11  * This file is part of rl_raylib
12  *
13  * rl_raylib is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * rl_raylib is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the
25  * Free Software Foundation, Inc.
26  * 51 Franklin Street, Fifth Floor
27  * Boston, MA 02110-1301, USA
28  *
29  * -->8-->8-->8-->8-- */
30 
31 /****************************************************************************
32  * Description: declare ReflectanceInfo, a descriptor for the reflectance
33  * information
34  *
35  * Note : (1-alpha) is real part of complex dielectric constant
36  * (-gamma) is imag part of complex dielectric constant
37  *
38  * History
39  *--------
40  * 1.0.1 2004-Dec-07 tjg simplify/remove include guards
41  * 1.0.0 1998-Jun-12 tjg fold rflinfo_private.h back into rflinfo.h
42  * 1.0.0 1998-Jun-12 tjg fold rflinfo_private.h back into rflinfo.h
43  * 0.0.0 1995-May-18 tjg original version
44  */
45 
46 #include <cstdlib> // size_t
47 #include <cstring> // memcpy
48 #include <cfloat> // DBL_MAX
49 #include <rl_raylib/rl_Traits.h> // rl_Traits::EInterpMode
50 #include <rl_raylib/rl_Exception.h> // rl_Exception
51 
52 // #define TEST_ALPHA_GAMMA
53 
54 //########################################################################
55 // rl_DielectricData
56 //########################################################################
57 //
65 {
66 public:
67 
74  {
79  };
80 
81 private:
82 
84  size_t nelts_;
86  rl_DielectricDataBinPOD* decrement_; // dielectric data
88  double emin_;
90  double emax_;
92  double bulkdensity_;
94  rl_Traits::EInterpMode interp_mode_;
95 
97  rl_DielectricData& operator=( rl_DielectricData const& ); // PROHIBITED
98 
99 public:
100 
105 
111 
116  rl_DielectricData( rl_DielectricData const& other );
117 
134  size_t num_pts,
135  rl_Traits::EInterpMode interp_mode,
136  double bulk_density = 1.0 );
137 
153  void init( rl_Traits::rl_DielectricPOD const* diel,
154  size_t num_pts,
155  rl_Traits::EInterpMode interp_mode,
156  double bulk_density = 1.0 );
157 
169  int alpha_gamma( double energy, double& alpha, double& gamma );
170 
174  double energy_min() const;
175 
179  double energy_max() const;
180 
186  double bulk_density_factor() const;
187 
191  rl_Traits::Bool is_vacuum() const;
192 };
193 
194 //########################################################################
195 //########################################################################
196 //
197 // # # # # # # # ###### ####
198 // # ## # # # ## # # #
199 // # # # # # # # # # ##### ####
200 // # # # # # # # # # # #
201 // # # ## # # # ## # # #
202 // # # # ###### # # # ###### ####
203 //
204 //########################################################################
205 //########################################################################
206 
207 //=========================================================================
208 // ctors...
209 
210 //-------------------------------------------------------------------------
211 inline rl_DielectricData::
213  : nelts_(0)
214  , decrement_(0)
215  , emin_(0.0)
216  , emax_(DBL_MAX)
217  , bulkdensity_(1.0)
218  , interp_mode_(rl_Traits::ELinLin)
219 {}
220 
221 //=========================================================================
222 // accessors...
223 
224 //-------------------------------------------------------------------------
225 inline double rl_DielectricData::
226 energy_min() const
227 { return emin_; }
228 
229 //-------------------------------------------------------------------------
230 inline double rl_DielectricData::
231 energy_max() const
232 { return emax_; }
233 
234 //-------------------------------------------------------------------------
235 inline double rl_DielectricData::
237 { return bulkdensity_; }
238 
239 //-------------------------------------------------------------------------
241 is_vacuum() const
242 { return rl_Traits::Bool(decrement_ == 0); }
243 
244 // rl_DielectricData_h_INCLUDED
245 #endif
rl_Traits::rl_DielectricPOD lo_
lower edge of energy bin
~rl_DielectricData()
Non-virtual detructor.
void init(rl_Traits::rl_DielectricPOD const *diel, size_t num_pts, rl_Traits::EInterpMode interp_mode, double bulk_density=1.0)
Initialization function.
rl_DielectricData()
Default constructor.
double bulk_density_factor() const
Return the maximum energy covered by this dataset.
int alpha_gamma(double energy, double &alpha, double &gamma)
Evaluate the dielectric decrements, alpha and gamma, at the given energy.
rl_Traits::rl_DielectricPOD hi_
upper edge of energy bin
double energy_min() const
Return the minimum energy covered by this dataset.
A class encapsulating the dielectric data (alpha, gamma) as a function of energy.
EInterpMode
Enumeration specifying the interpolation of the optical constants.
Definition: rl_Traits.h:69
rl_Traits::Bool is_vacuum() const
Returns True if the object is a vacuum state; False, otherwise.
A POD describing the lower and upper edge of an energy bin.
rl_Traits is a `‘traits’' class for the rl_RayLib library.
Definition: rl_Traits.h:55
double energy_max() const
Return the maximum energy covered by this dataset.
Bool
Typedef for the Boolean type.
Definition: rl_Traits.h:64