GOAT (Geometrical optics application tool) 0.1
Loading...
Searching...
No Matches
raytrace.h
Go to the documentation of this file.
1#pragma once
2#include "lightsrc_mc.h"
3#include "lightsrc.h"
4#include "objectshape.h"
5#include "vector.h"
6#include "detector.h"
7#include "raybase.h"
8#include "superarray.h"
9#include <vector>
10
11namespace GOAT
12{
13 namespace raytracing
14 {
15 #define RAYTRACER_TYPE_NONE 0
16 #define RAYTRACER_TYPE_PATH 1
17 #define RAYTRACER_TYPE_OT 2
18 #define RAYTRACER_TYPE_PURE 3
19
20 #define MAX_RECURSIONS 20
21 #define RAYTRACE_MAX_REFLEXIONS 2
27 class Scene
28 {
29 public:
31 Scene(const Scene& S);
34 void addObjectList(int nobj, std::vector<ObjectShape*> obj);
35 void removeObject(int index);
40 void removeLightSrc(int index);
43 void addLightSourceRRT(LightSrc* ls, maths::Vector<std::complex<double> >Pol1, maths::Vector<std::complex<double> >Pol2);
44 void addLightSourceList(int nls, std::vector<LightSrc*> ls);
46 void addDetectorList(int nDet, std::vector< Detector*> D);
48 void removeDetector(int index);
51 void setr0(double r0);
52 void setnS(std::complex<double> nS);
53 void setnSRRT(std::complex<double> nS);
54 void setRaytype(int raytype);
55 void setNumReflex(int numReflex);
56 void resetLS();
57 int testLS();
58 std::vector<ObjectShape*> Obj;
59 std::vector<LightSrc*> LS;
61 std::vector< Detector*> Det;
62 int nObj = 0;
63 int nLS = 0;
64 int nDet = 0;
65 int nReflex = 0;
66 std::complex<double> nS;
67 std::complex<double> nSRRT;
68 double r0=1000;
74 };
75
76
131
149
150
157 class Raytrace_Path : public Raytrace
158 {
159 public:
162 void trace(std::string FName);
163 void trace();
164 void setShowOutgoingRays(bool show);
166 std::vector<maths::Vector<double>> P1;
167 std::vector<maths::Vector<double>> P2;
168 int numRays=0;
169 private:
172 void storeStep();
174 std::ofstream os;
175 bool showOutgoingRays = true;
176 bool storeInFile = false;
177
178 };
179
184 class Raytrace_pure : public Raytrace
185 {
186 public:
189 private:
192 };
193
194 }
195}
Template class for threedimensional vectors.
Definition vector.h:57
The abstract Detector class provides an interface to a detector to store the information about the el...
Definition detector.h:22
This abstract class is the basic class for all light sources used in this raytracing library....
Definition lightsrc.h:68
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
maths::Vector< double > ** f
list of the forces acting on the objects, separated for the different light sources
Definition raytrace.h:146
void traceEnterObject()
force calculation, when the ray enters an object
maths::Vector< double > * F
list of the forces acting on the objects
Definition raytrace.h:144
void setScene(const Scene &S)
void traceLeaveObject()
force calculation, when the ray leaves an object
maths::Vector< double > * L
angular momenta acting on the objects
Definition raytrace.h:145
maths::Vector< double > ** l
list of the angular momenta acting on the objects, separated for the different light sources
Definition raytrace.h:147
std::vector< maths::Vector< double > > P2
Here, the ending points of each step are stored if no filename is given.
Definition raytrace.h:167
bool getShowOutgoingRays()
Returns true, if Rays, which going out of an object without hidding a second one will be stored.
void setShowOutgoingRays(bool show)
if true, Rays, which going out of an object without hidding a second one will be stored
Raytrace_Path(Scene)
Constructor with Scene Object.
void traceEnterObject()
this function is called when the ray enters an object
int numRays
Number of rays stored.
Definition raytrace.h:168
void trace(std::string FName)
Starting point of the raytracing with the filename where the data will be stored.
void traceLeaveObject()
this function is called when the ray leaves an object
std::vector< maths::Vector< double > > P1
Here, the starting points of each step are stored if no filename is given.
Definition raytrace.h:166
void trace()
If no Filename is given, the starting and endpoint of each ray step is stored in two arrays named P1 ...
void traceEnterObject()
this function is called when the ray enters an object
Definition raytrace.h:191
Raytrace_pure(const Scene &)
Constructor with Scene Object.
void traceLeaveObject()
this function is called when the ray leaves an object
Definition raytrace.h:190
bool useRRTParms
Flag which tells the raytracing procedure if the RRT parameters of scene or the normal parameters are...
Definition raytrace.h:117
virtual void traceOneRay(RayBase *ray, int &Reflexions, int &recur)
traces one ray
maths::Vector< std::complex< double > > EStop2
Start and end value of the electric field (second ray in IRay)
Definition raytrace.h:103
maths::Vector< std::complex< double > > EStop
Start and end value of the electric field.
Definition raytrace.h:102
int currentObj
Number of the last object hit (no object hit: -1)
Definition raytrace.h:98
maths::Vector< double > PStart
Definition raytrace.h:101
void setNumReflex(int numReflex)
sets number of reflexions
RayBase * tray
transmitted ray
Definition raytrace.h:127
double PowIn
Power of the incident ray.
Definition raytrace.h:114
double PowTrans
Power of the transmitted ray.
Definition raytrace.h:115
int currentLS
Number of the current light source, which is currently in the calculation process.
Definition raytrace.h:99
maths::Vector< double > ktrans
direction of the transmitted ray
Definition raytrace.h:109
Raytrace(const Scene &S)
virtual void traceEnterObject()=0
this function is called when the ray enters an object
Scene S
Description of the scene.
Definition raytrace.h:116
maths::Vector< double > kin
direction of the incident ray
Definition raytrace.h:107
maths::Vector< double > kref
direction of the reflected ray
Definition raytrace.h:108
void init()
this function is called if no object was hidden
virtual void traceStopObject()
Definition raytrace.h:95
virtual void traceLeaveObject()=0
this function is called when the ray leaves an object
void trace()
this is the starting point for the raytracing procedure
RayBase * ray
current ray
Definition raytrace.h:126
double PowRef
Powers stored when ray type is PRay.
Definition raytrace.h:113
void setScene(const Scene &S)
sets Scene
int lost
Rays unintentionally get lost, e.g. due to total internal reflection.
Definition raytrace.h:97
GOAT::maths::Vector< INDEX_TYPE > currentIndex
Definition raytrace.h:100
bool Abbruch
flag to stop calculation
Definition raytrace.h:128
maths::Vector< std::complex< double > > EStart2
Definition raytrace.h:103
maths::Vector< double > PStop
Start and end point of the last step.
Definition raytrace.h:101
int type
Flag which shows which type of raytracer is selected.
Definition raytrace.h:118
void copyRay(RayBase *&dest, RayBase *src)
int numReflex
current number of reflections
Definition raytrace.h:129
maths::Vector< std::complex< double > > EStart
Definition raytrace.h:102
Class defining a scene with lightsources and objects. This is a container used to inform the Raytrace...
Definition raytrace.h:28
bool suppress_phase_progress
If true, phase progress is skipped. This is needed for short pulse calculations.
Definition raytrace.h:70
INDEX_TYPE getNumberOfCellsPerDirection() const
Definition raytrace.h:72
int nDet
Number of detectors.
Definition raytrace.h:64
void addLightSourceList(int nls, std::vector< LightSrc * > ls)
add list of lightsources, nls: number of lightsources
void setnSRRT(std::complex< double > nS)
set the refractive index of the filling material in the scene
void removeAllLightSources()
removes all light sources from the scene
void addObject(ObjectShape *Obj)
add single object to scene
int nLS
Number of light sources.
Definition raytrace.h:63
int nObj
Number of objects in the scene.
Definition raytrace.h:62
double r0
Radius of the calculation space. All rays are followed within this calculation sphere.
Definition raytrace.h:68
void addObjectList(int nobj, std::vector< ObjectShape * > obj)
add a list of objects to scene, nobj: number of objects
void addLightSource(LightSrc *ls, int raytype)
add single lightsource to scene and determine ray type
std::vector< LightSrc * > LS
List of all light sources.
Definition raytrace.h:59
void setNumberOfCellsPerDirection(INDEX_TYPE no)
Definition raytrace.h:73
void removeAllObjects()
removes all objects from the scene
void setPhaseProgress(bool suppress_phase_progress)
LightSrc * LSRRT
Light source for reversed ray tracing (RRT)
Definition raytrace.h:60
int raytype
Type of the rays created by the light source. More detailed information about the available ray types...
Definition raytrace.h:69
void removeLightSrc(int index)
remove one light source from the scene
void setNumReflex(int numReflex)
set the number of reflections per ray considered in the raytracing
void removeDetector(int index)
remove detector "index" from detector list
int testLS()
tests, if all lightsources are outside all objects (return value: -1, if every lightsource is outside...
std::vector< ObjectShape * > Obj
List of all objects within the scene.
Definition raytrace.h:58
Scene()
Standard constructor.
void removeLightSource(LightSrc *ls)
void removeObject(int index)
removes object with index "index" from object list
void setRaytype(int raytype)
set the ray type for all light sources
void removeAllDetectors()
remove all detectors from the scene
void addLightSource(LightSrc *ls)
add single lightsource to scene
Definition raytrace.h:38
void cleanAllDetectors()
clean all detectors, i.e. all detectors are set to zero, but the detectors remain in the scene
int nReflex
Number of reflections.
Definition raytrace.h:65
void removeDetector(Detector *det)
Scene(const Scene &S)
Copy constructor.
void removeObject(ObjectShape *obj)
removes object, identified by its pointer from object list
void addLightSourceRRT(LightSrc *ls, maths::Vector< std::complex< double > >Pol1, maths::Vector< std::complex< double > >Pol2)
std::complex< double > nSRRT
refractive index of the surrounding medium (RRT), i.e. the medium between the objects
Definition raytrace.h:67
void setnS(std::complex< double > nS)
set the refractive index of the filling material in the scene
void addDetector(Detector *D)
add single detector to scene
INDEX_TYPE NumCellsPerDir
Number of cells per direction, used e.g. in raytrace_Inel for the virtual space grid.
Definition raytrace.h:71
std::vector< Detector * > Det
List of detectors, which are storing the electric field inside a defined area.
Definition raytrace.h:61
void addDetectorList(int nDet, std::vector< Detector * > D)
add a list of detectors to the scene, nDet: number of detectors to add
void setr0(double r0)
set the radius of the calculation space
std::complex< double > nS
refractive index of the surrounding medium, i.e. the medium between the objects
Definition raytrace.h:66
void resetLS()
reset all light sources. That means the counters for the rays within of the light sources are set to ...
#define LIGHTSRC_RAYTYPE_IRAY
Ray class : IRay.
Definition lightsrc.h:17
Raytracer used for ultrashort pulse calculation with raytracing only.
Definition asphericLens.h:6
long long int INDEX_TYPE
Definition superarray.h:16
This class is used for the iray class. This class is intended for internal use only....
Definition fresnel.h:7
#define RAYTRACER_TYPE_NONE
Definition raytrace.h:15
#define RAYTRACE_MAX_REFLEXIONS
Definition raytrace.h:21
This file contains the Vector template class and some useful functions around this class.