ARTS 2.5.0 (git: 9ee3ac6c)
cia.h
Go to the documentation of this file.
1/* Copyright (C) 2012 Stefan Buehler <sbuehler@ltu.se>
2
3 This program is free software; you can redistribute it and/or modify it
4 under the terms of the GNU General Public License as published by the
5 Free Software Foundation; either version 2, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 USA. */
17
31#ifndef cia_h
32#define cia_h
33
34#include "arts.h"
35#include "check_input.h"
36#include "gridded_fields.h"
37#include "matpackI.h"
38#include "mystring.h"
39#include "species.h"
40
41// Declare existance of some classes:
42class bifstream;
43class CIARecord;
44
46
47/* Header with implementation. */
49 ConstVectorView frequency,
50 const Numeric& temperature,
51 const GriddedField2& cia_data,
52 const Numeric& T_extrapolfac,
53 const Index& robust,
54 const Verbosity& verbosity);
55
57 const Species::Species sp1,
58 const Species::Species sp2);
59
68class CIARecord {
69 public:
78 String MoleculeName(const Index i) const;
79
90 void SetMoleculeName(const Index i, const String& name);
91
97 Species::Species Species(const Index i) const {
98 // Assert that i is 0 or 1:
99 ARTS_ASSERT(i >= 0);
100 ARTS_ASSERT(i <= 1);
101
102 return mspecies[i];
103 }
104
107 Index DatasetCount() const { return mdata.nelem(); }
108
112 ARTS_ASSERT(dataset >= 0);
113 ARTS_ASSERT(dataset < mdata.nelem());
114
115 return mdata[dataset].get_numeric_grid(0);
116 }
117
121 ARTS_ASSERT(dataset >= 0);
122 ARTS_ASSERT(dataset < mdata.nelem());
123
124 return mdata[dataset].get_numeric_grid(1);
125 }
126
129 const GriddedField2& Dataset(Index dataset) const {
130 ARTS_ASSERT(dataset >= 0);
131 ARTS_ASSERT(dataset < mdata.nelem());
132
133 return mdata[dataset];
134 }
135
138 const ArrayOfGriddedField2& Data() const { return mdata; }
139
143
148 void SetSpecies(const Species::Species first, const Species::Species second) {
149 mspecies[0] = first;
150 mspecies[1] = second;
151 }
152
165 void Extract(VectorView result,
166 ConstVectorView f_grid,
167 const Numeric& temperature,
168 const Index& dataset,
169 const Numeric& T_extrapolfac,
170 const Index& robust,
171 const Verbosity& verbosity) const;
172
185 Numeric Extract(const Numeric& frequency,
186 const Numeric& temperature,
187 const Index& dataset,
188 const Numeric& T_extrapolfac,
189 const Index& robust,
190 const Verbosity& verbosity) const {
191 Vector result(1);
192 const Vector freqvec(1, frequency);
193
194 Extract(result,
195 freqvec,
196 temperature,
197 dataset,
198 T_extrapolfac,
199 robust,
200 verbosity);
201
202 return result[0];
203 }
204
206 void ReadFromCIA(const String& filename, const Verbosity& verbosity);
207
208 friend void xml_read_from_stream(istream& is_xml,
209 CIARecord& cr,
210 bifstream* pbifs,
211 const Verbosity& verbosity);
212
214 void AppendDataset(const CIARecord& c2);
215
216 private:
218 void AppendDataset(const Vector& freq,
219 const ArrayOfNumeric& temp,
220 const ArrayOfVector& cia);
221
234
243 Species::Species mspecies[2];
244};
245
246ostream& operator<<(ostream& os, const CIARecord& cr);
247
248#endif // cia_h
The global header file for ARTS.
Index cia_get_index(const ArrayOfCIARecord &cia_data, const Species::Species sp1, const Species::Species sp2)
Get the index in cia_data for the two given species.
Definition: cia.cc:225
ostream & operator<<(ostream &os, const CIARecord &cr)
Output operator for CIARecord.
Definition: cia.cc:494
void cia_interpolation(VectorView result, ConstVectorView frequency, const Numeric &temperature, const GriddedField2 &cia_data, const Numeric &T_extrapolfac, const Index &robust, const Verbosity &verbosity)
Interpolate CIA data.
Definition: cia.cc:53
Array< CIARecord > ArrayOfCIARecord
Definition: cia.h:43
This can be used to make arrays out of anything.
Definition: array.h:107
Index nelem() const ARTS_NOEXCEPT
Number of elements.
Definition: array.h:195
CIA data for a single pair of molecules.
Definition: cia.h:68
friend void xml_read_from_stream(istream &is_xml, CIARecord &cr, bifstream *pbifs, const Verbosity &verbosity)
Reads CIARecord from XML input stream.
void SetSpecies(const Species::Species first, const Species::Species second)
Set CIA species.
Definition: cia.h:148
ArrayOfGriddedField2 mdata
The data itself, directly from the HITRAN file.
Definition: cia.h:233
void AppendDataset(const CIARecord &c2)
Append other CIARecord to this.
Definition: cia.cc:480
const ArrayOfGriddedField2 & Data() const
Return CIA data.
Definition: cia.h:138
ArrayOfGriddedField2 & Data()
Return CIA data.
Definition: cia.h:142
Species::Species Species(const Index i) const
Return CIA species index.
Definition: cia.h:97
void ReadFromCIA(const String &filename, const Verbosity &verbosity)
Read CIA catalog file.
Definition: cia.cc:301
Species::Species mspecies[2]
The pair of molecules associated with these CIA data.
Definition: cia.h:243
void SetMoleculeName(const Index i, const String &name)
Set each molecule name (from a string) that is associated with this CIARecord.
Definition: cia.cc:276
Index DatasetCount() const
Return number of datasets in this record.
Definition: cia.h:107
ConstVectorView FrequencyGrid(Index dataset) const
Return frequency grid for given dataset.
Definition: cia.h:111
void Extract(VectorView result, ConstVectorView f_grid, const Numeric &temperature, const Index &dataset, const Numeric &T_extrapolfac, const Index &robust, const Verbosity &verbosity) const
Vector version of extract.
Definition: cia.cc:237
Numeric Extract(const Numeric &frequency, const Numeric &temperature, const Index &dataset, const Numeric &T_extrapolfac, const Index &robust, const Verbosity &verbosity) const
Scalar version of extract.
Definition: cia.h:185
String MoleculeName(const Index i) const
Return each molecule name (as a string) that is associated with this CIARecord.
Definition: cia.cc:265
ConstVectorView TemperatureGrid(Index dataset) const
Return temperatur grid for given dataset.
Definition: cia.h:120
const GriddedField2 & Dataset(Index dataset) const
Return CIA dataset.
Definition: cia.h:129
A constant view of a Vector.
Definition: matpackI.h:489
The VectorView class.
Definition: matpackI.h:626
The Vector class.
Definition: matpackI.h:876
Binary output file stream class.
Definition: bifstream.h:42
#define ARTS_ASSERT(condition,...)
Definition: debug.h:83
Implementation of gridded fields.
#define temp
Implementation of Matrix, Vector, and such stuff.
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.