GOAT (Geometrical optics application tool) 0.1
Loading...
Searching...
No Matches
GOAT::raytracing::SuperArray< T > Class Template Reference

Template class to store arbitrary information in a 3D-grid This template class provides a virtual 3D-grid of arbitrary values which can be used to store e.g. the electric field in a volume. It circumscribes a sphere with radius r0 and virtual means here, that only the parts which are needed were allocated, but for the programmer it seems like a whole array or grid. By adding an object to the grid, the memory for the grid around the object (circumscribed box) is allocated, so one can store the electric field inside the object. The cells of the grid can be addressed with help of the bracket()-operator with different arguments. More...

#include <superarray.h>

Public Member Functions

void add (const SuperArray &S)
 Adds another SuperArray object. In this function, all array elements from S are added to the existing array elements. *.
bool addInc (ObjectShape *E, const bool isAbsolute=false)
 Add object to SuperArray Add one objects to the SuperArray. An object is added to the SuperArray by allocating memory that corresponds to the volume of the circumscribing cuboid.
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 the result and squared.
void allockugel ()
void arrangeGrids ()
void clear ()
 Clear the SuperArray and release the allocated memory.
void clear ()
void copy (const SuperArray &S)
 Copies SuperArray object Here, S will be copied into the existing SuperArray and all elements will be overridden.
void fill (const T &x)
 Fill the whole SuperArray with value x.
maths::Vector< INDEX_TYPEgitterpunkt (maths::Vector< double > P)
bool inObject (INDEX_TYPE ix, INDEX_TYPE iy, INDEX_TYPE iz, int i)
 checks if a point indicated by its indices (ix, iy, iz) is inside the i -th object
bool inObject (maths::Vector< double > P, int i)
 checks if P is inside the i-th object (p in real coordinates)
bool inObject (maths::Vector< INDEX_TYPE > Pi, int i)
 checks if Pi is inside the i-th object (pi in indices)
maths::Vector< INDEX_TYPEkugelindex (maths::Vector< INDEX_TYPE > Pi)
 Checks if the point Pi (indicated by the indices) is inside the calculation sphere The function returns the Vector Pi, if it is inside the calculation sphere otherwise a the vector (-1,-1,-1) is returned (for internal use only)
kugelwert (int ix, int iy, int iz)
 for internal use only
kugelwert (maths::Vector< int > Pi)
 for internal use only
void makeReal ()
T & operator() (INDEX_TYPE ix, INDEX_TYPE iy, INDEX_TYPE iz)
 gives the content of the cell[ix][iy][iz]
T & operator() (int i, INDEX_TYPE ix, INDEX_TYPE iy, INDEX_TYPE iz, bool isObjectCoordinate=true)
 returns the content of the i-th object, with the grid-coordinates ix,iy,iz
T & operator() (int i, maths::Vector< double > P)
 gives back the contents of the cell at P from the i-th object (faster)
T & operator() (int i, maths::Vector< INDEX_TYPE > Pi)
 gives back the contents of the cell with indices stored in Pi from the i-th object (faster)
T & operator() (maths::Vector< double > P)
 gives back the contents of the cell at P
T & operator() (maths::Vector< INDEX_TYPE > Pi)
 gives back the contents of the cell with indices stored in Pi
SuperArrayoperator= (const SuperArray &S)
 Assignment operator.
bool read (std::string fname)
void reinit (double r0, INDEX_TYPE n)
void reinit (double r0, INDEX_TYPE nx, INDEX_TYPE ny, INDEX_TYPE nz)
void removeAllObjects ()
void removeObject (int i)
void setActive (int i)
void setInactive (int i)
void setNumberOfCellsPerDirection (INDEX_TYPE no)
void sub (const SuperArray &S)
 Subtract another SuperArray object. In this function, all array elements from S are subtracted from the existing array elements.
 SuperArray ()
 SuperArray (const SuperArray &S)
 SuperArray (double r0, INDEX_TYPE nx, INDEX_TYPE ny, INDEX_TYPE nz, const int typ=IN_OBJECT)
 Constructor for SuperArray.
 SuperArray (double r0, INDEX_TYPE nx, INDEX_TYPE ny, INDEX_TYPE nz, std::vector< ObjectShape * >Obj, int numObjs, const bool isAbsolute=false, const int typ=IN_OBJECT)
bool write (std::string fname)
bool write (std::string fname)
 ~SuperArray ()

Public Attributes

maths::Vector< double > d
 Edge length of one cell in x-, y- and z-direction.
dummy
int Error
 Holds an error number.
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,iz: indices of the grid around object i.
maths::Matrix< double > H
bool iscleared = true
 Array is cleared (needed by the clear() function)
bool isequal
std::vector< std::vector< std::vector< T > > > K
std::vector< maths::Vector< INDEX_TYPE > > n
 n[i]: Dimensions, i.e. number of subdivision in x-, y- and z-direction
maths::Vector< INDEX_TYPEnges
 Vector which contains the number of subdivisions in x-, y- and z-direction for the whole (virtual) array.
int numObjs
 Number of objects.
std::vector< ObjectShape * > Obj
 here are the objects
pc
std::vector< maths::Vector< INDEX_TYPE > > Pul
maths::Matrix< double > R
 Transformation matrices in the local array coordinate system and backwards.
double r0
 Radius of the calculation sphere.
int type
 Mainly used for inelastic scattering. type=IN_HOST means the grid is stored in the whole volume, type=IN_OBJECT means grid is only used in the (active) objects.
std::vector< int > ywerte
std::vector< std::vector< int > > zwerte

Detailed Description

template<class T>
class GOAT::raytracing::SuperArray< T >

Template class to store arbitrary information in a 3D-grid This template class provides a virtual 3D-grid of arbitrary values which can be used to store e.g. the electric field in a volume. It circumscribes a sphere with radius r0 and virtual means here, that only the parts which are needed were allocated, but for the programmer it seems like a whole array or grid. By adding an object to the grid, the memory for the grid around the object (circumscribed box) is allocated, so one can store the electric field inside the object. The cells of the grid can be addressed with help of the bracket()-operator with different arguments.

Definition at line 25 of file superarray.h.

Constructor & Destructor Documentation

◆ SuperArray() [1/4]

template<class T>
GOAT::raytracing::SuperArray< T >::SuperArray ( )

Definition at line 191 of file superarray.h.

◆ SuperArray() [2/4]

template<class T>
GOAT::raytracing::SuperArray< T >::SuperArray ( double r0,
INDEX_TYPE nx,
INDEX_TYPE ny,
INDEX_TYPE nz,
const int typ = IN_OBJECT )

Constructor for SuperArray.

Parameters
r0Radius of the circumscribed sphere nx, ny, nz number of cells in the x-, y-, z- direction
typedescribes wether the whole space of the grid is allocated (IN_HOST) or in the objects only (IN_OBJECT)

Definition at line 202 of file superarray.h.

◆ SuperArray() [3/4]

template<class T>
GOAT::raytracing::SuperArray< T >::SuperArray ( double r0,
INDEX_TYPE nx,
INDEX_TYPE ny,
INDEX_TYPE nz,
std::vector< ObjectShape * > Obj,
int numObjs,
const bool isAbsolute = false,
const int typ = IN_OBJECT )

Definition at line 220 of file superarray.h.

◆ SuperArray() [4/4]

template<class T>
GOAT::raytracing::SuperArray< T >::SuperArray ( const SuperArray< T > & S)
inline

Definition at line 37 of file superarray.h.

◆ ~SuperArray()

template<class T>
GOAT::raytracing::SuperArray< T >::~SuperArray ( )
inline

Definition at line 59 of file superarray.h.

Member Function Documentation

◆ add()

template<class T>
void GOAT::raytracing::SuperArray< T >::add ( const SuperArray< T > & S)

Adds another SuperArray object. In this function, all array elements from S are added to the existing array elements. *.

Definition at line 871 of file superarray.h.

◆ addInc() [1/2]

template<class T>
bool GOAT::raytracing::SuperArray< T >::addInc ( ObjectShape * E,
const bool isAbsolute = false )

Add object to SuperArray Add one objects to the SuperArray. An object is added to the SuperArray by allocating memory that corresponds to the volume of the circumscribing cuboid.

Parameters
EThe object
isAbsolutetrue: Location/size information in absolute coordinates

Definition at line 323 of file superarray.h.

◆ addInc() [2/2]

template<class T>
bool GOAT::raytracing::SuperArray< T >::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 the result and squared.

Add objects to SuperArray Adds a list of objects to the SuperArray. An object is added to the SuperArray by allocating memory that corresponds to the volume of the circumscribing cuboid.

Parameters
ObjThe object list
numObjNumber of objects to add
isAbsolutetrue: Location/size information in absolute coordinates

Definition at line 239 of file superarray.h.

◆ allockugel()

template<class T>
void GOAT::raytracing::SuperArray< T >::allockugel ( )

Definition at line 1014 of file superarray.h.

◆ arrangeGrids()

template<class T>
void GOAT::raytracing::SuperArray< T >::arrangeGrids ( )

This method rearranges all grids after a change of r0 or the number of cells per direction

Definition at line 288 of file superarray.h.

◆ clear() [1/2]

template<class T>
void GOAT::raytracing::SuperArray< T >::clear ( )

Clear the SuperArray and release the allocated memory.

Definition at line 684 of file superarray.h.

◆ clear() [2/2]

void GOAT::raytracing::SuperArray< std::vector< GOAT::raytracing::gridEntry > >::clear ( )

◆ copy()

template<class T>
void GOAT::raytracing::SuperArray< T >::copy ( const SuperArray< T > & S)

Copies SuperArray object Here, S will be copied into the existing SuperArray and all elements will be overridden.

Definition at line 777 of file superarray.h.

◆ fill()

template<class T>
void GOAT::raytracing::SuperArray< T >::fill ( const T & x)

Fill the whole SuperArray with value x.

Definition at line 964 of file superarray.h.

◆ gitterpunkt()

template<class T>
maths::Vector< INDEX_TYPE > GOAT::raytracing::SuperArray< T >::gitterpunkt ( maths::Vector< double > P)

Definition at line 267 of file superarray.h.

◆ inObject() [1/3]

template<class T>
bool GOAT::raytracing::SuperArray< T >::inObject ( INDEX_TYPE ix,
INDEX_TYPE iy,
INDEX_TYPE iz,
int i )

checks if a point indicated by its indices (ix, iy, iz) is inside the i -th object

Definition at line 427 of file superarray.h.

◆ inObject() [2/3]

template<class T>
bool GOAT::raytracing::SuperArray< T >::inObject ( maths::Vector< double > P,
int i )

checks if P is inside the i-th object (p in real coordinates)

Definition at line 417 of file superarray.h.

◆ inObject() [3/3]

template<class T>
bool GOAT::raytracing::SuperArray< T >::inObject ( maths::Vector< INDEX_TYPE > Pi,
int i )

checks if Pi is inside the i-th object (pi in indices)

Definition at line 422 of file superarray.h.

◆ kugelindex()

template<class T>
maths::Vector< INDEX_TYPE > GOAT::raytracing::SuperArray< T >::kugelindex ( maths::Vector< INDEX_TYPE > Pi)

Checks if the point Pi (indicated by the indices) is inside the calculation sphere The function returns the Vector Pi, if it is inside the calculation sphere otherwise a the vector (-1,-1,-1) is returned (for internal use only)

for internal use only

Definition at line 1062 of file superarray.h.

◆ kugelwert() [1/2]

template<class T>
T GOAT::raytracing::SuperArray< T >::kugelwert ( int ix,
int iy,
int iz )

for internal use only

Definition at line 1132 of file superarray.h.

◆ kugelwert() [2/2]

template<class T>
T GOAT::raytracing::SuperArray< T >::kugelwert ( maths::Vector< int > Pi)

for internal use only

Definition at line 1103 of file superarray.h.

◆ makeReal()

template<class T>
void GOAT::raytracing::SuperArray< T >::makeReal ( )

Definition at line 1001 of file superarray.h.

◆ operator()() [1/6]

template<class T>
T & GOAT::raytracing::SuperArray< T >::operator() ( INDEX_TYPE ix,
INDEX_TYPE iy,
INDEX_TYPE iz )

gives the content of the cell[ix][iy][iz]

Definition at line 432 of file superarray.h.

◆ operator()() [2/6]

template<class T>
T & GOAT::raytracing::SuperArray< T >::operator() ( int i,
INDEX_TYPE ix,
INDEX_TYPE iy,
INDEX_TYPE iz,
bool isObjectCoordinate = true )

returns the content of the i-th object, with the grid-coordinates ix,iy,iz

Parameters
inumber of the object
ixgives back the contents of the cell from the i-th object with the indices (ix,iy,iz) (faster)

Definition at line 523 of file superarray.h.

◆ operator()() [3/6]

template<class T>
T & GOAT::raytracing::SuperArray< T >::operator() ( int i,
maths::Vector< double > P )

gives back the contents of the cell at P from the i-th object (faster)

Definition at line 649 of file superarray.h.

◆ operator()() [4/6]

template<class T>
T & GOAT::raytracing::SuperArray< T >::operator() ( int i,
maths::Vector< INDEX_TYPE > Pi )

gives back the contents of the cell with indices stored in Pi from the i-th object (faster)

Definition at line 550 of file superarray.h.

◆ operator()() [5/6]

template<class T>
T & GOAT::raytracing::SuperArray< T >::operator() ( maths::Vector< double > P)

gives back the contents of the cell at P

Definition at line 598 of file superarray.h.

◆ operator()() [6/6]

template<class T>
T & GOAT::raytracing::SuperArray< T >::operator() ( maths::Vector< INDEX_TYPE > Pi)

gives back the contents of the cell with indices stored in Pi

Definition at line 476 of file superarray.h.

◆ operator=()

template<class T>
SuperArray< T > & GOAT::raytracing::SuperArray< T >::operator= ( const SuperArray< T > & S)

Assignment operator.

Definition at line 801 of file superarray.h.

◆ read()

template<class T>
bool GOAT::raytracing::SuperArray< T >::read ( std::string fname)

◆ reinit() [1/2]

template<class T>
void GOAT::raytracing::SuperArray< T >::reinit ( double r0,
INDEX_TYPE n )
inline

Definition at line 749 of file superarray.h.

◆ reinit() [2/2]

template<class T>
void GOAT::raytracing::SuperArray< T >::reinit ( double r0,
INDEX_TYPE nx,
INDEX_TYPE ny,
INDEX_TYPE nz )

Definition at line 755 of file superarray.h.

◆ removeAllObjects()

template<class T>
void GOAT::raytracing::SuperArray< T >::removeAllObjects ( )
inline

Definition at line 402 of file superarray.h.

◆ removeObject()

template<class T>
void GOAT::raytracing::SuperArray< T >::removeObject ( int i)
inline

Definition at line 387 of file superarray.h.

◆ setActive()

template<class T>
void GOAT::raytracing::SuperArray< T >::setActive ( int i)
inline

Definition at line 253 of file superarray.h.

◆ setInactive()

template<class T>
void GOAT::raytracing::SuperArray< T >::setInactive ( int i)
inline

Definition at line 247 of file superarray.h.

◆ setNumberOfCellsPerDirection()

template<class T>
void GOAT::raytracing::SuperArray< T >::setNumberOfCellsPerDirection ( INDEX_TYPE no)
inline

set the number of cells per direction

Definition at line 168 of file superarray.h.

◆ sub()

template<class T>
void GOAT::raytracing::SuperArray< T >::sub ( const SuperArray< T > & S)

Subtract another SuperArray object. In this function, all array elements from S are subtracted from the existing array elements.

Definition at line 908 of file superarray.h.

◆ write() [1/2]

template<class T>
bool GOAT::raytracing::SuperArray< T >::write ( std::string fname)

◆ write() [2/2]

bool GOAT::raytracing::SuperArray< GOAT::maths::Vector< std::complex< double > > >::write ( std::string fname)

Member Data Documentation

◆ d

template<class T>
maths::Vector<double> GOAT::raytracing::SuperArray< T >::d

Edge length of one cell in x-, y- and z-direction.

Definition at line 158 of file superarray.h.

◆ dummy

template<class T>
T GOAT::raytracing::SuperArray< T >::dummy

Definition at line 153 of file superarray.h.

◆ Error

template<class T>
int GOAT::raytracing::SuperArray< T >::Error

Holds an error number.

Definition at line 145 of file superarray.h.

◆ G

template<class T>
std::vector<std::vector <std::vector <std::vector <T> > > > GOAT::raytracing::SuperArray< T >::G

Here, the data is stored. G[i][ix][iy][iz], whereas i: index of the object, ix,iy,iz: indices of the grid around object i.

Definition at line 151 of file superarray.h.

◆ H

template<class T>
maths::Matrix<double> GOAT::raytracing::SuperArray< T >::H

Definition at line 163 of file superarray.h.

◆ iscleared

template<class T>
bool GOAT::raytracing::SuperArray< T >::iscleared = true

Array is cleared (needed by the clear() function)

Definition at line 161 of file superarray.h.

◆ isequal

template<class T>
bool GOAT::raytracing::SuperArray< T >::isequal

Definition at line 160 of file superarray.h.

◆ K

template<class T>
std::vector< std::vector < std::vector <T> > > GOAT::raytracing::SuperArray< T >::K

Definition at line 152 of file superarray.h.

◆ n

template<class T>
std::vector<maths::Vector<INDEX_TYPE> > GOAT::raytracing::SuperArray< T >::n

n[i]: Dimensions, i.e. number of subdivision in x-, y- and z-direction

Definition at line 155 of file superarray.h.

◆ nges

template<class T>
maths::Vector<INDEX_TYPE> GOAT::raytracing::SuperArray< T >::nges

Vector which contains the number of subdivisions in x-, y- and z-direction for the whole (virtual) array.

Definition at line 156 of file superarray.h.

◆ numObjs

template<class T>
int GOAT::raytracing::SuperArray< T >::numObjs

Number of objects.

Definition at line 147 of file superarray.h.

◆ Obj

template<class T>
std::vector<ObjectShape*> GOAT::raytracing::SuperArray< T >::Obj

here are the objects

Definition at line 146 of file superarray.h.

◆ pc

template<class T>
T GOAT::raytracing::SuperArray< T >::pc

Definition at line 162 of file superarray.h.

◆ Pul

template<class T>
std::vector<maths::Vector<INDEX_TYPE> > GOAT::raytracing::SuperArray< T >::Pul

Definition at line 154 of file superarray.h.

◆ R

template<class T>
maths::Matrix<double> GOAT::raytracing::SuperArray< T >::R

Transformation matrices in the local array coordinate system and backwards.

Definition at line 163 of file superarray.h.

◆ r0

template<class T>
double GOAT::raytracing::SuperArray< T >::r0

Radius of the calculation sphere.

Definition at line 159 of file superarray.h.

◆ type

template<class T>
int GOAT::raytracing::SuperArray< T >::type

Mainly used for inelastic scattering. type=IN_HOST means the grid is stored in the whole volume, type=IN_OBJECT means grid is only used in the (active) objects.

Definition at line 148 of file superarray.h.

◆ ywerte

template<class T>
std::vector<int> GOAT::raytracing::SuperArray< T >::ywerte

Definition at line 149 of file superarray.h.

◆ zwerte

template<class T>
std::vector<std::vector<int> > GOAT::raytracing::SuperArray< T >::zwerte

Definition at line 150 of file superarray.h.


The documentation for this class was generated from the following file: