44 #ifndef EGS_ISOTROPIC_SOURCE_
45 #define EGS_ISOTROPIC_SOURCE_
57 #ifdef BUILD_ISOTROPIC_SOURCE_DLL
58 #define EGS_ISOTROPIC_SOURCE_EXPORT __declspec(dllexport)
60 #define EGS_ISOTROPIC_SOURCE_EXPORT __declspec(dllimport)
62 #define EGS_ISOTROPIC_SOURCE_LOCAL
66 #ifdef HAVE_VISIBILITY
67 #define EGS_ISOTROPIC_SOURCE_EXPORT __attribute__ ((visibility ("default")))
68 #define EGS_ISOTROPIC_SOURCE_LOCAL __attribute__ ((visibility ("hidden")))
70 #define EGS_ISOTROPIC_SOURCE_EXPORT
71 #define EGS_ISOTROPIC_SOURCE_LOCAL
260 geom(geometry), regions(0), min_theta(85.), max_theta(95.),
261 buf_1(1), buf_2(-1), min_phi(0), max_phi(2*M_PI),
262 nrs(0), gc(IncludeAll), media(0), nms(0), gcm(IncludeSelected) {
274 if (!geom->deref()) {
278 if (nrs > 0 && regions) {
281 if (nms > 0 && media) {
291 x = shape->getRandomPoint(rndm);
294 if (gc == IncludeAll) {
295 ok = geom->isInside(x);
297 else if (gc == ExcludeAll) {
298 ok = !geom->isInside(x);
300 else if (gc == IncludeSelected) {
302 int ireg = geom->isWhere(x);
303 for (
int j=0; j<nrs; ++j) {
304 if (ireg == regions[j]) {
310 else if (gc == ExcludeSelected) {
312 int ireg = geom->isWhere(x);
313 for (
int j=0; j<nrs; ++j) {
314 if (ireg == regions[j]) {
323 if (gcm == IncludeSelected) {
325 int ireg = geom->isWhere(x);
326 int currentMedium = geom->medium(ireg);
327 for (
int j=0; j<nms; ++j) {
328 if (currentMedium == media[j]) {
334 else if (gcm == ExcludeSelected) {
336 int ireg = geom->isWhere(x);
337 for (
int j=0; j<nrs; ++j) {
338 if (ireg == media[j]) {
354 EGS_Float sinz = 1-u.
z*u.
z;
357 EGS_Float cphi, sphi;
358 EGS_Float phi = min_phi +(max_phi - min_phi)*rndm->
getUniform();
384 return (s != 0 && shape != 0);
391 int *regions, *media;
395 EGS_Float min_theta, max_theta;
396 EGS_Float buf_1, buf_2;
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
Base shape class. All shapes in the EGSnrc C++ class library are derived from EGS_BaseShape.
Base class for 'simple' particle sources.
virtual void getPositionDirection(EGS_RandomGenerator *rndm, EGS_Vector &x, EGS_Vector &u, EGS_Float &wt)=0
Sample a particle position and direction.
virtual bool isValid() const
Is this a valid source?
virtual bool storeFluenceState(ostream &data_out) const
Store the fluence state of this source to the data stream data_out.
virtual bool setFluenceState(istream &data)
Set the data related to the sampling of positions and directions to a state contained in the stream d...
EGS_I64 count
Number of statistically independent particles delivered so far.
virtual EGS_Float getFluence() const =0
Return the fluence this source has emitted so far.
Base class for energy spectra. All energy spectra in the EGSnrc C++ class library are derived from th...
EGS_BaseShape * shape
The shape from which particles are emitted.
EGS_IsotropicSource(int Q, EGS_BaseSpectrum *Spec, EGS_BaseShape *Shape, EGS_BaseGeometry *geometry, const string &Name="", EGS_ObjectFactory *f=0)
Constructor.
GeometryConfinement
Geometry confinement options.
EGS_Float min_phi
avoid multi-calculating cos(min_theta) and cos(max_theta)
static void deleteObject(EGS_Object *o)
Delete an object.
Base random number generator class. All random number generators should be derived from this class.
EGS_Float getUniform()
Returns a random number uniformly distributed between zero (inclusive) and 1 (exclusive).
A class representing 3D vectors.
EGS_BaseGeometry class header file.
EGS_BaseSource class header file.
Attempts to fix broken math header files.
EGS_RandomGenerator class header file.
EGS_BaseShape and shape classes header file.
EGS_Vector methods for the manipulation of 3D vectors in cartesian co-ordinates.
const EGS_Float epsilon
The epsilon constant for floating point comparisons.