rl_raylib  1.1.10
rl_DielectricLayer.h
1 #ifndef rl_DielectricLayer_h_INCLUDED
2 #define rl_DielectricLayer_h_INCLUDED
3 
4 // File: rl_DielectricLayer.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  * encapsulate the dielectric layer properties:
33  *
34  * History
35  *--------
36  * 1.0.1 2004-Dec-07 tjg simplify/remove include guards
37  * 0.0.0 1998-Jun-24 tjg original version
38  */
39 
40 #include <cstdlib> // size_t
41 #include <rl_raylib/rl_Traits.h> // rl_Traits::EInterpMode complex
42 #include <rl_raylib/rl_Exception.h> // rl_Exception
43 #include <rl_raylib/rl_DielectricData.h> // rl_DielectricData
44 #include <rl_raylib/rl_ReflectionCoefPOD.h> // rl_ReflectionCoefPOD
45 #include <rl_raylib/rl_TransmissionCoefPOD.h> // rl_ReflectionCoefPOD
46 #include <rl_raylib/rl_Exception.h> // rl_Exception
47 
48 //########################################################################
49 // rl_DielectricLayer
50 //########################################################################
51 //
61 {
62 public:
63 
66 
69 
70 private:
71 
72  rl_DielectricLayer& operator=( rl_DielectricLayer const& );
73 
75  char* name_;
76 
78  rl_DielectricData diel_info_;
79 
81  double thickness_;
82 
90  double zcoat_;
91 
93  double alpha_;
94 
96  double gamma_;
97 
99  ERoughType rtype_;
100 
102  double srough_;
103 
105  double lambda_;
106 
108  complex prop_;
109 
127  complex kt_perp_;
128 
134  double phase_factor_; // 2\pi srough_ / lambda_
135 
137  rl_ReflectionCoefPOD rflcoef_;
138 
142 
146 
148  complex tij_tji_para_;
149 
151  complex tij_tji_perp_;
152 
154  complex r_para_;
155 
157  complex r_perp_;
158 
160  complex r2_para_;
161 
163  complex r2_perp_;
164 
166  complex r2_tij_tji_para_;
167 
169  complex r2_tij_tji_perp_;
170 
171  complex sqrt_epsratio_;
172  complex eps_epsupper_;
173  complex sqrt_eps_epsupper_;
174 
176  rl_Traits::Bool is_substrate_;
177 
178 public:
179 
184 
191  rl_DielectricLayer( char const layer_name[] = 0 );
192 
198  rl_DielectricLayer( rl_DielectricLayer const& other );
199 
216  diel,
217  std::size_t ndielpts,
218  double layer_thickness,
219  double roughness,
221  rl_Traits::EInterpMode interp_mode,
222  double bulkdensity,
223  char const* layer_name,
224  rl_Traits::Bool is_substrate = rl_Traits::False
225  );
226 
243  void init( rl_Traits::rl_DielectricPOD const* diel,
244  std::size_t ndielpts,
245  double layer_thickness,
246  double roughness,
248  rl_Traits::EInterpMode interp_mode,
249  double bulkdensity,
250  char const* layer_name,
251  rl_Traits::Bool is_substrate = rl_Traits::False
252  );
253 
261  int setup_for( double energy, double sinphi );
262 
274  void reflect_nlayer( rl_DielectricLayer layer[],
275  int num );
276 
293  void reflect_amp( rl_DielectricLayer const& layer,
294  double sinphi );
295 
301  complex const& propagator() const;
302 
308  double alpha() const;
309 
315  double gamma() const;
316 
322  double roughness() const;
323 
329  ERoughType roughness_type() const;
330 
336  rl_ReflectionCoefPOD const& reflection_coef() const;
337 
359  double reflectivity( double polarization_factor = 0.0 ) const;
360 
366 
371  rl_Traits::Bool is_vacuum() const;
372 
376  char const* layer_name() const;
377 
381  double energy_min() const;
382 
386  double energy_max() const;
387 
391  double thickness() const;
392 
396  double zcoat() const;
397 
402  double bulk_density_factor() const;
403 
411  std::ostream& dump_on( std::ostream& os, char const pre[] = "",
412  char const pst[] = "" ) const;
413 
421  void cdump_on( std::FILE* of, char const pre[] = "", char const pst[] = "" ) const;
422 
430  void cprint_constraints_on( std::FILE* of,
431  char const pre[] = "",
432  char const pst[] = "" ) const;
433 
434 
435 private:
436 
446  void
447  apply_DebyeWaller_RSAO_factor(
448  rl_DielectricLayer const& upper, // upper layer
449  double sinphi // sin(graze angle)
450  );
451 
461  void
462  apply_DebyeWaller_CSAO_factor(
463  rl_DielectricLayer const& upper, // upper layer
464  double sinphi // sin(graze angle)
465  );
466 
474  void
475  apply_DebyeWaller_Spiller_factor( double sinphi // sin(graze angle)
476  );
486  void
487  apply_ModifiedDW_factor( rl_DielectricLayer const& upper, // upper layer
488  double sinphi // sin(graze angle)
489  );
490 
513  void
514  apply_NevotCroce_factor( rl_DielectricLayer const& upper, // upper layer
515  double sinphi // sin(graze angle)
516  );
517 };
518 
520 propagator() const
521 { return prop_; }
522 
523 inline double rl_DielectricLayer::
524 alpha() const
525 { return alpha_; }
526 
527 inline double rl_DielectricLayer::
528 gamma() const
529 { return gamma_; }
530 
531 inline double rl_DielectricLayer::
532 thickness() const
533 { return thickness_; }
534 
535 inline double rl_DielectricLayer::
536 zcoat() const
537 { return zcoat_; }
538 
541 { return rtype_; }
542 
543 inline double rl_DielectricLayer::
544 roughness() const
545 { return srough_; }
546 
549 { return rflcoef_; }
550 
551 inline double rl_DielectricLayer::
552 reflectivity( double polarization_factor ) const
553 { return rflcoef_.reflectivity( polarization_factor ); }
554 
557 { return is_substrate_; }
558 
560 is_vacuum() const
561 { return diel_info_.is_vacuum(); }
562 
563 inline char const* rl_DielectricLayer::
564 layer_name() const
565 { if ( name_ ) { return name_; } else { return ""; } }
566 
567 inline double rl_DielectricLayer::
568 energy_min() const
569 { return diel_info_.energy_min(); }
570 
571 inline double rl_DielectricLayer::
572 energy_max() const
573 { return diel_info_.energy_max(); }
574 
575 inline double rl_DielectricLayer::
577 { return diel_info_.bulk_density_factor(); }
578 
579 // rl_DielectricLayer_h_INCLUDED
580 #endif
ERoughType roughness_type() const
Returns the roughness type of the upper surface of this layer.
void init(rl_Traits::rl_DielectricPOD const *diel, std::size_t ndielpts, double layer_thickness, double roughness, rl_Traits::ERoughType roughness_type, rl_Traits::EInterpMode interp_mode, double bulkdensity, char const *layer_name, rl_Traits::Bool is_substrate=rl_Traits::False)
Initializer.
std::complex< double > complex
Typedef for the complex type.
Definition: rl_Traits.h:61
int setup_for(double energy, double sinphi)
Set up layer state for given energy and graze angle.
double energy_max() const
double energy_min() const
double bulk_density_factor() const
Return the maximum energy covered by this dataset.
double bulk_density_factor() const
double reflectivity(double polarization_factor=0.0) const
Returns: this layer's reflectivity.
void reflect_nlayer(rl_DielectricLayer layer[], int num)
Compute reflectivity for a stack of num layers.
rl_Traits::Bool is_substrate() const
A Plain Ol' Data class representing complex reflection coefficients.
double alpha() const
Returns this layer's dielectric decrement (real part).
double thickness() const
rl_Traits::ERoughType ERoughType
roughness type
void cdump_on(std::FILE *of, char const pre[]="", char const pst[]="") const
Dumps layer information to a C-style FILE* stream.
double reflectivity(double polarization_factor=0.0) const
evaluate the reflectivity.
rl_ReflectionCoefPOD const & reflection_coef() const
Returns this layer's complex reflection coefficient.
std::ostream & dump_on(std::ostream &os, char const pre[]="", char const pst[]="") const
Dumps layer information to a stream.
rl_Traits::complex complex
complex type
rl_DielectricLayer(char const layer_name[]=0)
Constructor.
void cprint_constraints_on(std::FILE *of, char const pre[]="", char const pst[]="") const
Dumps layer information and constraints to a C-style FILE* stream.
double energy_min() const
Return the minimum energy covered by this dataset.
char const * layer_name() const
A class encapsulating the dielectric data (alpha, gamma) as a function of energy.
rl_Traits::Bool is_vacuum() const
EInterpMode
Enumeration specifying the interpolation of the optical constants.
Definition: rl_Traits.h:69
~rl_DielectricLayer()
Destructor.
ERoughType
Enumeration specifying the type of interlayer diffusion treatment.
Definition: rl_Traits.h:80
rl_Traits::Bool is_vacuum() const
Returns True if the object is a vacuum state; False, otherwise.
complex const & propagator() const
The propagator for this layer.
double energy_max() const
Return the maximum energy covered by this dataset.
void reflect_amp(rl_DielectricLayer const &layer, double sinphi)
Compute reflection amplitude for the interface between this layer and the layer immediately above it.
A class encapsulating the multilayer reflection of a ray.
double gamma() const
Returns this layer's dielectric decrement (imag part).
A Plain Ol' Data class representing complex reflection coefficients.
Bool
Typedef for the Boolean type.
Definition: rl_Traits.h:64
double roughness() const
Returns the roughness parameter of the upper surface of this layer.