RayZaler 0.1
The free opto-mechanical simulation framework
Simulation.h
1//
2// Copyright (c) 2025 Gonzalo José Carracedo Carballal
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Lesser General Public License as
6// published by the Free Software Foundation, either version 3 of the
7// License, or (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful, but
10// WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU Lesser General Public License for more details.
13//
14// You should have received a copy of the GNU Lesser General Public
15// License along with this program. If not, see
16// <http://www.gnu.org/licenses/>
17//
18
19#ifndef _SIMULATION_H
20#define _SIMULATION_H
21
22#include <string>
23#include <list>
24#include <RayTracingEngine.h>
25
26namespace RZ {
27 class RayBeamElement;
28 class RayTracingHeuristic;
29 class OMModel;
30
31 enum TracingType {
32 Sequential,
33 NonSequential
34 };
35
37 TracingType type = Sequential;
38 RayBeamElement *beamElement = nullptr;
39 bool clearPrevious = true;
40 bool clearDetectors = true;
41 std::string path;
42 const std::list<Ray> *pRays = nullptr;
43 std::list<Ray> rays;
44 std::string heuristic = "dummy";
45 unsigned int maxPropagations = 1000;
46 const struct timeval *startTime = nullptr;
47 RayTracingProcessListener *listener = nullptr;
48 };
49
50 class Simulation {
51 OMModel *m_model = nullptr;
52 RayTracingEngine *m_engine = nullptr;
53 RayBeam *m_NSBeam = nullptr;
54 uint64_t m_transferredRays = 0;
55 std::list<Ray> m_intermediateRays;
56 RayTracingHeuristic *m_heuristic = nullptr;
57 struct timeval m_lastTick;
58
59 bool traceSequential(TracingProperties const &);
60 bool traceNonSequential(TracingProperties const &);
61 void initNSBeam();
62
63 public:
64 inline RayTracingEngine *
65 engine() const
66 {
67 return m_engine;
68 }
69
70 Simulation(OMModel *model, std::string const &engine = "cpu");
72
73 bool trace(TracingProperties const &);
74 struct timeval lastTick() const;
75 };
76}
77
78#endif // _SIMULATION_H
Definition: OMModel.h:204
Definition: RayBeamElement.h:67
Definition: RayTracingEngine.h:51
Definition: RayTracingHeuristic.h:31
Definition: RayTracingEngine.h:38
Definition: Simulation.h:50
Definition: RayBeam.h:88
Definition: Simulation.h:36