GOAT (Geometrical optics application tool) 0.1
Loading...
Searching...
No Matches
detector.h
Go to the documentation of this file.
1#ifndef DETECTOR_H
2#define DETECTOR_H
3
4#include "vector.h"
5#include "box.h"
6
7#include <iostream>
8#include <vector>
9
10namespace GOAT
11{
12 namespace raytracing
13 {
14 #define DETECTOR_PLANE 20000
15 #define DETECTOR_ANGLE 20001
16
17
22 {
23 public:
24 Detector(void);
25 Detector(int n1, int n2);
26 Detector(const Detector& Det);
28 maths::Vector<std::complex<double> >& operator () (int i1, int i2) { return D[i1][i2]; }
29 ~Detector(void);
30
31 void clean();
32 void clear();
42 virtual bool cross(maths::Vector<double> P, maths::Vector<double> k, int& i1, int& i2, double& l) = 0;
43 int N1();
44 int N2();
45 void setN1(int n1);
46 void setN2(int n2);
47 void setN(int n1, int n2);
48 void setPosition(maths::Vector<double> Pos) {this->P=Pos;}
49 double D1();
50 double D2();
51
52 void setD(double d1, double d2);
53
54 void setD1(double d1);
55
56 void setD2(double d2);
57
58 int Type() { return type; }
64 bool load(const char* fn);
65 void save(const char* fn);
66 void saveabs(const char* fn);
67 void savePhase(const char* fn, int coord);
68 void savereal(const char* fn, int coord);
69 void saveimag(const char* fn, int coord);
70 std::vector <std::vector<maths::Vector<std::complex<double>>>> D;
71 // maths::Vector<std::complex<double> >** D=nullptr; ///< Here, the data will be stored
74 friend std::ostream& operator << (std::ostream& os, Detector& D);
75 std::string fname;
80 void mult(double fac);
83 protected:
88 void init(int n1, int n2);
89 double d1=0, d2=0;
90 int n1=0, n2=0;
91 int type=-1;
92 friend class DetectorPlane;
93 };
94
95
122
123 /*class DetectorBox : public Detector
124 {
125 public:
126 DetectorBox(maths::Vector<double> P, maths::Vector<double> d, maths::Vector<int> n);
127 bool cross(maths::Vector<double> P, maths::Vector<double> k, int& i1, int& i2, double& l);
128
129 std::vector<std::vector<std::vector<std::complex<double> > > > data;
130 Box box;
131 };*/
132#define SAVE_X 0
133#define SAVE_Y 1
134#define SAVE_Z 2
135#define SAVE_PHASE_X 3
136#define SAVE_PHASE_Y 4
137#define SAVE_PHASE_Z 5
138#define SAVE_ABS 6
139}
140}
141#endif
Template class for threedimensional vectors.
Definition vector.h:57
void save(const char *fn)
stores the content (the whole vector)
maths::Vector< double > n
Definition detector.h:87
maths::Vector< double > P
Position of the detector.
Definition detector.h:86
void saveimag(const char *fn, int coord)
stores the content (imaginary part of one component of the the electric field, coord determines the c...
void setD(double d1, double d2)
void setN2(int n2)
set the dimension of the array in the second direction
void setN(int n1, int n2)
set the dimensions of the array
int N1()
returns the dimension of the array in the first direction
void savePhase(const char *fn, int coord)
stores the content (phase of one component of the electric field, coord determines the coordinate 0,...
void clean()
Clean all data, i.e. all data is set to zero (Data array is not removed)
friend std::ostream & operator<<(std::ostream &os, Detector &D)
Detector(const Detector &Det)
copy constructor
maths::Vector< double > gete2()
returns the direction of the second axis of the detector
Definition detector.h:82
maths::Vector< double > e2
unit vector in the second direction
Definition detector.h:85
maths::Vector< double > e1
unit vector in the first direction
Definition detector.h:84
void mult(double fac)
Multiply with factor. This functions multiplies all elements of the detector with the factor fac.
Detector & operator=(const Detector &D)
friend class DetectorPlane
Definition detector.h:92
virtual bool cross(maths::Vector< double > P, maths::Vector< double > k, int &i1, int &i2, double &l)=0
int N2()
returns the dimension of the array in the second direction
int Type()
returns kind of detector
Definition detector.h:58
void init(int n1, int n2)
initialise array (for internal use only)
void setN1(int n1)
set the dimension of the array in the first direction
void savereal(const char *fn, int coord)
stores the content (real part of one component of the the electric field, coord determines the coordi...
void setPosition(maths::Vector< double > Pos)
set the position of the detector
Definition detector.h:48
Detector(int n1, int n2)
Constructor which is called by the size of the array (n1 x n2)
void saveabs(const char *fn)
stores the content (absolute value of the electric field) of the detector array in the file determine...
double D2()
return the length in the second direction
std::vector< std::vector< maths::Vector< std::complex< double > > > > D
Here, the data will be stored.
Definition detector.h:70
maths::Vector< double > norm()
returns the normal vector of the detectors surface
Definition detector.h:73
maths::Vector< double > gete1()
returns the direction of the first axis of the detector
Definition detector.h:81
maths::Vector< double > position()
returns the position of the detector
Definition detector.h:72
bool load(const char *fn)
double D1()
return the length in the first direction
maths::Vector< std::complex< double > > & operator()(int i1, int i2)
bracket operator which gives the content inside the array determined by the indices i1 and i2
Definition detector.h:28
void setNorm(maths::Vector< double > n)
set the normal on the detector
DetectorPlane(maths::Vector< double > P, maths::Vector< double > n, double d, int N)
DetectorPlane(maths::Vector< double > P, maths::Vector< double > e1, maths::Vector< double > e2, int n1, int n2)
bool cross(maths::Vector< double > P, maths::Vector< double > k, int &i1, int &i2, double &l)
implementation of the intersection checking function for the plane detector
Raytracer used for ultrashort pulse calculation with raytracing only.
Definition asphericLens.h:6
This class is used for the iray class. This class is intended for internal use only....
Definition fresnel.h:7
This file contains the Vector template class and some useful functions around this class.