#ifndef VECTOR_FIELD_H #define VECTOR_FIELD_H #include #include "blitz/array.h" #include "simulation/coordinates.h" #include "simulation/position_binning.h" // class for vector fields class VectorField { public: // return the value of the vector field at the Coordinate coordinate as a // CylinderVector object virtual CylinderVector value(const Coordinate& coordinate) const = 0; }; // class for vector fields that are defined by an array (e.g. from data that was used as input) class VectorFieldFromArray : public VectorField { public: // Constructor: takes the radial, azimuthal and longitudinal component of the vector field // as 3d arrays; all three arrays have to have the same size (not checked) // also takes the radius and length of the domain, where the vector field is defined VectorFieldFromArray(const blitz::Array& radial_component, const blitz::Array& azimuthal_component, const blitz::Array& longitudial_component, double radius, double length); // return the value at the Coordinate coordinate, if the coordinate does not fall into // the region where the vector field is defined in return (0,0,0) CylinderVector value(const Coordinate& coordinate) const; private: const blitz::Array Fr_; const blitz::Array Fphi_; const blitz::Array Fz_; // used to determine which array element is neccessary in the value() function CylinderBinning binning_; CylinderVector value(const blitz::TinyVector& bin) const; }; // class for spatially constant vector fields class VectorFieldConstant : public VectorField { public: // Constructor: takes the value of the constant cylinder vector for the vector field VectorFieldConstant(const CylinderVector& constant); // return the value of the vector field at the Coordinate coordinate as a CylinderVector CylinderVector value(const Coordinate& coordinate) const; private: const CylinderVector constant_; }; // class for a vector field that has a z-dependence that can be described by an // analytic function and is 0 for the radial and azimuthal component class VectorFieldFunctionInZ : public VectorField { public: // Constructor: takes a function that describes the value of the longitudinal // component as a function of r,phi,z VectorFieldFunctionInZ(std::function v_z); // return the value of the vector field at the Coordinate coordinate as a CylinderVector CylinderVector value(const Coordinate& coordinate) const; private: std::function F_z_; }; #endif /* VECTOR_FIELD_H */