Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ext-edelen_a
src
Commits
45e96c45
Commit
45e96c45
authored
Feb 28, 2015
by
kraus
Browse files
fixing problem with follow up tracks where no distribution is assigned to the trackrun command
parent
04ede2fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
36 deletions
+54
-36
src/Track/TrackRun.cpp
src/Track/TrackRun.cpp
+51
-35
src/Track/TrackRun.h
src/Track/TrackRun.h
+3
-1
No files found.
src/Track/TrackRun.cpp
View file @
45e96c45
...
...
@@ -80,6 +80,8 @@ namespace {
};
}
const
std
::
string
TrackRun
::
defaultDistribution
(
"DISTRIBUTION"
);
TrackRun
::
TrackRun
()
:
Action
(
SIZE
,
"RUN"
,
"The
\"
RUN
\"
sub-command tracks the defined particles through "
...
...
@@ -163,23 +165,26 @@ void TrackRun::execute() {
std
::
vector
<
std
::
string
>
distr_str
=
Attributes
::
getStringArray
(
itsAttr
[
DISTRIBUTION
]);
const
size_t
numberOfDistributions
=
distr_str
.
size
();
dist
=
Distribution
::
find
(
distr_str
.
at
(
0
));
dist
->
setNumberOfDistributions
(
numberOfDistributions
);
if
(
numberOfDistributions
==
0
)
{
dist
=
Distribution
::
find
(
defaultDistribution
);
}
else
{
dist
=
Distribution
::
find
(
distr_str
.
at
(
0
));
dist
->
setNumberOfDistributions
(
numberOfDistributions
);
if
(
numberOfDistributions
>
1
)
{
*
gmsg
<<
"Found more than one distribution: "
;
for
(
size_t
i
=
1
;
i
<
numberOfDistributions
;
++
i
)
{
Distribution
*
d
=
Distribution
::
find
(
distr_str
.
at
(
i
));
if
(
numberOfDistributions
>
1
)
{
*
gmsg
<<
"Found more than one distribution: "
;
for
(
size_t
i
=
1
;
i
<
numberOfDistributions
;
++
i
)
{
Distribution
*
d
=
Distribution
::
find
(
distr_str
.
at
(
i
));
d
->
setNumberOfDistributions
(
numberOfDistributions
);
distrs_m
.
push_back
(
d
);
d
->
setNumberOfDistributions
(
numberOfDistributions
);
distrs_m
.
push_back
(
d
);
*
gmsg
<<
" "
<<
distr_str
.
at
(
i
);
*
gmsg
<<
" "
<<
distr_str
.
at
(
i
);
}
*
gmsg
<<
endl
;
}
*
gmsg
<<
endl
;
}
fs
=
FieldSolver
::
find
(
Attributes
::
getString
(
itsAttr
[
FIELDSOLVER
]));
fs
->
initCartesianFields
();
...
...
@@ -535,7 +540,11 @@ void TrackRun::execute() {
Track
::
block
->
bunch
->
PType
=
0
;
std
::
vector
<
std
::
string
>
distr_str
=
Attributes
::
getStringArray
(
itsAttr
[
DISTRIBUTION
]);
dist
=
Distribution
::
find
(
distr_str
.
at
(
0
));
if
(
distr_str
.
size
()
==
0
)
{
dist
=
Distribution
::
find
(
defaultDistribution
);
}
else
{
dist
=
Distribution
::
find
(
distr_str
.
at
(
0
));
}
// set macromass and charge for simulation particles
double
macromass
=
0.0
;
...
...
@@ -805,32 +814,35 @@ double TrackRun::SetDistributionParallelT(Beam *beam) {
=
Attributes
::
getStringArray
(
itsAttr
[
DISTRIBUTION
]);
const
size_t
numberOfDistributions
=
distributionArray
.
size
();
dist
=
Distribution
::
find
(
distributionArray
.
at
(
0
));
dist
->
setNumberOfDistributions
(
numberOfDistributions
);
if
(
numberOfDistributions
>
1
)
{
*
gmsg
<<
endl
<<
"---------------------------------"
<<
endl
<<
"Found more than one distribution:"
<<
endl
<<
endl
;
*
gmsg
<<
"Main Distribution"
<<
endl
<<
"---------------------------------"
<<
endl
<<
distributionArray
.
at
(
0
)
<<
endl
<<
endl
<<
"Secondary Distribution(s)"
<<
endl
<<
"---------------------------------"
<<
endl
;
for
(
size_t
i
=
1
;
i
<
numberOfDistributions
;
++
i
)
{
Distribution
*
distribution
=
Distribution
::
find
(
distributionArray
.
at
(
i
));
distribution
->
setNumberOfDistributions
(
numberOfDistributions
);
distrs_m
.
push_back
(
distribution
);
*
gmsg
<<
distributionArray
.
at
(
i
)
<<
endl
;
if
(
numberOfDistributions
==
0
)
{
dist
=
Distribution
::
find
(
defaultDistribution
);
}
else
{
dist
=
Distribution
::
find
(
distributionArray
.
at
(
0
));
dist
->
setNumberOfDistributions
(
numberOfDistributions
);
if
(
numberOfDistributions
>
1
)
{
*
gmsg
<<
endl
<<
"---------------------------------"
<<
endl
<<
"Found more than one distribution:"
<<
endl
<<
endl
;
*
gmsg
<<
"Main Distribution"
<<
endl
<<
"---------------------------------"
<<
endl
<<
distributionArray
.
at
(
0
)
<<
endl
<<
endl
<<
"Secondary Distribution(s)"
<<
endl
<<
"---------------------------------"
<<
endl
;
for
(
size_t
i
=
1
;
i
<
numberOfDistributions
;
++
i
)
{
Distribution
*
distribution
=
Distribution
::
find
(
distributionArray
.
at
(
i
));
distribution
->
setNumberOfDistributions
(
numberOfDistributions
);
distrs_m
.
push_back
(
distribution
);
*
gmsg
<<
distributionArray
.
at
(
i
)
<<
endl
;
}
*
gmsg
<<
endl
<<
"---------------------------------"
<<
endl
<<
endl
;
}
*
gmsg
<<
endl
<<
"---------------------------------"
<<
endl
<<
endl
;
}
}
/*
* Initialize distributions.
*/
...
...
@@ -899,7 +911,11 @@ ParallelTTracker *TrackRun::setupForAutophase() {
Track
::
block
->
bunch
->
setSolver
(
fs
);
std
::
vector
<
std
::
string
>
distr_str
=
Attributes
::
getStringArray
(
itsAttr
[
DISTRIBUTION
]);
dist
=
Distribution
::
find
(
distr_str
.
at
(
0
));
if
(
distr_str
.
size
()
==
0
)
{
dist
=
Distribution
::
find
(
defaultDistribution
);
}
else
{
dist
=
Distribution
::
find
(
distr_str
.
at
(
0
));
}
double
charge
=
beam
->
getCharge
()
*
beam
->
getCurrent
()
/
beam
->
getFrequency
();
...
...
src/Track/TrackRun.h
View file @
45e96c45
...
...
@@ -84,10 +84,12 @@ private:
DataSink
*
ds
;
OpalData
*
OPAL
;
static
const
std
::
string
defaultDistribution
;
#ifdef HAVE_AMR_SOLVER
std
::
vector
<
std
::
string
>
filterString
(
std
::
string
str
);
std
::
pair
<
Box
,
unsigned
int
>
getBlGrids
(
std
::
string
str
);
#endif
};
#endif // OPAL_TrackRun_HH
#endif // OPAL_TrackRun_HH
\ No newline at end of file
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