ARTS 2.5.0 (git: 9ee3ac6c)
energylevelmap.h
Go to the documentation of this file.
1/* Copyright (C) 2019
2 Richard Larsson <ric.larsson@gmail.com>
3
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 2, or (at your option) any
7 later version.
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 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 USA. */
18
27#ifndef energylevelmap_h
28#define energylevelmap_h
29
30#include "absorptionlines.h"
31#include "matpackIV.h"
32#include "mystring.h"
33#include "quantum.h"
34
35// Output from EnergyLevelMap
36struct Output2{
39};
40
41// Output from EnergyLevelMap
42struct Output4{
47};
48
53 None_t,
54};
55
57
59
61private:
66
67public:
68 [[nodiscard]] bool OK() const noexcept;
69
70 void ThrowIfNotOK() const ARTS_NOEXCEPT {ARTS_ASSERT (OK(), "Class in bad state");}
71
73 mvib_energy(0), mvalue(0, 0, 0, 0) {}
74
76 Index cols, const EnergyLevelMap& old) :
77 mtype(new_type), mlevels(old.mlevels), mvib_energy(old.mvib_energy),
78 mvalue(old.mlevels.nelem(), pages, rows, cols) {ThrowIfNotOK();};
79
80 // Create Tensor3_t from the raw inputs
82
83 // Create Vector_t from the raw inputs
85
86 // Create Numeric_t from the raw inputs
88
89 // Create Vector_t from Tensor3_t
90 [[nodiscard]] EnergyLevelMap InterpToGridPos(Index atmosphere_dim, const ArrayOfGridPos& p, const ArrayOfGridPos& lat, const ArrayOfGridPos& lon) const;
91
92 // Create Numeric_t from Vector_t
93 [[nodiscard]] EnergyLevelMap operator[](Index ip) const;
94
95 // Create Numeric_t from Tensor3_t
96 [[nodiscard]] EnergyLevelMap operator()(Index ip, Index ilat, Index ilon) const;
97
99 [[nodiscard]] EnergyLevelMapType Type() const noexcept {return mtype;}
100
102 [[nodiscard]] const ArrayOfQuantumIdentifier& Levels() const noexcept {return mlevels;}
103
105 [[nodiscard]] const Vector& Energies() const noexcept {return mvib_energy;}
106
108 [[nodiscard]] const Tensor4& Data() const noexcept {return mvalue;}
109
111 EnergyLevelMapType& Type() noexcept {return mtype;}
112
115
117 Vector& Energies() noexcept {return mvib_energy;}
118
120 Tensor4& Data() noexcept {return mvalue;}
121
123 // C API interface access //
125
126 static bool validIndexForType(Index x) noexcept
127 {
129 return std::any_of(keys.cbegin(), keys.cend(), [x](auto y){return x == y;});
130 }
131
133 void Type(EnergyLevelMapType x) noexcept {mtype = x;}
134
135 static EnergyLevelMapType string2Type(const String& s) noexcept
136 {
137 if (s == "Tensor3")
139 if (s == "Vector")
141 if (s == "Numeric")
143 if (s == "None")
145 return EnergyLevelMapType(-1);
146 }
147
149 // Numeric_t access //
151
157 [[nodiscard]] Output2 get_ratio_params(const AbsorptionLines& band, const Index& line_index) const;
158
164 [[nodiscard]] Output4 get_vibtemp_params(const AbsorptionLines& band, const Index& line_index, const Numeric T) const;
165};
166
167std::ostream& operator<<(std::ostream& os, const EnergyLevelMap& elm);
168
169#endif // energylevelmap_h
Contains the absorption namespace.
constexpr std::array< T, 1+sizeof...(Ts)> stdarrayify(const T &first, const Ts &... the_rest)
Make a std::array of a list of variables (must be 1-long at least)
Definition: array.h:374
void * data
Tensor4 & Data() noexcept
Energy level type.
const ArrayOfQuantumIdentifier & Levels() const noexcept
Energy level type.
ArrayOfQuantumIdentifier mlevels
void Type(EnergyLevelMapType x) noexcept
Energy level type.
EnergyLevelMap operator[](Index ip) const
Output4 get_vibtemp_params(const AbsorptionLines &band, const Index &line_index, const Numeric T) const
Get the output required for Population::NLTE-VibrationalTemperatures.
Output2 get_ratio_params(const AbsorptionLines &band, const Index &line_index) const
Get the output required for Population::NLTE.
EnergyLevelMapType mtype
bool OK() const noexcept
const Vector & Energies() const noexcept
Energy level type.
static bool validIndexForType(Index x) noexcept
EnergyLevelMap(EnergyLevelMapType new_type, Index pages, Index rows, Index cols, const EnergyLevelMap &old)
EnergyLevelMapType Type() const noexcept
Energy level type.
EnergyLevelMapType & Type() noexcept
Energy level type.
EnergyLevelMap InterpToGridPos(Index atmosphere_dim, const ArrayOfGridPos &p, const ArrayOfGridPos &lat, const ArrayOfGridPos &lon) const
const Tensor4 & Data() const noexcept
Energy level type.
ArrayOfQuantumIdentifier & Levels() noexcept
Energy level type.
void ThrowIfNotOK() const ARTS_NOEXCEPT
static EnergyLevelMapType string2Type(const String &s) noexcept
Vector & Energies() noexcept
Energy level type.
EnergyLevelMap operator()(Index ip, Index ilat, Index ilon) const
The Matrix class.
Definition: matpackI.h:1225
The Tensor4 class.
Definition: matpackIV.h:421
The Vector class.
Definition: matpackI.h:876
#define ARTS_NOEXCEPT
Definition: debug.h:80
#define ARTS_ASSERT(condition,...)
Definition: debug.h:83
String energylevelmaptype2string(EnergyLevelMapType type)
EnergyLevelMapType string2energylevelmaptype(const String &s)
EnergyLevelMapType
std::ostream & operator<<(std::ostream &os, const EnergyLevelMap &elm)
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
This file contains the definition of String, the ARTS string class.
Index nelem(const Lines &l)
Number of lines.
char Type type
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
Definition: oem.h:31
Numeric r_upp
Numeric r_low
Numeric E_upp
Numeric T_upp
Numeric T_low
Numeric E_low