Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
S
src
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
71
Issues
71
List
Boards
Labels
Service Desk
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Code Review
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OPAL
src
Commits
f24a1a3e
Commit
f24a1a3e
authored
Dec 15, 2018
by
frey_m
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PeakFinder: do not evaluate per particle
parent
5bc2faa5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
37 deletions
+24
-37
src/Classic/AbsBeamline/Probe.cpp
src/Classic/AbsBeamline/Probe.cpp
+3
-4
src/Classic/Structure/PeakFinder.cpp
src/Classic/Structure/PeakFinder.cpp
+19
-29
src/Classic/Structure/PeakFinder.h
src/Classic/Structure/PeakFinder.h
+2
-4
No files found.
src/Classic/AbsBeamline/Probe.cpp
View file @
f24a1a3e
...
...
@@ -259,12 +259,11 @@ bool Probe::checkProbe(PartBunchBase<double, 3> *bunch, const int turnnumber, co
probepoint
=
bunch
->
R
[
i
]
+
dist2
*
1000.0
*
bunch
->
P
[
i
]
/
euclidean_norm
(
bunch
->
P
[
i
]);
lossDs_m
->
addParticle
(
probepoint
,
bunch
->
P
[
i
],
bunch
->
ID
[
i
],
t
+
dt
,
turnnumber
);
peakfinder_m
->
addParticle
(
probepoint
,
turnnumber
);
peakfinder_m
->
addParticle
(
probepoint
);
flagprobed
=
true
;
}
if
(
bunch
->
getTotalNum
()
>
0
)
peakfinder_m
->
evaluate
(
tempnum
);
peakfinder_m
->
evaluate
(
turnnumber
);
}
...
...
src/Classic/Structure/PeakFinder.cpp
View file @
f24a1a3e
...
...
@@ -19,8 +19,6 @@ PeakFinder::PeakFinder(std::string elem, double min,
,
singlemode_m
(
singlemode
)
,
first_m
(
true
)
,
finished_m
(
false
)
,
fPeakRadius_m
(
0.0
)
,
fRegisered_m
(
0
)
{
if
(
min_m
>
max_m
)
{
std
::
swap
(
min_m
,
max_m
);
...
...
@@ -30,11 +28,18 @@ PeakFinder::PeakFinder(std::string elem, double min,
}
void
PeakFinder
::
addParticle
(
const
Vector_t
&
R
,
const
int
&
turn
)
{
void
PeakFinder
::
addParticle
(
const
Vector_t
&
R
)
{
double
radius
=
std
::
hypot
(
R
(
0
),
R
(
1
));
radius_m
.
push_back
(
radius
);
peakRadius_m
+=
radius
;
++
registered_m
;
}
void
PeakFinder
::
evaluate
(
const
int
&
turn
)
{
if
(
first_m
)
{
turn_m
=
turn
;
first_m
=
false
;
...
...
@@ -42,38 +47,24 @@ void PeakFinder::addParticle(const Vector_t& R, const int& turn) {
if
(
turn_m
!=
turn
)
{
finished_m
=
true
;
turn_m
=
turn
;
fPeakRadius_m
=
peakRadius_m
;
fRegisered_m
=
registered_m
;
peakRadius_m
=
0.0
;
registered_m
=
0
;
}
peakRadius_m
+=
radius
;
++
registered_m
;
}
void
PeakFinder
::
evaluate
(
const
unsigned
int
&
localnum
)
{
bool
globFinished
=
false
;
// a core might have no particles, thus, never set finished_m = true
if
(
localnum
==
0
)
finished_m
=
true
;
if
(
!
singlemode_m
)
allreduce
(
finished_m
,
globFinished
,
1
,
std
::
logical_and
<
bool
>
());
else
globFinished
=
finished_m
;
if
(
globFinished
)
{
this
->
computeCentroid_m
();
turn_m
=
turn
;
// reset
fP
eakRadius_m
=
0.0
;
fRegis
ered_m
=
0
;
p
eakRadius_m
=
0.0
;
regist
ered_m
=
0
;
finished_m
=
false
;
}
}
...
...
@@ -84,8 +75,6 @@ void PeakFinder::save() {
createHistogram_m
();
// last turn is not yet computed
fPeakRadius_m
=
peakRadius_m
;
fRegisered_m
=
registered_m
;
this
->
computeCentroid_m
();
if
(
!
peaks_m
.
empty
()
)
{
...
...
@@ -118,15 +107,16 @@ void PeakFinder::computeCentroid_m() {
//FIXME inefficient
if
(
!
singlemode_m
)
{
reduce
(
fP
eakRadius_m
,
globPeakRadius
,
1
,
std
::
plus
<
double
>
());
reduce
(
fRegis
ered_m
,
globRegister
,
1
,
std
::
plus
<
int
>
());
reduce
(
p
eakRadius_m
,
globPeakRadius
,
1
,
std
::
plus
<
double
>
());
reduce
(
regist
ered_m
,
globRegister
,
1
,
std
::
plus
<
int
>
());
}
else
{
globPeakRadius
=
fP
eakRadius_m
;
globRegister
=
fRegis
ered_m
;
globPeakRadius
=
p
eakRadius_m
;
globRegister
=
regist
ered_m
;
}
if
(
Ippl
::
myNode
()
==
0
)
{
peaks_m
.
push_back
(
globPeakRadius
/
double
(
globRegister
));
if
(
globRegister
>
0
)
peaks_m
.
push_back
(
globPeakRadius
/
double
(
globRegister
));
}
}
...
...
src/Classic/Structure/PeakFinder.h
View file @
f24a1a3e
...
...
@@ -37,12 +37,12 @@ public:
* Append the particle coordinates to the container
* @param R is a particle position (x, y, z)
*/
void
addParticle
(
const
Vector_t
&
R
,
const
int
&
turn
);
void
addParticle
(
const
Vector_t
&
R
);
/*!
* Evaluate the centroid of a turn.
*/
void
evaluate
(
const
unsigned
int
&
localnum
);
void
evaluate
(
const
int
&
turn
);
void
save
();
...
...
@@ -101,8 +101,6 @@ private:
bool
first_m
;
bool
finished_m
;
double
fPeakRadius_m
;
int
fRegisered_m
;
};
#endif
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