SPH
Settings.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "common/ForwardDecl.h"
4 #include "gui/objects/Color.h"
5 #include "gui/objects/Point.h"
10 #include "system/Settings.h"
11 
13 
14 enum class RendererEnum {
16  NONE,
17 
19  PARTICLE,
20 
22  MESH,
23 
25  RAYMARCHER,
26 
28  VOLUME,
29 
31  CONTOUR,
32 
33 };
34 
35 enum class CameraEnum {
36  ORTHO,
38  FISHEYE,
39  SPHERICAL,
40 };
41 
42 enum class PlotEnum {
44  INTERNAL_ENERGY = 1 << 0,
45 
47  KINETIC_ENERGY = 1 << 1,
48 
51  TOTAL_ENERGY = 1 << 2,
52 
54  TOTAL_MOMENTUM = 1 << 3,
55 
57  TOTAL_ANGULAR_MOMENTUM = 1 << 4,
58 
60  RELATIVE_ENERGY_CHANGE = 1 << 5,
61 
63  CURRENT_SFD = 1 << 6,
64 
66  PREDICTED_SFD = 1 << 7,
67 
69  SPEED_HISTOGRAM = 1 << 8,
70 
73 
75  SELECTED_PARTICLE = 1 << 10,
76 
78 };
79 
80 enum class BrdfEnum {
81  LAMBERT,
82  PHONG,
83 };
84 
85 enum class ColorMapEnum {
86  LINEAR,
88  FILMIC,
89 };
90 
91 enum class GuiSettingsId {
93  RENDERER,
94 
96 
98 
100 
101  CAMERA_ORBIT,
102 
104 
105  CAMERA_UP,
106 
109 
111 
113 
115 
117 
119 
121 
123 
124  VIEW_WIDTH,
125 
126  VIEW_HEIGHT,
127 
129 
131 
134 
136 
138 
140 
141  SHOW_KEY,
142 
144 
145  ANTIALIASED,
146 
148 
150 
153 
156 
159 
162 
165 
168 
170 
173 
175 
177 
179 
181 
183 
185 
187 
189 
191 
193 
195 
197 
199  WINDOW_TITLE,
200 
201  WINDOW_WIDTH,
202 
204 
206 
208 
210 
212 
213  IMAGES_WIDTH,
214 
216 
218  IMAGES_SAVE,
219 
221  IMAGES_PATH,
222 
224  IMAGES_NAME,
225 
227 
229 
231 
235 
236 };
237 
238 class GuiSettings : public Settings<GuiSettingsId> {
239 public:
241 
243 
244  template <typename TValue>
245  INLINE TValue get(const GuiSettingsId id) const {
247  }
248 
249  template <typename TValue>
250  INLINE GuiSettings& set(const GuiSettingsId id, const TValue& value) {
251  Settings<GuiSettingsId>::set(id, value);
252 
253  if (accessor) {
254  accessor(id);
255  }
256  return *this;
257  }
258 };
259 
260 template <>
261 INLINE Pixel GuiSettings::get<Pixel>(const GuiSettingsId id) const {
262  const Interval i = this->get<Interval>(id);
263  return Pixel(int(i.lower()), int(i.upper()));
264 }
265 
266 template <>
267 INLINE Rgba GuiSettings::get<Rgba>(const GuiSettingsId id) const {
268  const Vector v = this->get<Vector>(id);
269  return Rgba(float(v[X]), float(v[Y]), float(v[Z]), float(v[H]));
270 }
271 
272 template <>
273 INLINE GuiSettings& GuiSettings::set<Rgba>(const GuiSettingsId id, const Rgba& color) {
274  this->set(id, Vector(color.r(), color.g(), color.b(), color.a()));
275  return *this;
276 }
277 
NAMESPACE_SPH_BEGIN
Definition: BarnesHut.cpp:13
@ NONE
No collision took place.
@ TOTAL_ENERGY
Sum of kinetic and internal energy for given particle.
Helper object for converting enums to string, listing all available values of enum,...
Generic wrappers of lambdas, functors and other callables.
#define INLINE
Macros for conditional compilation based on selected compiler.
Definition: Object.h:31
#define NAMESPACE_SPH_END
Definition: Object.h:12
Basic vector algebra. Computations are accelerated using SIMD.
BasicVector< Float > Vector
Definition: Vector.h:539
@ H
Definition: Vector.h:25
@ Y
Definition: Vector.h:23
@ X
Definition: Vector.h:22
@ Z
Definition: Vector.h:24
INLINE TValue get(const GuiSettingsId id) const
Definition: Settings.h:245
INLINE GuiSettings & set(const GuiSettingsId id, const TValue &value)
Definition: Settings.h:250
Function< void(GuiSettingsId id)> accessor
Definition: Settings.h:242
Object representing a 1D interval of real numbers.
Definition: Interval.h:17
INLINE Float lower() const
Returns lower bound of the interval.
Definition: Interval.h:74
INLINE Float upper() const
Returns upper bound of the interval.
Definition: Interval.h:79
Definition: Color.h:8
float & a()
Definition: Color.h:63
float & g()
Definition: Color.h:47
float & r()
Definition: Color.h:39
float & b()
Definition: Color.h:55
Generic object containing various settings and parameters of the run.
Definition: Settings.h:108
Settings & set(const TEnum idx, TValue &&value, std::enable_if_t<!std::is_enum< std::decay_t< TValue >>::value, int >=0)
Saves a value into the settings.
Definition: Settings.h:226
Generic storage and input/output routines of settings.
@ LINEAR
Constant time between consecutive output times.
@ LOGARITHMIC
Constant ratio between consecutive output times.
GuiSettingsId
Definition: Settings.h:91
@ COLORMAP_LOGARITHMIC_FACTOR
@ RAYTRACE_ITERATION_LIMIT
@ IMAGES_NAME
Mask of the image names, having d where the output number will be placed.
@ SURFACE_RESOLUTION
Size of the grid used in MarchingCubes (in code units, not h).
@ CAMERA_ORTHO_CUTOFF
Max z-coordinate of particle to be displayed by ortho renderer.
@ WINDOW_TITLE
Title of the window appearing on taskbar.
@ IMAGES_PATH
Path of directory where the rendered images will be saved.
@ RENDERER
Selected renderer.
@ VIEW_GRID_SIZE
Size of the grid cell in simulation units (not window units); if zero, no grid is drawn.
@ SURFACE_LEVEL
Value of iso-surface being constructed; lower value means larget bodies.
@ SURFACE_SUN_INTENSITY
Intentity of the sun.
@ IMAGES_SAVE
If true, rendered images are saved to disk.
@ SURFACE_SUN_POSITION
Direction to the sun used for shading.
@ CAMERA_ORTHO_FOV
View field of view (zoom). Special value 0 means the field of view is computed from the bounding box.
@ SURFACE_AMBIENT
Ambient color for surface renderer.
ColorMapEnum
Definition: Settings.h:85
BrdfEnum
Definition: Settings.h:80
CameraEnum
Definition: Settings.h:35
PlotEnum
Definition: Settings.h:42
@ TOTAL_MOMENTUM
Evolution of the total momentum in time.
@ SPEED_HISTOGRAM
Speed histogram.
@ INTERNAL_ENERGY
Evolution of the total internal energy in time.
@ SELECTED_PARTICLE
Evolution of the selected quantity for the selected particle in time.
@ TOTAL_ANGULAR_MOMENTUM
Evolution of the total angular momentum in time.
@ KINETIC_ENERGY
Evolution of the total kinetic energy in time.
@ RELATIVE_ENERGY_CHANGE
Relative change of total energy.
@ CURRENT_SFD
Current size-frequency distribution.
@ ANGULAR_HISTOGRAM_OF_VELOCITIES
Angular histogram (in x-y plane) of velocity directions.
@ PREDICTED_SFD
Predicted size-frequency distribution.
RendererEnum
Definition: Settings.h:14
@ PARTICLE
2D section showing particles as points
@ MESH
Surfaces of bodies are meshed using Marching cubes and drawed as triangles.
@ RAYMARCHER
Raymarcher that computes intersections with implicit surface.
@ VOLUME
Volumetric renderer.
@ CONTOUR
Draws contours (iso-lines) of quantities.
Simple 2D vector with integer coordinates. Provides conversion from and to wxPoint.
Definition: Point.h:101