-
Notifications
You must be signed in to change notification settings - Fork 148
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 triangular mesh support and octree acceleration #1057
Open
a-l-demelo
wants to merge
85
commits into
nrc-cnrc:develop
Choose a base branch
from
a-l-demelo:egs-mesh-stl
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Authors of the EGSnrc files are unequivocally identified in the git commit log. However, we also want to preserve the names of authors and contributors inside text files headers, as much as possible, in case the files are extracted from the repository (or the repository eventually moves to another version control system). This script compares, for each modified file in a commit range (passed as the first argument, master..HEAD by default), the commit authors of the file against the authors and contributors listed in the file header. It reports the missing names, and returns 1 (error) if some authors are missing, or 0 (success) otherwise. Binary files are excluded from the comparison, as well as files that do not contain authorship information. The latter are reported at the end of the output, skipping over files that do not contain author information (e.g., image files). This script is intended to run automatically as a github action. It implies that all commit authors should be listed under "Contributors", regardless of the significance of the contribution, so that the script runs cleanly. The output of the github action should always be inspected before merging to check the files that don't contain authorship information.
Clarify that multiple-scattering transport is triggered only if the intended electron step is longer than a skin depth, even in bulk media away from any region boundaries. This improves efficiency, because a multiple-scattering step costs about the same as 3 single-scattering steps (the default skin depth is 3 mean free paths). Below a skin depth, it is more efficient (and more accurate) to use single-scattering.
Fix the output message in the egslst file for BEAMnrc simulations about the number of brems events the took place. When DBS was turned on, it would always read zero.
Fix a bug in egs_phsp_scoring where the electron energy for IAEA phase-spaces was written as the total energy instead of the kinetic energy. This was a critical bug.
Fix a bug where the source collection fluence was not calculated properly when multiple transformations were performed on a single base source.
The documentation in the source code for core EGSnrc parameters options is updated match HEN_HOUSE/src/get_inputs.mortran
BUG: Commit 8023cd0 labels fluorescent photons from EII as secondaries. The pertinent block for UBS and BCSE requires knowledge of the local region number IRL, which is only set later in AUSGAB. FIX: Set IRL above the UBS/BCSE block in the AUSGAB routine. Funnily enough this bug only showed when using BEAMnrc as library, not during BEAM simulations. Perhaps IRL was taking values below smaller than the dimension of the IREGION_TO_BIT array, set to 3000.
Follow-up on previous commit: Why did the bug not appear during standalone BEAMnrc runs? During direct BEAMnrc simulations, when IRL isn't set in the block to split EII-generated secondary photons, it takes value 2, the first region of the geometry, set during previous calls to AUSGAB. When using BEAMnrc as a library with other applications, the memory location IRL is pointing to can change, taking an arbitrary number. In my case it was a very large integer.
Add libclean target to standard beam_makefile which removes BEAMnrc library related files. Until now one had to do this manually!
Fixes ===== - Average source energy calculation was assuming a statistical weight of 1 and lumping all particles together. Now weight is accounted for, and average energy for photons and charge particles scored separately. Moreover, average energy of scoring photons is also estimated. - Typos in differential fluence xmgrace file output Additions ========= - Flexible scoring region input spares user from having to enter huge number of regions one at the time. Here are the different input schemes: a) Individual entries using 'scoring regions' input key Simply enter scoring regions individually b) Initial and final region pairs using `scoring region ranges` Expects pairs of initial and final scoring regions c) Groups of regions using 'scoring start region' and 'scoring stop region' input keys. Requires using two input keys on two lines, similar to what is done for the dose scoring ausgab object. d) Equally spaced scoring regions using key 'Incremental scoring regions' The most general scheme, expects triplets of initial, final and increment regions allowing the definition of ranges where scoring is performed at specified intervals (increments) between regions. Note that using an increment of 1 is equivalent to schemes b) and c). If an error in these inputs is detected, code aborts with a warning message, rather than simply ignoring the error. - Scoring regions mass input schemes: Using `scoring region masses` input key a) One value per region, regardless of scoring region input scheme b) One value per group (pair or triplet) when using scoring input options b, c, or d above. c) One value for all regions (positive) d) One value for whole scoring volume (negative) Using `scoring volume mass` input key assumes mass for whole scoring volume as in d). - Fluence calculation expanded to estimating integral fluence on all scoring regions ir for each calculation geometry ig, Ftot(ig,ir), and differential fluence (spectrum) Fdiff(ig,E), for each calculation geometry ig in the total scoring volume. TODO: Add option to specify spectral scoring regions rather than using all scoring regions. - Estimate average mass-energy absorption coefficient in each scoring region when integral fluence is calculated. - Fix small typo in output
The new, more natural way of projection input, had a typo in the projection variable iproj
Apply astyle 3.1 to a recent rebase on the develop branch.
Add the feature to select regions for source emission for the isotropic source depending on the medium. The medium selection can include media, or exclude them. Region selections are combined with the media selections using an AND operation, so that a valid region must meet both criteria.
Fix track sorting used for dynamic .ptracks files containing time indices. Usually the original .ptracks file is overwritten by the sorted one, but on Windows file deletion may be blocked. As a workaround for this situation, the sorted .ptracks file is left as a separate file.
Revert changes to units in the output of egs_fluence_scoring and cavity. This was needed to avoid compiler errors when using newer compilers.
Fix doxygen compiler errors for egs_dynamic_geometry. Also improve the documentation for the dynamic geometry, shape and source.
Add support for gcc 4.8.5 in recent changes adding with the dynamic geometry and dynamic track scoring.
Fix a compiler error that occurred when MXSTACK was increased to 1e7 or higher. This was due to the line length of an output statement flowing over 80 characters. The fix was just to split the line, so that more characters are available.
BUG: Diff flu output for log scale is normalized to {log(Emax) - log(Emin)}/Nbin rather than proper DE_i = E_i - E_i-1 which for log-scale is not constant. Fix: Applied proper DE_i when normalizing diff fluence. - Fix another bug in egsdat output of ave. source energies as well as scoring energies whereby no spaces were inserted between adjacent values, making the analyzing or parallel processing fail when reading the egsdat file.
Flag latch was being reset to 0 after call to getNextParticle which was overriding settings from other applications such as BEAM. Since egs_kerma only checks for negative values when a particle enters an exclusion region, latch is only multiply by -1 in those cases. Otherwise, latch is left unchanged. This can be important for VRT AOs such as radiative splitting.
- To avoid potential clashes with BEAM sources and AOs that might rely on the use of latch, particles entering exclusion zones are now killed. This approach is about 40% faster for the example input file example_1m_40keV_FD.egsinp Results using both options, latch set to -1 or killing the photons when entering an exclusion regions are consistent within 0.004% k=1 uncertainty when estimating concrete wall contributions to a 5 cm air sphere in the middle of an 8 m X 8 m room. Fixes bug noted by @bwalters when multiplying latch by -1 which was wrong for cases where latch = 0. - A check has been added to verify that the user did not mistakenly define regions as being both scoring and exclusion regions. Although the code gives preferences to the scoring region, it is deemed safer to abort issuing a warning.
- It was still using the old file name emuen_icru90_1.5MeV.data - It should be emuen_rho_air_1keV-1.5MeV.data
- Added comment line on top of the E*muen/rho file names stating that these values were ontained uding the g app with the MCDF-XCOM option
- For e- sources was adding the e- rest mass to the e- kinetic energy which is actually done in the EGS_AdvancedApplication::shower method
Add a new geometry to model triangle meshes, e.g. from .stl files.
This will be extended in future commits to a full octree.
Add octree acceleration of howfar, iswhere and hownear. Several previously unnoticed bugs have been fixed: 1) Envelope bug fix improved by adding a small boundary tolerance around dist=0. 2) Corrected bug where not all triangles would be added to any suboctant. This is a problem since they must be contained in at least one suboctant if they are contained in the octant.
d4986d8
to
06df944
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for STL triangular meshes, thanks to @mxxo. Also adds octree acceleration to the implementation, similar to egs_mesh, thanks to @a-l-demelo.