Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
OPAL
src
Commits
4afce1f2
Commit
4afce1f2
authored
Apr 23, 2021
by
ext-calvo_p
Browse files
Resolve "Add option to write VTK file"
parent
5b44baf7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
248 additions
and
237 deletions
+248
-237
src/BasicActions/Option.cpp
src/BasicActions/Option.cpp
+107
-109
src/BasicActions/Option.h
src/BasicActions/Option.h
+6
-6
src/Classic/Utilities/Options.cpp
src/Classic/Utilities/Options.cpp
+34
-52
src/Classic/Utilities/Options.h
src/Classic/Utilities/Options.h
+48
-47
src/Structure/BoundaryGeometry.cpp
src/Structure/BoundaryGeometry.cpp
+44
-14
src/Structure/DataSink.cpp
src/Structure/DataSink.cpp
+1
-1
src/Track/TrackRun.cpp
src/Track/TrackRun.cpp
+8
-8
No files found.
src/BasicActions/Option.cpp
View file @
4afce1f2
...
...
@@ -35,7 +35,7 @@
#include <limits>
#include <cstddef>
extern
Inform
*
gmsg
;
extern
Inform
*
gmsg
;
using
namespace
Options
;
...
...
@@ -64,13 +64,13 @@ namespace {
EBDUMP
,
CSRDUMP
,
AUTOPHASE
,
SURFDUMPFREQ
,
NUMBLOCKS
,
RECYCLEBLOCKS
,
RECYCLEBLOCKS
,
NLHS
,
CZERO
,
RNGTYPE
,
ENABLEHDF5
,
ENABLEVTK
,
ASCIIDUMP
,
BOUNDPDESTROYFQ
,
BEAMHALOBOUNDARY
,
...
...
@@ -105,7 +105,9 @@ Option::Option():
(
"INFO"
,
"If true, print information messages"
,
info
);
itsAttr
[
TRACE
]
=
Attributes
::
makeBool
(
"TRACE"
,
"If true, print execution trace"
,
mtrace
);
(
"TRACE"
,
"If true, print execution trace"
"Must be the first option in the inputfile in "
"order to render correct results"
,
mtrace
);
itsAttr
[
WARN
]
=
Attributes
::
makeBool
(
"WARN"
,
"If true, print warning messages"
,
warn
);
...
...
@@ -136,28 +138,30 @@ Option::Option():
itsAttr
[
SCSOLVEFREQ
]
=
Attributes
::
makeReal
(
"SCSOLVEFREQ"
,
"The frequency to solve space charge fields. its default value is 1"
);
itsAttr
[
MTSSUBSTEPS
]
=
Attributes
::
makeReal
(
"MTSSUBSTEPS"
,
"How many small timesteps "
"are inside the large timestep used in multiple "
"time stepping (MTS) integrator"
);
itsAttr
[
MTSSUBSTEPS
]
=
Attributes
::
makeReal
(
"MTSSUBSTEPS"
,
"How many small timesteps "
"are inside the large timestep used in multiple "
"time stepping (MTS) integrator"
);
itsAttr
[
REMOTEPARTDEL
]
=
Attributes
::
makeReal
(
"REMOTEPARTDEL"
,
"Artifically delete the remote particle if its distance "
"to the beam mass is larger than REMOTEPARTDEL times of the beam rms size, "
"its default values is 0 (no delete) "
,
0.0
);
(
"REMOTEPARTDEL"
,
"Artifically delete the remote particle "
"if its distance to the beam mass is larger than "
"REMOTEPARTDEL times of the beam rms size, "
"its default values is 0 (no delete) "
,
remotePartDel
);
itsAttr
[
PSDUMPFRAME
]
=
Attributes
::
makeUpperCaseString
(
"PSDUMPFRAME"
,
"Controls the frame of phase space dump in "
"stat file and h5 file. If 'GLOBAL' OPAL will dump in the "
"lab (global) Cartesian frame; if 'BUNCH_MEAN' OPAL will "
"dump in the local Cartesian frame of the beam mean; "
"if 'REFERENCE' OPAL will dump in the local Cartesian "
"frame of the reference particle 0. Only av
i
able for "
"OPAL-cycl, its default value is 'GLOBAL'"
);
(
"PSDUMPFRAME"
,
"Controls the frame of phase space dump in "
"stat file and h5 file. If 'GLOBAL' OPAL will dump in the "
"lab (global) Cartesian frame; if 'BUNCH_MEAN' OPAL will "
"dump in the local Cartesian frame of the beam mean; "
"if 'REFERENCE' OPAL will dump in the local Cartesian "
"frame of the reference particle 0. Only av
ail
able for "
"OPAL-cycl, its default value is 'GLOBAL'"
);
itsAttr
[
SPTDUMPFREQ
]
=
Attributes
::
makeReal
(
"SPTDUMPFREQ"
,
"The frequency to dump single "
"particle trajectory of particles with ID = 0 & 1, "
"its default value is 1.
"
);
"its default value is 1."
,
sptDumpFreq
);
itsAttr
[
REPARTFREQ
]
=
Attributes
::
makeReal
(
"REPARTFREQ"
,
"The frequency to do particles repartition "
...
...
@@ -181,8 +185,8 @@ Option::Option():
"space the scalar rho field is also dumped (H5Block)"
,
rhoDump
);
itsAttr
[
EBDUMP
]
=
Attributes
::
makeBool
(
"EBDUMP"
,
"If true, in addition to the phase space the "
"E and B field at each particle is also dumped into the H5 file)"
,
ebDump
);
(
"EBDUMP"
,
"If true, in addition to the phase space the "
"E and B field at each particle is also dumped into the H5 file)"
,
ebDump
);
itsAttr
[
CSRDUMP
]
=
Attributes
::
makeBool
(
"CSRDUMP"
,
"If true, the csr E field, line density "
...
...
@@ -195,54 +199,57 @@ Option::Option():
"acceleration. Defines the number of refinements of the "
"search range"
,
autoPhase
);
itsAttr
[
SURFDUMPFREQ
]
=
Attributes
::
makeReal
(
"SURFDUMPFREQ"
,
"The frequency to dump surface-particle "
"interaction data, its default value is -1 (no dump)."
,
surfDumpFreq
);
itsAttr
[
CZERO
]
=
Attributes
::
makeBool
(
"CZERO"
,
"If set to true a symmetric distribution is "
"created -> centroid == 0.0
"
,
cZero
);
"created -> centroid == 0.0"
,
cZero
);
itsAttr
[
RNGTYPE
]
=
Attributes
::
makeUpperCaseString
(
"RNGTYPE"
,
"RANDOM (default), Quasi-random number "
"generators: HALTON, SOBOL, NIEDERREITER (Gsl ref manual 18.5)"
,
rngtype
);
itsAttr
[
CLOTUNEONLY
]
=
Attributes
::
makeBool
(
"CLOTUNEONLY"
,
"If set to true stop after "
"CLO and tune calculation "
,
cloTuneOnly
);
itsAttr
[
CLOTUNEONLY
]
=
Attributes
::
makeBool
(
"CLOTUNEONLY"
,
"If set to true stop after "
"CLO and tune calculation "
,
cloTuneOnly
);
itsAttr
[
NUMBLOCKS
]
=
Attributes
::
makeReal
(
"NUMBLOCKS"
,
"Maximum number of vectors in the Krylov "
"space (for RCGSolMgr). Default value is 0 and BlockCGSolMgr will be used."
);
(
"NUMBLOCKS"
,
"Maximum number of vectors in the Krylov "
"space (for RCGSolMgr). Default value is 0 and BlockCGSolMgr will be used."
);
itsAttr
[
RECYCLEBLOCKS
]
=
Attributes
::
makeReal
(
"RECYCLEBLOCKS"
,
"Number of vectors in the recycle "
"space (for RCGSolMgr). Default value is 0 and BlockCGSolMgr will be used."
);
(
"RECYCLEBLOCKS"
,
"Number of vectors in the recycle "
"space (for RCGSolMgr). Default value is 0 and BlockCGSolMgr will be used."
);
itsAttr
[
NLHS
]
=
Attributes
::
makeReal
(
"NLHS"
,
"Number of stored old solutions for extrapolating "
"the new starting vector. Default value is 1 and just the last solution is used."
);
(
"NLHS"
,
"Number of stored old solutions for extrapolating "
"the new starting vector. Default value is 1 and just the last solution is used."
);
itsAttr
[
ENABLEHDF5
]
=
Attributes
::
makeBool
(
"ENABLEHDF5"
,
"If true, HDF5 actions are enabled"
,
enableHDF5
);
(
"ENABLEHDF5"
,
"If true, HDF5 actions are enabled"
,
enableHDF5
);
itsAttr
[
ENABLEVTK
]
=
Attributes
::
makeBool
(
"ENABLEVTK"
,
"If true, writing of VTK files are enabled"
,
enableVTK
);
itsAttr
[
ASCIIDUMP
]
=
Attributes
::
makeBool
(
"ASCIIDUMP"
,
"If true, some of the elements dump in ASCII instead of HDF5"
,
false
);
(
"ASCIIDUMP"
,
"If true, some of the elements dump in ASCII instead of HDF5"
,
asciidump
);
itsAttr
[
BOUNDPDESTROYFQ
]
=
Attributes
::
makeReal
(
"BOUNDPDESTROYFQ"
,
"The frequency to do boundp_destroy to delete lost particles. Default 10"
,
10.0
);
(
"BOUNDPDESTROYFQ"
,
"The frequency to do boundp_destroy to "
"delete lost particles. Default 10"
,
boundpDestroyFreq
);
itsAttr
[
BEAMHALOBOUNDARY
]
=
Attributes
::
makeReal
(
"BEAMHALOBOUNDARY"
,
"Defines in terms of sigma where the halo starts. Default 0.0"
,
0.0
);
(
"BEAMHALOBOUNDARY"
,
"Defines in terms of sigma where "
"the halo starts. Default 0.0"
,
beamHaloBoundary
);
itsAttr
[
IDEALIZED
]
=
Attributes
::
makeBool
(
"IDEALIZED"
,
"Using the hard edge model for the calculation of path length. Default: false"
,
false
);
(
"IDEALIZED"
,
"Using the hard edge model for the calculation "
"of path length. Default: false"
,
idealized
);
itsAttr
[
LOGBENDTRAJECTORY
]
=
Attributes
::
makeBool
(
"LOGBENDTRAJECTORY"
,
"Writing the trajectory of every bend to disk. Default: false"
,
false
);
(
"LOGBENDTRAJECTORY"
,
"Writing the trajectory of "
"every bend to disk. Default: false"
,
writeBendTrajectories
);
itsAttr
[
VERSION
]
=
Attributes
::
makeReal
(
"VERSION"
,
"Version of OPAL for which input file was written"
,
10000
);
(
"VERSION"
,
"Version of OPAL for which input file was written"
,
version
);
#ifdef ENABLE_AMR
itsAttr
[
AMR
]
=
Attributes
::
makeBool
...
...
@@ -258,14 +265,16 @@ Option::Option():
"in multi-bunch mode (default: 10)"
,
amrRegridFreq
);
#endif
itsAttr
[
MEMORYDUMP
]
=
Attributes
::
makeBool
(
"MEMORYDUMP"
,
"If true, write memory to SDDS file"
,
memoryDump
);
(
"MEMORYDUMP"
,
"If true, write memory to SDDS file"
,
memoryDump
);
itsAttr
[
HALOSHIFT
]
=
Attributes
::
makeReal
(
"HALOSHIFT"
,
"Constant parameter to shift halo value (default: 0.0)"
,
haloShift
);
(
"HALOSHIFT"
,
"Constant parameter to shift halo value (default: 0.0)"
,
haloShift
);
itsAttr
[
DELPARTFREQ
]
=
Attributes
::
makeReal
(
"DELPARTFREQ"
,
"The frequency to delete particles, i.e. delete when step%delPartFreq == 0. Default: 1"
,
delPartFreq
);
(
"DELPARTFREQ"
,
"The frequency to delete particles, "
"i.e. delete when step%delPartFreq == 0. Default: 1"
,
delPartFreq
);
registerOwnership
(
AttributeHandler
::
STATEMENT
);
...
...
@@ -273,13 +282,13 @@ Option::Option():
}
Option
::
Option
(
const
std
::
string
&
name
,
Option
*
parent
)
:
Option
::
Option
(
const
std
::
string
&
name
,
Option
*
parent
)
:
Action
(
name
,
parent
)
{
Attributes
::
setBool
(
itsAttr
[
ECHO
],
echo
);
Attributes
::
setBool
(
itsAttr
[
INFO
],
info
);
Attributes
::
setBool
(
itsAttr
[
TRACE
],
mtrace
);
Attributes
::
setBool
(
itsAttr
[
WARN
],
warn
);
Attributes
::
setReal
(
itsAttr
[
SEED
],
seed
);
Attributes
::
setBool
(
itsAttr
[
ECHO
],
echo
);
Attributes
::
setBool
(
itsAttr
[
INFO
],
info
);
Attributes
::
setBool
(
itsAttr
[
TRACE
],
mtrace
);
Attributes
::
setBool
(
itsAttr
[
WARN
],
warn
);
Attributes
::
setReal
(
itsAttr
[
SEED
],
seed
);
Attributes
::
setReal
(
itsAttr
[
PSDUMPFREQ
],
psDumpFreq
);
Attributes
::
setReal
(
itsAttr
[
STATDUMPFREQ
],
statDumpFreq
);
Attributes
::
setBool
(
itsAttr
[
PSDUMPEACHTURN
],
psDumpEachTurn
);
...
...
@@ -296,7 +305,6 @@ Option::Option(const std::string &name, Option *parent):
Attributes
::
setBool
(
itsAttr
[
EBDUMP
],
ebDump
);
Attributes
::
setBool
(
itsAttr
[
CSRDUMP
],
csrDump
);
Attributes
::
setReal
(
itsAttr
[
AUTOPHASE
],
autoPhase
);
Attributes
::
setReal
(
itsAttr
[
SURFDUMPFREQ
],
surfDumpFreq
);
Attributes
::
setBool
(
itsAttr
[
CZERO
],
cZero
);
Attributes
::
setBool
(
itsAttr
[
CLOTUNEONLY
],
cloTuneOnly
);
Attributes
::
setUpperCaseString
(
itsAttr
[
RNGTYPE
],
std
::
string
(
rngtype
));
...
...
@@ -304,6 +312,7 @@ Option::Option(const std::string &name, Option *parent):
Attributes
::
setReal
(
itsAttr
[
RECYCLEBLOCKS
],
recycleBlocks
);
Attributes
::
setReal
(
itsAttr
[
NLHS
],
nLHS
);
Attributes
::
setBool
(
itsAttr
[
ENABLEHDF5
],
enableHDF5
);
Attributes
::
setBool
(
itsAttr
[
ENABLEVTK
],
enableVTK
);
Attributes
::
setBool
(
itsAttr
[
ASCIIDUMP
],
asciidump
);
Attributes
::
setReal
(
itsAttr
[
BOUNDPDESTROYFQ
],
boundpDestroyFreq
);
Attributes
::
setReal
(
itsAttr
[
BEAMHALOBOUNDARY
],
beamHaloBoundary
);
...
...
@@ -325,23 +334,30 @@ Option::~Option()
{}
Option
*
Option
::
clone
(
const
std
::
string
&
name
)
{
Option
*
Option
::
clone
(
const
std
::
string
&
name
)
{
return
new
Option
(
name
,
this
);
}
void
Option
::
execute
()
{
// Store the option flags.
echo
=
Attributes
::
getBool
(
itsAttr
[
ECHO
]);
info
=
Attributes
::
getBool
(
itsAttr
[
INFO
]);
mtrace
=
Attributes
::
getBool
(
itsAttr
[
TRACE
]);
warn
=
Attributes
::
getBool
(
itsAttr
[
WARN
]);
psDumpEachTurn
=
Attributes
::
getBool
(
itsAttr
[
PSDUMPEACHTURN
]);
rhoDump
=
Attributes
::
getBool
(
itsAttr
[
RHODUMP
]);
ebDump
=
Attributes
::
getBool
(
itsAttr
[
EBDUMP
]);
csrDump
=
Attributes
::
getBool
(
itsAttr
[
CSRDUMP
]);
enableHDF5
=
Attributes
::
getBool
(
itsAttr
[
ENABLEHDF5
]);
version
=
Attributes
::
getReal
(
itsAttr
[
VERSION
]);
echo
=
Attributes
::
getBool
(
itsAttr
[
ECHO
]);
info
=
Attributes
::
getBool
(
itsAttr
[
INFO
]);
mtrace
=
Attributes
::
getBool
(
itsAttr
[
TRACE
]);
warn
=
Attributes
::
getBool
(
itsAttr
[
WARN
]);
psDumpEachTurn
=
Attributes
::
getBool
(
itsAttr
[
PSDUMPEACHTURN
]);
remotePartDel
=
Attributes
::
getReal
(
itsAttr
[
REMOTEPARTDEL
]);
rhoDump
=
Attributes
::
getBool
(
itsAttr
[
RHODUMP
]);
ebDump
=
Attributes
::
getBool
(
itsAttr
[
EBDUMP
]);
csrDump
=
Attributes
::
getBool
(
itsAttr
[
CSRDUMP
]);
enableHDF5
=
Attributes
::
getBool
(
itsAttr
[
ENABLEHDF5
]);
enableVTK
=
Attributes
::
getBool
(
itsAttr
[
ENABLEVTK
]);
idealized
=
Attributes
::
getBool
(
itsAttr
[
IDEALIZED
]);
asciidump
=
Attributes
::
getBool
(
itsAttr
[
ASCIIDUMP
]);
version
=
Attributes
::
getReal
(
itsAttr
[
VERSION
]);
seed
=
Attributes
::
getReal
(
itsAttr
[
SEED
]);
writeBendTrajectories
=
Attributes
::
getBool
(
itsAttr
[
LOGBENDTRAJECTORY
]);
#ifdef ENABLE_AMR
amr
=
Attributes
::
getBool
(
itsAttr
[
AMR
]);
amrYtDumpFreq
=
int
(
Attributes
::
getReal
(
itsAttr
[
AMR_YT_DUMP_FREQ
]));
...
...
@@ -353,9 +369,10 @@ void Option::execute() {
amrRegridFreq
=
int
(
Attributes
::
getReal
(
itsAttr
[
AMR_REGRID_FREQ
]));
amrRegridFreq
=
(
amrRegridFreq
<
1
)
?
1
:
amrRegridFreq
;
#endif
memoryDump
=
Attributes
::
getBool
(
itsAttr
[
MEMORYDUMP
]);
haloShift
=
Attributes
::
getReal
(
itsAttr
[
HALOSHIFT
]);
delPartFreq
=
Attributes
::
getReal
(
itsAttr
[
DELPARTFREQ
]);
memoryDump
=
Attributes
::
getBool
(
itsAttr
[
MEMORYDUMP
]);
haloShift
=
Attributes
::
getReal
(
itsAttr
[
HALOSHIFT
]);
delPartFreq
=
Attributes
::
getReal
(
itsAttr
[
DELPARTFREQ
]);
if
(
memoryDump
)
{
IpplMemoryUsage
::
IpplMemory_p
memory
=
IpplMemoryUsage
::
getInstance
(
...
...
@@ -363,8 +380,6 @@ void Option::execute() {
memory
->
sample
();
}
seed
=
Attributes
::
getReal
(
itsAttr
[
SEED
]);
/// note: rangen is used only for the random number generator in the OPAL language
/// not for the distributions
...
...
@@ -373,19 +388,14 @@ void Option::execute() {
else
rangen
.
init55
(
seed
);
IpplInfo
::
Info
->
on
(
info
);
IpplInfo
::
Warn
->
on
(
warn
);
handlePsDumpFrame
(
Attributes
::
getString
(
itsAttr
[
PSDUMPFRAME
]));
if
(
itsAttr
[
ASCIIDUMP
])
{
asciidump
=
Attributes
::
getBool
(
itsAttr
[
ASCIIDUMP
]);
}
/// note: rangen is used only for the random number generator in the OPAL language
/// not for the distributions
if
(
itsAttr
[
SEED
])
{
if
(
itsAttr
[
SEED
])
{
seed
=
int
(
Attributes
::
getReal
(
itsAttr
[
SEED
]));
if
(
seed
==
-
1
)
rangen
.
init55
(
time
(
0
));
...
...
@@ -393,41 +403,34 @@ void Option::execute() {
rangen
.
init55
(
seed
);
}
if
(
itsAttr
[
PSDUMPFREQ
])
{
if
(
itsAttr
[
PSDUMPFREQ
])
{
psDumpFreq
=
int
(
Attributes
::
getReal
(
itsAttr
[
PSDUMPFREQ
]));
if
(
psDumpFreq
==
0
)
psDumpFreq
=
std
::
numeric_limits
<
int
>::
max
();
}
if
(
itsAttr
[
STATDUMPFREQ
])
{
if
(
itsAttr
[
STATDUMPFREQ
])
{
statDumpFreq
=
int
(
Attributes
::
getReal
(
itsAttr
[
STATDUMPFREQ
]));
if
(
statDumpFreq
==
0
)
statDumpFreq
=
std
::
numeric_limits
<
int
>::
max
();
}
if
(
itsAttr
[
SPTDUMPFREQ
])
{
if
(
itsAttr
[
SPTDUMPFREQ
])
{
sptDumpFreq
=
int
(
Attributes
::
getReal
(
itsAttr
[
SPTDUMPFREQ
]));
if
(
sptDumpFreq
==
0
)
sptDumpFreq
=
std
::
numeric_limits
<
int
>::
max
();
}
if
(
itsAttr
[
SCSOLVEFREQ
])
{
if
(
itsAttr
[
SCSOLVEFREQ
])
{
scSolveFreq
=
int
(
Attributes
::
getReal
(
itsAttr
[
SCSOLVEFREQ
]));
scSolveFreq
=
(
scSolveFreq
<
1
)
?
1
:
scSolveFreq
;
}
if
(
itsAttr
[
MTSSUBSTEPS
])
{
if
(
itsAttr
[
MTSSUBSTEPS
])
{
mtsSubsteps
=
int
(
Attributes
::
getReal
(
itsAttr
[
MTSSUBSTEPS
]));
}
if
(
itsAttr
[
REMOTEPARTDEL
])
{
remotePartDel
=
Attributes
::
getReal
(
itsAttr
[
REMOTEPARTDEL
]);
}
if
(
itsAttr
[
REPARTFREQ
])
{
if
(
itsAttr
[
REPARTFREQ
])
{
repartFreq
=
int
(
Attributes
::
getReal
(
itsAttr
[
REPARTFREQ
]));
}
...
...
@@ -439,48 +442,43 @@ void Option::execute() {
minStepForRebin
=
int
(
Attributes
::
getReal
(
itsAttr
[
MINSTEPFORREBIN
]));
}
if
(
itsAttr
[
REBINFREQ
])
{
if
(
itsAttr
[
REBINFREQ
])
{
rebinFreq
=
int
(
Attributes
::
getReal
(
itsAttr
[
REBINFREQ
]));
}
if
(
itsAttr
[
AUTOPHASE
])
{
if
(
itsAttr
[
AUTOPHASE
])
{
autoPhase
=
int
(
Attributes
::
getReal
(
itsAttr
[
AUTOPHASE
]));
}
if
(
itsAttr
[
SURFDUMPFREQ
])
{
surfDumpFreq
=
int
(
Attributes
::
getReal
(
itsAttr
[
SURFDUMPFREQ
]));
}
if
(
itsAttr
[
NUMBLOCKS
])
{
if
(
itsAttr
[
NUMBLOCKS
])
{
numBlocks
=
int
(
Attributes
::
getReal
(
itsAttr
[
NUMBLOCKS
]));
}
if
(
itsAttr
[
RECYCLEBLOCKS
])
{
if
(
itsAttr
[
RECYCLEBLOCKS
])
{
recycleBlocks
=
int
(
Attributes
::
getReal
(
itsAttr
[
RECYCLEBLOCKS
]));
}
if
(
itsAttr
[
NLHS
])
{
if
(
itsAttr
[
NLHS
])
{
nLHS
=
int
(
Attributes
::
getReal
(
itsAttr
[
NLHS
]));
}
if
(
itsAttr
[
CZERO
])
{
if
(
itsAttr
[
CZERO
])
{
cZero
=
bool
(
Attributes
::
getBool
(
itsAttr
[
CZERO
]));
}
if
(
itsAttr
[
RNGTYPE
])
{
if
(
itsAttr
[
RNGTYPE
])
{
rngtype
=
std
::
string
(
Attributes
::
getString
(
itsAttr
[
RNGTYPE
]));
}
else
{
rngtype
=
std
::
string
(
"RANDOM"
);
}
if
(
itsAttr
[
BEAMHALOBOUNDARY
])
{
if
(
itsAttr
[
BEAMHALOBOUNDARY
])
{
beamHaloBoundary
=
Attributes
::
getReal
(
itsAttr
[
BEAMHALOBOUNDARY
]);
}
else
{
}
else
{
beamHaloBoundary
=
0
;
}
idealized
=
Attributes
::
getBool
(
itsAttr
[
IDEALIZED
]);
writeBendTrajectories
=
Attributes
::
getBool
(
itsAttr
[
LOGBENDTRAJECTORY
]);
if
(
itsAttr
[
CLOTUNEONLY
])
{
if
(
itsAttr
[
CLOTUNEONLY
])
{
cloTuneOnly
=
bool
(
Attributes
::
getBool
(
itsAttr
[
CLOTUNEONLY
]));
}
else
{
cloTuneOnly
=
false
;
...
...
@@ -489,7 +487,7 @@ void Option::execute() {
// Set message flags.
FileStream
::
setEcho
(
echo
);
if
(
Attributes
::
getBool
(
itsAttr
[
TELL
]))
{
if
(
Attributes
::
getBool
(
itsAttr
[
TELL
]))
{
*
gmsg
<<
"
\n
Current settings of options:
\n
"
<<
*
this
<<
endl
;
}
...
...
@@ -499,7 +497,7 @@ void Option::execute() {
}
}
void
Option
::
handlePsDumpFrame
(
const
std
::
string
&
dumpFrame
)
{
void
Option
::
handlePsDumpFrame
(
const
std
::
string
&
dumpFrame
)
{
if
(
dumpFrame
==
"GLOBAL"
)
{
psDumpFrame
=
GLOBAL
;
}
else
if
(
dumpFrame
==
"BUNCH_MEAN"
)
{
...
...
@@ -530,4 +528,4 @@ void Option::update(const std::vector<Attribute>& othersAttributes) {
for
(
int
i
=
0
;
i
<
SIZE
;
++
i
)
{
itsAttr
[
i
]
=
othersAttributes
[
i
];
}
}
\ No newline at end of file
}
src/BasicActions/Option.h
View file @
4afce1f2
...
...
@@ -32,21 +32,21 @@ public:
virtual
~
Option
();
/// Make clone.
virtual
Option
*
clone
(
const
std
::
string
&
name
);
virtual
Option
*
clone
(
const
std
::
string
&
name
);
/// Execute the command.
virtual
void
execute
();
private:
void
handlePsDumpFrame
(
const
std
::
string
&
dumpFrame
);
void
handlePsDumpFrame
(
const
std
::
string
&
dumpFrame
);
void
update
(
const
std
::
vector
<
Attribute
>&
);
// Not implemented.
Option
(
const
Option
&
);
void
operator
=
(
const
Option
&
);
Option
(
const
Option
&
);
void
operator
=
(
const
Option
&
);
// Clone constructor.
Option
(
const
std
::
string
&
name
,
Option
*
parent
);
Option
(
const
std
::
string
&
name
,
Option
*
parent
);
};
#endif // OPAL_Option_HH
\ No newline at end of file
#endif // OPAL_Option_HH
src/Classic/Utilities/Options.cpp
View file @
4afce1f2
...
...
@@ -18,106 +18,88 @@
//
#include "OptionTypes.h"
#include "Utilities/ClassicRandom.h"
#include <string>
namespace
Options
{
// The global program options.
bool
echo
=
false
;
bool
info
=
true
;
int
infoLevel
=
1
;
bool
warn
=
true
;
int
warnLevel
=
1
;
bool
csrDump
=
false
;
// If true create symmetric distribution
bool
cZero
=
false
;
bool
asciidump
=
false
;
// If the distance of a particle to bunch mass larger than remotePartDel times of the rms size of the bunch in any dimension,
// the particle will be deleted artifically to hold the accuracy of space charge calculation. The default setting of -1 stands for no deletion.
double
remotePartDel
=
0.0
;
double
beamHaloBoundary
=
0
;
bool
writeBendTrajectories
=
false
;
// The global program options.
bool
mtrace
=
false
;
bool
psDumpEachTurn
=
false
;
DumpFrame
psDumpFrame
=
GLOBAL
;
bool
rhoDump
=
false
;
bool
ebDump
=
false
;
bool
enableHDF5
=
true
;
bool
warn
=
true
;
int
warnLevel
=
1
;
// The global random generator.
Random
rangen
;
// The current random seed.
int
seed
=
123456789
;
// the number of refinements of the search range for the phase with maximum energy
// if eq 0 then no autophase
int
autoPhase
=
6
;
// The frequency to dump the phase space, i.e.dump data when step%psDumpFreq==0
int
psDumpFreq
=
10
;
// // The frequency to dump the phase space, i.e.dump data when step%psDumpFreq==0
// double rDump = 0.0;
// The frequency to dump statistical quantities such as beam RMS properties, i.e. dump
// when step%statDumpFreq == 0.
int
statDumpFreq
=
10
;
// The frequency to dump single particle trajectory of particles with ID = 0 & 1
bool
psDumpEachTurn
=
false
;
DumpFrame
psDumpFrame
=
GLOBAL
;
int
sptDumpFreq
=
1
;
// The frequency to do particles repartition for better load balance between nodes
int
repartFreq
=
10
;
// The number of bins that have to be emitted before the bin are squashed into a single bin
int
minBinEmitted
=
10
;
// The number of steps into the simulation before the bins are squashed into a single bin
int
minStepForRebin
=
200
;
// The frequency to reset energy bin ID for all particles
int
rebinFreq
=
100
;
/// The frequency to solve space charge fields.
int
scSolveFreq
=
1
;
// How many small timesteps are inside the large timestep used in multiple time stepping (MTS) integrator
int
mtsSubsteps
=
1
;
// The frequency to dump the particle-geometry surface interation data, -1 stands for no dump.
int
surfDumpFreq
=
-
1
;
double
remotePartDel
=
0.0
;
bool
rhoDump
=
false
;
bool
ebDump
=
false
;
bool
csrDump
=
false
;
int
autoPhase
=
6
;
// Options for the Belos solver
int
numBlocks
=
0
;
int
recycleBlocks
=
0
;
int
nLHS
=
1
;
bool
cZero
=
false
;
std
::
string
rngtype
=
std
::
string
(
"RANDOM"
);
bool
cloTuneOnly
=
false
;
bool
enableHDF5
=
true
;
bool
enableVTK
=
true
;
bool
asciidump
=
false
;
// Governs how often boundp_destroy is called to destroy lost particles
// Mainly used in the CyclotronTracker as of now -DW
int
boundpDestroyFreq
=
10
;
// Using hard edge model for calculation of path length
double
beamHaloBoundary
=
0
;
bool
cloTuneOnly
=
false
;
bool
idealized
=
false
;
// opal version of input file
bool
writeBendTrajectories
=
false
;
int
version
=
10000
;
bool
amr
=
false
;
/// The frequency to dump AMR grid data and particles into file
int
amrYtDumpFreq
=
10
;
int
amrRegridFreq
=
10
;
bool
memoryDump
=
false
;
...
...
@@ -125,4 +107,4 @@ namespace Options {
double
haloShift
=
0.0
;
unsigned
int
delPartFreq
=
1
;
}
\ No newline at end of file
}
src/Classic/Utilities/Options.h
View file @
4afce1f2
...
...
@@ -22,6 +22,8 @@
#include "OptionTypes.h"
#include "Utilities/ClassicRandom.h"