ARTS 2.5.0 (git: 9ee3ac6c)
arts_api.cc
Go to the documentation of this file.
1#include "arts_api.h"
2
3#include "agenda_class.h"
4#include "arts.h"
5#include "auto_md.h"
6#include "auto_version.h"
7#include "global_data.h"
9#include "parameters.h"
10#include "parser.h"
11#include "workspace_ng.h"
12
17extern String out_basename;
18Index get_wsv_id(const char *);
19
21
22std::string string_buffer;
23
24//extern "C" {
25
27// Internal Helper Functions
29
31 ArrayOfIndex &input,
32 unsigned long n_args_out,
33 const long *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]);
39 }
40 input.reserve(n_args_in);
41 for (size_t i = 0; i < n_args_in; ++i) {
42 input.push_back(args_in[i]);
43 }
44}
45
47// Setup and Finalization.
49
50void include_path_push(const char *path) {
51 parameters.includepath.push_back(path);
52}
53
55
56void data_path_push(const char *path) { parameters.datapath.push_back(path); }
57
58void data_path_pop() { parameters.datapath.pop_back(); }
59
61
62void finalize() {
63 // Nothing to do here.
64}
65
66const char *get_error() { return string_buffer.c_str(); }
67
68void set_basename(const char *name) { out_basename = name; }
69
71// Parsing and executing agendas.
73Agenda *parse_agenda(const char *filename) {
74 Agenda *a = new Agenda;
75 ArtsParser parser = ArtsParser(*a, filename, verbosity_at_launch);
76
77 try {
78 parser.parse_tasklist();
79 a->set_name(filename);
80 a->set_main_agenda();
81 } catch (const std::exception &e) {
82 string_buffer = std::string(e.what());
83 return nullptr;
84 }
85 return a;
86}
87
88Agenda *create_agenda(const char *name) {
89 Agenda *ptr = new Agenda;
90 ptr->set_name(name);
91 return ptr;
92}
93
95 Agenda *a,
96 long id,
97 long group_id) {
98 TokVal t{};
99 ArrayOfIndex output(1), input(0);
100 output[0] = id;
101 std::stringstream s;
102 s << wsv_group_names[group_id] << "Set";
103 Index m_id = MdMap.at(String(s.str()));
104 MRecord mr;
105
106 // Agenda
107 if (wsv_group_names[group_id] == "Agenda") {
108 const Agenda &agenda =
109 *reinterpret_cast<Agenda *>(workspace->operator[](id));
110 mr = MRecord(m_id, output, input, t, agenda);
111 } else {
112 // Index
113 if (wsv_group_names[group_id] == "Index") {
114 t = TokVal(*reinterpret_cast<Index *>(workspace->operator[](id)));
115 }
116 // Numeric
117 if (wsv_group_names[group_id] == "Numeric") {
118 t = TokVal(*reinterpret_cast<Numeric *>(workspace->operator[](id)));
119 }
120 // ArrayOfIndex
121 if (wsv_group_names[group_id] == "ArrayOfIndex") {
122 t = TokVal(*reinterpret_cast<ArrayOfIndex *>(workspace->operator[](id)));
123 }
124 // String
125 if (wsv_group_names[group_id] == "String") {
126 t = TokVal(*reinterpret_cast<String *>(workspace->operator[](id)));
127 }
128 // ArrayOfString
129 if (wsv_group_names[group_id] == "ArrayOfString") {
130 t = TokVal(*reinterpret_cast<ArrayOfString *>(workspace->operator[](id)));
131 }
132 // ArrayOfIndex
133 if (wsv_group_names[group_id] == "ArrayOfIndex") {
134 t = TokVal(*reinterpret_cast<ArrayOfIndex *>(workspace->operator[](id)));
135 }
136 // Vector
137 if (wsv_group_names[group_id] == "Vector") {
138 t = TokVal(*reinterpret_cast<Vector *>(workspace->operator[](id)));
139 }
140 // Matrix
141 if (wsv_group_names[group_id] == "Matrix") {
142 t = TokVal(*reinterpret_cast<Matrix *>(workspace->operator[](id)));
143 }
144 // ArrayOfSpeciesTag
145 if (wsv_group_names[group_id] == "ArrayOfSpeciesTag") {
146 t = TokVal(*reinterpret_cast<ArrayOfSpeciesTag *>(workspace->operator[](id)));
147 }
148 mr = MRecord(m_id, output, input, t, Agenda{});
149 }
150 a->push_back(mr);
151}
152
154 ArrayOfIndex output(0), input(0);
155 Index id = md_data.size() - 1;
156 Callback *pc = new Callback(f);
158 a->push_back(MRecord(id, output, input, TokVal(callback_id), Agenda{}));
159}
160
162 const long id,
163 unsigned long n_output_args,
164 const long *output_args,
165 unsigned long n_input_args,
166 const long *input_args) {
167 ArrayOfIndex output, input;
168 TokVal t{};
170 output, input, n_output_args, output_args, n_input_args, input_args);
171 MRecord mr(id, output, input, t, Agenda{});
172 a->push_back(mr);
173}
174
175void agenda_append(Agenda *dst, const Agenda *src) {
176 auto methods = src->Methods();
177 for (auto m : methods) {
178 dst->push_back(m);
179 }
180}
181
182void agenda_clear(Agenda *a) { a->operator=(Agenda()); }
183
184const char *execute_agenda(InteractiveWorkspace *workspace, const Agenda *a) {
185 Agenda b(*a);
186 b.set_main_agenda();
187 return workspace->execute_agenda(&b);
188}
189
190void destroy_agenda(Agenda *a) { delete a; }
191
193// Creating Workspaces
196 const Index agenda_verbosity) {
197 return new InteractiveWorkspace(verbosity, agenda_verbosity);
198}
199
200void destroy_workspace(InteractiveWorkspace *workspace) { delete workspace; }
201
203// Accessing WSV Group Information
205
206unsigned long get_number_of_groups() { return wsv_group_names.size(); }
207
208const char *get_group_name(int i) { return wsv_group_names[i].c_str(); }
209
211// Accessing and Executing WSMs
213unsigned long get_number_of_methods() { return md_data.size(); }
214
216 MethodStruct m{i,
217 md_data[i].Name().c_str(),
218 md_data[i].Description().c_str(),
219 // Output
220 md_data[i].Out().size(),
221 nullptr,
222 // Generic Output
223 md_data[i].GOut().size(),
224 nullptr,
225 // Input
226 md_data[i].In().size(),
227 nullptr,
228 // Generic Input
229 md_data[i].GIn().size(),
230 nullptr};
231 if (m.n_out > 0) {
232 m.out = &md_data[i].Out()[0];
233 }
234 if (m.n_g_in > 0) {
235 m.g_in_types = &md_data[i].GInType()[0];
236 }
237 if (m.n_in > 0) {
238 m.in = &md_data[i].In()[0];
239 }
240 if (m.n_g_out > 0) {
241 m.g_out_types = &md_data[i].GOutType()[0];
242 }
243 return m;
244}
245
246const char *get_method_in(Index i, Index j) {
247 return md_data[i].GIn()[j].c_str();
248}
249
250const char *get_method_g_in(Index i, Index j) {
251 return md_data[i].GIn()[j].c_str();
252}
253
255 return md_data[i].GInDefault()[j].c_str();
256}
257
258const char *get_method_out(Index i, Index j) {
259 return md_data[i].GIn()[j].c_str();
260}
261
262const char *get_method_g_out(Index i, Index j) {
263 return md_data[i].GOut()[j].c_str();
264}
265
267 long id,
268 unsigned long n_args_out,
269 const long *args_out,
270 unsigned long n_args_in,
271 const long *args_in) {
272 ArrayOfIndex output, input;
274 output, input, n_args_out, args_out, n_args_in, args_in);
275 return workspace->execute_workspace_method(id, output, input);
276}
277
278const char *method_print_doc(long id) {
279 std::stringstream ss;
280 ;
281 ss << md_data[id];
282 string_buffer = ss.str();
283 return string_buffer.c_str();
284}
285
287// Accessing and Manipulating WSVs
289long lookup_workspace_variable(const char *s) {
290 auto it = Workspace::WsvMap.find(s);
291 if (it == Workspace::WsvMap.end()) {
292 return -1;
293 }
294 return it->second;
295}
296
297unsigned long get_number_of_variables() { return Workspace::wsv_data.size(); }
298
300 const WsvRecord &r = Workspace::wsv_data[i];
301 return VariableStruct{r.Name().c_str(), r.Description().c_str(), r.Group()};
302}
303
305 Index id,
306 Index group_id) {
307 VariableValueStruct value{nullptr,
308 workspace->is_initialized(id),
309 {0, 0, 0, 0, 0, 0},
310 nullptr,
311 nullptr};
312 // Index
313 if (wsv_group_names[group_id] == "Index") {
314 if (value.initialized) {
315 value.ptr = workspace->operator[](id);
316 }
317 }
318 // ArrayOfIndex
319 else if (wsv_group_names[group_id] == "ArrayOfIndex") {
320 if (value.initialized) {
321 ArrayOfIndex *a =
322 reinterpret_cast<ArrayOfIndex *>(workspace->operator[](id));
323 value.dimensions[0] = a->size();
324 value.ptr = a->data();
325 }
326 }
327 // String
328 else if (wsv_group_names[group_id] == "String") {
329 if (value.initialized) {
330 value.ptr =
331 reinterpret_cast<String *>(workspace->operator[](id))->c_str();
332 }
333 }
334 // Numeric
335 else if (wsv_group_names[group_id] == "Numeric") {
336 if (value.initialized) {
337 value.ptr = reinterpret_cast<Numeric *>(workspace->operator[](id));
338 }
339 }
340 // Vector
341 else if (wsv_group_names[group_id] == "Vector") {
342 if (value.initialized) {
343 Vector *v = reinterpret_cast<Vector *>(workspace->operator[](id));
344 value.dimensions[0] = v->nelem();
345 if (!v->empty()) {
346 value.ptr = v->get_c_array();
347 }
348 }
349 }
350 // Matrix
351 else if (wsv_group_names[group_id] == "Matrix") {
352 if (value.initialized) {
353 Matrix *m = reinterpret_cast<Matrix *>(workspace->operator[](id));
354 value.dimensions[0] = m->nrows();
355 value.dimensions[1] = m->ncols();
356 if (!m->empty()) {
357 value.ptr = m->get_c_array();
358 }
359 }
360 }
361 // Tensor3
362 else if (wsv_group_names[group_id] == "Tensor3") {
363 if (value.initialized) {
364 Tensor3 *t = reinterpret_cast<Tensor3 *>(workspace->operator[](id));
365 value.dimensions[0] = t->npages();
366 value.dimensions[1] = t->nrows();
367 value.dimensions[2] = t->ncols();
368 if (!t->empty()) {
369 value.ptr = t->get_c_array();
370 }
371 }
372 }
373 // Tensor4
374 else if (wsv_group_names[group_id] == "Tensor4") {
375 if (value.initialized) {
376 Tensor4 *t = reinterpret_cast<Tensor4 *>(workspace->operator[](id));
377 value.dimensions[0] = t->nbooks();
378 value.dimensions[1] = t->npages();
379 value.dimensions[2] = t->nrows();
380 value.dimensions[3] = t->ncols();
381 if (!t->empty()) {
382 value.ptr = t->get_c_array();
383 }
384 }
385 }
386 // Tensor5
387 else if (wsv_group_names[group_id] == "Tensor5") {
388 if (value.initialized) {
389 Tensor5 *t = reinterpret_cast<Tensor5 *>(workspace->operator[](id));
390 value.dimensions[0] = t->nshelves();
391 value.dimensions[1] = t->nbooks();
392 value.dimensions[2] = t->npages();
393 value.dimensions[3] = t->nrows();
394 value.dimensions[4] = t->ncols();
395 if (!t->empty()) {
396 value.ptr = t->get_c_array();
397 }
398 }
399 }
400 // Tensor6
401 else if (wsv_group_names[group_id] == "Tensor6") {
402 if (value.initialized) {
403 Tensor6 *t = reinterpret_cast<Tensor6 *>(workspace->operator[](id));
404 value.dimensions[0] = t->nvitrines();
405 value.dimensions[1] = t->nshelves();
406 value.dimensions[2] = t->nbooks();
407 value.dimensions[3] = t->npages();
408 value.dimensions[4] = t->nrows();
409 value.dimensions[5] = t->ncols();
410
411 if (!t->empty()) {
412 value.ptr = t->get_c_array();
413 }
414 }
415 }
416 // Tensor7
417 else if (wsv_group_names[group_id] == "Tensor7") {
418 if (value.initialized) {
419 Tensor7 *t = reinterpret_cast<Tensor7 *>(workspace->operator[](id));
420 value.dimensions[0] = t->nlibraries();
421 value.dimensions[1] = t->nvitrines();
422 value.dimensions[2] = t->nshelves();
423 value.dimensions[3] = t->nbooks();
424 value.dimensions[4] = t->npages();
425 value.dimensions[5] = t->nrows();
426 value.dimensions[6] = t->ncols();
427
428 if (!t->empty()) {
429 value.ptr = t->get_c_array();
430 }
431 }
432 }
433 // Sparse
434 else if (wsv_group_names[group_id] == "Sparse") {
435 if (value.initialized) {
436 Sparse *s = reinterpret_cast<Sparse *>(workspace->operator[](id));
437 value.dimensions[0] = s->nrows();
438 value.dimensions[1] = s->ncols();
439 value.dimensions[2] = s->nnz();
440 value.ptr = s->get_element_pointer();
441 value.inner_ptr = s->get_column_index_pointer();
442 value.outer_ptr = s->get_row_start_pointer();
443 }
444 }
445 // Covariance Matrix
446 else if (wsv_group_names[group_id] == "CovarianceMatrix") {
447 if (value.initialized) {
449 reinterpret_cast<CovarianceMatrix *>(workspace->operator[](id));
450
451 auto &blocks = c->get_blocks();
452 auto &inv_blocks = c->get_inverse_blocks();
453
454 value.ptr = c;
455 value.dimensions[0] = blocks.size();
456 value.dimensions[1] = inv_blocks.size();
457 value.inner_ptr = reinterpret_cast<int *>(blocks.data());
458 }
459 } else {
460 if (value.initialized) {
461 value.ptr = workspace->operator[](id);
462 }
463 }
464 return value;
465}
466
468 return workspace->operator[](id);
469}
470
472 long block_index,
473 bool inverse) {
474 std::vector<Block> &blocks =
475 inverse ? m->get_inverse_blocks() : m->get_blocks();
476
477 ARTS_USER_ERROR_IF ((block_index < 0) || ((size_t)block_index >= blocks.size()),
478 "The block index is invalid.");
479 Block &block = blocks[block_index];
480
481 Index i, j;
482 std::tie(i, j) = block.get_indices();
483 Range rr = block.get_row_range();
484 Range cr = block.get_column_range();
485
486 void *ptr = nullptr;
487 int *inner_ptr = nullptr;
488 int *outer_ptr = nullptr;
489 long nnz = 0;
490
492 ptr = block.get_dense().get_c_array();
493 } else {
494 Sparse &s = block.get_sparse();
495 ptr = s.get_element_pointer();
496 inner_ptr = s.get_column_index_pointer();
497 outer_ptr = s.get_row_start_pointer();
498 nnz = s.nnz();
499 }
500
502 b.indices[0] = i;
503 b.indices[1] = j;
504 b.dimensions[0] = rr.get_extent();
505 b.dimensions[1] = cr.get_extent();
506 b.position[0] = rr.get_start();
507 b.position[1] = cr.get_start();
508 b.ptr = ptr;
509 b.nnz = nnz;
510 b.inner_ptr = inner_ptr;
511 b.outer_ptr = outer_ptr;
512 return b;
513}
514
516 long id,
517 long group_id,
518 VariableValueStruct value) {
519 // If ptr is null empty variable
520 if (value.ptr == nullptr) {
521 workspace->initialize_variable(id);
522 }
523 // Agenda
524 else if (wsv_group_names[group_id] == "Agenda") {
525 try {
526 const Agenda *ptr = reinterpret_cast<const Agenda *>(value.ptr);
527 workspace->set_agenda_variable(id, *ptr);
528 } catch (const std::exception &e) {
529 string_buffer = std::string(e.what());
530 return string_buffer.c_str();
531 }
532 }
533 // Index
534 else if (wsv_group_names[group_id] == "Index") {
535 const Index *ptr = reinterpret_cast<const Index *>(value.ptr);
536 workspace->set_index_variable(id, *ptr);
537 }
538 // Numeric
539 else if (wsv_group_names[group_id] == "Numeric") {
540 const Numeric *ptr = reinterpret_cast<const Numeric *>(value.ptr);
541 workspace->set_numeric_variable(id, *ptr);
542 }
543 // String
544 else if (wsv_group_names[group_id] == "String") {
545 const char *ptr = reinterpret_cast<const char *>(value.ptr);
546 workspace->set_string_variable(id, ptr);
547 }
548 // Array of String
549 else if (wsv_group_names[group_id] == "ArrayOfString") {
550 const char *const *ptr = reinterpret_cast<const char *const *>(value.ptr);
551 workspace->set_array_of_string_variable(id, value.dimensions[0], ptr);
552 }
553 // Array of Index
554 else if (wsv_group_names[group_id] == "ArrayOfIndex") {
555 const Index *ptr = reinterpret_cast<const Index *>(value.ptr);
556 workspace->set_array_of_index_variable(id, value.dimensions[0], ptr);
557 }
558 // Vector
559 else if (wsv_group_names[group_id] == "Vector") {
560 const Numeric *ptr = reinterpret_cast<const Numeric *>(value.ptr);
561 workspace->set_vector_variable(id, value.dimensions[0], ptr);
562 }
563 // Matrix
564 else if (wsv_group_names[group_id] == "Matrix") {
565 const Numeric *ptr = reinterpret_cast<const Numeric *>(value.ptr);
566 workspace->set_matrix_variable(
567 id, value.dimensions[0], value.dimensions[1], ptr);
568 }
569 // Tensor3
570 else if (wsv_group_names[group_id] == "Tensor3") {
571 const Numeric *ptr = reinterpret_cast<const Numeric *>(value.ptr);
572 workspace->set_tensor3_variable(
573 id, value.dimensions[0], value.dimensions[1], value.dimensions[2], ptr);
574 }
575 // Tensor4
576 else if (wsv_group_names[group_id] == "Tensor4") {
577 const Numeric *ptr = reinterpret_cast<const Numeric *>(value.ptr);
578 workspace->set_tensor4_variable(id,
579 value.dimensions[0],
580 value.dimensions[1],
581 value.dimensions[2],
582 value.dimensions[3],
583 ptr);
584 }
585 // Tensor5
586 else if (wsv_group_names[group_id] == "Tensor5") {
587 const Numeric *ptr = reinterpret_cast<const Numeric *>(value.ptr);
588 workspace->set_tensor5_variable(id,
589 value.dimensions[0],
590 value.dimensions[1],
591 value.dimensions[2],
592 value.dimensions[3],
593 value.dimensions[4],
594 ptr);
595 }
596 // Tensor6
597 else if (wsv_group_names[group_id] == "Tensor6") {
598 const Numeric *ptr = reinterpret_cast<const Numeric *>(value.ptr);
599 workspace->set_tensor6_variable(id,
600 value.dimensions[0],
601 value.dimensions[1],
602 value.dimensions[2],
603 value.dimensions[3],
604 value.dimensions[4],
605 value.dimensions[5],
606 ptr);
607 }
608 // Tensor7
609 else if (wsv_group_names[group_id] == "Tensor7") {
610 const Numeric *ptr = reinterpret_cast<const Numeric *>(value.ptr);
611 workspace->set_tensor7_variable(id,
612 value.dimensions[0],
613 value.dimensions[1],
614 value.dimensions[2],
615 value.dimensions[3],
616 value.dimensions[4],
617 value.dimensions[5],
618 value.dimensions[6],
619 ptr);
620 }
621 // Sparse
622 else if (wsv_group_names[group_id] == "Sparse") {
623 const Numeric *ptr = reinterpret_cast<const Numeric *>(value.ptr);
624 workspace->set_sparse_variable(id,
625 value.dimensions[0],
626 value.dimensions[1],
627 value.dimensions[2],
628 ptr,
629 value.inner_ptr,
630 value.outer_ptr);
631 } else {
632 string_buffer = std::string(
633 "This variable can currently not be set through the C API."
634 " Signal your need to ARTS dev mailing list.");
635 return string_buffer.c_str();
636 }
637 return nullptr;
638}
639
641 long group_id,
642 const char *name) {
643 return workspace->add_variable(group_id, name);
644}
645
647void erase_variable(InteractiveWorkspace *workspace, long id, long group_id) {
648 return workspace->erase_variable(id, group_id);
649}
650
653 VersionStruct version;
654 std::string version_string(ARTS_FULL_VERSION);
655
656 version_string = version_string.substr(5, std::string::npos);
657 size_t dash_pos = version_string.find('.');
658 version.major =
659 static_cast<Index>(std::stoi(version_string.substr(0, dash_pos)));
660
661 version_string = version_string.substr(dash_pos + 1, std::string::npos);
662 dash_pos = version_string.find('.');
663 version.minor =
664 static_cast<Index>(std::stoi(version_string.substr(0, dash_pos)));
665
666 version_string = version_string.substr(dash_pos + 1, std::string::npos);
667 version.revision = static_cast<Index>(
668 std::stoi(version_string.substr(0, std::string::npos)));
669
670 return version;
671}
672//}
Declarations for agendas.
The global header file for ARTS.
const char * get_method_in(Index i, Index j)
Definition: arts_api.cc:246
Verbosity verbosity_at_launch
The global message verbosity settings:
Definition: messages.cc:34
InteractiveWorkspace * create_workspace(const Index verbosity, const Index agenda_verbosity)
Create new workspace.
Definition: arts_api.cc:195
unsigned long get_number_of_methods()
Return number of WSMs.
Definition: arts_api.cc:213
void agenda_clear(Agenda *a)
Clear Agenda.
Definition: arts_api.cc:182
void destroy_agenda(Agenda *a)
Destroy Agenda.
Definition: arts_api.cc:190
String out_basename
The basename for the report file and for all other output files.
Definition: messages.cc:42
void agenda_append(Agenda *dst, const Agenda *src)
Append agendas.
Definition: arts_api.cc:175
void data_path_pop()
Remove last data path.
Definition: arts_api.cc:58
void initialize()
Initalize ARTS runtime.
Definition: arts_api.cc:60
void include_path_pop()
Remove last include path.
Definition: arts_api.cc:54
const char * method_print_doc(long id)
Print method documentation.
Definition: arts_api.cc:278
const char * get_method_g_in_default(Index i, Index j)
Get default value of generic input argument.
Definition: arts_api.cc:254
void finalize()
Finalize ARTS runtime.
Definition: arts_api.cc:62
const char * get_method_g_out(Index i, Index j)
Get name value of generic output argument.
Definition: arts_api.cc:262
long add_variable(InteractiveWorkspace *workspace, long group_id, const char *name)
Add variable of given type to workspace.
Definition: arts_api.cc:640
Agenda * parse_agenda(const char *filename)
Parse Controlfile.
Definition: arts_api.cc:73
VariableValueStruct get_variable_value(InteractiveWorkspace *workspace, Index id, Index group_id)
Get value WSV in given workspace.
Definition: arts_api.cc:304
VariableStruct get_variable(Index i)
Get WSV by index.
Definition: arts_api.cc:299
void * get_variable_data_pointer(InteractiveWorkspace *workspace, Index id)
Get data pointer to the WSV variable.
Definition: arts_api.cc:467
unsigned long get_number_of_variables()
Number of defined WSVs.
Definition: arts_api.cc:297
MethodStruct get_method(Index i)
Return MethodStruct describing method with index i.
Definition: arts_api.cc:215
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)
Definition: arts_api.cc:30
const char * set_variable_value(InteractiveWorkspace *workspace, long id, long group_id, VariableValueStruct value)
Sets the value of a WSV in a given workspace.
Definition: arts_api.cc:515
Agenda * create_agenda(const char *name)
Create Agenda.
Definition: arts_api.cc:88
DLL_PUBLIC void erase_variable(InteractiveWorkspace *workspace, long id, long group_id)
Erase variable from workspace.
Definition: arts_api.cc:647
const char * execute_agenda(InteractiveWorkspace *workspace, const Agenda *a)
Execute Agenda.
Definition: arts_api.cc:184
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)
Definition: arts_api.cc:161
const char * get_error()
Get most recent error.
Definition: arts_api.cc:66
void agenda_insert_set(InteractiveWorkspace *workspace, Agenda *a, long id, long group_id)
Insert a set method into an agenda.
Definition: arts_api.cc:94
void set_basename(const char *name)
Set the ARTS basename.
Definition: arts_api.cc:68
DLL_PUBLIC VersionStruct get_version()
Get ARTS Version.
Definition: arts_api.cc:652
const char * get_group_name(int i)
Get pointer to name of given group.
Definition: arts_api.cc:208
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.
Definition: arts_api.cc:266
const char * get_method_out(Index i, Index j)
Definition: arts_api.cc:258
unsigned long get_number_of_groups()
Return number of WSV groups.
Definition: arts_api.cc:206
void data_path_push(const char *path)
Add data path.
Definition: arts_api.cc:56
std::string string_buffer
Definition: arts_api.cc:22
CovarianceMatrixBlockStruct get_covariance_matrix_block(CovarianceMatrix *m, long block_index, bool inverse)
Return block of covariance matrix.
Definition: arts_api.cc:471
void include_path_push(const char *path)
Add include path.
Definition: arts_api.cc:50
const char * get_method_g_in(Index i, Index j)
Get name of generic input argument.
Definition: arts_api.cc:250
void agenda_insert_callback(Agenda *a, void(*f)(InteractiveWorkspace *))
Insert callback into agenda.
Definition: arts_api.cc:153
long lookup_workspace_variable(const char *s)
Lookup workspace variable by name.
Definition: arts_api.cc:289
Parameters parameters
Holds the command line parameters.
Definition: parameters.cc:41
void destroy_workspace(InteractiveWorkspace *workspace)
Destroy given workspace.
Definition: arts_api.cc:200
Index get_wsv_id(const char *)
Get index of WSV.
Definition: workspace.cc:5772
#define DLL_PUBLIC
Definition: arts_api.h:32
#define ARTS_FULL_VERSION
Definition: auto_version.h:1
The Agenda class.
Definition: agenda_class.h:44
void push_back(const MRecord &n)
Append a new method to end of list.
Definition: agenda_class.h:274
void set_name(const String &nname)
Set agenda name.
const Array< MRecord > & Methods() const
Definition: agenda_class.h:74
void parse_tasklist()
Public interface to the main function of the parser.
Definition: parser.cc:50
MatrixType get_matrix_type() const
const Sparse & get_sparse() const
const Matrix & get_dense() const
IndexPair get_indices() const
Range get_row_range() const
Range get_column_range() const
External callbacks.
bool empty() const ARTS_NOEXCEPT
Returns true if variable size is zero.
Definition: matpackI.cc:430
Index nrows() const ARTS_NOEXCEPT
Returns the number of rows.
Definition: matpackI.cc:433
Index ncols() const ARTS_NOEXCEPT
Returns the number of columns.
Definition: matpackI.cc:436
Index npages() const
Returns the number of pages.
Definition: matpackIII.h:144
Index nrows() const
Returns the number of rows.
Definition: matpackIII.h:147
Index ncols() const
Returns the number of columns.
Definition: matpackIII.h:150
bool empty() const
Check if variable is empty.
Definition: matpackIII.cc:36
Index npages() const
Returns the number of pages.
Definition: matpackIV.cc:58
Index nbooks() const
Returns the number of books.
Definition: matpackIV.cc:55
Index ncols() const
Returns the number of columns.
Definition: matpackIV.cc:64
bool empty() const
Check if variable is empty.
Definition: matpackIV.cc:50
Index nrows() const
Returns the number of rows.
Definition: matpackIV.cc:61
Index ncols() const
Returns the number of columns.
Definition: matpackV.cc:56
Index nshelves() const
Returns the number of shelves.
Definition: matpackV.cc:44
Index npages() const
Returns the number of pages.
Definition: matpackV.cc:50
Index nrows() const
Returns the number of rows.
Definition: matpackV.cc:53
bool empty() const
Check if variable is empty.
Definition: matpackV.cc:38
Index nbooks() const
Returns the number of books.
Definition: matpackV.cc:47
Index ncols() const
Returns the number of columns.
Definition: matpackVI.cc:57
Index npages() const
Returns the number of pages.
Definition: matpackVI.cc:51
Index nrows() const
Returns the number of rows.
Definition: matpackVI.cc:54
Index nshelves() const
Returns the number of shelves.
Definition: matpackVI.cc:45
Index nbooks() const
Returns the number of books.
Definition: matpackVI.cc:48
bool empty() const
Check if variable is empty.
Definition: matpackVI.cc:36
Index nvitrines() const
Returns the number of vitrines.
Definition: matpackVI.cc:42
bool empty() const
Check if variable is empty.
Definition: matpackVII.cc:36
Index nshelves() const
Returns the number of shelves.
Definition: matpackVII.cc:48
Index nrows() const
Returns the number of rows.
Definition: matpackVII.cc:57
Index nvitrines() const
Returns the number of vitrines.
Definition: matpackVII.cc:45
Index npages() const
Returns the number of pages.
Definition: matpackVII.cc:54
Index ncols() const
Returns the number of columns.
Definition: matpackVII.cc:60
Index nlibraries() const
Returns the number of libraries.
Definition: matpackVII.cc:42
Index nbooks() const
Returns the number of books.
Definition: matpackVII.cc:51
std::vector< Block > & get_inverse_blocks()
Blocks of the inverse covariance matrix.
std::vector< Block > & get_blocks()
Block in the covariance matrix.
Interactive ARTS workspace.
const char * execute_agenda(const Agenda *a)
Execute agenda.
void set_vector_variable(Index id, size_t n, const Numeric *src)
Deep-copy of Vector variable into workspace.
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.
void set_array_of_string_variable(Index id, size_t n, const char *const *src)
Deep-copy of ArrayOfString variable into workspace.
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 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.
void set_index_variable(Index id, const Index &src)
Deep-copy of Index variable into workspace.
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.
void set_array_of_index_variable(Index id, size_t n, const Index *src)
Deep-copy of ArrayOfIndex variable into workspace.
Index add_variable(Index group_id, const char *name)
Push a stack for a new variable to the workspace.
void set_numeric_variable(Index id, const Numeric &src)
Deep-copy of Numeric variable into workspace.
bool is_initialized(Index i)
Checks existence of the given WSV.
Definition: workspace_ng.h:118
void set_string_variable(Index id, const char *src)
Deep-copy of String variable into workspace.
void erase_variable(Index i, Index group_id)
Remove a variable stack from the workspace.
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.
static Index add_callback(Callback *cb)
Add callback to workspace.
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.
const char * execute_workspace_method(long id, const ArrayOfIndex &output, const ArrayOfIndex &input)
Execute workspace method.
void set_matrix_variable(Index id, size_t m, size_t n, const Numeric *src)
Deep-copy of Matrix variable into workspace.
void set_agenda_variable(Index id, const Agenda &src)
Set agenda variable into workspace.
static void initialize()
Workspace intialization.
void initialize_variable(Index id)
Initialize workspace variable.
Method runtime data.
Definition: agenda_class.h:121
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
Definition: matpackI.cc:739
The Matrix class.
Definition: matpackI.h:1225
Structure to hold all command line Parameters.
Definition: parameters.h:42
ArrayOfString includepath
List of paths to search for include files.
Definition: parameters.h:106
ArrayOfString datapath
List of paths to search for data files.
Definition: parameters.h:108
The range class.
Definition: matpackI.h:165
constexpr Index get_start() const ARTS_NOEXCEPT
Returns the start index of the range.
Definition: matpackI.h:332
constexpr Index get_extent() const ARTS_NOEXCEPT
Returns the extent of the range.
Definition: matpackI.h:334
The Sparse class.
Definition: matpackII.h:67
Index nnz() const
Returns the number of nonzero elements.
Definition: matpackII.cc:72
int * get_row_start_pointer()
Definition: matpackII.h:131
Numeric * get_element_pointer()
Definition: matpackII.h:129
int * get_column_index_pointer()
Definition: matpackII.h:130
Index nrows() const
Returns the number of rows.
Definition: matpackII.cc:66
Index ncols() const
Returns the number of columns.
Definition: matpackII.cc:69
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
Definition: matpackIII.cc:317
The Tensor3 class.
Definition: matpackIII.h:339
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
Definition: matpackIV.cc:354
The Tensor4 class.
Definition: matpackIV.h:421
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
Definition: matpackV.cc:674
The Tensor5 class.
Definition: matpackV.h:506
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
Definition: matpackVI.cc:1732
The Tensor6 class.
Definition: matpackVI.h:1088
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
Definition: matpackVII.cc:5011
The Tensor7 class.
Definition: matpackVII.h:2382
This stores arbitrary token values and remembers the type.
Definition: token.h:42
The Vector class.
Definition: matpackI.h:876
static Array< WsvRecord > wsv_data
Global WSV data.
Definition: workspace_ng.h:58
static map< String, Index > WsvMap
Global map associated with wsv_data.
Definition: workspace_ng.h:61
This class contains all static information for one workspace variable.
Definition: wsv_aux.h:56
const String & Name() const
Name of this workspace variable.
Definition: wsv_aux.h:102
const String & Description() const
A text describing this workspace variable.
Definition: wsv_aux.h:104
Index Group() const
The wsv group to which this variable belongs.
Definition: wsv_aux.h:106
#define ARTS_USER_ERROR_IF(condition,...)
Definition: debug.h:134
This file contains all declarations of the ARTS C API.
std::vector< Method > methods()
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
my_basic_string< char > String
The String type for ARTS.
Definition: mystring.h:287
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
Definition: zeemandata.h:109
const Array< MdRecord > md_data
Lookup information for workspace methods.
const map< String, Index > MdMap
The map associated with md_data.
Definition: methods_aux.cc:39
const ArrayOfString wsv_group_names
The names associated with Wsv groups as Strings.
Definition: global_data.h:90
This file contains header information for the dealing with command line parameters.
#define v
#define a
#define c
#define b
Covariance matrix block.
Definition: arts_api.h:172
Representation of workspace methods.
Definition: arts_api.h:97
Representation of ARTS WSVs.
Definition: arts_api.h:44
Representation of ARTS values.
Definition: arts_api.h:58
const int * inner_ptr
Additional array data for sparse matrices.
Definition: arts_api.h:84
long dimensions[7]
Dimensions of array data.
Definition: arts_api.h:78
const int * outer_ptr
Additional array data for sparse matrices.
Definition: arts_api.h:90
const void * ptr
Data pointer.
Definition: arts_api.h:64
ARTS version.
Definition: arts_api.h:157
long major
Major version number of ARTS.
Definition: arts_api.h:159
long minor
Minor version number of this ARTS major version.
Definition: arts_api.h:161
long revision
Revision number.
Definition: arts_api.h:163
This file contains the Workspace class.