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