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++
ausgab_objects
egs_radiative_splitting
egs_radiative_splitting.cpp
Go to the documentation of this file.
1
/*
2
###############################################################################
3
#
4
# EGSnrc egs++ radiative splitting object
5
# Copyright (C) 2018 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: Ernesto Mainegra-Hing, 2018
25
#
26
# Contributors:
27
#
28
###############################################################################
29
#
30
# A general radiative splitting tool.
31
#
32
# TODO:
33
#
34
# - Add directional radiative splitting (DRS)
35
#
36
###############################################################################
37
*/
38
39
45
#include <fstream>
46
#include <string>
47
#include <cstdlib>
48
49
#include "
egs_radiative_splitting.h
"
50
#include "
egs_input.h
"
51
#include "
egs_functions.h
"
52
53
EGS_RadiativeSplitting::EGS_RadiativeSplitting(
const
string
&Name,
54
EGS_ObjectFactory
*f) :
55
nsplit(1) {
56
otype
=
"EGS_RadiativeSplitting"
;
57
}
58
59
EGS_RadiativeSplitting::~EGS_RadiativeSplitting() {
60
}
61
62
void
EGS_RadiativeSplitting::setApplication(
EGS_Application
*App) {
63
EGS_AusgabObject::setApplication
(App);
64
if
(!
app
) {
65
return
;
66
}
67
68
char
buf[32];
69
70
// Set EGSnrc internal radiative splitting number .
71
app
->setRadiativeSplitting(nsplit);
72
73
description
=
"\n===========================================\n"
;
74
description
+=
"Radiative splitting Object ("
;
75
description
+=
name
;
76
description
+=
")\n"
;
77
description
+=
"===========================================\n"
;
78
if
(nsplit > 1) {
79
description
+=
"\n - Splitting radiative events in "
;
80
sprintf(buf,
"%d\n\n"
,nsplit);
81
description
+= buf;
82
}
83
else
if
(nsplit == 1) {
84
description
+=
"\n - NO radiative splitting"
;
85
}
86
else
{
87
description
+=
"\n - BEWARE: Turning OFF radiative events !!!"
;
88
}
89
description
+=
"\n===========================================\n\n"
;
90
}
91
92
//*********************************************************************
93
// Process input for this ausgab object
94
//
95
//**********************************************************************
96
extern
"C"
{
97
98
EGS_RADIATIVE_SPLITTING_EXPORT
EGS_AusgabObject
*createAusgabObject(
EGS_Input
*input,
99
EGS_ObjectFactory
*f) {
100
const
static
char
*func =
"createAusgabObject(radiative_splitting)"
;
101
if
(!input) {
102
egsWarning
(
"%s: null input?\n"
,func);
103
return
0;
104
}
105
106
EGS_Float nsplit = 1.0;
107
int
err = input->
getInput
(
"splitting"
,nsplit);
108
109
//=================================================
110
111
/* Setup radiative splitting object with input parameters */
112
EGS_RadiativeSplitting
*result =
new
EGS_RadiativeSplitting
(
""
,f);
113
result->setSplitting(nsplit);
114
result->
setName
(input);
115
return
result;
116
}
117
}
EGS_AusgabObject
Definition:
egs_ausgab_object.h:64
EGS_AusgabObject::description
string description
A short ausgab object description.
Definition:
egs_ausgab_object.h:242
egs_input.h
EGS_Input class header file.
egs_functions.h
Global egspp functions header file.
EGS_ObjectFactory
An object factory.
Definition:
egs_object_factory.h:206
EGS_RadiativeSplitting
A radiative splitting object: header.
Definition:
egs_radiative_splitting.h:93
EGS_Object::setName
void setName(EGS_Input *inp)
Set the name of the object from the information provided by inp.
Definition:
egs_object_factory.cpp:93
egs_radiative_splitting.h
A radiative splitting ausgab object: header.
EGS_Object::name
string name
The object name.
Definition:
egs_object_factory.h:175
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_AusgabObject::setApplication
virtual void setApplication(EGS_Application *App)
Set the application this object belongs to.
Definition:
egs_ausgab_object.h:105
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_Application
Base class for advanced EGSnrc C++ applications.
Definition:
egs_application.h:267
EGS_AusgabObject::app
EGS_Application * app
The application this object belongs to.
Definition:
egs_ausgab_object.h:245
egsWarning
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.
Definition:
egs_functions.cpp:135
Generated by
1.8.5