26bool finite(
double value)
noexcept
28 return std::isfinite(value);
31const double Pi = 3.1415926535897932384626433832795;
38 if (!config.enabled) {
41 if (config.targetObjectId == 0 || !finite(config.quenchTime) || config.quenchTime < 0.0 ||
42 !finite(config.beforeValue) || !finite(config.afterValue)) {
50 return parameterValue(*
object, config.parameter, ignored);
57 if (!config.enabled) {
60 if (config.targetObjectId == 0 || !finite(config.meanValue) ||
61 !finite(config.amplitude) || !finite(config.angularFrequency) ||
62 config.angularFrequency < 0.0 || !finite(config.phaseDegrees)) {
70 return parameterValue(*
object, config.parameter, ignored);
77 if (!config.enabled) {
80 if (config.targetObjectId == 0 || !finite(config.startValue) ||
81 !finite(config.endValue) || !finite(config.startTime) ||
82 !finite(config.duration) || !finite(config.holdDuration) ||
83 !finite(config.returnDuration) || config.startTime < 0.0 ||
84 !(config.duration > 0.0) || config.holdDuration < 0.0 ||
85 (config.returnEnabled && !(config.returnDuration > 0.0))) {
93 return parameterValue(*
object, config.parameter, ignored);
100 if (!config.enabled) {
103 if (config.targetObjectId == 0 || !finite(config.meanValue) ||
104 !finite(config.amplitude) || !finite(config.angularFrequency) ||
105 !(config.angularFrequency > 0.0) ||
106 !finite(config.firstPulsePhaseDegrees) ||
107 !finite(config.secondPulsePhaseDegrees) ||
108 !finite(config.startTime) || config.startTime < 0.0 ||
109 !finite(config.pulseDuration) || !(config.pulseDuration > 0.0) ||
110 !finite(config.freeEvolutionDuration) || config.freeEvolutionDuration < 0.0 ||
111 !finite(config.echoPulseDuration) ||
112 (config.echoEnabled && !(config.echoPulseDuration > 0.0)) ||
113 !finite(config.echoPulsePhaseDegrees)) {
120 double ignored = 0.0;
121 return parameterValue(*
object, config.parameter, ignored);
126 double value)
noexcept
128 if (!finite(value)) {
131 const float v =
static_cast<float>(value);
144 object.curvatureX = v;
148 object.curvatureY = v;
152 object.curvatureX = v;
153 object.curvatureY = v;
169 double &value)
noexcept
173 value =
object.value;
176 value =
object.centerX;
179 value =
object.centerY;
183 value =
object.curvatureX;
187 value =
object.curvatureY;
191 if (std::abs(
static_cast<double>(
object.curvatureX) -
static_cast<double>(
object.curvatureY)) > 1.0e-6) {
194 value =
object.curvatureX;
198 value =
object.slopeX;
202 value =
object.slopeY;
210 double time)
noexcept
213 return config.meanValue;
215 const double phase = config.angularFrequency * time + config.phaseDegrees * Pi / 180.0;
216 return config.meanValue + config.amplitude * std::sin(phase);
221 double time)
noexcept
223 if (!finite(time) || time <= config.startTime) {
224 return config.startValue;
227 const double outwardEnd = config.startTime + config.duration;
228 if (time < outwardEnd) {
229 const double u = (time - config.startTime) / config.duration;
230 return config.startValue + (config.endValue - config.startValue) * u;
233 if (!config.returnEnabled) {
234 return config.endValue;
237 const double holdEnd = outwardEnd + config.holdDuration;
238 if (time < holdEnd) {
239 return config.endValue;
242 const double returnEnd = holdEnd + config.returnDuration;
243 if (time >= returnEnd) {
244 return config.startValue;
247 const double u = (time - holdEnd) / config.returnDuration;
248 return config.endValue + (config.startValue - config.endValue) * u;
254 if (!config.returnEnabled) {
255 return config.duration;
257 return config.duration + config.holdDuration + config.returnDuration;
263 return 2.0 * config.pulseDuration + config.freeEvolutionDuration +
264 (config.echoEnabled ? config.echoPulseDuration : 0.0);
270 double *localPulseTime)
noexcept
272 if (localPulseTime) *localPulseTime = 0.0;
273 if (!finite(time) || time < config.startTime) {
276 const double firstEnd = config.startTime + config.pulseDuration;
277 if (time < firstEnd) {
278 if (localPulseTime) *localPulseTime = time - config.startTime;
282 if (!config.echoEnabled) {
283 const double freeEnd = firstEnd + config.freeEvolutionDuration;
285 const double secondEnd = freeEnd + config.pulseDuration;
286 if (time < secondEnd) {
287 if (localPulseTime) *localPulseTime = time - freeEnd;
293 const double halfFree = 0.5 * config.freeEvolutionDuration;
294 const double firstFreeEnd = firstEnd + halfFree;
297 const double echoEnd = firstFreeEnd + config.echoPulseDuration;
298 if (time < echoEnd) {
299 if (localPulseTime) *localPulseTime = time - firstFreeEnd;
303 const double secondFreeEnd = echoEnd + halfFree;
306 const double secondEnd = secondFreeEnd + config.pulseDuration;
307 if (time < secondEnd) {
308 if (localPulseTime) *localPulseTime = time - secondFreeEnd;
316 double time)
noexcept
318 double localTime = 0.0;
323 return config.meanValue;
326 double phaseDegrees = config.firstPulsePhaseDegrees;
328 phaseDegrees = config.echoPulsePhaseDegrees;
330 phaseDegrees = config.secondPulsePhaseDegrees;
332 const double phase = config.angularFrequency * localTime + phaseDegrees * Pi / 180.0;
333 return config.meanValue + config.amplitude * std::sin(phase);
Implements the Potential Field2D component.
Implements the Potential Scene2D component.
void rasterize(PotentialField2D &target) const
Performs rasterize.
PotentialObject2D * find(std::uint64_t id) noexcept
Performs find.
static RamseyPulseSequence2DState rasterizeRamsey(const PotentialScene2D &baseScene, const RamseyPulseSequence2DConfig &config, double time, PotentialField2D &target)
Performs rasterize ramsey.
static bool parameterValue(const PotentialObject2D &object, TimePotentialParameter2D parameter, double &value) noexcept
Performs parameter value.
static bool validatePeriodic(const PotentialScene2D &scene, const PeriodicPotentialDrive2DConfig &config) noexcept
Validates periodic.
static bool validateSweep(const PotentialScene2D &scene, const LinearPotentialSweep2DConfig &config) noexcept
Validates sweep.
static double sweepValue(const LinearPotentialSweep2DConfig &config, double time) noexcept
Performs sweep value.
static bool validateRamsey(const PotentialScene2D &scene, const RamseyPulseSequence2DConfig &config) noexcept
Validates ramsey.
static RamseyPulseSegment2D ramseySegment(const RamseyPulseSequence2DConfig &config, double time, double *localPulseTime=nullptr) noexcept
Performs ramsey segment.
static bool applyParameter(PotentialObject2D &object, TimePotentialParameter2D parameter, double value) noexcept
Applies parameter.
static double ramseyValue(const RamseyPulseSequence2DConfig &config, double time) noexcept
Performs ramsey value.
static double ramseyTotalDuration(const RamseyPulseSequence2DConfig &config) noexcept
Performs ramsey total duration.
static PeriodicPotentialDrive2DState rasterizePeriodic(const PotentialScene2D &baseScene, const PeriodicPotentialDrive2DConfig &config, double time, PotentialField2D &target)
Performs rasterize periodic.
static double sweepTotalDuration(const LinearPotentialSweep2DConfig &config) noexcept
Performs sweep total duration.
static QuantumQuench2DState rasterize(const PotentialScene2D &baseScene, const QuantumQuench2DConfig &config, double time, PotentialField2D &target)
Performs rasterize.
static bool validate(const PotentialScene2D &scene, const QuantumQuench2DConfig &config) noexcept
Performs validate.
static double periodicValue(const PeriodicPotentialDrive2DConfig &config, double time) noexcept
Performs periodic value.
static LinearPotentialSweep2DState rasterizeSweep(const PotentialScene2D &baseScene, const LinearPotentialSweep2DConfig &config, double time, PotentialField2D &target)
Performs rasterize sweep.
TimePotentialParameter2D
Enumerates the supported Time Potential Parameter2D values.
RamseyPulseSegment2D
Enumerates the supported Ramsey Pulse Segment2D values.
Declares the potentialfield2d physics/numerical component used by QPE experiments.
Configuration values for Linear Potential Sweep2D Config.
std::uint64_t targetObjectId
TimePotentialParameter2D parameter
Data record containing Linear Potential Sweep2D State.
Configuration values for Periodic Potential Drive2D Config.
TimePotentialParameter2D parameter
std::uint64_t targetObjectId
Data record containing Periodic Potential Drive2D State.
Data structure used by the Potential Object2D component.
bool valid() const noexcept
Performs valid.
Configuration values for Quantum Quench2D Config.
std::uint64_t targetObjectId
TimePotentialParameter2D parameter
Data record containing Quantum Quench2D State.
Configuration values for Ramsey Pulse Sequence2D Config.
std::uint64_t targetObjectId
TimePotentialParameter2D parameter
Data record containing Ramsey Pulse Sequence2D State.
RamseyPulseSegment2D segment
Declares the timedependentpotential2d physics/numerical component used by QPE experiments.