EGS Brachy
An egs++ user code for rapid brachytherapy calculations
Loading...
Searching...
No Matches
/Users/marc/Developer/EGSnrc/HEN_HOUSE/user_codes/egs_brachy/egs_brachy/latch.h
Go to the documentation of this file.
1/*
2################################################################################
3#
4# egs_brachy latch.h
5# Copyright (C) 2016 Rowan Thomson, Dave Rogers, Randle Taylor, and Marc
6# Chamberland
7#
8# This file is part of egs_brachy
9#
10# egs_brachy is free software: you can redistribute it and/or modify it
11# under the terms of the GNU Affero General Public License as published
12# by the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# egs_brachy is distributed in the hope that it will be useful, but
16# WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18# Affero General Public License for more details:
19# <http://www.gnu.org/licenses/>.
20#
21################################################################################
22#
23# When egs_brachy is used for publications, please cite our paper:
24# M. J. P. Chamberland, R. E. P. Taylor, D. W. O. Rogers, and R. M. Thomson,
25# egs brachy: a versatile and fast Monte Carlo code for brachytherapy,
26# Phys. Med. Biol. 61, 8214-8231 (2016).
27#
28################################################################################
29#
30# Author: Randle Taylor, 2016
31#
32# Contributors: Marc Chamberland
33# Dave Rogers
34# Rowan Thomson
35#
36################################################################################
37*/
38
43#ifndef EGS_BRACHY_LATCH
44#define EGS_BRACHY_LATCH
45#include "egs_advanced_application.h"
46#include "pubsub.h"
47
51class Latch : public Subscriber {
52
65
66
67
68
69public:
70
72 void update(EB_Message message, void *particle);
73
75 //bool inSource(EGS_Particle *p);
76
78 static bool hasEscaped(EGS_Particle *p);
79
81 static void setFlag(Flag flag, EGS_Particle *p);
82
84 static void setFlag(Flag flag, int &latch);
85
87 static void unsetFlag(Flag flag, EGS_Particle *p);
88
90 static void unsetFlag(Flag flag, int &latch);
91
93 static bool checkFlag(Flag flag, EGS_Particle *p);
94
96 static bool checkFlag(Flag flag, int latch);
97
98 /* \brief add scattering event to particle latch */
99 static void addScatter(EGS_Particle *p);
100
101 /* \brief add scattering event to latch */
102 static void addScatter(int &latch);
103
104 /* \brief set primary flag for latch */
105 static void setPrimary(int &latch);
106
107 /* \brief set primary flag for particle*/
108 static void setPrimary(EGS_Particle *p);
109
110 /* \brief check if unscattered */
111 static bool isPrimary(int latch);
112 static bool isPrimary(EGS_Particle *p);
113
114 /* \brief check if single scattered*/
115 static bool isSingleScat(int latch);
116 static bool isSingleScat(EGS_Particle *p);
117
118 /* \brief check if multiple scattered*/
119 static bool isMultScat(int latch);
120 static bool isMultScat(EGS_Particle *p);
121
122};
123
124#endif
A class for handling latch bits relevant to egs_brachy. The Latch class listens for particle events a...
Definition latch.h:51
static bool hasEscaped(EGS_Particle *p)
True if particle is currently in a source.
Definition latch.cpp:134
static void setPrimary(int &latch)
Definition latch.cpp:88
static bool isMultScat(int latch)
Definition latch.cpp:121
static bool checkFlag(Flag flag, EGS_Particle *p)
Check whether flag is set on particle p.
Definition latch.cpp:62
static void addScatter(EGS_Particle *p)
Definition latch.cpp:80
Flag
Definition latch.h:53
@ IN_SOURCE
Definition latch.h:54
@ PRIM_PARTICLE
Definition latch.h:60
@ MSCAT_PARTICLE
Definition latch.h:62
@ SSCAT_PARTICLE
Definition latch.h:61
@ ESCAPED_SOURCE
Definition latch.h:56
static bool isPrimary(int latch)
Definition latch.cpp:105
static bool isSingleScat(int latch)
Definition latch.cpp:113
static void unsetFlag(Flag flag, EGS_Particle *p)
Unset flag on input particle p.
Definition latch.cpp:54
void update(EB_Message message, void *particle)
listen to events and delegate to appropriate handler
Definition latch.cpp:70
static void setFlag(Flag flag, EGS_Particle *p)
Set flag on input particle p.
Definition latch.cpp:46
A simple pub/sub module to allow various egs_brachy classes to subscribe to particle events.
EB_Message
Definition pubsub.h:54