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
70
Issues
70
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
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
09b2b8ad
Commit
09b2b8ad
authored
Aug 14, 2015
by
kraus
Committed by
kraus
Aug 19, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing 3DDynamic field map; cleaning up Collimator class
parent
af9160f9
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
158 additions
and
143 deletions
+158
-143
classic/5.0/src/AbsBeamline/Collimator.cpp
classic/5.0/src/AbsBeamline/Collimator.cpp
+19
-50
classic/5.0/src/Fields/FM2DDynamic.cpp
classic/5.0/src/Fields/FM2DDynamic.cpp
+0
-1
classic/5.0/src/Fields/FM3DDynamic.cpp
classic/5.0/src/Fields/FM3DDynamic.cpp
+124
-84
classic/5.0/src/Fields/FM3DDynamic.h
classic/5.0/src/Fields/FM3DDynamic.h
+5
-4
classic/5.0/src/Fields/Fieldmap.cpp
classic/5.0/src/Fields/Fieldmap.cpp
+1
-0
src/Algorithms/AutophaseTracker.cpp
src/Algorithms/AutophaseTracker.cpp
+6
-1
src/Track/TrackRun.cpp
src/Track/TrackRun.cpp
+3
-3
No files found.
classic/5.0/src/AbsBeamline/Collimator.cpp
View file @
09b2b8ad
...
@@ -208,17 +208,13 @@ inline bool Collimator::isInColl(Vector_t R, Vector_t P, double recpgamma) {
...
@@ -208,17 +208,13 @@ inline bool Collimator::isInColl(Vector_t R, Vector_t P, double recpgamma) {
}
}
}
}
return
!
alive
;
return
!
alive
;
}
else
if
(
isASlit_m
)
{
}
else
if
(
isASlit_m
||
isARColl_m
)
{
return
(
R
(
0
)
<=
-
getXsize
()
||
R
(
1
)
<=
-
getYsize
()
||
R
(
0
)
>=
getXsize
()
||
R
(
1
)
>=
getYsize
());
return
(
std
::
abs
(
R
(
0
))
>=
getXsize
()
||
std
::
abs
(
R
(
1
))
>=
getYsize
());
}
else
if
(
isARColl_m
)
{
return
(
R
(
0
)
<=
-
getXsize
()
||
R
(
1
)
<=
-
getYsize
()
||
R
(
0
)
>=
getXsize
()
||
R
(
1
)
>=
getYsize
());
}
else
if
(
isAWire_m
)
{
}
else
if
(
isAWire_m
)
{
ERRORMSG
(
"Not yet implemented"
);
ERRORMSG
(
"Not yet implemented"
);
}
else
{
}
else
{
// case of an elliptic collimator
// case of an elliptic collimator
const
double
trm1
=
((
R
(
0
)
*
R
(
0
))
/
(
getXsize
()
*
getXsize
()));
return
(
std
::
pow
(
R
(
0
)
/
getXsize
(),
2.0
)
+
std
::
pow
(
R
(
1
)
/
getYsize
(),
2.0
))
>=
1.0
;
const
double
trm2
=
((
R
(
1
)
*
R
(
1
))
/
(
getYsize
()
*
getYsize
()));
return
(
trm1
+
trm2
)
>
1.0
;
}
}
}
}
return
false
;
return
false
;
...
@@ -342,39 +338,7 @@ void Collimator::finalise()
...
@@ -342,39 +338,7 @@ void Collimator::finalise()
}
}
void
Collimator
::
goOnline
(
const
double
&
)
{
void
Collimator
::
goOnline
(
const
double
&
)
{
if
(
RefPartBunch_m
==
NULL
)
{
print
();
if
(
!
informed_m
)
{
std
::
string
errormsg
=
Fieldmap
::
typeset_msg
(
"BUNCH SIZE NOT SET"
,
"warning"
);
ERRORMSG
(
errormsg
<<
endl
);
if
(
Ippl
::
myNode
()
==
0
)
{
ofstream
omsg
(
"errormsg.txt"
,
ios_base
::
app
);
omsg
<<
errormsg
<<
endl
;
omsg
.
close
();
}
informed_m
=
true
;
}
return
;
}
*
gmsg
<<
level3
;
if
(
isAPepperPot_m
)
*
gmsg
<<
"* Pepperpot x= "
<<
a_m
<<
" y= "
<<
b_m
<<
" r= "
<<
rHole_m
<<
" nx= "
<<
nHolesX_m
<<
" ny= "
<<
nHolesY_m
<<
" pitch= "
<<
pitch_m
<<
endl
;
else
if
(
isASlit_m
)
*
gmsg
<<
"* Slit x= "
<<
getXsize
()
<<
" Slit y= "
<<
getYsize
()
<<
" start= "
<<
position_m
<<
" fn= "
<<
filename_m
<<
endl
;
else
if
(
isARColl_m
)
*
gmsg
<<
"* RCollimator a= "
<<
getXsize
()
<<
" b= "
<<
b_m
<<
" start= "
<<
position_m
<<
" fn= "
<<
filename_m
<<
" ny= "
<<
nHolesY_m
<<
" pitch= "
<<
pitch_m
<<
endl
;
else
if
(
isACColl_m
)
*
gmsg
<<
"* CCollimator angle start "
<<
xstart_m
<<
" (Deg) angle end "
<<
ystart_m
<<
" (Deg) "
<<
"R start "
<<
xend_m
<<
" (mm) R rend "
<<
yend_m
<<
" (mm)"
<<
endl
;
else
if
(
isAWire_m
)
*
gmsg
<<
"* Wire x= "
<<
x0_m
<<
" y= "
<<
y0_m
<<
endl
;
else
*
gmsg
<<
"* ECollimator a= "
<<
getXsize
()
<<
" b= "
<<
b_m
<<
" start= "
<<
position_m
<<
" fn= "
<<
filename_m
<<
" ny= "
<<
nHolesY_m
<<
" pitch= "
<<
pitch_m
<<
endl
;
PosX_m
.
reserve
((
int
)(
1.1
*
RefPartBunch_m
->
getLocalNum
()));
PosX_m
.
reserve
((
int
)(
1.1
*
RefPartBunch_m
->
getLocalNum
()));
PosY_m
.
reserve
((
int
)(
1.1
*
RefPartBunch_m
->
getLocalNum
()));
PosY_m
.
reserve
((
int
)(
1.1
*
RefPartBunch_m
->
getLocalNum
()));
...
@@ -391,8 +355,7 @@ void Collimator::print() {
...
@@ -391,8 +355,7 @@ void Collimator::print() {
if
(
RefPartBunch_m
==
NULL
)
{
if
(
RefPartBunch_m
==
NULL
)
{
if
(
!
informed_m
)
{
if
(
!
informed_m
)
{
std
::
string
errormsg
=
Fieldmap
::
typeset_msg
(
"BUNCH SIZE NOT SET"
,
"warning"
);
std
::
string
errormsg
=
Fieldmap
::
typeset_msg
(
"BUNCH SIZE NOT SET"
,
"warning"
);
*
gmsg
<<
errormsg
<<
"
\n
"
ERRORMSG
(
errormsg
<<
endl
);
<<
endl
;
if
(
Ippl
::
myNode
()
==
0
)
{
if
(
Ippl
::
myNode
()
==
0
)
{
ofstream
omsg
(
"errormsg.txt"
,
ios_base
::
app
);
ofstream
omsg
(
"errormsg.txt"
,
ios_base
::
app
);
omsg
<<
errormsg
<<
endl
;
omsg
<<
errormsg
<<
endl
;
...
@@ -403,19 +366,25 @@ void Collimator::print() {
...
@@ -403,19 +366,25 @@ void Collimator::print() {
return
;
return
;
}
}
*
gmsg
<<
level3
;
if
(
isAPepperPot_m
)
if
(
isAPepperPot_m
)
*
gmsg
<<
"Pepperpot x= "
<<
a_m
<<
" y= "
<<
b_m
<<
" r= "
<<
rHole_m
<<
" nx= "
<<
nHolesX_m
<<
" ny= "
<<
nHolesY_m
<<
" pitch= "
<<
pitch_m
<<
endl
;
*
gmsg
<<
"* Pepperpot x= "
<<
a_m
<<
" y= "
<<
b_m
<<
" r= "
<<
rHole_m
<<
" nx= "
<<
nHolesX_m
<<
" ny= "
<<
nHolesY_m
<<
" pitch= "
<<
pitch_m
<<
endl
;
else
if
(
isASlit_m
)
else
if
(
isASlit_m
)
*
gmsg
<<
"Slit x= "
<<
getXsize
()
<<
" Slit y= "
<<
getYsize
()
<<
" start= "
<<
position_m
<<
" fn= "
<<
filename_m
<<
endl
;
*
gmsg
<<
"* Slit x= "
<<
getXsize
()
<<
" Slit y= "
<<
getYsize
()
<<
" start= "
<<
position_m
<<
" fn= "
<<
filename_m
<<
endl
;
else
if
(
isARColl_m
)
else
if
(
isARColl_m
)
*
gmsg
<<
"RCollimator a= "
<<
getXsize
()
<<
" b= "
<<
b_m
<<
" start= "
<<
position_m
<<
" fn= "
<<
filename_m
<<
" ny= "
<<
nHolesY_m
<<
" pitch= "
<<
pitch_m
<<
endl
;
*
gmsg
<<
"* RCollimator a= "
<<
getXsize
()
<<
" b= "
<<
getYsize
()
<<
" start= "
<<
position_m
<<
" fn= "
<<
filename_m
<<
" ny= "
<<
nHolesY_m
<<
" pitch= "
<<
pitch_m
<<
endl
;
else
if
(
isACColl_m
)
else
if
(
isACColl_m
)
*
gmsg
<<
"CCollimator angstart= "
<<
xstart_m
<<
" angend "
<<
ystart_m
<<
" rstart "
<<
xend_m
<<
" rend "
<<
yend_m
<<
endl
;
*
gmsg
<<
"* CCollimator angle start "
<<
xstart_m
<<
" (Deg) angle end "
<<
ystart_m
<<
" (Deg) "
<<
"R start "
<<
xend_m
<<
" (mm) R rend "
<<
yend_m
<<
" (mm)"
<<
endl
;
else
if
(
isAWire_m
)
else
if
(
isAWire_m
)
*
gmsg
<<
"Wire x= "
<<
x0_m
<<
" y= "
<<
y0_m
<<
endl
;
*
gmsg
<<
"
*
Wire x= "
<<
x0_m
<<
" y= "
<<
y0_m
<<
endl
;
else
else
*
gmsg
<<
"
ECollimator a= "
<<
getXsize
()
<<
" b= "
<<
b_m
<<
" start= "
<<
position_m
<<
" fn= "
<<
filename_m
<<
" ny= "
<<
nHolesY_m
<<
" pitch= "
<<
pitch_m
<<
endl
;
*
gmsg
<<
"
* ECollimator a= "
<<
getXsize
()
<<
" b= "
<<
b_m
<<
" start= "
<<
position_m
<<
" fn= "
<<
filename_m
<<
" ny= "
<<
nHolesY_m
<<
" pitch= "
<<
pitch_m
<<
endl
;
}
}
void
Collimator
::
goOffline
()
{
void
Collimator
::
goOffline
()
{
...
@@ -641,4 +610,4 @@ int Collimator::checkPoint(const double &x, const double &y) {
...
@@ -641,4 +610,4 @@ int Collimator::checkPoint(const double &x, const double &y) {
}
}
}
}
return
(
cn
&
1
);
// 0 if even (out), and 1 if odd (in)
return
(
cn
&
1
);
// 0 if even (out), and 1 if odd (in)
}
}
\ No newline at end of file
classic/5.0/src/Fields/FM2DDynamic.cpp
View file @
09b2b8ad
...
@@ -242,7 +242,6 @@ void FM2DDynamic::setFrequency(double freq) {
...
@@ -242,7 +242,6 @@ void FM2DDynamic::setFrequency(double freq) {
void
FM2DDynamic
::
getOnaxisEz
(
std
::
vector
<
std
::
pair
<
double
,
double
>
>
&
F
)
{
void
FM2DDynamic
::
getOnaxisEz
(
std
::
vector
<
std
::
pair
<
double
,
double
>
>
&
F
)
{
double
dz
=
(
zend_m
-
zbegin_m
)
/
(
num_gridpz_m
-
1
);
double
dz
=
(
zend_m
-
zbegin_m
)
/
(
num_gridpz_m
-
1
);
std
::
string
tmpString
;
F
.
resize
(
num_gridpz_m
);
F
.
resize
(
num_gridpz_m
);
for
(
int
i
=
0
;
i
<
num_gridpz_m
;
++
i
)
{
for
(
int
i
=
0
;
i
<
num_gridpz_m
;
++
i
)
{
...
...
classic/5.0/src/Fields/FM3DDynamic.cpp
View file @
09b2b8ad
This diff is collapsed.
Click to expand it.
classic/5.0/src/Fields/FM3DDynamic.h
View file @
09b2b8ad
...
@@ -14,6 +14,7 @@ public:
...
@@ -14,6 +14,7 @@ public:
virtual
void
getInfo
(
Inform
*
msg
);
virtual
void
getInfo
(
Inform
*
msg
);
virtual
double
getFrequency
()
const
;
virtual
double
getFrequency
()
const
;
virtual
void
setFrequency
(
double
freq
);
virtual
void
setFrequency
(
double
freq
);
virtual
void
getOnaxisEz
(
std
::
vector
<
std
::
pair
<
double
,
double
>
>
&
F
);
private:
private:
FM3DDynamic
(
std
::
string
aFilename
);
FM3DDynamic
(
std
::
string
aFilename
);
...
@@ -43,12 +44,12 @@ private:
...
@@ -43,12 +44,12 @@ private:
double
hx_m
;
/**< length between points in grid, x-direction */
double
hx_m
;
/**< length between points in grid, x-direction */
double
hy_m
;
/**< length between points in grid, y-direction */
double
hy_m
;
/**< length between points in grid, y-direction */
double
hz_m
;
/**< length between points in grid, z-direction */
double
hz_m
;
/**< length between points in grid, z-direction */
int
num_gridpx_m
;
/**< Read in number of points after 0(not counted here) in grid, r-direction*/
unsigned
int
num_gridpx_m
;
/**< Read in number of points after 0(not counted here) in grid, r-direction*/
int
num_gridpy_m
;
/**< Read in number of points after 0(not counted here) in grid, r-direction*/
unsigned
int
num_gridpy_m
;
/**< Read in number of points after 0(not counted here) in grid, r-direction*/
int
num_gridpz_m
;
/**< Read in number of points after 0(not counted here) in grid, z-direction*/
unsigned
int
num_gridpz_m
;
/**< Read in number of points after 0(not counted here) in grid, z-direction*/
bool
swap_m
;
bool
swap_m
;
friend
class
Fieldmap
;
friend
class
Fieldmap
;
};
};
#endif
#endif
\ No newline at end of file
classic/5.0/src/Fields/Fieldmap.cpp
View file @
09b2b8ad
...
@@ -675,6 +675,7 @@ void Fieldmap::SetFieldGap(double gap) {
...
@@ -675,6 +675,7 @@ void Fieldmap::SetFieldGap(double gap) {
}
}
REGISTER_PARSE_TYPE
(
int
);
REGISTER_PARSE_TYPE
(
int
);
REGISTER_PARSE_TYPE
(
unsigned
int
);
REGISTER_PARSE_TYPE
(
double
);
REGISTER_PARSE_TYPE
(
double
);
REGISTER_PARSE_TYPE
(
std
::
string
);
REGISTER_PARSE_TYPE
(
std
::
string
);
...
...
src/Algorithms/AutophaseTracker.cpp
View file @
09b2b8ad
...
@@ -153,6 +153,10 @@ void AutophaseTracker::execute(const std::queue<double> &dtAllTracks,
...
@@ -153,6 +153,10 @@ void AutophaseTracker::execute(const std::queue<double> &dtAllTracks,
maxStepsAutoPhasing
.
pop
();
maxStepsAutoPhasing
.
pop
();
}
}
INFOMSG
(
level2
<<
"step = "
<<
step
<<
", spos = "
<<
refR
(
2
)
<<
" [m], "
<<
"t= "
<<
itsBunch_m
.
getT
()
<<
" [s], "
<<
"E = "
<<
getEnergyMeV
(
refP
)
<<
" [MeV] "
<<
endl
);
printCavityPhases
();
printCavityPhases
();
sendCavityPhases
();
sendCavityPhases
();
...
@@ -166,6 +170,7 @@ void AutophaseTracker::track(double uptoSPos,
...
@@ -166,6 +170,7 @@ void AutophaseTracker::track(double uptoSPos,
std
::
queue
<
unsigned
long
long
>
&
maxStepsAutoPhasing
)
{
std
::
queue
<
unsigned
long
long
>
&
maxStepsAutoPhasing
)
{
Vector_t
&
refR
=
itsBunch_m
.
R
[
0
];
Vector_t
&
refR
=
itsBunch_m
.
R
[
0
];
Vector_t
&
refP
=
itsBunch_m
.
P
[
0
];
Vector_t
&
refP
=
itsBunch_m
.
P
[
0
];
double
t
=
itsBunch_m
.
getT
();
double
t
=
itsBunch_m
.
getT
();
const
int
dtfraction
=
DTFRACTION
;
const
int
dtfraction
=
DTFRACTION
;
...
@@ -571,4 +576,4 @@ void AutophaseTracker::save(const std::string &fname) {
...
@@ -571,4 +576,4 @@ void AutophaseTracker::save(const std::string &fname) {
}
}
out
.
close
();
out
.
close
();
}
}
\ No newline at end of file
src/Track/TrackRun.cpp
View file @
09b2b8ad
...
@@ -911,14 +911,14 @@ void TrackRun::findPhasesForMaxEnergy(bool writeToFile) const {
...
@@ -911,14 +911,14 @@ void TrackRun::findPhasesForMaxEnergy(bool writeToFile) const {
void
TrackRun
::
executeAutophaseTracker
()
{
void
TrackRun
::
executeAutophaseTracker
()
{
Beam
*
beam
=
Beam
::
find
(
Attributes
::
getString
(
itsAttr
[
BEAM
]));
Beam
*
beam
=
Beam
::
find
(
Attributes
::
getString
(
itsAttr
[
BEAM
]));
double
charge
=
setDistributionParallelT
(
beam
);
/*double charge =*/
setDistributionParallelT
(
beam
);
Track
::
block
->
bunch
->
setdT
(
Track
::
block
->
dT
.
front
());
Track
::
block
->
bunch
->
setdT
(
Track
::
block
->
dT
.
front
());
Track
::
block
->
bunch
->
dtScInit_m
=
Track
::
block
->
dtScInit
;
Track
::
block
->
bunch
->
dtScInit_m
=
Track
::
block
->
dtScInit
;
Track
::
block
->
bunch
->
deltaTau_m
=
Track
::
block
->
deltaTau
;
Track
::
block
->
bunch
->
deltaTau_m
=
Track
::
block
->
deltaTau
;
Track
::
block
->
bunch
->
setT
(
Track
::
block
->
t0_m
);
Track
::
block
->
bunch
->
setT
(
Track
::
block
->
t0_m
);
Track
::
block
->
bunch
->
setCharge
(
charge
);
//
Track::block->bunch->setCharge(charge);
double
couplingConstant
=
1.0
/
(
4
*
pi
*
epsilon_0
);
double
couplingConstant
=
1.0
/
(
4
*
pi
*
epsilon_0
);
Track
::
block
->
bunch
->
setCouplingConstant
(
couplingConstant
);
Track
::
block
->
bunch
->
setCouplingConstant
(
couplingConstant
);
...
@@ -1138,4 +1138,4 @@ Amr* TrackRun::setupAMRSolver() {
...
@@ -1138,4 +1138,4 @@ Amr* TrackRun::setupAMRSolver() {
return
amrptr
;
return
amrptr
;
}
}
#endif
#endif
\ 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