RayZaler 0.1
The free opto-mechanical simulation framework
MediumBoundary.h
1//
2// Copyright (c) 2024 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 _MEDIUM_BOUNDARY_H
20#define _MEDIUM_BOUNDARY_H
21
22#include "Random.h"
23
24#define RZ_SPEED_OF_LIGHT 299792458 // m/s
25#define RZ_WAVELENGTH 555e-9
26
27namespace RZ {
28 class SurfaceShape;
29 class ReferenceFrame;
30 class EMInterface;
31
32 struct RayBeam;
33 struct RayBeamSlice;
34
36 SurfaceShape *m_surfaceShape = nullptr;
37 EMInterface *m_emInterface = nullptr;
38 bool m_reversible = false;
39
40 protected:
41 inline void
42 setSurfaceShape(SurfaceShape *ap)
43 {
44 m_surfaceShape = ap;
45 }
46
47 inline void
48 setEMInterface(EMInterface *em)
49 {
50 m_emInterface = em;
51 }
52
53 inline void
54 setReversible(bool rev)
55 {
56 m_reversible = rev;
57 }
58
59 public:
60 inline bool
61 reversible() const
62 {
63 return m_reversible;
64 }
65
66 inline SurfaceShape *
67 surfaceShape() const
68 {
69 return m_surfaceShape;
70 }
71
72 template <class T>
73 inline T *
74 surfaceShape()
75 {
76 return static_cast<T *>(surfaceShape());
77 }
78
79 template <class T>
80 inline T const *
81 surfaceShape() const
82 {
83 return static_cast<const T *>(surfaceShape());
84 }
85
86 inline EMInterface *
87 emInterface() const
88 {
89 return m_emInterface;
90 }
91
92 template <class T>
93 inline T *
94 emInterface()
95 {
96 return static_cast<T *>(emInterface());
97 }
98
99 template <class T>
100 inline T const *
101 emInterface() const
102 {
103 return static_cast<const T *>(emInterface());
104 }
105
106 virtual std::string name() const = 0;
107
108 virtual void cast(RayBeam &) const;
109 virtual void transmit(RayBeamSlice const &) const;
110
111 virtual ~MediumBoundary();
112 };
113}
114
115#endif // _MEDIUM_BOUNDARY_H
116
Definition: EMInterface.h:34
Definition: MediumBoundary.h:35
Definition: SurfaceShape.h:31
Definition: RayBeam.h:88
Definition: RayBeam.h:261