PLaSK library
Loading...
Searching...
No Matches
axes.hpp
Go to the documentation of this file.
1
/*
2
* This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
3
* Copyright (c) 2022 Lodz University of Technology
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, version 3.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*/
14
#ifndef PLASK__AXES_H
15
#define PLASK__AXES_H
16
17
#include <string>
18
#include <map>
19
#include "
geometry/primitives.hpp
"
20
25
#include "
vector/3d.hpp
"
26
27
namespace
plask
{
28
34
struct
PLASK_API
AxisNames
{
35
39
struct
PLASK_API
Register
{
41
std::map<std::string, AxisNames>
axisNames
;
42
44
Register
() {}
45
46
template
<
typename
... Params>
47
Register
(
const
std::string& c0_name,
const
std::string& c1_name,
const
std::string& c2_name,
const
Params&... names) {
48
this->operator()(c0_name, c1_name, c2_name, names...);
49
}
50
56
void
addname
(
const
std::string& c0_name,
const
std::string& c1_name,
const
std::string& c2_name,
const
std::string& name) {
57
axisNames[name] =
AxisNames
(c0_name, c1_name, c2_name);
58
}
59
64
Register
&
operator()
(
const
std::string& c0_name,
const
std::string& c1_name,
const
std::string& c2_name) {
65
addname(c0_name, c1_name, c2_name, c0_name + c1_name + c2_name);
66
return
*
this
;
67
}
68
75
template
<
typename
Param1>
76
Register
&
operator()
(
const
std::string& c0_name,
const
std::string& c1_name,
const
std::string& c2_name,
const
Param1& name) {
77
addname(c0_name, c1_name, c2_name, name);
78
return
this->operator()(c0_name, c1_name, c2_name);
79
}
80
87
template
<
typename
Param1,
typename
... Params>
88
Register
&
operator()
(
const
std::string& c0_name,
const
std::string& c1_name,
const
std::string& c2_name,
const
Param1& firstName,
const
Params&... names) {
89
addname(c0_name, c1_name, c2_name, firstName);
90
return
this->operator()(c0_name, c1_name, c2_name, names...);
91
}
92
99
const
AxisNames
& get(
const
std::string& name)
const
;
100
};
101
103
static
Register
axisNamesRegister
;
104
106
static
const
AxisNames
& getAbsoluteNames();
107
109
std::string byIndex[3];
110
112
AxisNames
() {}
113
114
AxisNames
(
const
std::string&
c0_name
,
const
std::string&
c1_name
,
const
std::string&
c2_name
);
115
121
const
std::string&
operator[]
(
const
std::size_t i)
const
{
return
byIndex[i]; }
122
128
std::size_t operator[](
const
std::string& name)
const
;
129
137
Primitive<3>::Direction
get3D(
const
std::string& name)
const
;
138
146
Primitive<2>::Direction
get2D(
const
std::string& name)
const
;
147
155
template
<
int
DIMS>
156
typename
Primitive<DIMS>::Direction
get
(
const
std::string& name)
const
;
157
159
std::string
str
()
const
;
160
161
std::string
getNameForLong
()
const
{
return
operator [](
axis::lon_index
); }
162
163
std::string
getNameForTran
()
const
{
return
operator [](
axis::tran_index
); }
164
165
std::string
getNameForVert
()
const
{
return
operator [](
axis::up_index
); }
166
172
bool
operator==
(
const
AxisNames
&
to_compare
)
const
;
173
179
bool
operator!=
(
const
AxisNames
&
to_compare
)
const
{
return
!(*
this
==
to_compare
); }
180
};
181
182
template
<>
inline
Primitive<2>::Direction
AxisNames::get<2>(
const
std::string& name)
const
{
return
this->
get2D
(name); }
183
template
<>
inline
Primitive<3>::Direction
AxisNames::get<3>(
const
std::string& name)
const
{
return
this->
get3D
(name); }
184
185
186
187
}
// namespace plask
188
189
#endif
// PLASK__AXES_H
plask
axes.hpp
Generated by
1.9.8