Quantum Phenomena Explorer 7.9.8
Interactive quantum-phenomena Explorer Tutor — source documentation
Loading...
Searching...
No Matches
potentialscene2d.h
Go to the documentation of this file.
1/**
2 * @file potentialscene2d.h
3 * @brief Declares the potentialscene2d physics/numerical component used by QPE experiments.
4 * @ingroup qpe_quantum
5 *
6 * Source: @c core/quantum/potentialscene2d.h. This file is part of Quantum Phenomena Explorer (QPE),
7 * maintained by Officina Turini. See LICENSE_IT.txt / LICENSE.txt for the
8 * QPE freeware source-available terms and THIRD_PARTY_NOTICES.txt for
9 * third-party components.
10 */
11
12#pragma once
13
14#include <cstddef>
15#include <cstdint>
16#include <vector>
17
18namespace qpe {
19
20class PotentialField2D;
21
22/**
23 * @brief Enumerates the supported Potential Object Type2D values.
24 *
25 * The enumeration is part of the typed interface used to keep experiment configuration and analysis routing explicit.
26 */
28{
29 Rectangle = 1,
30 Circle = 2,
31 Barrier = 3,
32 SingleSlit = 4,
33 DoubleSlit = 5,
34 PolygonWedge = 6,
35 Gaussian = 7,
36 Harmonic = 8,
37 Linear = 9,
38 SoftenedRadial = 10,
40};
41
42// One editable term of V(x,y). The fields deliberately mirror the current
43// GUI primitives so the existing parameter pages can act as an inspector.
44// Only the subset relevant to type is used during rasterization.
45/**
46 * @brief Data structure used by the Potential Object2D component.
47 *
48 * The structure keeps related values explicit and testable across the QPE physics, analysis, or persistence layers.
49 */
51{
52 std::uint64_t id = 0;
54 bool enabled = true;
55 float value = 0.0f;
56
57 float centerX = 0.0f;
58 float centerY = 0.0f;
59
60 float width = 1.0f;
61 float height = 1.0f;
62 float radius = 1.0f;
63
64 float length = 1.0f;
65 float thickness = 1.0f;
66
67 float wallWidth = 1.0f;
68 float slitHeight = 1.0f;
69 float slitSeparation = 2.0f;
70
71 // Smooth-potential parameters. value is the Gaussian amplitude, harmonic
72 // offset, linear offset, or radial coupling depending on type.
73 float sigmaX = 1.0f;
74 float sigmaY = 1.0f;
75 float curvatureX = 0.25f;
76 float curvatureY = 0.25f;
77 float slopeX = 0.0f;
78 float slopeY = 0.0f;
79 float softening = 0.5f;
80
81 /**
82 * @brief Performs valid.
83 */
84 bool valid() const noexcept;
85};
86
87// A small object model for composing an external potential from independent
88// terms. Composition is additive: V_total = sum_i V_i. This is the natural
89// Hamiltonian semantics and also makes overlapping objects explicit instead
90// of depending on draw order.
91/**
92 * @brief Implements the Potential Scene2D component.
93 *
94 * The class provides one focused service within the QPE architecture and is documented here independently of the experiment-level Help.
95 */
97{
98public:
99 /**
100 * @brief Performs add.
101 * @param object The object value used by the operation.
102 */
103 std::uint64_t add(PotentialObject2D object);
104 /**
105 * @brief Performs update.
106 * @param id Stable identifier of the requested object.
107 * @param object The object value used by the operation.
108 */
109 bool update(std::uint64_t id, const PotentialObject2D &object);
110 /**
111 * @brief Performs remove.
112 * @param id Stable identifier of the requested object.
113 */
114 bool remove(std::uint64_t id);
115 /**
116 * @brief Performs clear.
117 */
118 void clear() noexcept;
119
120 /**
121 * @brief Performs empty.
122 */
123 bool empty() const noexcept;
124 /**
125 * @brief Returns size.
126 */
127 std::size_t size() const noexcept;
128
129 /**
130 * @brief Performs objects.
131 */
132 const std::vector<PotentialObject2D> &objects() const noexcept;
133 /**
134 * @brief Performs find.
135 * @param id Stable identifier of the requested object.
136 */
137 PotentialObject2D *find(std::uint64_t id) noexcept;
138 /**
139 * @brief Performs find.
140 * @param id Stable identifier of the requested object.
141 */
142 const PotentialObject2D *find(std::uint64_t id) const noexcept;
143
144 // Replace the target field with the additive scene potential. The target
145 // field must already have the desired simulation grid.
146 /**
147 * @brief Performs rasterize.
148 * @param target The target value used by the operation.
149 */
150 void rasterize(PotentialField2D &target) const;
151
152private:
153 /**
154 * @brief Performs allocate id.
155 */
156 std::uint64_t allocateId() noexcept;
157
158 std::vector<PotentialObject2D> objects_;
159 std::uint64_t nextId_ = 1;
160};
161
162} // namespace qpe
Implements the Potential Field2D component.
Implements the Potential Scene2D component.
std::vector< PotentialObject2D > objects_
PotentialObjectType2D
Enumerates the supported Potential Object Type2D values.
Data structure used by the Potential Object2D component.
PotentialObjectType2D type
bool valid() const noexcept
Performs valid.