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
2dca98e3
Commit
2dca98e3
authored
Oct 07, 2019
by
Pedro Calvo Portela
Browse files
Save geometry losses
parent
d769c7ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
src/Algorithms/ParallelCyclotronTracker.cpp
src/Algorithms/ParallelCyclotronTracker.cpp
+15
-1
src/Algorithms/ParallelCyclotronTracker.h
src/Algorithms/ParallelCyclotronTracker.h
+3
-1
No files found.
src/Algorithms/ParallelCyclotronTracker.cpp
View file @
2dca98e3
...
...
@@ -79,6 +79,7 @@
#include "Structure/BoundaryGeometry.h"
#include "Structure/DataSink.h"
#include "Structure/LossDataSink.h"
using
Physics
::
pi
;
using
Physics
::
q_e
;
...
...
@@ -167,6 +168,8 @@ ParallelCyclotronTracker::ParallelCyclotronTracker(const Beamline &beamline,
*
*/
ParallelCyclotronTracker
::~
ParallelCyclotronTracker
()
{
if
(
bgf_m
)
lossDs_m
->
save
();
for
(
Component
*
component
:
myElements
)
{
delete
(
component
);
}
...
...
@@ -197,7 +200,12 @@ void ParallelCyclotronTracker::bgf_main_collision_test() {
int
res
=
bgf_m
->
partInside
(
itsBunch_m
->
R
[
i
],
itsBunch_m
->
P
[
i
],
dtime
,
itsBunch_m
->
PType
[
i
],
itsBunch_m
->
Q
[
i
],
intecoords
,
triId
);
//int res = bgf_m->partInside(itsBunch_m->R[i]*1.0e-3, itsBunch_m->P[i], dtime, itsBunch_m->PType[i], itsBunch_m->Q[i], intecoords, triId);
if
(
res
>=
0
)
{
lossDs_m
->
addParticle
(
itsBunch_m
->
R
[
i
]
*
1000
,
itsBunch_m
->
P
[
i
],
itsBunch_m
->
ID
[
i
],
itsBunch_m
->
getT
()
*
1e9
,
turnnumber_m
,
itsBunch_m
->
bunchNum
[
i
]);
itsBunch_m
->
Bin
[
i
]
=
-
1
;
Inform
gmsgALL
(
"OPAL "
,
INFORM_ALL_NODES
);
gmsgALL
<<
level4
<<
"* Particle "
<<
itsBunch_m
->
ID
[
i
]
<<
" lost on boundary geometry"
<<
endl
;
}
}
}
...
...
@@ -1191,6 +1199,12 @@ void ParallelCyclotronTracker::execute() {
// Get BoundaryGeometry that is already initialized
bgf_m
=
OpalData
::
getInstance
()
->
getGlobalGeometry
();
if
(
bgf_m
)
{
lossDs_m
=
std
::
unique_ptr
<
LossDataSink
>
(
new
LossDataSink
(
"GEOM"
,
!
Options
::
asciidump
));
*
gmsg
<<
"* Boundary geometry initialized "
<<
endl
;
*
gmsg
<<
"* -------------------------------------"
<<
endl
;
}
// External field arrays for dumping
for
(
int
k
=
0
;
k
<
2
;
k
++
)
...
...
@@ -3511,4 +3525,4 @@ void ParallelCyclotronTracker::initPathLength() {
// we need to reset the path length of each bunch
itsDataSink
->
setMultiBunchInitialPathLengh
(
mbHandler_m
.
get
());
}
}
\ No newline at end of file
}
src/Algorithms/ParallelCyclotronTracker.h
View file @
2dca98e3
...
...
@@ -29,6 +29,7 @@
class
DataSink
;
class
PluginElement
;
class
LossDataSink
;
template
<
class
T
,
unsigned
Dim
>
class
PartBunchBase
;
...
...
@@ -435,6 +436,7 @@ private:
// we store a pointer explicitly to the Ring
Ring
*
opalRing_m
;
std
::
unique_ptr
<
LossDataSink
>
lossDs_m
;
// If Ring is defined take the harmonic number from Ring; else use
// cyclotron
...
...
@@ -573,4 +575,4 @@ bool ParallelCyclotronTracker::hasMultiBunch() const {
return
(
isMultiBunch
()
&&
mbHandler_m
->
getNumBunch
()
>
1
);
}
#endif // OPAL_ParallelCyclotronTracker_HH
\ No newline at end of file
#endif // OPAL_ParallelCyclotronTracker_HH
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment