16#define LIGHTSRC_RAYTYPE_RAY 1
17#define LIGHTSRC_RAYTYPE_IRAY 2
18#define LIGHTSRC_RAYTYPE_PRAY 3
34#define LIGHTSRC_NOT_LAST_RAY 0
35#define LIGHTSRC_IS_LAST_RAY 1
36#define LIGHTSRC_ERROR -1
37#define Z0 376.730313461
39#define LIGHTSRC_POL_X 0
40#define LIGHTSRC_POL_Y 1
41#define LIGHTSRC_POL_Z 2
42#define LIGHTSRC_POL_USER_DEFINED 0
90 virtual double area() {
return 1.0; }
148 std::vector<ObjectShape*>
Obj;
163 std::complex<double>
n0;
307 LightSrcGauss(
maths::Vector<double> Pos,
int N,
double wvl,
double w0,
maths::Vector<double> focuspos,
double D = 1.0,
maths::Vector<std::complex<double> >
Pol =
maths::Vector<std::complex<double> >(0.0, 1.0, 0.0),
int raytype =
LIGHTSRC_RAYTYPE_IRAY,
double r0 = 1.0);
325 if (abs(
e1) < 1E-10)
e1 = maths::ex;
339 double theta = atan(
wvl / (M_PI *
w0));
340 NA = real(
n0) * sin(theta);
344 k0 = 2.0 * M_PI /
wvl;
345 std::cout <<
"Gauss: k=" <<
k << std::endl;
350 w =
w0 * sqrt(1.0 + z * z / (
z0 *
z0));
361 Normfak =
Z0 * sqrt(2.0 / M_PI) / (
n0 * l * M_PI) *
w /
w0 /
w0 * exp(-2.0 * l * l /
w /
w);
Template class for threedimensional vectors.
This class represents a single ray.
void binWriteItem(std::ofstream &os)
writes content of LightSrc in a binary file, represented by is (has to be specified by the derived cl...
int next(GOAT::raytracing::RayBase *ray)
std::complex< double > calcStartPhase(maths::Vector< double > P)
maths::Vector< double > getFocuspos()
returns the position of the focus
void setWvl(double wvl)
sets the vacuum wavelength
LightSrcGauss(const LightSrcGauss &)
maths::Vector< double > focuspos
focal position
void setk(maths::Vector< double > k)
sets the main direction of light source
double area()
area A of the light source
double getNA()
returns numerical aperture
double calcz0()
recalculates Rayleigh-length z0
std::complex< double > Normfak
void setW0(double w0)
sets the beam's waist
void setFocuspos(maths::Vector< double > fp)
sets the focus position to fp
void setNA(double na)
sets the numerical aperture NA and recalculates the width D, the focal beam waist w0 and the Rayleigh...
double z0
Rayleigh length (for internal use only)
void binReadItem(std::ifstream &is)
reads content of LightSrc from a binary file, represented by os (has to be specified by the derived c...
double f
distance between light source area and the focal point
double w
radius of the beam (for internal use only)
double w0
Waist diameter (fictitious !), only used for the correct calculation of the electric field distributi...
void setPos(maths::Vector< double > pos)
sets the position of the light source to pos
double NA
numerical aperture (normalized by the intermediate refractive index)
LightSrcGauss(maths::Vector< double > Pos, int N, double wvl, double w0, maths::Vector< double > focuspos, double D=1.0, maths::Vector< std::complex< double > > Pol=maths::Vector< std::complex< double > >(0.0, 1.0, 0.0), int raytype=LIGHTSRC_RAYTYPE_IRAY, double r0=1.0)
Main constructor for gaussian beam light source The direction of the beam is given by the starting po...
This abstract class is the basic class for all light sources used in this raytracing library....
void setObject(ObjectShape *O, int i=-1)
exchanges i-th object in the object list
virtual void binReadItem(std::ifstream &os)=0
reads content of LightSrc from a binary file, represented by os (has to be specified by the derived c...
maths::Vector< std::complex< double > > initPol
Polarisation, if the k-Vector points in z-direction.
int N
number of rays (per direction)
int numObjs
number of objects
maths::Vector< double > k
main direction of the light source
double r0
radius of the calculation sphere
void binWrite(std::ofstream &os)
reads content of LightSrc from a binary file, represented by os
void setR0(double r0)
sets the radius of the calculation sphere
void addObject(ObjectShape *obj)
add single object to the object list
maths::Vector< double > Pos
position of the light source (center of the square area of the light source)
virtual void binWriteItem(std::ofstream &os)=0
writes content of LightSrc in a binary file, represented by is (has to be specified by the derived cl...
void setNumRaysRT(int numRaysRT)
virtual int next(RayBase *ray)=0
virtual int next(IRay &ray)=0
void setD(double D1, double D2)
LightSrc(const LightSrc &)
Copy constructor.
void setPol(maths::Vector< std::complex< double > > pol)
sets the polarisation
void ObjectList(int Anz, std::vector< ObjectShape * > Obj)
void setWavelength(double wvl)
void setD(double D)
sets the width of the light source (this resets also the ray counter)
void setN0(std::complex< double > n0)
sets the complex valued refractive index of the intermediate medium
friend class LightSrcGauss
void clearObjects()
clear object list
int raytype
Strahltyp : ray oder ISTRAHL (=RAY oder IRAY)
virtual int next(Ray_pow &ray)=0
friend class LightSrcPlane
void binRead(std::ifstream &is)
writes content of LightSrc in a binary file, represented by is
ObjectShape * getObject(int i)
returns i-th item in the object list
double D2
width in the e1- and the e2-direction (used only for _mc versions of LightSrc)
int rayType()
returns the current ray type
void removeObject(ObjectShape *obj)
remove object from the object list
int getNumRays()
returns the number of rays (per direction in space)
std::complex< double > n0
refractive index of the intermediate medium
double k0
wavenumber (i.e.
maths::Vector< std::complex< double > > Pol2
second polarisation (used by IRay)
double density
ray density, i.e. distance between two neighboring rays
int getNumObjs()
returns the number of Objects (only needed, when used seperately outside scene)
bool suppress_phase_progress
if set true, the phase won't be changed when calling a next method (needed for USP-calculations)
void reset()
Reset everything (counting starts from the beginning)
void setWavenumber(double k0)
maths::Vector< std::complex< double > > getInitPol()
maths::Vector< double > e2
unit vectors that span the light source area
double D
width of the square light source area
int i1
first index of the ray inside the starting area (for internal use, -1 if the calculation has not yet ...
int polType
Polarisationsrichtung (s.o.)
std::vector< ObjectShape * > Obj
list of all objects
int numRaysRT
used in GOATvis to determine number of rays for ray representation
maths::Vector< std::complex< double > > Pol
polarisation (default: (0.0, 1.0, 0.0)
void setPos(maths::Vector< double > P)
sets the position of the light source. This is the center of the square area of the light source
maths::Vector< double > rotVec
Vector which holds the spherical coordinates , and of the direction vector k.
void setk(const maths::Vector< double > &k)
sets the main direction of the light source
virtual int next(tubedRay &ray)=0
int type
type of the light source
double getDensity()
returns the ray density, i.e. the number of rays per unit length (=D/N)
maths::Vector< double > e1
maths::Vector< double > getk()
returns the main direction of the light source
int i2
second index of the ray inside the starting area (for internal use, -1 if the calculation has not yet...
maths::Vector< double > getPos()
returns the position of the light source. This is the center of the square area of the light source
friend std::ostream & operator<<(std::ostream &os, LightSrc *ls)
void binReadItem(std::ifstream &os)
reads content of LightSrc from a binary file, represented by os (has to be specified by the derived c...
void binWriteItem(std::ofstream &os)
writes content of LightSrc in a binary file, represented by is (has to be specified by the derived cl...
maths::Vector< double > direction
LightSrcLine(maths::Vector< double > Pos, int N, double wvl, double size, maths::Vector< double > k=maths::ez, maths::Vector< double > direction=maths::ey)
constructor
double area()
area A of the light source,
LightSrcPlane(const LightSrcPlane &)
copy Constructor
int next(tubedRay &S)
gives the next ray for the following calculations
int next(Ray_pow &S)
gives the next ray for the following calculations
int next(GOAT::raytracing::RayBase *ray)
Destructor, not needed.
LightSrcPlane(maths::Vector< double > Pos, int N, double wvl, double D=100.0, maths::Vector< std::complex< double > > Pol=maths::Vector< std::complex< double > >(0.0, 1.0, 0.0), int raytype=LIGHTSRC_RAYTYPE_IRAY, double r0=100.0)
constructor with the following parameters : Pos: position of the light source, k : main direction of ...
void binWriteItem(std::ofstream &os)
writes content of LightSrc in a binary file, represented by is (has to be specified by the derived cl...
void binReadItem(std::ifstream &os)
reads content of LightSrc from a binary file, represented by os (has to be specified by the derived c...
int next(IRay &S)
gives the next ray for the following calculations
LightSrcRing(maths::Vector< double > Pos, int N, double wvl, double rmin=0.0, double rmax=100.0, maths::Vector< std::complex< double > > Pol=maths::Vector< std::complex< double > >(0.0, 1.0, 0.0), int raytype=LIGHTSRC_RAYTYPE_IRAY, double r0=100.0)
void binReadItem(std::ifstream &os)
reads content of LightSrc from a binary file, represented by os (has to be specified by the derived c...
double getRmax()
returns the outer radius of the light source
void setRmax(double rmax)
set the outer radius of the light source
void binWriteItem(std::ofstream &os)
writes content of LightSrc in a binary file, represented by is (has to be specified by the derived cl...
double getRmin()
returns the inner radius of the light source
void setRmin(double rmin)
set the inner radius of the light source
Abstract base class for all volume objects This abstract class provides a template for all volume obj...
This class provides a ray which carries a special power.
Abstract base class for all rays used for the raytracing process. This abstract base class for all ra...
This class represents a ray with a finite cross section. class tubedRay: This class represents a ray ...
#define Z0
impedance of the free space in Ohms
#define LIGHTSRC_RAYTYPE_IRAY
Ray class : IRay.
#define LIGHTSRC_POL_Y
Light source is polarized in y-direction.
Raytracer used for ultrashort pulse calculation with raytracing only.
constexpr int LIGHTSRC_SRCTYPE_GAUSS
Light source is a gaussian wave.
void copyLightSrcList(LightSrc **&d, LightSrc **s, int nLS)
Copy the given light source list.
void binWriteLSList(std::ofstream &os, int nLS, LightSrc **ls)
Writes a list of light sources into a binary file.
void binReadLSList(std::ifstream &is, int nLS, LightSrc **&ls)
Reads list of light sources from a binary file and allocates the memory for the light source list.
constexpr int LIGHTSRC_SRCTYPE_TOPHAT
Light source is a top hat.
constexpr int LIGHTSRC_SRCTYPE_PLANE_MC
Light source is a plane wave (random distribution)
constexpr int LIGHTSRC_SRCTYPE_RING
Light source is a ring shaped wave.
constexpr int LIGHTSRC_SRCTYPE_PLANE
Light source is a plane wave.
constexpr int LIGHTSRC_SRCTYPE_RING_MC
Light source is a ring (random distribution)
constexpr int LIGHTSRC_SRCTYPE_LINE
Light source along a straight line.
constexpr int LIGHTSRC_SRCTYPE_GAUSS_MC
Light source is a gaussian wave (random distribution)
constexpr int LIGHTSRC_SRCTYPE_POINT_MC
Point light source (random distribution)
constexpr int LIGHTSRC_SRCTYPE_LINE_MC
Light source along a straight line (random distribution)
constexpr int LIGHTSRC_SRCTYPE_POINT
Point light source.
This class is used for the iray class. This class is intended for internal use only....
This file contains the Vector template class and some useful functions around this class.