ARTS 2.5.11 (git: 725533f0)
m_partfun.cc
Go to the documentation of this file.
1#include <filesystem>
2
3#include "math_funcs.h"
4#include "matpack_concepts.h"
5#include "messages.h"
6#include "mystring.h"
7#include "partfun.h"
8
9#include "xml_io.h"
10
12 const String& fileformat,
13 const String& dir,
14 const Numeric& Tlow,
15 const Numeric& Tupp,
16 const Index& N,
17 const Verbosity& verbosity) {
19 ARTS_USER_ERROR_IF(Tupp <= Tlow, "Need a range [low, high], has [", Tlow, ", ", Tupp, "]")
20 ARTS_USER_ERROR_IF(N < 2, "Need a positive step counter 2 or larger, has: ", N)
21
22 const auto d = std::filesystem::path(dir.c_str());
23 ARTS_USER_ERROR_IF(not std::filesystem::is_directory(d), "dir: ", dir, " is not a directory")
24
25 const Vector T = [&]{Vector x; nlinspace(x, Tlow, Tupp, N); return x;}();
26 const FileType ftype = string2filetype(fileformat);
27
28 for (auto& ir: Species::Isotopologues) {
30
31 PartitionFunctionsData data{PartitionFunctions::Type::Interp, Matrix(N, 2)};
32 for (Index i=0; i<N; i++) {
33 data.data(i, 0) = T[i];
34 data.data(i, 1) = PartitionFunctions::Q(T[i], ir);
35 }
36
37 xml_write_to_file(String((d / (ir.FullName() + ".xml").c_str()).native()),
38 data, ftype, 0, verbosity);
39 }
40 }
41}
#define ARTS_USER_ERROR_IF(condition,...)
Definition debug.h:137
void WriteBuiltinPartitionFunctionsXML(const String &fileformat, const String &dir, const Numeric &Tlow, const Numeric &Tupp, const Index &N, const Verbosity &verbosity)
WORKSPACE METHOD: WriteBuiltinPartitionFunctionsXML.
Definition m_partfun.cc:11
void nlinspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
nlinspace
Declarations having to do with the four output streams.
#define CREATE_OUT2
Definition messages.h:188
This file contains the definition of String, the ARTS string class.
my_basic_string< char > String
The String type for ARTS.
Definition mystring.h:199
constexpr bool has_partfun(const Species::IsotopeRecord &ir) noexcept
Definition partfun.h:153
Numeric Q(Numeric T, const Species::IsotopeRecord &ir)
Definition partfun.cc:14
constexpr std::array Isotopologues
A list of all ARTS isotopologues, note how the species enum class input HAS to be sorted.
#define d
This file contains basic functions to handle XML data files.
void xml_write_to_file(const String &filename, const T &type, const FileType ftype, const Index no_clobber, const Verbosity &verbosity)
Write data to XML file.
Definition xml_io.h:155
FileType string2filetype(const String &file_format)
FileType
Definition xml_io_base.h:25