32 unsigned long n_args_out,
34 unsigned long n_args_in,
35 const long *args_in) {
36 output.reserve(n_args_out);
37 for (
size_t i = 0;
i < n_args_out; ++
i) {
38 output.push_back(args_out[
i]);
40 input.reserve(n_args_in);
41 for (
size_t i = 0;
i < n_args_in; ++
i) {
42 input.push_back(args_in[
i]);
81 }
catch (
const std::exception &e) {
107 if (wsv_group_names[group_id] ==
"Agenda") {
109 *
reinterpret_cast<Agenda *
>(workspace->operator[](id));
110 mr =
MRecord(m_id, output, input, t, agenda);
113 if (wsv_group_names[group_id] ==
"Index") {
114 t =
TokVal(*reinterpret_cast<Index *>(workspace->operator[](
id)));
117 if (wsv_group_names[group_id] ==
"Numeric") {
118 t =
TokVal(*reinterpret_cast<Numeric *>(workspace->operator[](
id)));
121 if (wsv_group_names[group_id] ==
"ArrayOfIndex") {
122 t =
TokVal(*reinterpret_cast<ArrayOfIndex *>(workspace->operator[](
id)));
125 if (wsv_group_names[group_id] ==
"String") {
126 t =
TokVal(*reinterpret_cast<String *>(workspace->operator[](
id)));
129 if (wsv_group_names[group_id] ==
"ArrayOfString") {
130 t =
TokVal(*reinterpret_cast<ArrayOfString *>(workspace->operator[](
id)));
133 if (wsv_group_names[group_id] ==
"ArrayOfIndex") {
134 t =
TokVal(*reinterpret_cast<ArrayOfIndex *>(workspace->operator[](
id)));
137 if (wsv_group_names[group_id] ==
"Vector") {
138 t =
TokVal(*reinterpret_cast<Vector *>(workspace->operator[](
id)));
141 if (wsv_group_names[group_id] ==
"Matrix") {
142 t =
TokVal(*reinterpret_cast<Matrix *>(workspace->operator[](
id)));
159 unsigned long n_output_args,
160 const long *output_args,
161 unsigned long n_input_args,
162 const long *input_args) {
166 output, input, n_output_args, output_args, n_input_args, input_args);
192 const Index agenda_verbosity) {
231 m.g_in_types = &
md_data[
i].GInType()[0];
237 m.g_out_types = &
md_data[
i].GOutType()[0];
251 return md_data[
i].GInDefault()[j].c_str();
259 return md_data[
i].GOut()[j].c_str();
264 unsigned long n_args_out,
265 const long *args_out,
266 unsigned long n_args_in,
267 const long *args_in) {
270 output, input, n_args_out, args_out, n_args_in, args_in);
310 if (value.initialized) {
311 value.ptr = workspace->operator[](id);
316 if (value.initialized) {
318 reinterpret_cast<ArrayOfIndex *
>(workspace->operator[](id));
319 value.dimensions[0] = a->size();
320 value.ptr = a->data();
325 if (value.initialized) {
327 reinterpret_cast<String *
>(workspace->operator[](id))->c_str();
332 if (value.initialized) {
333 value.ptr =
reinterpret_cast<Numeric *
>(workspace->operator[](id));
338 if (value.initialized) {
339 Vector *v =
reinterpret_cast<Vector *
>(workspace->operator[](id));
340 value.dimensions[0] = v->
nelem();
348 if (value.initialized) {
349 Matrix *m =
reinterpret_cast<Matrix *
>(workspace->operator[](id));
350 value.dimensions[0] = m->
nrows();
351 value.dimensions[1] = m->
ncols();
359 if (value.initialized) {
360 Tensor3 *t =
reinterpret_cast<Tensor3 *
>(workspace->operator[](id));
361 value.dimensions[0] = t->
npages();
362 value.dimensions[1] = t->
nrows();
363 value.dimensions[2] = t->
ncols();
371 if (value.initialized) {
372 Tensor4 *t =
reinterpret_cast<Tensor4 *
>(workspace->operator[](id));
373 value.dimensions[0] = t->
nbooks();
374 value.dimensions[1] = t->
npages();
375 value.dimensions[2] = t->
nrows();
376 value.dimensions[3] = t->
ncols();
384 if (value.initialized) {
385 Tensor5 *t =
reinterpret_cast<Tensor5 *
>(workspace->operator[](id));
386 value.dimensions[0] = t->
nshelves();
387 value.dimensions[1] = t->
nbooks();
388 value.dimensions[2] = t->
npages();
389 value.dimensions[3] = t->
nrows();
390 value.dimensions[4] = t->
ncols();
398 if (value.initialized) {
399 Tensor6 *t =
reinterpret_cast<Tensor6 *
>(workspace->operator[](id));
401 value.dimensions[1] = t->
nshelves();
402 value.dimensions[2] = t->
nbooks();
403 value.dimensions[3] = t->
npages();
404 value.dimensions[4] = t->
nrows();
405 value.dimensions[5] = t->
ncols();
414 if (value.initialized) {
415 Tensor7 *t =
reinterpret_cast<Tensor7 *
>(workspace->operator[](id));
418 value.dimensions[2] = t->
nshelves();
419 value.dimensions[3] = t->
nbooks();
420 value.dimensions[4] = t->
npages();
421 value.dimensions[5] = t->
nrows();
422 value.dimensions[6] = t->
ncols();
431 if (value.initialized) {
432 Sparse *s =
reinterpret_cast<Sparse *
>(workspace->operator[](id));
433 value.dimensions[0] = s->
nrows();
434 value.dimensions[1] = s->
ncols();
435 value.dimensions[2] = s->
nnz();
443 if (value.initialized) {
451 value.dimensions[0] = blocks.size();
452 value.dimensions[1] = inv_blocks.size();
453 value.inner_ptr =
reinterpret_cast<int *
>(blocks.data());
456 if (value.initialized) {
457 value.ptr = workspace->operator[](id);
464 return workspace->operator[](id);
470 std::vector<Block> &blocks =
473 if ((block_index < 0) || ((
size_t)block_index >= blocks.size())) {
474 throw std::runtime_error(
"The block index is invalid.");
476 Block &block = blocks[block_index];
484 int *inner_ptr =
nullptr;
485 int *outer_ptr =
nullptr;
507 b.inner_ptr = inner_ptr;
508 b.outer_ptr = outer_ptr;
517 if (value.
ptr ==
nullptr) {
525 }
catch (
const std::exception &e) {
532 const Index *ptr =
reinterpret_cast<const Index *
>(value.
ptr);
542 const char *ptr =
reinterpret_cast<const char *
>(value.
ptr);
547 const char *
const *ptr =
reinterpret_cast<const char *
const *
>(value.
ptr);
552 const Index *ptr =
reinterpret_cast<const Index *
>(value.
ptr);
630 "This variable can currently not be set through the C API." 631 " Signal your need to ARTS dev mailing list.");
653 version_string = version_string.substr(5, std::string::npos);
654 size_t dash_pos = version_string.find(
'.');
656 static_cast<Index>(std::stoi(version_string.substr(0, dash_pos)));
658 version_string = version_string.substr(dash_pos + 1, std::string::npos);
659 dash_pos = version_string.find(
'.');
661 static_cast<Index>(std::stoi(version_string.substr(0, dash_pos)));
663 version_string = version_string.substr(dash_pos + 1, std::string::npos);
665 std::stoi(version_string.substr(0, std::string::npos)));
Index npages() const
Returns the number of pages.
INDEX Index
The type to use for all integer numbers and indices.
static Array< WsvRecord > wsv_data
Global WSV data.
Agenda * parse_agenda(const char *filename)
Parse Controlfile.
Index nnz() const
Returns the number of nonzero elements.
const char * get_method_out(Index i, Index j)
void destroy_agenda(Agenda *a)
Destroy Agenda.
Range get_column_range() const
Index nrows() const
Returns the number of rows.
long indices[2]
Quantity indices.
bool empty() const
Check if variable is empty.
VariableStruct get_variable(Index i)
Get WSV by index.
DLL_PUBLIC VersionStruct get_version()
Get ARTS Version.
const char * execute_agenda(const Agenda *a)
Execute agenda.
long dimensions[7]
Dimensions of array data.
This file contains all declarations of the ARTS C API.
bool empty() const
Returns true if variable size is zero.
#define ARTS_FULL_VERSION
const Matrix & get_dense() const
MethodStruct get_method(Index i)
Return MethodStruct describing method with index i.
InteractiveWorkspace * create_workspace(const Index verbosity, const Index agenda_verbosity)
Create new workspace.
Index Group() const
The wsv group to which this variable belongs.
void set_tensor7_variable(Index id, size_t k, size_t l, size_t m, size_t n, size_t o, size_t p, size_t q, const Numeric *src)
Deep-copy of Tensor5 variable into workspace.
const Numeric * get_c_array() const
Conversion to plain C-array.
Index nvitrines() const
Returns the number of vitrines.
const char * get_group_name(int i)
Get pointer to name of given group.
const Sparse & get_sparse() const
const int * inner_ptr
Additional array data for sparse matrices.
void parse_tasklist()
Public interface to the main function of the parser.
String out_basename
The basename for the report file and for all other output files.
bool empty() const
Check if variable is empty.
const char * set_variable_value(InteractiveWorkspace *workspace, long id, long group_id, VariableValueStruct value)
Sets the value of a WSV in a given workspace.
void * get_variable_data_pointer(InteractiveWorkspace *workspace, Index id)
Get data pointer to the WSV variable.
std::string string_buffer
Index nrows() const
Returns the number of rows.
Index npages() const
Returns the number of pages.
bool empty() const
Returns true if variable size is zero.
Index ncols() const
Returns the number of columns.
bool is_initialized(Index i)
Checks existence of the given WSV.
int * get_column_index_pointer()
bool empty() const
Check if variable is empty.
VariableValueStruct get_variable_value(InteractiveWorkspace *workspace, Index id, Index group_id)
Get value WSV in given workspace.
void set_index_variable(Index id, const Index &src)
Deep-copy of Index variable into workspace.
void initialize()
Initalize ARTS runtime.
void agenda_insert_callback(Agenda *a, void(*f)(InteractiveWorkspace *))
Insert callback into agenda.
Structure to hold all command line Parameters.
Index nbooks() const
Returns the number of books.
const char * get_method_g_in_default(Index i, Index j)
Get default value of generic input argument.
void agenda_insert_set(InteractiveWorkspace *workspace, Agenda *a, long id, long group_id)
Insert a set method into an agenda.
void copy_output_and_input(ArrayOfIndex &output, ArrayOfIndex &input, unsigned long n_args_out, const long *args_out, unsigned long n_args_in, const long *args_in)
Index nrows() const
Returns the number of rows.
unsigned long get_number_of_methods()
Return number of WSMs.
constexpr Index get_start() const
Returns the start index of the range.
const Verbosity & verbosity
void set_matrix_variable(Index id, size_t m, size_t n, const Numeric *src)
Deep-copy of Matrix variable into workspace.
Index nrows() const
Returns the number of rows.
void initialize_variable(Index id)
Initialize workspace variable.
Index nelem() const
Returns the number of elements.
const String & Name() const
Name of this workspace variable.
basic_stringstream< char, string_char_traits< char >, alloc > stringstream
ArrayOfString includepath
List of paths to search for include files.
const char * execute_workspace_method(InteractiveWorkspace *workspace, long id, unsigned long n_args_out, const long *args_out, unsigned long n_args_in, const long *args_in)
Execute workspace method.
const map< String, Index > MdMap
The map associated with md_data.
MatrixType get_matrix_type() const
const char * get_method_g_in(Index i, Index j)
Get name of generic input argument.
This file contains the Workspace class.
ArrayOfString datapath
List of paths to search for data files.
const void * ptr
Data pointer.
Index ncols() const
Returns the number of columns.
void finalize()
Finalize ARTS runtime.
const Numeric * get_c_array() const
Conversion to plain C-array, const-version.
The global header file for ARTS.
Index nshelves() const
Returns the number of shelves.
const char * get_error()
Get most recent error.
void set_basename(const char *name)
Set the ARTS basename.
std::vector< Block > & get_inverse_blocks()
Blocks of the inverse covariance matrix.
Agenda * create_agenda(const char *name)
Create Agenda.
std::vector< Block > & get_blocks()
Block in the covariance matrix.
void set_agenda_variable(Index id, const Agenda &src)
Set agenda variable into workspace.
void set_vector_variable(Index id, size_t n, const Numeric *src)
Deep-copy of Vector variable into workspace.
unsigned long get_number_of_variables()
Number of defined WSVs.
Parameters parameters
Holds the command line parameters.
long lookup_workspace_variable(const char *s)
Lookup workspace variable by name.
const char * get_method_g_out(Index i, Index j)
Get name value of generic output argument.
Index get_wsv_id(const char *)
Get index of WSV.
void set_tensor5_variable(Index id, size_t k, size_t l, size_t m, size_t n, size_t o, const Numeric *src)
Deep-copy of Tensor5 variable into workspace.
Index ncols() const
Returns the number of columns.
void agenda_append(Agenda *dst, const Agenda *src)
Append agendas.
static void initialize()
Workspace intialization.
Declarations for agendas.
const String & Description() const
A text describing this workspace variable.
constexpr Index get_extent() const
Returns the extent of the range.
void set_tensor6_variable(Index id, size_t k, size_t l, size_t m, size_t n, size_t o, size_t p, const Numeric *src)
Deep-copy of Tensor6 variable into workspace.
void include_path_push(const char *path)
Add include path.
const char * get_method_in(Index i, Index j)
Index nrows() const
Returns the number of rows.
void include_path_pop()
Remove last include path.
Representation of workspace methods.
Representation of ARTS WSVs.
std::vector< Method > methods()
void agenda_clear(Agenda *a)
Clear Agenda.
void set_numeric_variable(Index id, const Numeric &src)
Deep-copy of Numeric variable into workspace.
Index nrows() const
Returns the number of rows.
void set_sparse_variable(Index id, Index m, Index n, Index nnz, const Numeric *src, const int *row_indices, const int *column_indices)
Deep-copy of Sparse matrix into workspace.
unsigned long get_number_of_groups()
Return number of WSV groups.
void set_array_of_index_variable(Index id, size_t n, const Index *src)
Deep-copy of ArrayOfIndex variable into workspace.
NUMERIC Numeric
The type to use for all floating point numbers.
Range get_row_range() const
Index nlibraries() const
Returns the number of libraries.
int * get_row_start_pointer()
Interactive ARTS workspace.
const Numeric * get_c_array() const
Conversion to plain C-array.
const Numeric * get_c_array() const
Conversion to plain C-array.
const char * method_print_doc(long id)
Print method documentation.
void set_tensor3_variable(Index id, size_t l, size_t m, size_t n, const Numeric *src)
Deep-copy of Tensor3 variable into workspace.
Index npages() const
Returns the number of pages.
Index nshelves() const
Returns the number of shelves.
Index ncols() const
Returns the number of columns.
long minor
Minor version number of this ARTS major version.
const ArrayOfString wsv_group_names
The names associated with Wsv groups as Strings.
void set_name(const String &nname)
Set agenda name.
bool empty() const
Check if variable is empty.
static map< String, Index > WsvMap
Global map associated with wsv_data.
const Numeric * get_c_array() const
Conversion to plain C-array.
void data_path_push(const char *path)
Add data path.
long add_variable(InteractiveWorkspace *workspace, long group_id, const char *name)
Add variable of given type to workspace.
void set_tensor4_variable(Index id, size_t k, size_t l, size_t m, size_t n, const Numeric *src)
Deep-copy of Tensor4 variable into workspace.
Representation of ARTS values.
bool empty() const
Check if variable is empty.
static Index add_callback(Callback *cb)
Add callback to workspace.
void agenda_add_method(Agenda *a, const long id, unsigned long n_output_args, const long *output_args, unsigned long n_input_args, const long *input_args)
void set_array_of_string_variable(Index id, size_t n, const char *const *src)
Deep-copy of ArrayOfString variable into workspace.
const Array< MRecord > & Methods() const
Index npages() const
Returns the number of pages.
void destroy_workspace(InteractiveWorkspace *workspace)
Destroy given workspace.
Index nshelves() const
Returns the number of shelves.
const int * outer_ptr
Additional array data for sparse matrices.
const char * execute_agenda(InteractiveWorkspace *workspace, const Agenda *a)
Execute Agenda.
const char * execute_workspace_method(long id, const ArrayOfIndex &output, const ArrayOfIndex &input)
Execute workspace method.
Index npages() const
Returns the number of pages.
Index nbooks() const
Returns the number of books.
void data_path_pop()
Remove last data path.
long revision
Revision number.
const Array< MdRecord > md_data
Lookup information for workspace methods.
Verbosity verbosity_at_launch
The global message verbosity settings:
Index ncols() const
Returns the number of columns.
Index add_variable(Index group_id, const char *name)
Push a stack for a new variable to the workspace.
const Numeric * get_c_array() const
Conversion to plain C-array.
CovarianceMatrixBlockStruct get_covariance_matrix_block(CovarianceMatrix *m, long block_index, bool inverse)
Return block of covariance matrix.
Index nvitrines() const
Returns the number of vitrines.
void erase_variable(Index i, Index group_id)
Remove a variable stack from the workspace.
This class contains all static information for one workspace variable.
Index ncols() const
Returns the number of columns.
This file contains header information for the dealing with command line parameters.
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
Index ncols() const
Returns the number of columns.
IndexPair get_indices() const
This stores arbitrary token values and remembers the type.
Numeric * get_element_pointer()
Index nrows() const
Returns the number of rows.
Index nbooks() const
Returns the number of books.
DLL_PUBLIC void erase_variable(InteractiveWorkspace *workspace, long id, long group_id)
Erase variable from workspace.
my_basic_string< char > String
The String type for ARTS.
void set_string_variable(Index id, const char *src)
Deep-copy of String variable into workspace.
const Numeric * get_c_array() const
Conversion to plain C-array.
long major
Major version number of ARTS.
void push_back(const MRecord &n)
Append a new method to end of list.
Index nbooks() const
Returns the number of books.