rl_raylib  1.1.10
rl_Multilayer.h
1 #ifndef rl_Multilayer_h_INCLUDED
2 #define rl_Multilayer_h_INCLUDED
3 
4 // File: rl_Multilayer.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 multilayer surface properties:
33  * . multilayer properties
34  * . complex reflection coefficient
35  *
36  * History
37  *--------
38  * 1.0.1 2004-Dec-07 tjg simplify/remove include guards
39  * 0.0.0 1998-Jun-24 tjg original version
40  */
41 
42 #include <cstdlib> // size_t
43 #include <rl_raylib/rl_Traits.h> // rl_Traits::EInterpMode complex
44 #include <rl_raylib/rl_DielectricLayer.h> // rl_Traits::EInterpMode complex
45 
46 class rl_ReflectionCoefPOD; // forward declaration
47 
48 //########################################################################
49 // rl_Multilayer
50 //########################################################################
51 
61 {
62 private:
63 
65  rl_Multilayer();
67  rl_Multilayer( rl_Multilayer const& );
69  rl_Multilayer& operator=( rl_Multilayer const& );
70 
71 protected:
72 
81 
82 public:
83 
86 
92  virtual ~rl_Multilayer();
93 
105  rl_DielectricLayer* layers,
106  rl_Traits::Bool adopt_data = rl_Traits::True );
107 
119  void
120  init( int num_layers,
121  rl_DielectricLayer* layers,
122  rl_Traits::Bool adopt_data = rl_Traits::True );
123 
133  int
135  rl_ReflectionCoefPOD& rfl,
136  //out: reflection coefficient
137  double energy, // in: energy of ray
138  double sg // in: sine graze angle
139  );
140 
170  int
171  multilayer_reflectivity( double& rfl, // out: multilayer reflectivity
172  double energy, // in: energy of ray
173  double sg, // in: sine graze angle
174  double polarization_factor = 0.0 // in:
175  );
176 
180  rl_DielectricLayer const& layer( int layer_no ) const;
181 
185  int num_layers() const;
186 
197  std::ostream& dump_on( std::ostream& os, int layer_no,
198  char const pre[] = "",
199  char const pst[] = "" ) const;
200 
209  void cdump_on( std::FILE* of, int layer_no,
210  char const pre[] = "",
211  char const pst[] = "" ) const;
212 };
213 
214 //########################################################################
215 //########################################################################
216 //
217 // # # # # # # # ###### ####
218 // # ## # # # ## # # #
219 // # # # # # # # # # ##### ####
220 // # # # # # # # # # # #
221 // # # ## # # # ## # # #
222 // # # # ###### # # # ###### ####
223 //
224 //########################################################################
225 //########################################################################
226 
227 
228 //=========================================================================
229 // accessors
230 inline int rl_Multilayer::
231 num_layers() const
232 {
233  return num_layers_;
234 }
235 
236 // rl_Multilayer_h_INCLUDED
237 #endif
int num_layers_
number of multilayers
Definition: rl_Multilayer.h:74
std::ostream & dump_on(std::ostream &os, int layer_no, char const pre[]="", char const pst[]="") const
Dump information about layer layer_no to stream os.
void cdump_on(std::FILE *of, int layer_no, char const pre[]="", char const pst[]="") const
Dump information about layer layer_no to output FILE*.
rl_Traits::Bool own_data_
do we own the rl_DielectricLayer array?
Definition: rl_Multilayer.h:80
void init(int num_layers, rl_DielectricLayer *layers, rl_Traits::Bool adopt_data=rl_Traits::True)
Initialize multilayer from num_layers individual layers.
A Plain Ol' Data class representing complex reflection coefficients.
rl_DielectricLayer vacuum_
the top (vacuum) layer
Definition: rl_Multilayer.h:76
int multilayer_reflect_coef(rl_ReflectionCoefPOD &rfl, double energy, double sg)
Evaluate the multilayer reflection coefficients.
int num_layers() const
A class encapsulating reflection of a ray from a multilayer surface.
Definition: rl_Multilayer.h:60
rl_DielectricLayer * layer_
array of dielectric layers
Definition: rl_Multilayer.h:78
int multilayer_reflectivity(double &rfl, double energy, double sg, double polarization_factor=0.0)
Evaluate the multilayer reflectivity (assuming unpolarized rays)
EInterpMode
Enumeration specifying the interpolation of the optical constants.
Definition: rl_Traits.h:69
rl_DielectricLayer const & layer(int layer_no) const
rl_Traits::EInterpMode EInterpMode
interpolation mode for dielectric data
Definition: rl_Multilayer.h:85
virtual ~rl_Multilayer()
Destructor.
A class encapsulating the multilayer reflection of a ray.
Bool
Typedef for the Boolean type.
Definition: rl_Traits.h:64