GOAT (Geometrical optics application tool) 0.1
Loading...
Searching...
No Matches
tubedray.h
Go to the documentation of this file.
1/***************************************************************************
2 tubed.h - description
3 -------------------
4 begin : Fri Oct 15 1999
5 copyright : (C) 1999 by Thomas Weigel
6 email : weigel@lat.ruhr-uni-bochum.de
7 ***************************************************************************/
8
9
10
11#pragma once
12#include "raybase.h"
13#include <complex>
14//#include "fresnel.h"
15#include "resutil.h"
16#include "vector.h"
17#include "matrix.h"
18#include "plane.h"
19#include "objectshape.h"
20
21namespace GOAT {
22 namespace raytracing {
23
24 /*#ifndef KORR
25 #define KORR 1E-8
26 #endif */
27
28#define KEIN_SCHNITTPUNKT -1
29#define GESCHNITTEN 0
30#define IN_Plane 1
31
32#ifndef EPS_WINKEL
33#define EPS_WINKEL 0
34#endif
35
36
40
41
45 typedef struct {
46 std::complex<double> n;
50 int numObj;
51 std::vector<ObjectShape*> Obj;
52 double r0;
55
56
57
61 typedef struct
62 {
63 double w0;
66 bool isGauss;
67 } Gauss;
68
69
70 void binWrite(Gauss gs, std::ofstream& os);
71 void binRead(Gauss& Gs, std::ifstream& is);
72
73
74 std::ostream& operator << (std::ostream& os, Gauss gs);
75
76#ifndef OHNE_GAUSS
77#define OHNE_GAUSS
79#endif
80
88 class tubedRay : public RayBase {
89 public:
91 tubedRay(const tubedRay& ray);
98 tubedRay(Plane E, const maths::Vector<double>& p, double dy, double dz, const
99 maths::Vector<std::complex<double> >& Pol, std::complex<double> n0, double r0, double
100 k0, const int Anzein = 0, std::vector<ObjectShape*> Einschluss = std::vector<ObjectShape*>(), bool logRay = false);
101 tubedRay(const maths::Vector<double>& p, double dy, double dz, const maths::Vector<std::complex<double> >& Pol, const maths::Vector<double>& K, std::complex<double> n0, double r0, double k0, const int Anzein = 0, std::vector<ObjectShape*> Einschluss = std::vector<ObjectShape*>(), bool logRay = false);
102 void setGauss(Gauss g) { this->g = g; }
103 bool next();
105 int objectIndex() { return objIndex; }
106 void reflectRay(RayBase*& tray, maths::Vector<double> n, std::complex<double> n1, std::complex<double> n2);
107 tubedRay reflect(maths::Vector<double> n, std::complex<double> n1, std::complex<double> n2);
108 void refract(maths::Vector<double> n, std::complex<double> n1, std::complex<double> n2);
109 void tunnel(maths::Vector<std::complex<double> > Pol, std::complex<double> n1, std::complex<double> n2);
110 void tunnel(maths::Vector<std::complex<double> > Pol, std::complex<double> na, std::complex<double> np, int l);
111 double flaeche();
112 void setRefract(std::complex<double> n) { this->n = n; }
113 std::complex<double> getRefract() { return n; }
114 void setk(int i, const maths::Vector<double>& K) { k[i] = K; }
115 void setphi(int i, const std::complex<double>& p) { phi[i] = p; }
116 void setP(int i, const maths::Vector<double>& p) { P[i] = p; }
117 void setiR(int i) { iR = i; }
118 void setGetunnelt(bool v) { getunnelt = v; }
119 void setN0(std::complex<double> n) { n0 = n; }
120 maths::Vector<double> getk(int i) { return k[i]; }
121 maths::Vector<double> getk() { return k[4]; }
122 maths::Vector<double> getP(int i) { return P[i]; }
123 maths::Vector<double> getP() { return P[4]; }
124 std::complex<double> getphi(int i) { return phi[i]; }
125 void getP(maths::Vector<double> p[5]) { p = P; }
127 void setAmp(int i, const maths::Vector<std::complex<double> >& A) { E[i] = A; }
128 ObjectShape* Einschluss(int i) { return Obj[i]; }
130 bool Einschluss() { return inObject; }
131 bool isInObject() { return inObject; }
132 // maths::Vector<double> checkEinschluss(int s, const maths::Vector<double>& Ps,int& Index);
134
135 bool Getunnelt() { return getunnelt; }
136 int currentObjectIndex() { return objIndex; }
137 double Intensity(int i) { return abs2(E[i]); }
138 friend std::ostream& operator << (std::ostream& os, tubedRay S);
139 int reflections() { return iR; }
148 double pjump(maths::Vector<double> P1[5], maths::Vector<double> P2[5], const double epsilon = 1E-10);
158
159 double pjump(void);
164 public:
172 tubedRay reflect(maths::Vector<double>* n, std::complex<double> n1, std::complex<double> n2);
173
180 void refract(maths::Vector<double>* n, std::complex<double> n1, std::complex<double> n2);
181
189 maths::Matrix<std::complex<double> > Fresnel_reflect(double alpha, std::complex<double> n1, std::complex<double> n2);
190
198 maths::Matrix<std::complex<double> > Fresnel_trans(double alpha, std::complex<double> beta, std::complex<double> n1, std::complex<double> n2);
199
200
201 void initElectricField(const maths::Vector<std::complex<double> >& Pol, const int numRays, double dx, Plane Eb);
202 void initElectricFieldGauss(int i, const Plane& Eb, const maths::Vector<std::complex<double> >& Pol);
203
204 void initElectricField(const maths::Vector<std::complex<double> >& Pol, int AnzRays = 1);
207 const maths::Vector<double> P20, const maths::Vector<double> P21);
209 maths::Vector <double> nextCaustic(double& l);
210
212 // project(int i){};
217
218 std::complex<double> phi[5];
219 //EinschlussInfo *Ein;
220 int iR;
221 int pol;
223 bool logRay;
227 double KORR;
228 };
229 }
230}
This class represents a threedimensional (numeric) Matrix as a template.
Definition matrix.h:23
Template class for threedimensional vectors.
Definition vector.h:57
Abstract base class for all volume objects This abstract class provides a template for all volume obj...
Definition objectshape.h:60
Abstract base class for all rays used for the raytracing process. This abstract base class for all ra...
Definition raybase.h:16
int objIndex
index of the current object
Definition raybase.h:29
std::complex< double > n0
current refractive index and refractive index of the host material
Definition raybase.h:30
bool inObject
is in an object
Definition raybase.h:26
std::complex< double > n
Definition raybase.h:30
std::vector< ObjectShape * > Obj
list of all objects
Definition raybase.h:27
RayBase * tray
transmitted ray (used by the raytracer, for internal use only)
Definition raybase.h:25
double k0
wave number
Definition raybase.h:31
maths::Vector< double > k[5]
Definition tubedray.h:215
void setAmp(int i, const maths::Vector< std::complex< double > > &A)
sets the value of the electric field of the i-th sub-ray
Definition tubedray.h:127
void setphi(int i, const std::complex< double > &p)
Definition tubedray.h:115
maths::Vector< std::complex< double > > E[5]
Definition tubedray.h:216
void setP(int i, const maths::Vector< double > &p)
Definition tubedray.h:116
tubedRay reflect(maths::Vector< double > n, std::complex< double > n1, std::complex< double > n2)
bool Einschluss()
like isInObject (for compatibilty reasons, will be removed in future)
Definition tubedray.h:130
void refract(maths::Vector< double > *n, std::complex< double > n1, std::complex< double > n2)
This method refracts the beam.
tubedRay & operator=(const tubedRay &S)
double pjump(void)
for internal use only
void tunnel(maths::Vector< std::complex< double > > Pol, std::complex< double > n1, std::complex< double > n2)
Strahl wird gebrochen.
double Intensity(int i)
returns the squared magnitude of the electric field
Definition tubedray.h:137
std::complex< double > getphi(int i)
Definition tubedray.h:124
tubedRay(Plane E, const maths::Vector< double > &p, double dy, double dz, const maths::Vector< std::complex< double > > &Pol, std::complex< double > n0, double r0, double k0, const int Anzein=0, std::vector< ObjectShape * > Einschluss=std::vector< ObjectShape * >(), bool logRay=false)
maths::Vector< double > ka
Definition tubedray.h:226
tubedRay(const maths::Vector< double > &p, double dy, double dz, const maths::Vector< std::complex< double > > &Pol, const maths::Vector< double > &K, std::complex< double > n0, double r0, double k0, const int Anzein=0, std::vector< ObjectShape * > Einschluss=std::vector< ObjectShape * >(), bool logRay=false)
maths::Vector< std::complex< double > > getAmp(int i)
returns the value of the electric field of the i-th sub-ray
Definition tubedray.h:126
void initElectricField(const maths::Vector< std::complex< double > > &Pol, int AnzRays=1)
void refract(maths::Vector< double > n, std::complex< double > n1, std::complex< double > n2)
Strahl wird reflektiert.
tubedRay(tubedRayBuffer &B)
maths::Vector< double > nextCaustic(double &l)
int schneidePlane(const Plane &E, double d, maths::Vector< double > &S1, maths::Vector< double > &S2)
void getP(maths::Vector< double > p[5])
returns an array whichs holds the current positions of the sub-rays
Definition tubedray.h:125
double crossXAxis(const maths::Vector< double > &P1, const maths::Vector< double > &P2, const maths::Vector< double > &k)
maths::Vector< double > getk(int i)
returns the directional vector of the i-th sub-ray
Definition tubedray.h:120
double normVol(maths::Vector< double > P[5], maths::Vector< double > k, maths::Vector< double > n)
void initElectricFieldGauss(int i, const Plane &Eb, const maths::Vector< std::complex< double > > &Pol)
ObjectShape * Einschluss(int i)
Definition tubedray.h:128
maths::Vector< double > getP()
returns the position of the central sub-ray (same as getP(4) )
Definition tubedray.h:123
int objectIndex()
index of the current object or -1
Definition tubedray.h:105
maths::Vector< double > getP(int i)
returns the position of the i-th sub-ray
Definition tubedray.h:122
double pjump(maths::Vector< double > P1[5], maths::Vector< double > P2[5], const double epsilon=1E-10)
This method checks if there is a phase jump due to self focusing The method checks if neighboring edg...
int currentObjectIndex()
returns index of the currently hitted object
Definition tubedray.h:136
std::complex< double > phi[5]
Definition tubedray.h:218
void setRefract(std::complex< double > n)
set current refractive index
Definition tubedray.h:112
maths::Vector< double > crossPlane(const maths::Vector< double > Pe, const maths::Vector< double > n)
maths::Vector< double > P[5]
Definition tubedray.h:214
void setk(int i, const maths::Vector< double > &K)
Definition tubedray.h:114
bool schneidePlane(maths::Vector< double > *Erg, const Plane &E)
tubedRay reflect(maths::Vector< double > *n, std::complex< double > n1, std::complex< double > n2)
This method reflects the beam.
maths::Vector< double > getk()
return the directional vector of the central sub-ray (same as getk(4) )
Definition tubedray.h:121
std::complex< double > getRefract()
returns the current refractive index
Definition tubedray.h:113
double pjump(maths::Vector< double > P1[5], maths::Vector< double > P2[5], maths::Vector< double > *S)
This method checks if there is a phase jump due to self focusing The method checks if neighboring edg...
bool next()
do the next step
double cross(const maths::Vector< double > P10, const maths::Vector< double > P11, const maths::Vector< double > P20, const maths::Vector< double > P21)
void reflectRay(RayBase *&tray, maths::Vector< double > n, std::complex< double > n1, std::complex< double > n2)
reflects ray
void setN0(std::complex< double > n)
Definition tubedray.h:119
bool isInObject()
Is the ray currently inside an object?
Definition tubedray.h:131
maths::Matrix< std::complex< double > > Fresnel_reflect(double alpha, std::complex< double > n1, std::complex< double > n2)
calculates the Fresnel matrix for the reflected beam (used in method reflect)
void checkObjectIntersection(int Index[5], maths::Vector< double > *Pmin)
void setGetunnelt(bool v)
Definition tubedray.h:118
void tunnel(maths::Vector< std::complex< double > > Pol, std::complex< double > na, std::complex< double > np, int l)
maths::Vector< double > OK
Definition tubedray.h:213
tubedRay(const tubedRay &ray)
maths::Vector< double > schneidePlane(const Plane &E, bool &found)
maths::Matrix< std::complex< double > > Fresnel_trans(double alpha, std::complex< double > beta, std::complex< double > n1, std::complex< double > n2)
calculates the Fresnel matrix for the refracted beam (used in method reflect)
void initElectricField(const maths::Vector< std::complex< double > > &Pol, const int numRays, double dx, Plane Eb)
friend std::ostream & operator<<(std::ostream &os, tubedRay S)
maths::Vector< std::complex< double > > getE()
gives back electric field strength
Definition tubedray.h:104
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
double abs2(double x)
returns the squared absolute value of x
const Gauss ohne_gauss
Definition tubedray.h:78
void binRead(lensSide ls, std::ifstream &is)
read a lensSide structure from a binary file
void binWrite(lensSide ls, std::ofstream &os)
write a lensSide structure in a binary file
std::ostream & operator<<(std::ostream &os, Box B)
output operator for the Box class
This class is used for the iray class. This class is intended for internal use only....
Definition fresnel.h:7
maths::Vector< double > F
(virtual) beam waist
Definition tubedray.h:64
maths::Vector< double > k
position of the beam
Definition tubedray.h:65
bool isGauss
direction of the beam
Definition tubedray.h:66
double r0
list of objects in the scene
Definition tubedray.h:52
maths::Vector< double > P[5]
current refractive index
Definition tubedray.h:47
maths::Vector< std::complex< double > > *** Gitter
radius of the calculation space
Definition tubedray.h:53
int numObj
current electric field of the edge ray (index 0-3) and of the center ray (index 4)
Definition tubedray.h:50
std::complex< double > n
Definition tubedray.h:46
std::vector< ObjectShape * > Obj
number of objects within the scene
Definition tubedray.h:51
maths::Vector< double > k[5]
current position of the edge ray (index 0-3) and of the center ray (index 4)
Definition tubedray.h:48
maths::Vector< std::complex< double > > E[5]
current direction of the edge ray (index 0-3) and of the center ray (index 4)
Definition tubedray.h:49
This file contains the Vector template class and some useful functions around this class.