Core Classes¶
-
group
Core
Core classes used to build CRPropa.
Typedefs
-
typedef Grid<float>
Grid1f
-
typedef Grid<double>
Grid1d
-
typedef Vector3<double>
Vector3d
-
typedef Vector3<float>
Vector3f
Functions
-
std::string
getDataPath
(std::string filename)
-
std::string
getInstallPrefix
()
-
int
digit
(const int &value, const int &d)
-
template <typename T>
Tclip
(const T &x, const T &lower, const T &upper)
-
double
interpolate
(double x, const std::vector<double> &X, const std::vector<double> &Y)¶
-
double
interpolate2d
(double x, double y, const std::vector<double> &X, const std::vector<double> &Y, const std::vector<double> &Z)
-
double
interpolateEquidistant
(double x, double lo, double hi, const std::vector<double> &Y)
-
size_t
closestIndex
(double x, const std::vector<double> &X)
-
std::array<float, 3>
rmsFieldStrengthPerAxis
(ref_ptr<Grid3f> grid) Evaluate the RMS of all grid points per axis
-
void
fromMagneticField
(ref_ptr<Grid3f> grid, ref_ptr<MagneticField> field) Fill vector grid from provided magnetic field
-
void
fromMagneticFieldStrength
(ref_ptr<Grid1f> grid, ref_ptr<MagneticField> field) Fill scalar grid from provided magnetic field
-
void
loadGrid
(ref_ptr<Grid3f> grid, std::string filename, double conversion = 1) Load a Grid3f from a binary file with single precision
-
void
loadGrid
(ref_ptr<Grid1f> grid, std::string filename, double conversion = 1)¶ Load a Grid1f from a binary file with single precision
-
void
dumpGrid
(ref_ptr<Grid3f> grid, std::string filename, double conversion = 1) Dump a Grid3f to a binary file
-
void
dumpGrid
(ref_ptr<Grid1f> grid, std::string filename, double conversion = 1)¶ Dump a Grid1f to a binary file with single precision
-
void
loadGridFromTxt
(ref_ptr<Grid3f> grid, std::string filename, double conversion = 1) Load a Grid3f grid from a plain text file
-
void
loadGridFromTxt
(ref_ptr<Grid1f> grid, std::string filename, double conversion = 1)¶ Load a Grid1f from a plain text file
-
void
dumpGridToTxt
(ref_ptr<Grid3f> grid, std::string filename, double conversion = 1) Dump a Grid3f to a plain text file
-
void
dumpGridToTxt
(ref_ptr<Grid1f> grid, std::string filename, double conversion = 1)¶ Dump a Grid1f to a plain text file
-
std::vector<std::pair<int, float>>
gridPowerSpectrum
(ref_ptr<Grid3f> grid) Calculate the omnidirectional power spectrum E(k) for a given turbulent field Returns a vector of pairs (k_i, E(k_i))
-
void
intrusive_ptr_add_ref
(Referenced *p)
-
void
intrusive_ptr_release
(Referenced *p)
-
template <class T>
T *get_pointer
(const ref_ptr<T> &rp)
-
template <typename T>
std::ostream &operator<<
(std::ostream &out, const Vector3<T> &v)
-
template <typename T>
std::istream &operator>>
(std::istream &in, Vector3<T> &v)
-
class
Candidate
: public Referenced - #include <include/crpropa/Candidate.h>
All information about the cosmic ray.
The Candidate is a passive object, that holds the information about the state of the cosmic ray and the simulation itself.
-
class
Surface
: public Referenced - #include <Geometry.h>
A geometrical surface.
Defines a surface. Can be queried if the candidate has crossed the surface in the last step.
Subclassed by ParaxialBox, Plane, Sphere
-
class
Plane
: public Surface - #include <Geometry.h>
A plane given by a point x0 and two axes v1 and v2 with normal n = v1.cross(v2) or the normal n. Note that distance is negative on one side of the plane and positive on the other, depending on the orientation of the normal vector.
-
class
Sphere
: public Surface - #include <Geometry.h>
A sphere around point _center with radius _radius.
-
class
ParaxialBox
: public Surface - #include <Geometry.h>
A box with perpendicular surfaces aligned to the x,y,z-axes.
-
class
GridProperties
: public Referenced - #include <Grid.h>
Combines parameters that uniquely define Grid class.
-
template <typename T>
classGrid
: public Referenced - #include <Grid.h>
Template class for fields on a periodic grid with trilinear interpolation.
The grid spacing is constant with diffrent resulution along all three axes. Values are calculated by trilinear interpolation of the surrounding 8 grid points. The grid is periodically (default) or reflectively extended. The grid sample positions are at 1/2 * size/N, 3/2 * size/N … (2N-1)/2 * size/N.
Subclassed by ScalarGrid, VectorGrid
-
class
ParticleState
- #include <ParticleState.h>
State of the particle: ID, energy, position, direction.
The ParticleState defines the state of an ultra-high energy cosmic ray, which is assumed to be traveling at the exact speed of light. The cosmic ray state is defined by particle ID, energy and position and direction vector. For faster lookup mass and charge of the particle are stored as members.
-
class
Random
- #include <Random.h>
Random number generator.
Mersenne Twister random number generator a C++ class Random Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus Richard J. Wagner v1.0 15 May 2003 rjwagner@writeme.com
-
class
Referenced
- #include <Referenced.h>
Base class for reference counting.
A form of memory management is needed to prevent memory leaks when using MPC in Python via SWIG. This base class enables reference counting. Every reference increases the reference counter, every dereference decreases it. When the counter is decreased to 0, the object is deleted. Candidate, Module, MagneticField and Source inherit from this class
Subclassed by AdvectionField, Candidate, CylindricalProjectionMap, Density, EmissionMap, Grid< T >, GridProperties, MagneticField, Module, ObserverFeature, PhotonField, SourceFeature, SourceInterface, StepLengthModifier, Surface, TurbulenceSpectrum
-
template <class T>
classref_ptr
- #include <Referenced.h>
Referenced pointer.
-
template <typename T>
classVector3
- #include <Vector3.h>
Template class for 3-vectors of type float, double, …
Allows accessing and changing the elements x, y, z directly or through the corresponding get and set methods.
Angle definitions are phi [-pi, pi]: azimuthal angle in the x-y plane, 0 pointing in x-direction theta [0, pi]: zenith angle towards the z axis, 0 pointing in z-direction
-
typedef Grid<float>