42 #ifndef EGS_ISOTROPIC_SOURCE_
43 #define EGS_ISOTROPIC_SOURCE_
55 #ifdef BUILD_ISOTROPIC_SOURCE_DLL
56 #define EGS_ISOTROPIC_SOURCE_EXPORT __declspec(dllexport)
58 #define EGS_ISOTROPIC_SOURCE_EXPORT __declspec(dllimport)
60 #define EGS_ISOTROPIC_SOURCE_LOCAL
64 #ifdef HAVE_VISIBILITY
65 #define EGS_ISOTROPIC_SOURCE_EXPORT __attribute__ ((visibility ("default")))
66 #define EGS_ISOTROPIC_SOURCE_LOCAL __attribute__ ((visibility ("hidden")))
68 #define EGS_ISOTROPIC_SOURCE_EXPORT
69 #define EGS_ISOTROPIC_SOURCE_LOCAL
244 geom(geometry), regions(0), min_theta(85.), max_theta(95.),
245 buf_1(1), buf_2(-1), min_phi(0), max_phi(2*M_PI),
246 nrs(0), gc(IncludeAll) {
258 if (!geom->deref()) {
262 if (nrs > 0 && regions) {
271 x = shape->getRandomPoint(rndm);
273 if (gc == IncludeAll) {
274 ok = geom->isInside(x);
276 else if (gc == ExcludeAll) {
277 ok = !geom->isInside(x);
279 else if (gc == IncludeSelected) {
281 int ireg = geom->isWhere(x);
282 for (
int j=0; j<nrs; ++j) {
283 if (ireg == regions[j]) {
291 int ireg = geom->isWhere(x);
292 for (
int j=0; j<nrs; ++j) {
293 if (ireg == regions[j]) {
303 EGS_Float sinz = 1-u.
z*u.
z;
306 EGS_Float cphi, sphi;
307 EGS_Float phi = min_phi +(max_phi - min_phi)*rndm->
getUniform();
333 return (s != 0 && shape != 0);
344 EGS_Float min_theta, max_theta;
345 EGS_Float buf_1, buf_2;
virtual void getPositionDirection(EGS_RandomGenerator *rndm, EGS_Vector &x, EGS_Vector &u, EGS_Float &wt)=0
Sample a particle position and direction.
GeometryConfinement
Geometry confinement options.
EGS_BaseSource class header file.
EGS_Vector methods for the manipulation of 3D vectors in cartesian co-ordinates.
A class representing 3D vectors.
static void deleteObject(EGS_Object *o)
Delete an object.
Base shape class. All shapes in the EGSnrc C++ class library are derived from EGS_BaseShape.
EGS_I64 count
Number of statistically independent particles delivered so far.
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
EGS_IsotropicSource(int Q, EGS_BaseSpectrum *Spec, EGS_BaseShape *Shape, EGS_BaseGeometry *geometry, const string &Name="", EGS_ObjectFactory *f=0)
Constructor.
Base random number generator class. All random number generators should be derived from this class...
EGS_RandomGenerator class header file.
EGS_BaseShape and shape classes header file.
Attempts to fix broken math header files.
virtual EGS_Float getFluence() const =0
Return the fluence this source has emitted so far.
EGS_Float getUniform()
Returns a random number uniformly distributed between zero (inclusive) and 1 (exclusive).
virtual bool storeFluenceState(ostream &data_out) const
Store the fluence state of this source to the data stream data_out.
const EGS_Float epsilon
The epsilon constant for floating point comparisons.
EGS_Float min_phi
avoid multi-calculating cos(min_theta) and cos(max_theta)
Base class for energy spectra. All energy spectra in the EGSnrc C++ class library are derived from th...
EGS_BaseGeometry class header file.
Base class for 'simple' particle sources.
virtual bool isValid() const
Is this a valid source?
virtual bool setFluenceState(istream &data)
Set the data related to the sampling of positions and directions to a state contained in the stream d...