96 bool addInc(std::vector<ObjectShape*>
Obj,
int numObj,
const bool isAbsolute=
false);
146 std::vector<ObjectShape*>
Obj;
151 std::vector <std::vector <std::vector <std::vector <T> > > >
G;
152 std::vector < std::vector < std::vector <T> > >
K;
154 std::vector<maths::Vector<INDEX_TYPE>>
Pul;
155 std::vector<maths::Vector<INDEX_TYPE>>
n;
242 for (
int i = 0; (i <
numObjs) && (ok); i++) ok =
addInc(
Obj[i], isAbsolute);
255 if (
G[i].size() == 0)
G[i].resize(
n[i][0] + 1);
258 G[i][ix].resize(
n[i][1] + 1);
262 G[i][ix][iy].resize(
n[i][2] + 1);
295 std::cerr <<
"[arrangeGrids] d=" <<
d <<
"\tr0=" <<
r0 <<
"\tnges=(" <<
nges[0] <<
"," <<
nges[1] <<
"," <<
nges[2] <<
")" << std::endl;
297 for (
int i = 0; i <
numObjs; i++)
300; h = ceil(ediv(
Obj[i]->por,
d)) - floor(ediv(
Obj[i]->pul,
d));
307 if (
Obj[i]->isActive())
309 G[i].resize(
n[i][0] + 1);
312 G[i][ix].resize(
n[i][1] + 1);
316 G[i][ix][iy].resize(
n[i][2] + 1);
335 h = ceil(ediv(E->
por-E->
pul,
d)) ;
341 + hn[0] *
sizeof(T**)
342 + hn[0] * hn[1] *
sizeof(T*)
343 + hn[0] * hn[1] * hn[2] *
sizeof(T);
392 for (
int ix =
n[i][0]; ix >= 0; ix--)
394 for (
int iy =
n[i][1]; iy >= 0; iy--)
404 for (
int i = 0; i <
Obj.size(); i++)
419 return Obj[i]->isInside(P);
424 return (
Obj[i]->isInside(emult(Pi,
d)));
443 }
while ((i <
numObjs) && (!found));
455 return G[i][Pi[0]][Pi[1]][Pi[2]];
467 return K[Pi[0]][Pi[1]][Pi[2]];
488 }
while ((i <
numObjs) && (!found));
501 return G[i][Pi[0]][Pi[1]][Pi[2]];
513 return K[Pi[0]][Pi[1]][Pi[2]];
528 if (
G[i].size() == 0)
533 if (!isEinKoord) Pi = Pi -
Pul[i];
534 return G[i][Pi[0]][Pi[1]][Pi[2]];
540 return K[Pi[0]][Pi[1]][Pi[2]];
562 if (Pi[0] >=
n[i][0])
569 if (Pi[1] >=
n[i][1])
576 if (Pi[2] >=
n[i][2])
584 return G[i][Pi[0]][Pi[1]][Pi[2]];
590 return K[Pi[0]][Pi[1]][Pi[2]];
605 for (i = 0; i < 3; i++)
616 }
while ((i <
numObjs) && (!found));
632 std::cout <<
"PI:" << Pi << std::endl;
633 return G[i][Pi[0]][Pi[1]][Pi[2]];
640 return K[Pi[0]][Pi[1]][Pi[2]];
657 for (
int j = 0; j < 3; j++)
668 return G[i][Pi[0]][Pi[1]][Pi[2]];
674 return K[Pi[0]][Pi[1]][Pi[2]];
694 for (
int i =
numObjs - 1; i >= 0; i--)
698 for (
int ix =
n[i][0]; ix >= 0; ix--)
700 for (
int iy =
n[i][1]; iy >= 0; iy--)
721 for (
int k = 0; k < anzx2; k++)
781 for (
int i = 0; i <
numObjs; i++)
782 if (
Obj[i]->isActive())
786 G[i][ix][iy][iz] = S.
G[i][ix][iy][iz];
807 if (
this == &S)
return *
this;
814 this->
Obj.shrink_to_fit();
822 anzx =
nges[0]; anzx2 =
nges[0] / 2;
846 for (
int k = 0; k < anzx2; k++)
849 for (
int l = 0; l < S.
ywerte[k]; l++)
852 for (
int m = 0; m < S.
zwerte[k][l]; m++)
854 K[anzx2 - 1 - k][
ywerte[k] - 1 - l][m] = S.
K[anzx2 - 1 - k][
ywerte[k] - 1 - l][m];
855 K[anzx2 + k][
ywerte[k] - 1 - l][m] = S.
K[anzx2 + k][
ywerte[k] - 1 - l][m];
856 K[anzx2 - 1 - k][
ywerte[k] + l][m] = S.
K[anzx2 - 1 - k][
ywerte[k] + l][m];
857 K[anzx2 + k][
ywerte[k] + l][m] = S.
K[anzx2 + k][
ywerte[k] + l][m];
858 K[anzx2 - 1 - k][
ywerte[k] - 1 - l][2 *
zwerte[k][l] - 1 - m] = S.
K[anzx2 - 1 - k][
ywerte[k] - 1 - l][2 *
zwerte[k][l] - 1 - m];
873 int anzx2 =
nges[0] / 2;
879 for (
int i = 0; i < S.
numObjs; i++)
880 for (
int ix = 0; ix < S.
n[i][0]; ix++)
881 for (
int iy = 0; iy < S.
n[i][1]; iy++)
882 for (
int iz = 0; iz < S.
n[i][2]; iz++)
883 G[i][ix][iy][iz] += S.
G[i][ix][iy][iz];
887 for (
int k = 0; k < anzx2; k++)
889 for (
int l = 0; l <
ywerte[k]; l++)
892 for (
int m = 0; m <
zwerte[k][l]; m++)
894 K[anzx2 - 1 - k][
ywerte[k] - 1 - l][m] += S.
K[anzx2 - 1 - k][
ywerte[k] - 1 - l][m];
895 K[anzx2 + k][
ywerte[k] - 1 - l][m] += S.
K[anzx2 + k][
ywerte[k] - 1 - l][m];
896 K[anzx2 - 1 - k][
ywerte[k] + l][m] += S.
K[anzx2 - 1 - k][
ywerte[k] + l][m];
897 K[anzx2 + k][
ywerte[k] + l][m] += S.
K[anzx2 + k][
ywerte[k] + l][m];
898 K[anzx2 - 1 - k][
ywerte[k] - 1 - l][2 *
zwerte[k][l] - 1 - m] += S.
K[anzx2 - 1 - k][
ywerte[k] - 1 - l][2 *
zwerte[k][l] - 1 - m];
910 int anzx2 =
nges[0] / 2;
915 for (
int i = 0; i < S.
numObjs; i++)
916 for (
int ix = 0; ix < S.
n[i][0]; ix++)
917 for (
int iy = 0; iy < S.
n[i][1]; iy++)
918 for (
int iz = 0; iz < S.
n[i][2]; iz++)
919 G[i][ix][iy][iz] -= S.
G[i][ix][iy][iz];
923 for (
int k = 0; k < anzx2; k++)
925 for (
int l = 0; l <
ywerte[k]; l++)
928 for (
int m = 0; m <
zwerte[k][l]; m++)
930 K[anzx2 - 1 - k][
ywerte[k] - 1 - l][m] -= S.
K[anzx2 - 1 - k][
ywerte[k] - 1 - l][m];
931 K[anzx2 + k][
ywerte[k] - 1 - l][m] -= S.
K[anzx2 + k][
ywerte[k] - 1 - l][m];
932 K[anzx2 - 1 - k][
ywerte[k] + l][m] -= S.
K[anzx2 - 1 - k][
ywerte[k] + l][m];
933 K[anzx2 + k][
ywerte[k] + l][m] -= S.
K[anzx2 + k][
ywerte[k] + l][m];
934 K[anzx2 - 1 - k][
ywerte[k] - 1 - l][2 *
zwerte[k][l] - 1 - m] -= S.
K[anzx2 - 1 - k][
ywerte[k] - 1 - l][2 *
zwerte[k][l] - 1 - m];
946 os <<
"r0=" << S.
r0 << std::endl;
947 os <<
"Ausdehnung: nx=" << S.
nges[0] <<
" ny=" << S.
nges[1] <<
" nz=" << S.
nges[2] << std::endl;
948 os << S.
numObjs <<
" Einschluesse" << std::endl;
950 for (
int i = 0; i < S.
numObjs; i++)
952 os <<
"====================== Einschluss Nr. " << i <<
" ======================" << std::endl;
953 for (
int ix = 0; ix < S.
n[i][0]; ix++)
954 for (
int iy = 0; iy < S.
n[i][1]; iy++)
955 for (
int iz = 0; iz < S.
n[i][2]; iz++)
956 os << abs(S.
G[i][ix][iy][iz]) << std::endl;
967 anzx =
nges[0]; anzx2 =
nges[0] / 2;
971 for (
int i = 0; i <
numObjs; i++)
972 if (
Obj[i]->isActive())
973 for (
int ix = 0; ix <
n[i][0]; ix++)
974 for (
int iy = 0; iy <
n[i][1]; iy++)
975 for (
int iz = 0; iz <
n[i][2]; iz++)
976 G[i][ix][iy][iz] = x;
980 for (
int k = 0; k < anzx2; k++)
982 for (
int l = 0; l <
ywerte[k]; l++)
984 for (
int m = 0; m <
zwerte[k][l]; m++)
986 K[anzx2 - 1 - k][
ywerte[k] - 1 - l][
zwerte[k][l] - 1 - m] = x;
1003 for (
int i = 0; i <
numObjs; i++)
1004 for (
int ix = 0; ix <
n[i][0]; ix++)
1005 for (
int iy = 0; iy <
n[i][1]; iy++)
1006 for (
int iz = 0; iz <
n[i][2]; iz++)
1007 for (
int j = 0; j < 3; j++)
1008 G[i][ix][iy][iz][j] = abs(
G[i][ix][iy][iz][j]);
1017 double dx, dy, dz, hilf;
1019 anzx2 =
nges[0] / 2;
1030 for (
int i = 0; i < anzx2; i++)
1032 ywerte.push_back(ceil(sqrt(1.0 - (i * dx) * (i * dx)) / dy));
1033 for (
int j = 0; j < anzx2; j++)
1035 hilf = 1.0 - (i * dx) * (i * dx) - (j * dy) * (j * dy);
1039 zwerte[i].push_back(ceil(sqrt(hilf) / dz));
1048 for (
int k = 0; k < anzx2; k++)
1050 K[anzx2 - 1 - k].resize(2 *
ywerte[k]);
1051 K[anzx2 + k].resize(2 *
ywerte[k]);
1052 for (
int l = 0; l <
ywerte[k]; l++)
1056 K[anzx2 - 1 - k][
ywerte[k] - 1 - l].resize(2 *
zwerte[k][l]);
1064 int anzx, jx, jy, jz, ix, iy, iz, jxh, jyh;
1067 ix = Pi[0]; iy = Pi[1]; iz = Pi[2];
1070 jxh = abs(
int(jx - (anzx - 1) / 2.0));
1071 jy = iy - (anzx / 2 -
ywerte[jxh]);
1072 if ((jy < 0) || (jy > (2 *
ywerte[jxh] - 1)))
1083 jz = iz - (anzx / 2 -
zwerte[jxh][jyh]);
1085 if ((jz < 0) || (jz > (2 *
zwerte[jxh][jyh]) - 1))
1105 int anzx, jx, jy, jz, ix, iy, iz, jxh, jyh;
1108 ix = Pi[0]; iy = Pi[1]; iz = Pi[2];
1110 jxh = abs(
int(jx - (anzx - 1) / 2.0));
1111 jy = iy - (anzx / 2 -
ywerte[jxh]);
1113 if ((jy < 0) || (jy > (2 *
ywerte[jxh] - 1)))
1115 std::cout <<
"Fehler!! Index iy falsch" << std::endl;
1120 jyh = abs(
int(jy - (2 *
ywerte[jxh] - 1) / 2.0));
1121 jz = iz - (anzx / 2 -
zwerte[jxh][jyh]);
1123 if ((jz < 0) || (jz > (2 *
zwerte[jxh][jyh]) - 1))
1127 return K[jx][jy][jz];
1134 int anzx, jx, jy, jz, jxh, jyh;
1140 jxh = abs(
int(jx - (anzx - 1) / 2.0));
1141 jy = iy - (anzx / 2 -
ywerte[jxh]);
1142 if ((jy < 0) || (jy > (2 *
ywerte[jxh] - 1)))
1144 std::cout <<
"Fehler!! Index iy falsch" << std::endl;
1150 jyh = abs(
int(jy - (2 *
ywerte[jxh] - 1) / 2.0));
1151 jz = iz - (anzx / 2 -
zwerte[jxh][jyh]);
1152 if ((jz < 0) || (jz > (2 *
zwerte[jxh][jyh]) - 1))
1154 std::cout <<
"Fehler!! Index iz falsch" << std::endl;
1227bool save(
SuperArray<std::vector<GOAT::raytracing::gridEntry > > S, std::string FName);
This class represents a threedimensional (numeric) Matrix as a template.
Template class for threedimensional vectors.
Abstract base class for all volume objects This abstract class provides a template for all volume obj...
maths::Vector< double > por
corners of the circumferent cuboid (lower left corner and upper right corner)
maths::Vector< double > pul
bool isActive()
returns true if the object should be considered for inelastic calculation
Template class to store arbitrary information in a 3D-grid This template class provides a virtual 3D-...
SuperArray(const SuperArray &S)
bool inObject(maths::Vector< double > P, int i)
checks if P is inside the i-th object (p in real coordinates)
int type
Mainly used for inelastic scattering. type=IN_HOST means the grid is stored in the whole volume,...
void reinit(double r0, INDEX_TYPE n)
T kugelwert(maths::Vector< int > Pi)
for internal use only
maths::Vector< INDEX_TYPE > gitterpunkt(maths::Vector< double > P)
maths::Vector< INDEX_TYPE > kugelindex(maths::Vector< INDEX_TYPE > Pi)
Checks if the point Pi (indicated by the indices) is inside the calculation sphere The function retur...
std::vector< std::vector< std::vector< std::vector< T > > > > G
Here, the data is stored. G[i][ix][iy][iz], whereas i: index of the object, ix,iy,...
bool write(std::string fname)
void sub(const SuperArray &S)
Subtract another SuperArray object. In this function, all array elements from S are subtracted from t...
void add(const SuperArray &S)
Adds another SuperArray object. In this function, all array elements from S are added to the existing...
bool addInc(std::vector< ObjectShape * >Obj, int numObj, const bool isAbsolute=false)
Summing up SuperArray Here, all cell contents are first added up. The absolute value is taken from th...
std::vector< std::vector< int > > zwerte
bool read(std::string fname)
std::vector< maths::Vector< INDEX_TYPE > > Pul
bool write(std::string fname)
maths::Matrix< double > H
maths::Vector< double > d
Edge length of one cell in x-, y- and z-direction.
std::vector< int > ywerte
void setNumberOfCellsPerDirection(INDEX_TYPE no)
void clear()
Clear the SuperArray and release the allocated memory.
std::vector< ObjectShape * > Obj
maths::Matrix< double > R
Transformation matrices in the local array coordinate system and backwards.
int Error
Holds an error number.
SuperArray & operator=(const SuperArray &S)
Assignment operator.
void fill(const T &x)
Fill the whole SuperArray with value x.
void copy(const SuperArray &S)
Copies SuperArray object Here, S will be copied into the existing SuperArray and all elements will be...
std::vector< maths::Vector< INDEX_TYPE > > n
n[i]: Dimensions, i.e. number of subdivision in x-, y- and z-direction
std::vector< std::vector< std::vector< T > > > K
maths::Vector< INDEX_TYPE > nges
Vector which contains the number of subdivisions in x-, y- and z-direction for the whole (virtual) ar...
bool iscleared
Array is cleared (needed by the clear() function)
T & operator()(INDEX_TYPE ix, INDEX_TYPE iy, INDEX_TYPE iz)
gives the content of the cell[ix][iy][iz]
#define INVALID_PARAMETER
Matrix< double > unity()
unity matrix (double precision)
Raytracer used for ultrashort pulse calculation with raytracing only.
bool saveExPhase(SuperArray< maths::Vector< std::complex< double > > > &S, char *FName, int i=0)
save the phase of the x-component of the electric field Save the phase of the x-component of the elec...
bool saveExPol(SuperArray< maths::Vector< std::complex< double > > > &S, char *FName, int i=0)
bool saveEzPhase(SuperArray< maths::Vector< std::complex< double > > > &S, char *FName, int i=0)
save the phase of the z-component of the electric field Save the phase of the z-component of the elec...
bool saveEyPol(SuperArray< maths::Vector< std::complex< double > > > &S, char *FName, int i=0)
bool saveabsEbin(SuperArray< maths::Vector< std::complex< double > > > &S, std::string FName, int i=0)
bool saveabsE(SuperArray< maths::Vector< std::complex< double > > > &S, std::string FName, int i=0)
save the square of the absolute value of the z-component of the electric field Save the square of the...
bool saveEyPhase(SuperArray< maths::Vector< std::complex< double > > > &S, char *FName, int i=0)
save the phase of the y-component of the electric field Save the phase of the y-component of the elec...
std::ostream & operator<<(std::ostream &os, Box B)
output operator for the Box class
void clear(GlobalParms parms, maths::Vector< std::complex< double > > **Gitter)
bool saveEzPol(SuperArray< maths::Vector< std::complex< double > > > &S, char *FName, int i=0)
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.