RayZaler 0.1
The free opto-mechanical simulation framework
TopLevelModel.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 _TOP_LEVEL_MODEL_H
20#define _TOP_LEVEL_MODEL_H
21
22#include <OMModel.h>
23#include <GenericCompositeModel.h>
24#include <map>
25
26namespace RZ {
27 class ApertureStop;
28
30 std::map<std::string, ReferenceFrame *> m_ports;
31
32 protected:
33 // Interface methods
34 virtual void registerDof(
35 std::string const &name,
36 GenericModelParam *) override;
37
38 virtual void registerParam(
39 std::string const &name,
40 GenericModelParam *) override;
41
42 virtual void registerOpticalPath(
43 std::string const &name,
44 std::list<std::string> &params) override;
45
46 virtual GenericEvaluator *allocateEvaluator(
47 std::string const &expr,
48 const GenericEvaluatorSymbolDict *dict,
49 std::list<GenericCustomFunction *> const &functions,
50 ExprRandomState *) override;
51
52 void exposePort(
53 std::string const &,
54 ReferenceFrame *) override;
55
56 public:
57 TopLevelModel(Recipe *recipe);
59
60 std::list<std::string> focalPlanes() const;
61 std::list<std::string> ports() const;
62 std::list<std::string> apertureStops() const;
63
64 ApertureStop *getApertureStop(std::string const &) const;
65 ReferenceFrame *getFocalPlane(std::string const &) const;
66 ReferenceFrame *getPort(std::string const &) const;
67
68 virtual void notifyDetector(
69 std::string const &preferredName,
70 Detector *det) override;
71
72 static TopLevelModel *fromFile(
73 std::string const &path,
74 std::list<std::string> const &searchPaths = std::list<std::string>());
75
76 static TopLevelModel *fromString(
77 std::string const &str,
78 std::list<std::string> const &searchPath = std::list<std::string>(),
79 std::string const &fileName = "<string>");
80 };
81}
82
83#endif // _TOP_LEVEL_MODEL_H
Definition: ApertureStop.h:29
Definition: Detector.h:116
Definition: Random.h:28
Definition: GenericCompositeModel.h:120
Definition: GenericCompositeModel.h:64
Definition: OMModel.h:204
Definition: Recipe.h:142
Definition: ReferenceFrame.h:59
Definition: TopLevelModel.h:29
Definition: GenericCompositeModel.h:106