OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
SFunction.cpp
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2// $RCSfile: SFunction.cpp,v $
3// ------------------------------------------------------------------------
4// $Revision: 1.1.1.1 $
5// ------------------------------------------------------------------------
6// Copyright: see Copyright.readme
7// ------------------------------------------------------------------------
8//
9// Class: SFunction
10// Object handling the position funcitions SI(), SC(), and SO().
11//
12// ------------------------------------------------------------------------
13//
14// $Date: 2000/03/27 09:33:42 $
15// $Author: Andreas Adelmann $
16//
17// ------------------------------------------------------------------------
18
21
22// The pointer to the current s-dependent function.
23// ------------------------------------------------------------------------
24
25const SFunction* SFunction::sfun = 0;
26
27// Class SFunction
28// ------------------------------------------------------------------------
29
31 reset();
32 sfun = this;
33}
34
36
38 if (sfun) {
39 return sfun->position(1.0);
40 } else {
41 throw OpalException(
42 "arcIn()",
43 "The use of function \"SI()\" "
44 "is not valid in this context.");
45 }
46}
47
49 if (sfun) {
50 return sfun->position(0.5);
51 } else {
52 throw OpalException(
53 "arcCtr()",
54 "The use of function \"SC()\" "
55 "is not valid in this context.");
56 }
57}
58
60 if (sfun) {
61 return sfun->position(0.0);
62 } else {
63 throw OpalException(
64 "arcOut()",
65 "The use of function \"SO()\" "
66 "is not valid in this context.");
67 }
68}
69
71 elementLength = 0.0;
72 exitArc = 0.0;
73}
74
75void SFunction::update(double length) {
76 elementLength = length;
78}
79
80double SFunction::position(double flag) const {
81 // Backtrack to desired position.
82 return exitArc - flag * elementLength;
83}
Functions of arc length.
Definition SFunction.h:30
double exitArc
Definition SFunction.h:69
double elementLength
Definition SFunction.h:66
SFunction()
Default constructor.
Definition SFunction.cpp:30
static double arcIn()
Return arc length at entrance SI().
Definition SFunction.cpp:37
static double arcOut()
Return arc length at exit SO().
Definition SFunction.cpp:59
void reset()
Reset the arc length to zero.
Definition SFunction.cpp:70
~SFunction()
Destructor.
Definition SFunction.cpp:35
static const SFunction * sfun
Definition SFunction.h:73
static double arcCtr()
Return arc length at center SC().
Definition SFunction.cpp:48
double position(double flag) const
Definition SFunction.cpp:80
void update(double length)
Advance position by element length.
Definition SFunction.cpp:75