GOAT (Geometrical optics application tool) 0.1
Loading...
Searching...
No Matches
resutil.h
Go to the documentation of this file.
1#include <complex>
2#include <limits>
3#include "vector.h"
4#include "matrix.h"
5
6#pragma once
7namespace GOAT
8{
9 namespace raytracing
10 {
11#ifndef INF
12 constexpr double INF = std::numeric_limits<double>::infinity();
13#endif
14#ifndef complex_I
15#define complex_I
16 //std::complex<double> I=std::complex<double>(0.0,1.0); // imaginaere Einheit
17#define I std::complex<double>(0.0,1.0)
18#endif
19
20#ifndef RESUTIL_H
21#define RESUTIL_H
22
23#define SENKRECHT 1
24#define PARALLEL 0
25#define MULTI 1
26#define ANZ_STRAHLEN 500 // Anzahl der einfallenden Strahlen
27
28#define IS_NOTHING 0
29#define IS_ROW 1
30#define IS_COL 2
31
32#ifndef SQRT3
33#define SQRT3 1.73205080756887729352744634150587 // Wurzel aus 3
34#endif
35
36#define RAMAN 0
37#define FLUORESZENZ 1
38
39#define IN_OBJECT 1
40#define IN_HOST 2
41#define IN_INC_AND_HOST 3
42
43#ifndef VAR_XZ
44#define VAR_XZ 1
45#endif
46#ifndef VAR_YZ
47#define VAR_YZ 2
48#endif
49#ifndef VAR_XY
50#define VAR_XY 3
51#endif
52
53
54 typedef struct
55 {
56 int x, y;
57 } Point;
58
59 typedef struct
60 {
61 char Name[255];
62 double n;
63 } OptProp;
64
65
66 typedef struct
67 {
68 /*
69 E : Richtungsvektor des Felds
70 EAmp : Amplitude
71 k : Ausbreitungsvektor (normiert)
72 phi : Phase
73 pol : Polarisationsrichtung (senkrecht oder parallel)
74 alpha : Winkel von einem Reflexionspunkt zur naechsten (vom
75 Partikelmittelpkt. gerechnet
76 m : Anzahl der bisher durchgefuehrten Strahlumlaeufe
77 */
78
79
81 int pol;
83 std::complex<double> E;
84 std::complex<double> phi;
85 int m;
86 double b;
87 } StrahlInfo;
88
89 typedef struct
90 {
91
92 maths::Vector <double> P;
95
96 typedef struct
97 {
98 /*
99 P : Ort des Einschlusses
100 n : Brechungsindex
101 a : Radius (in Einheiten des Partikelradius�)
102 alpha : Polarisierbarkeit;
103 */
104 maths::Vector <double> P;
105 std::complex<double> n;
106 double a;
108 } objectInfo;
109
110
115 {
116 public:
118 int Ebene;
119 int Pol;
121 double angmin, angmax;
122 int nang;
123 double wave;
125 };
127 {
128 /*
129 nx,ny : Anzahl der Gitterpunkte in x/y-Richtung
130 alpha : Einfallswinkel (relativ zur x-Achse)
131 AnzReflex : Anzahl der max. durch zufuehrenden Reflexionen an der Oberflaeche
132 pro Strahl
133 AnzRays : Anzahl Strahlen
134 dx, dy : Breite und Hoehe einer Gitterzelle
135 dxy : Diagonale einer Gitterzelle
136 r0 : Groesse des Partikels
137 l0 : (Vakuum-)Wellenlaenge
138 n0 : Brechungsindex des Partikels
139 pol : Polarisation des einfallenden Strahls
140 ResRad : radiale Modenzahl
141 ResAzi : azimutale Modenzahl (phi-Richtung)
142 numObj : Anzahl Einschluesse
143 ColMin, ColMax : Minimal-/Maximalwert bei Farbeinteilung (in % des Maximums)
144 */
145
146 public:
148
150 double r0;
151
153 int nx, ny;
155 double alpha;
157 double dx;
159 double dy;
161 double dxy;
162 double db;
167 double bmax, r0end, l0, k0;
169 std::complex<double> n0;
171 int pol;
174 double AngleTol, evan;
175 double PolAngle;
176 int phase;
179 double ColMax, ColMin;
180 int EinX;
182 };
183
184
185
186 std::ostream& operator << (std::ostream& os, GlobalParms& parms);
187 std::istream& operator >> (std::istream& is, GlobalParms& parms);
188
189 double abs2(double x);
190
191 void output(int nx, int ny, maths::Vector<std::complex<double> >** G);
192 void init_Strahl(GlobalParms Parms, StrahlArray* Strahl);
193 void sub_Gitter(GlobalParms parms, maths::Vector<std::complex<double> >** Erg,
194 maths::Vector<std::complex<double> >** Gitter1,
195 maths::Vector<std::complex<double> >** Gitter2);
196 void add_Gitter(GlobalParms parms, maths::Vector<std::complex<double> >** Erg,
197 maths::Vector<std::complex<double> >** Gitter1,
198 maths::Vector<std::complex<double> >** Gitter2);
199 void clear(GlobalParms parms, maths::Vector<std::complex<double> >** Gitter);
200 void Delete(int n, maths::Vector<std::complex<double> >** Gitter);
201 void copy(StrahlInfo& dest, StrahlInfo src);
202 double minmax(double a, double b);
205
207 maths::Vector <double> set_grid_point(const GlobalParms& parms, Point P);
208 double grad(const GlobalParms& parms, maths::Vector<std::complex<double> >** Gitter, const maths::Vector<double>& P);
209 //std::complex<double> asin(const std::complex<double> &);
210 std::complex<double> acos(const std::complex<double>&);
212 const maths::Vector<double>& P0,
213 const maths::Vector<double>& k);
214
215 void minmax(double x, double dx, int& min, int& max);
217 StrahlInfo& S, int numObj, objectInfo* Obj,
218 maths::Vector<double>& Ps, int& Index);
220 StrahlInfo& S, int numObj, objectInfo* Obj,
221 maths::Vector<double>& Ps, int& Index);
223 const maths::Vector<double> k, int numObj, objectInfo* Obj,
224 maths::Vector<double>& Ps, int& Index);
225
227 void toString(char* S, objectInfo* E, int i);
228 std::ostream& operator << (std::ostream& os, objectInfo E);
229
231 std::ostream& savebinGlobalParms(std::ostream& os, GlobalParms parms);
232 std::istream& loadbinGlobalParms(std::istream& os, GlobalParms& parms);
233 GlobalParms readGlobalParms(bool old, std::ifstream& is);
234 GlobalParms readGlobalParms(bool old, std::ifstream* is);
235 void writeRRTParms(std::ofstream& os, RRTParmsInfo erg);
236 RRTParmsInfo readRRTParms(bool old, std::ifstream* is);
237 RRTParmsInfo readRRTParms(bool old, std::ifstream& is);
238 void readRRTParms(std::ifstream& is, RRTParmsInfo& erg);
239 }
240}
241#endif
This class represents a threedimensional (numeric) Matrix as a template.
Definition matrix.h:23
Template class for threedimensional vectors.
Definition vector.h:57
int AnzReflex
Anzahl der max. durch zufuehrenden Reflexionen an der Oberflaeche pro Strahl.
Definition resutil.h:164
double r0
Radius der "Weltkugel".
Definition resutil.h:150
int nx
Anzahl der Gitterpunkte in x/y-Richtung.
Definition resutil.h:153
std::complex< double > n0
Brechungsindex des Umgebungsmediums.
Definition resutil.h:169
double alpha
Einfallswinkel (relativ zur x-Achse)
Definition resutil.h:155
double dx
Breite einer Gitterzelle.
Definition resutil.h:157
int pol
Polarisationsrichtung: kann die Werte SENKRECHT und PARALLEL annehmen.
Definition resutil.h:171
double dy
Hoehe einer Gitterzelle.
Definition resutil.h:159
double dxy
Diagonale einer Gitterzelle.
Definition resutil.h:161
int AnzRays
Anzahl Strahlen.
Definition resutil.h:166
Class used to set the parameters for inelastic scattering (may replaced later)
Definition resutil.h:115
This file contains the definition of a template for 3x3 matrices, which can be used together with the...
Raytracer used for ultrashort pulse calculation with raytracing only.
Definition asphericLens.h:6
RRTParmsInfo readRRTParms(bool old, std::ifstream *is)
void toString(char *S, objectInfo *E, int i)
std::ostream & savebinGlobalParms(std::ostream &os, GlobalParms parms)
std::complex< double > acos(const std::complex< double > &)
std::istream & loadbinGlobalParms(std::istream &os, GlobalParms &parms)
double abs2(double x)
returns the squared absolute value of x
maths::Vector< double > set_grid_point(const GlobalParms &parms, Point P)
void init_Strahl(GlobalParms Parms, StrahlArray *Strahl)
maths::Vector< double > kart2sph(maths::Vector< double > v)
bool operator==(objectInfo a, objectInfo b)
maths::Vector< double > nextP(maths::Vector< double > P, maths::Vector< double > k, maths::Vector< double > OK, double rK, bool &found)
double grad(const GlobalParms &parms, maths::Vector< std::complex< double > > **Gitter, const maths::Vector< double > &P)
maths::Vector< double > sph2kart(maths::Vector< double > v)
constexpr double INF
Definition resutil.h:12
void checkObjectIntersection(maths::Vector< double > &anf, const maths::Vector< double > &end, StrahlInfo &S, int numObj, objectInfo *Obj, maths::Vector< double > &Ps, int &Index)
void output(int nx, int ny, maths::Vector< std::complex< double > > **G)
void copy(StrahlInfo &dest, StrahlInfo src)
void writeRRTParms(std::ofstream &os, RRTParmsInfo erg)
GlobalParms readGlobalParms(bool old, std::ifstream &is)
void add_Gitter(GlobalParms parms, maths::Vector< std::complex< double > > **Erg, maths::Vector< std::complex< double > > **Gitter1, maths::Vector< std::complex< double > > **Gitter2)
double minmax(double a, double b)
void sub_Gitter(GlobalParms parms, maths::Vector< std::complex< double > > **Erg, maths::Vector< std::complex< double > > **Gitter1, maths::Vector< std::complex< double > > **Gitter2)
Point get_grid_point(const GlobalParms &parms, maths::Vector< double > P)
std::ostream & operator<<(std::ostream &os, Box B)
output operator for the Box class
void clear(GlobalParms parms, maths::Vector< std::complex< double > > **Gitter)
void Delete(int n, maths::Vector< std::complex< double > > **Gitter)
std::istream & operator>>(std::istream &is, GlobalParms &parms)
maths::Vector< double > next(const GlobalParms &parms, const maths::Vector< double > &P0, const maths::Vector< double > &k)
This class is used for the iray class. This class is intended for internal use only....
Definition fresnel.h:7
maths::Vector< double > P
Definition resutil.h:92
std::complex< double > E
Definition resutil.h:83
maths::Vector< double > k
Definition resutil.h:82
std::complex< double > phi
Definition resutil.h:84
maths::Vector< double > EAmp
Definition resutil.h:82
maths::Vector< double > P
Definition resutil.h:104
maths::Matrix< double > alpha
Definition resutil.h:107
std::complex< double > n
Definition resutil.h:105
This file contains the Vector template class and some useful functions around this class.