EGSnrc C++ class library
Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Coding Examples
File List
File Members
egs++
sources
egs_point_source
egs_point_source.cpp
Go to the documentation of this file.
1
/*
2
###############################################################################
3
#
4
# EGSnrc egs++ point source
5
# Copyright (C) 2015 National Research Council Canada
6
#
7
# This file is part of EGSnrc.
8
#
9
# EGSnrc is free software: you can redistribute it and/or modify it under
10
# the terms of the GNU Affero General Public License as published by the
11
# Free Software Foundation, either version 3 of the License, or (at your
12
# option) any later version.
13
#
14
# EGSnrc is distributed in the hope that it will be useful, but WITHOUT ANY
15
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
17
# more details.
18
#
19
# You should have received a copy of the GNU Affero General Public License
20
# along with EGSnrc. If not, see <http://www.gnu.org/licenses/>.
21
#
22
###############################################################################
23
#
24
# Author: Iwan Kawrakow, 2005
25
#
26
# Contributors:
27
#
28
###############################################################################
29
*/
30
31
37
#include "
egs_point_source.h
"
38
#include "
egs_input.h
"
39
40
EGS_PointSource::EGS_PointSource
(
EGS_Input
*input,
EGS_ObjectFactory
*f) :
41
EGS_BaseSimpleSource
(input,f), xo(), valid(true) {
42
vector<EGS_Float> pos;
43
int
err = input->
getInput
(
"position"
,pos);
44
if
(!err && pos.size() == 3) {
45
xo =
EGS_Vector
(pos[0],pos[1],pos[2]);
46
}
47
else
{
48
egsWarning
(
"EGS_PointSource: missing/wrong 'position' input\n"
);
49
valid =
false
;
50
}
51
setUp
();
52
}
53
54
void
EGS_PointSource::setUp
() {
55
otype
=
"EGS_PointSource"
;
56
if
(!isValid()) {
57
description
=
"Invalid point source"
;
58
}
59
else
{
60
description
=
"Point source with "
;
61
description
+=
s
->
getType
();
62
if
(
q
== -1) {
63
description
+=
", electrons"
;
64
}
65
else
if
(
q
== 0) {
66
description
+=
", photons"
;
67
}
68
else
if
(
q
== 1) {
69
description
+=
", positrons"
;
70
}
71
else
{
72
description
+=
", unknown particle type"
;
73
}
74
}
75
}
76
77
78
extern
"C"
{
79
80
EGS_POINT_SOURCE_EXPORT
EGS_BaseSource
*createSource(
EGS_Input
*input,
81
EGS_ObjectFactory
*f) {
82
return
createSourceTemplate<EGS_PointSource>(input,f,
"point source"
);
83
}
84
85
}
EGS_PointSource::EGS_PointSource
EGS_PointSource(int Q, EGS_BaseSpectrum *Spec, const EGS_Vector &Xo, const string &Name="", EGS_ObjectFactory *f=0)
Constructor.
Definition:
egs_point_source.h:122
egs_input.h
EGS_Input class header file.
EGS_Vector
A class representing 3D vectors.
Definition:
egs_vector.h:56
EGS_BaseSimpleSource::s
EGS_BaseSpectrum * s
The energy spectrum of this source.
Definition:
egs_base_source.h:796
EGS_PointSource::setUp
void setUp()
Sets up the source type and description.
Definition:
egs_point_source.cpp:54
EGS_ObjectFactory
An object factory.
Definition:
egs_object_factory.h:206
egs_point_source.h
A point source.
EGS_BaseSimpleSource::q
int q
The charge of this simple source.
Definition:
egs_base_source.h:790
EGS_BaseSpectrum::getType
const string & getType() const
Get the spectrum type.
Definition:
egs_base_source.h:355
EGS_Input
A class for storing information in a tree-like structure of key-value pairs. This class is used throu...
Definition:
egs_input.h:182
EGS_Object::otype
string otype
The object type.
Definition:
egs_object_factory.h:180
EGS_BaseSimpleSource
Base class for 'simple' particle sources.
Definition:
egs_base_source.h:557
EGS_Input::getInput
int getInput(const string &key, vector< string > &values) const
Assign values to an array of strings from an input identified by key.
Definition:
egs_input.cpp:338
EGS_BaseSource
Base source class. All particle sources must be derived from this class.
Definition:
egs_base_source.h:80
EGS_BaseSource::description
string description
A short source description.
Definition:
egs_base_source.h:313
egsWarning
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.
Definition:
egs_functions.cpp:135
Generated by
1.8.5