Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EGS_DynamicSource class #308

Merged
merged 3 commits into from Oct 3, 2018
Merged

Add EGS_DynamicSource class #308

merged 3 commits into from Oct 3, 2018

Conversation

blakewalters
Copy link
Contributor

An EGS_DynamicSource allows the user to simulate dynamic (time-varying)
motion of any source during a single calculation. Continuous motion
of the source is simulated between user-defined control points, where
each control point defines a set of incident polar coordinates and an
associated fractional monitor unit (mu) index.

If the source is an IAEA-format phase space file or a BEAM simulation
source, then, provided the source stores the value of mu for each
particle, the user has the option to use these when setting incident
source coordinates, thus synchronizing the motion of EGS_DynamicSource
with jaw and MLC opening coordinates in the upstream BEAM simulation.

For phase space and BEAM simulation sources, EGS_DynamicSource
essentially provides the same functionality as sources 20 and 21
in DOSXYZnrc, as documented by Lobo & Popescu, Phys. Med. Biol.,
55:4431-4443 (2010).

Note that implementation of this source required the implementation
of a new method, EGS_Float getMu(), in egs_base_source. As
reimplemented in iaea_phsp_source and egs_beam_source, getMu returns
the value of mu associated with a particle.

See the source documentation for more info and an example input.

@ftessier
Copy link
Member

@blakewalters this branch does not pass the travis compilation test, it fails while building the egs++ library. Can you take a look at that?

@blakewalters
Copy link
Contributor Author

Okay, @ftessier, I'll take a look!


/*! \file egs_dynamic_source.cpp
* \brief A dynamic source
* \IK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here, should be \BW.

}
}

//actually select the rotation coordinats for the incident particle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment.

/*
###############################################################################
#
# EGSnrc egs++ transformed source headers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File title and authors are wrong.

Copy link
Contributor

@rtownson rtownson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs an astyle run.

const string &Name="", EGS_ObjectFactory *f=0) :
EGS_BaseSource(Name,f), source(Source) {
};
/*! \brief Construct a dynamic source from the input \a inp */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no inp.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, let me clean these up before this gets merged....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS. What's an astyle run and can I do it in the safety and comfort of my own home?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why yes, you can! Check out the handy-dandy wiki docs on coding style:

https://github.com/nrc-cnrc/EGSnrc/wiki/Coding-style

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eeehaa! Thanks!

@ftessier
Copy link
Member

Cleaned up this branch, put everything in a single commit and rebased on develop. @blakewalters this is awesome! Is it ready for merging into develop?

@blakewalters
Copy link
Contributor Author

blakewalters commented Dec 21, 2017

Should be ready to merge, @ftessier. It's all part of the effort of stealthily supplanting dosxyznrc.

@ftessier
Copy link
Member

Updated the Makefile which still referred to the transformed source.

@ftessier ftessier force-pushed the feature-dynamic_source branch 2 times, most recently from a163c3c to ca22273 Compare April 11, 2018 18:50
@ftessier
Copy link
Member

Rebased on develop tip and applied astyle.

@blakewalters
Copy link
Contributor Author

blakewalters commented Aug 23, 2018

The setSimulationChunk method--essential if you're going to use a dynamic phase space source in parallel runs--was omitted from this source and from EGS_TransformedSource. I've implemented this method in both sources in the latest commit. Thanks @vahx129 for doing all the heavy debugging!

Add an EGS_DynamicSource class to allow simulation of dynamic
(time-varying) motion of any source during a single calculation.
Continuous motion of the source is simulated between user-defined
control points, where each control point defines a set of incident polar
coordinates and an associated fractional monitor unit (mu) index.

If the source is an IAEA format phase space file or a BEAMnrc simulation
source which stores the value of mu for each particle, this mu value can
be used to set incident source coordinates, thus synchronizing the
motion of EGS_DynamicSource with jaw and MLC opening coordinates in the
upstream BEAMnrc simulation.

For phase space and BEAMnrc simulation sources, EGS_DynamicSource
essentially provides the same functionality as sources 20 and 21 in
DOSXYZnrc, as documented by Lobo & Popescu, Phys. Med. Biol.,
55:4431-4443 (2010).

Note that implementation of this source requires the implementation of a
new method, EGS_Float getMu(), in egs_base_source. As reimplemented in
iaea_phsp_source and egs_beam_source, getMu returns the value of mu
associated with a particle.

See the source documentation for more info and sample input.

Note: replaced to_string(), which is not a member of std on all g++
compilers, with another method of converting integers to strings during
the source input loop.
Implement a getMu method so that egs_dynamic_source can pass on the
dynamic indexing parameter mu (monitor unit). Also, fix a bug in the
iaea_phsp_source when determining whether mu is stored in the phase
space source or not.
Add setSimulationChunk method to dynamic and transformed sources in order
to set the portion of the phase space source to use during parallel runs.
Copy link
Member

@ftessier ftessier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brought up to date with develop.

@ftessier ftessier merged commit ca21597 into develop Oct 3, 2018
@ftessier ftessier deleted the feature-dynamic_source branch October 3, 2018 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants