ARTS  2.0.49
methods_aux.cc
Go to the documentation of this file.
1 /* Copyright (C) 2000-2008 Stefan Buehler <sbuehler@ltu.se>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
30 #include "arts.h"
31 #include <map>
32 #include "make_array.h"
33 #include "methods.h"
34 #include "wsv_aux.h"
35 #include "workspace_ng.h"
36 
37 
38 void limit_line_length( ostream& os, ostringstream& curline,
39  ostringstream& token, const String& indent,
40  size_t linelen);
41 
43 
49 MdRecord::MdRecord(const char name[],
50  const char description[],
51  const MakeArray<String>& authors,
52  const MakeArray<String>& output,
53  const MakeArray<String>& gout,
54  const MakeArray<String>& gouttype,
55  const MakeArray<String>& goutdesc,
56  const MakeArray<String>& input,
57  const MakeArray<String>& gin,
58  const MakeArray<String>& gintype,
59  const MakeArray<String>& gindefault,
60  const MakeArray<String>& gindesc,
61  bool set_method,
62  bool agenda_method,
63  bool suppress_header,
64  bool pass_workspace,
65  bool pass_wsv_names ) :
66  mname( name ),
67  mdescription( description ),
68  mauthors( authors ),
69  moutput( 0 ),
70  mgout( gout ),
71  mgouttype( 0 ),
72  mgoutdesc( goutdesc ),
73  minput( 0 ),
74  mgin( gin ),
75  mgintype( 0 ),
76  mgindefault( gindefault ),
77  mgindesc( gindesc ),
78  mset_method( set_method ),
79  magenda_method( agenda_method ),
80  msupergeneric( false ),
81  msuppress_header( suppress_header ),
82  mpass_workspace( pass_workspace ),
83  mpass_wsv_names( pass_wsv_names ),
84  mactual_groups( "" )
85 {
86  // Initializing the various arrays with input data should now
87  // work correctly.
88 
89  // Generic variable names, types and defaults must have the same number of
90  // elements. (Defaults specifies the default values associated with each
91  // generic input.)
92  assert( mgout.nelem() == gouttype.nelem() );
93  assert( mgout.nelem() == goutdesc.nelem() );
94  assert( mgin.nelem() == mgindefault.nelem() );
95  assert( mgin.nelem() == gintype.nelem() );
96  assert( mgin.nelem() == gindesc.nelem() );
97 
98  // Map the WSV names to indexes
99  moutput.resize(output.nelem());
100  for ( Index j=0; j<output.nelem(); ++j )
101  {
102  moutput[j] = get_wsv_id (output[j]);
103  if (moutput[j] == -1)
104  {
105  ostringstream os;
106  os << "Unknown WSV " << output[j] << " for output "
107  << "in WSM " << mname;
108  throw runtime_error( os.str() );
109  }
110  }
111 
112  minput.resize(input.nelem());
113  for ( Index j=0; j<input.nelem(); ++j )
114  {
115  minput[j] = get_wsv_id (input[j]);
116  if (minput[j] == -1)
117  {
118  ostringstream os;
119  os << "Unknown WSV " << input[j] << " for input "
120  << "in WSM " << mname;
121  throw runtime_error( os.str() );
122  }
123  }
124 
125  // Map the group names to groups' indexes
126  mgoutspectype.resize(gouttype.nelem());
127  mgouttype.resize(gouttype.nelem());
128  for ( Index j=0; j<gouttype.nelem(); ++j )
129  {
130  ArrayOfIndex types;
131  get_wsv_group_ids (types, gouttype[j]);
132 
133  if (types.nelem() == 1)
134  {
135  mgouttype[j] = types[0];
136  mgoutspectype[j].resize(0);
137  }
138  else if (types.nelem() > 1)
139  {
140  mgouttype[j] = get_wsv_group_id ("Any");
141  mgoutspectype[j] = types;
142  }
143  else
144  {
145  ostringstream os;
146  os << "Unknown WSV Group " << gouttype[j] << " for generic output "
147  << "in WSM " << mname;
148  throw runtime_error( os.str() );
149  }
150 
151  }
152 
153  mginspectype.resize(gintype.nelem());
154  mgintype.resize(gintype.nelem());
155  for ( Index j=0; j<gintype.nelem(); ++j )
156  {
157  ArrayOfIndex types;
158  get_wsv_group_ids (types, gintype[j]);
159 
160  if (types.nelem() == 1)
161  {
162  mgintype[j] = get_wsv_group_id (gintype[j]);
163  mginspectype[j].resize(0);
164  }
165  else if (types.nelem() > 1)
166  {
167  mgintype[j] = get_wsv_group_id ("Any");
168  mginspectype[j] = types;
169  }
170  else
171  {
172  ostringstream os;
173  os << "Unknown WSV Group " << gintype[j] << " for generic input "
174  << "in WSM " << mname;
175  throw runtime_error( os.str() );
176  }
177  }
178 
179  // Check that the number of types for all supergeneric variables are
180  // consistent
182  {
183  bool consistent = true;
184  Index nspecs = 0;
185  for (Index i = 0; consistent && i < mginspectype.nelem(); i++)
186  {
187  if (mginspectype[0].nelem())
188  {
189  if (!nspecs) nspecs = mginspectype[0].nelem();
190  else if (nspecs != mginspectype[0].nelem()) consistent = false;
191  }
192  }
193 
194  for (Index i = 0; consistent && i < mgoutspectype.nelem(); i++)
195  {
196  if (mgoutspectype[0].nelem())
197  {
198  if (!nspecs) nspecs = mgoutspectype[0].nelem();
199  else if (nspecs != mgoutspectype[0].nelem()) consistent = false;
200  }
201  }
202  if (!consistent)
203  {
204  ostringstream os;
205  os << "Inconsistent number of types given for supergeneric variables"
206  << endl << "in WSM " << mname << "." << endl;
207  throw runtime_error (os.str());
208  }
209  }
210 
211  // Find out if this method is supergeneric, and set the flag if
212  // yes:
213  const Index anyid = get_wsv_group_id("Any");
214  for ( Index j=0; j<mgouttype.nelem(); ++j )
215  if ( anyid == mgouttype[j] )
216  msupergeneric = true;
217  for ( Index j=0; j<mgintype.nelem(); ++j )
218  if ( anyid == mgintype[j] )
219  msupergeneric = true;
220 
221  // Determine variables that are only input
222  minonly = minput; // Input
223  for (ArrayOfIndex::const_iterator j=moutput.begin(); j<moutput.end(); ++j)
224  for (ArrayOfIndex::iterator k=minonly.begin(); k<minonly.end(); ++k)
225  if ( *j == *k )
226  {
227  k = minonly.erase(k) - 1;
228  // We need the -1 here, otherwise due to the
229  // following increment we would miss the element
230  // behind the erased one, which is now at the
231  // position of the erased one.
232  }
233 
234  // Determine variables that are input and output
235  minout.resize(0);
236  Index i = 0;
237  for (ArrayOfIndex::const_iterator j=moutput.begin(); j<moutput.end(); ++j,++i)
238  for (ArrayOfIndex::const_iterator k=minput.begin(); k<minput.end(); ++k)
239  if ( *j == *k )
240  minout.push_back(i);
241 
242  // Determine variables that are only output
243  moutonly = moutput; // Output
244  for (ArrayOfIndex::const_iterator j=minput.begin(); j<minput.end(); ++j)
245  for (ArrayOfIndex::iterator k=moutonly.begin(); k<moutonly.end(); ++k)
246  if ( *j == *k )
247  {
248  k = moutonly.erase(k) - 1;
249  // We need the -1 here, otherwise due to the
250  // following increment we would miss the element
251  // behind the erased one, which is now at the
252  // position of the erased one.
253  }
254 
255 }
256 
257 
259 
269 {
270  const Index wsv_group_id_Any = get_wsv_group_id("Any");
271  // The group names, we need them for the expansion:
272  extern const ArrayOfString wsv_group_names;
273 
274  // Make sure they are initialized:
275  assert( 0 != wsv_group_names.nelem() );
276 
277  // Make sure that g is in the allowed range, which means
278  // 0<=g<wsv_group_names.nelem() and g != Any_
279  assert( 0 <= g );
280  assert( wsv_group_id_Any != g );
281  assert( g < wsv_group_names.nelem() );
282 
283  // Make sure that this really is a supergeneric method:
284  assert( Supergeneric() );
285 
286  // Modify the name:
287 // {
288 // ostringstream os;
289 // os << mname << "_sg_" << wsv_group_names[g];
290 // mname = os.str();
291 // }
292 
293  for ( Index j=0; j<mgouttype.nelem(); ++j )
294  if ( wsv_group_id_Any == mgouttype[j] ) mgouttype[j] = g;
295  for ( Index j=0; j<mgintype.nelem(); ++j )
296  if ( wsv_group_id_Any == mgintype[j] ) mgintype[j] = g;
297 
298  // Set the field for the actual group:
300 }
301 
302 
304 
314 {
315  // The group names, we need them for the expansion:
316  extern const ArrayOfString wsv_group_names;
317 
318  const Index wsv_group_id_Any = get_wsv_group_id("Any");
319 
320  // Make sure that g is in the allowed range, which means
321  // 0<=g<wsv_group_names.nelem() and g != Any_
322  assert( 0 <= g );
323 
324  // Make sure that this really is a supergeneric method:
325  assert( Supergeneric() );
326 
327  // Modify the name:
328 // {
329 // ostringstream os;
330 // os << mname << "_sg_" << wsv_group_names[g];
331 // mname = os.str();
332 // }
333 
334  mactual_groups = "";
335  for ( Index j=0; j<mgouttype.nelem(); ++j )
336  if ( wsv_group_id_Any == mgouttype[j] )
337  {
338  mgouttype[j] = mgoutspectype[j][g];
339  // Set the field for the actual group:
341  }
342 
343  for ( Index j=0; j<mgintype.nelem(); ++j )
344  if ( wsv_group_id_Any == mgintype[j] )
345  {
346  mgintype[j] = mginspectype[j][g];
347  // Set the field for the actual group:
349  }
350 
351 }
352 
353 
355 
365 {
366  extern const Array<MdRecord> md_data_raw;
367  extern Array<MdRecord> md_data;
368 
369  // The group names, we need them for the expansion:
370  extern const ArrayOfString wsv_group_names;
371 
372  const Index wsv_group_id_Any = get_wsv_group_id("Any");
373 
374  // Make sure that they have been initialized:
375  assert ( 0!=wsv_group_names.nelem() );
376 
377  // Reset md_data, just in case:
378  md_data.resize(0);
379 
380  for ( Index i=0; i<md_data_raw.nelem(); ++i )
381  {
382  const MdRecord& mdd = md_data_raw[i];
383 
384  if ( !mdd.Supergeneric() )
385  {
386  md_data.push_back(mdd);
387  }
388  else
389  {
390  // Special treatment for supergeneric methods:
391 
392  // Check if the method is really supergeneric or just valid
393  // for certain types.
394 
395  if ((mdd.GInSpecType().nelem() && mdd.GInSpecType()[0].nelem())
396  || (mdd.GOutSpecType().nelem() && mdd.GOutSpecType()[0].nelem()))
397  {
398  Index max = 0;
399  if (mdd.GInSpecType().nelem())
400  max = mdd.GInSpecType()[0].nelem();
401  if (mdd.GOutSpecType().nelem()
402  && mdd.GOutSpecType()[0].nelem() > max )
403  max = mdd.GOutSpecType()[0].nelem();
404 
405  for (Index k=0; k<max; k++)
406  {
407  MdRecord mdlocal = mdd;
408 
410 
411  md_data.push_back(mdlocal);
412  }
413  }
414  else
415  {
416  for ( Index j=0; j<wsv_group_names.nelem(); ++j )
417  {
418  // Any_ itself is also a group, but we don't want to
419  // create a record for Any_!
420  if ( wsv_group_id_Any != j )
421  {
422  // Not a reference but a copy this time, since we
423  // have to manipulate this.
424  MdRecord mdlocal = mdd;
425 
426  mdlocal.subst_any_with_group( j );
427 
428  md_data.push_back(mdlocal);
429  }
430  }
431  }
432  }
433  }
434 }
435 
437 
441 {
442  // md_data is constant here and should never be changed
443  extern Array<MdRecord> md_data;
444  extern map<String, Index> MdMap;
445  DEBUG_ONLY( extern const ArrayOfString wsv_group_names; )
446 
447  // Check that md_data and wsv_group_names have already be defined:
448  assert( 0 != md_data.nelem() );
449  assert( 0 != wsv_group_names.nelem() );
450 
451  for ( Index i=0 ; i<md_data.nelem() ; ++i)
452  {
453  const MdRecord& mdd = md_data[i];
454 
455  // For supergeneric methods, add group to method name
456  String methodname;
457  ostringstream os;
458  if ( mdd.Supergeneric() )
459  {
460  os << mdd.Name() << "_sg_"
461  << mdd.ActualGroups();
462  }
463  else
464  {
465  os << mdd.Name();
466  }
467  methodname = os.str();
468 
469  MdMap[methodname] = i;
470  }
471 }
472 
474 
483 {
484  extern const Array<MdRecord> md_data_raw;
485  extern map<String, Index> MdRawMap;
486 
487  for ( Index i=0 ; i<md_data_raw.nelem() ; ++i)
488  {
489  MdRawMap[md_data_raw[i].Name()] = i;
490  }
491 }
492 
493 
494 bool format_paragraph (String &s, const String &indent, const size_t linelen,
495  const size_t offset)
496 {
497  bool fit = true;
498  String out;
499  String token;
500  size_t currentlinelength = offset;
501  for (size_t i = 0; i < s.length(); i++)
502  {
503  if (s[i] == '\n') s[i] = ' ';
504  token += s[i];
505  if (s[i] == ' ')
506  {
507  if (currentlinelength + token.length() > linelen)
508  {
509  out += '\n' + indent;
510  currentlinelength = indent.length();
511  fit = false;
512  }
513  out += token;
514  currentlinelength += token.length();
515  token = "";
516  }
517  }
518 
519  if (token.length())
520  {
521  if (currentlinelength + token.length() > linelen)
522  {
523  out += '\n' + indent;
524  fit = false;
525  }
526  out += token;
527  }
528  s = out;
529  return fit;
530 }
531 
532 
534 {
535  Index pos;
536  Index pos2;
537 
538  // Find the end of the short WSV description
539  pos = desc.find(".\n");
540  pos2 = desc.find(". ");
541  if (pos == String::npos || (pos2 != String::npos && pos2 < pos)) pos = pos2;
542  if (pos == String::npos) pos = desc.find("\n");
543  if (pos != String::npos)
544  s = desc.substr(0, pos+1);
545  else
546  s = desc;
547 
548  // Replace any newlines inside the description with spaces
549  while ((pos = s.find("\n")) != String::npos)
550  {
551  s.replace (pos, 1, " ");
552  }
553 }
554 
555 
556 ostream& MdRecord::PrintTemplate(ostream& os,
557  bool show_description) const
558 {
559  extern const ArrayOfString wsv_group_names;
560 
561  if (show_description)
562  {
563  // FIXME: Print description String!
564  }
565 
566  os << Name();
567 
568  // Is this a generic method? -- Then we need round braces.
569  if ( 0 != GOutType().nelem()+GInType().nelem() )
570  {
571  // First entry needs to comma before:
572  bool first=true;
573 
574  os << '(';
575 
576  for (Index i=0; i<GOutType().nelem(); ++i)
577  {
578  if (first) first=false;
579  else os << ",\n";
580 
581  os << wsv_group_names[GOutType()[i]];
582  }
583 
584  for (Index i=0; i<GInType().nelem(); ++i)
585  {
586  if (first) first=false;
587  else os << ",\n";
588 
589  os << wsv_group_names[GInType()[i]];
590  }
591 
592  os << ')';
593  }
594 
595  // Now the keywords:
596 
597  os << '{';
598 
599  // Determine the length of the longest keyword:
600  Index maxsize = 0;
601  for (Index i=0; i<GIn().nelem(); ++i)
602  if ( GIn()[i].nelem() > maxsize )
603  maxsize = GIn()[i].nelem();
604 
605 
606  for (Index i=0; i<GIn().nelem(); ++i)
607  {
608  os << "\t" << setw((int)maxsize)
609  << GIn()[i] << " = \n";
610  }
611 
612  os << '}';
613 
614  return os;
615 }
616 
617 
619 
624 void limit_line_length( ostream& os,
625  ostringstream& curline,
626  ostringstream& token,
627  const String& indent,
628  size_t linelen)
629 {
630  if (indent.length() + curline.str().length() + token.str().length() > linelen)
631  {
632  os << curline.str() << endl << indent;
633  curline.str("");
634  }
635  curline << token.str();
636  token.str("");
637 }
638 
639 
641 ostream& operator<<(ostream& os, const MdRecord& mdr)
642 {
643  extern const ArrayOfString wsv_group_names;
644  bool first;
645  ostringstream buf;
646  ostringstream param;
647  String indent = "";
648  const size_t linelen = 68;
649  bool fit;
650  size_t lastlen;
651 
652  os << "\n*-------------------------------------------------------------------*\n"
653  << "Workspace method = " << mdr.Name() <<
654  "\n---------------------------------------------------------------------\n"
655  << "\n" << mdr.Description() << "\n";
656 
657  if (mdr.Description()[mdr.Description().nelem() - 1] != '\n')
658  {
659  os << "\n";
660  }
661 
662  // Print the method's synopsis
663  while (indent.length() < mdr.Name().length() + 2) indent += ' ';
664 
665  os << "\nSynopsis:\n\n";
666  buf << mdr.Name() << "( ";
667  first = true;
668  for ( Index i=0; i<mdr.Out().nelem(); ++i )
669  {
670  if (first) first=false; else buf << ", ";
671  param << Workspace::wsv_data[mdr.Out()[i]].Name();
672 
673  limit_line_length( os, buf, param, indent, linelen );
674  }
675 
676  for ( Index i=0; i<mdr.GOutType().nelem(); ++i )
677  {
678  if (first) first=false; else buf << ", ";
679  if (mdr.GOut()[i].length())
680  param << mdr.GOut()[i];
681  else
682  param << "gout" << i;
683 
684  limit_line_length( os, buf, param, indent, linelen );
685  }
686 
687  const ArrayOfIndex &inonly = mdr.InOnly();
688  for ( Index i=0; i<inonly.nelem(); ++i )
689  {
690  if (first) first=false; else buf << ", ";
691  param << Workspace::wsv_data[inonly[i]].Name();
692 
693  limit_line_length( os, buf, param, indent, linelen );
694  }
695 
696  for ( Index i=0; i<mdr.GInType().nelem(); ++i )
697  {
698  if (first) first=false; else buf << ", ";
699  if (mdr.GIn()[i].length())
700  {
701  param << mdr.GIn()[i];
702  }
703  else
704  {
705  param << "gin" << i;
706  }
707 
708  limit_line_length( os, buf, param, indent, linelen );
709  }
710  if (buf.str().length()) os << buf.str();
711 
712  os << " )\n\n\n";
713 
714  {
715  bool is_first_author = true;
716  for (Index i = 0; i < mdr.Authors().nelem(); i++)
717  {
718  if (is_first_author)
719  {
720  os << "Authors: ";
721  is_first_author = false;
722  }
723  else
724  os << ", ";
725 
726  os << mdr.Authors()[i];
727  }
728  os << "\n";
729  }
730 
731  os << "\n\nVariables:\n\n";
732 
733  // os << "\n-----\nName = " << mdr.Name() << '\n\n'
734  // << "Description =\n" << mdr.Description() << "\n\n";
735 
736  // Out:
737  indent = String(6);
738  String desc;
739  for ( Index i=0; i<mdr.Out().nelem(); ++i )
740  {
741  buf.str("");
742  buf << "OUT ";
743 
744  buf << Workspace::wsv_data[mdr.Out()[i]].Name();
745  buf << " (";
746  buf << wsv_group_names[Workspace::wsv_data[mdr.Out()[i]].Group()];
747  buf << "): ";
748 
750  desc, Workspace::wsv_data[mdr.Out()[i]].Description());
751 
752  if (buf.str().length() + desc.length() > linelen)
753  {
754  format_paragraph (desc, indent, linelen);
755  buf << endl << indent << desc;
756  }
757  else
758  {
759  buf << desc;
760  }
761 
762  os << buf.str() << endl;
763  }
764 
765  for ( Index i=0; i<mdr.GOut().nelem(); ++i )
766  {
767  buf.str("");
768  buf << "GOUT " << mdr.GOut()[i] << " (";
769  if (mdr.GOutType()[i] == get_wsv_group_id("Any")
770  && mdr.GOutSpecType()[i].nelem())
771  {
772  bool firstarg = true;
773  for (Index j = 0; j < mdr.GOutSpecType()[i].nelem(); j++)
774  {
775  if (!firstarg) buf << ", "; else firstarg = false;
776  buf << wsv_group_names[mdr.GOutSpecType()[i][j]];
777  }
778  }
779  else
780  {
781  buf << wsv_group_names[mdr.GOutType()[i]];
782  }
783 
784  buf << "): ";
785  desc = buf.str();
786  lastlen = desc.length();
787  fit = format_paragraph (desc, indent, linelen);
788  buf.str("");
789  os << desc;
790 
791  desc = mdr.GOutDescription()[i];
792  if (!fit)
793  {
794  format_paragraph (desc, indent, linelen);
795  buf << endl << indent << desc;
796  }
797  else if (lastlen + desc.length() > linelen)
798  {
799  format_paragraph (desc, indent, linelen, lastlen);
800  buf << endl << desc;
801  }
802  else
803  {
804  buf << desc;
805  }
806 
807  os << buf.str() << endl;
808  }
809 
810  for ( Index i=0; i<mdr.In().nelem(); ++i )
811  {
812  buf.str("");
813  buf << "IN ";
814 
815  buf << Workspace::wsv_data[mdr.In()[i]].Name();
816  buf << " (";
817  buf << wsv_group_names[Workspace::wsv_data[mdr.In()[i]].Group()];
818  buf << "): ";
819 
821  desc, Workspace::wsv_data[mdr.In()[i]].Description());
822 
823  if (buf.str().length() + desc.length() > linelen)
824  {
825  format_paragraph (desc, indent, linelen, indent.length());
826  buf << endl << indent << desc;
827  }
828  else
829  {
830  buf << desc;
831  }
832 
833  os << buf.str() << endl;
834  }
835 
836  for ( Index i=0; i<mdr.GIn().nelem(); ++i )
837  {
838  buf.str("");
839  buf << "GIN " << mdr.GIn()[i] << " (";
840  if (mdr.GInType()[i] == get_wsv_group_id("Any")
841  && mdr.GInSpecType()[i].nelem())
842  {
843  bool firstarg = true;
844  for (Index j = 0; j < mdr.GInSpecType()[i].nelem(); j++)
845  {
846  if (!firstarg) buf << ", "; else firstarg = false;
847  buf << wsv_group_names[mdr.GInSpecType()[i][j]];
848  }
849  }
850  else
851  {
852  buf << wsv_group_names[mdr.GInType()[i]];
853  }
854 
855  if (mdr.GInDefault()[i] != NODEF)
856  {
857  buf << ", Default: ";
858  if (mdr.GInType()[i] == get_wsv_group_id ("String"))
859  {
860  buf << "\"" << mdr.GInDefault()[i] << "\"";
861  }
862  else
863  {
864  buf << mdr.GInDefault()[i];
865  }
866 
867  }
868 
869  buf << "): ";
870  desc = buf.str();
871  lastlen = desc.length();
872  fit = format_paragraph (desc, indent, linelen);
873  buf.str("");
874  os << desc;
875 
876  desc = mdr.GInDescription()[i];
877  if (!fit)
878  {
879  format_paragraph (desc, indent, linelen);
880  buf << endl << indent << desc;
881  }
882  else if (lastlen + desc.length() > linelen)
883  {
884  format_paragraph (desc, indent, linelen, indent.length());
885  buf << endl << indent << desc;
886  }
887  else
888  {
889  buf << desc;
890  }
891 
892  os << buf.str() << endl;
893  }
894 
895  os << "\n*-------------------------------------------------------------------*\n";
896 
897  return os;
898 }
899 
MdRecord::GOut
const ArrayOfString & GOut() const
Definition: methods.h:93
limit_line_length
void limit_line_length(ostream &os, ostringstream &curline, ostringstream &token, const String &indent, size_t linelen)
Limit length of output.
Definition: methods_aux.cc:624
Workspace::wsv_data
static Array< WsvRecord > wsv_data
Definition: workspace_ng.h:59
MdRecord::Supergeneric
bool Supergeneric() const
Definition: methods.h:108
MdRecord::GOutSpecType
const ArrayOfArrayOfIndex & GOutSpecType() const
Definition: methods.h:95
MdRecord::GOutType
const ArrayOfIndex & GOutType() const
Definition: methods.h:94
MdRecord::mgouttype
ArrayOfIndex mgouttype
Generic Workspace Output Type.
Definition: methods.h:164
md_data_raw
Array< MdRecord > md_data_raw
Lookup information for workspace methods.
Definition: globals_2.cc:54
MdRecord::GInType
const ArrayOfIndex & GInType() const
Definition: methods.h:99
get_wsv_id
Index get_wsv_id(const String &name)
Get index of WSV.
Definition: workspace.cc:4555
MdRecord::mgoutspectype
ArrayOfArrayOfIndex mgoutspectype
Generic Workspace Output Types (Contains the valid types if the method.
Definition: methods.h:168
define_md_raw_map
void define_md_raw_map()
Define MdRawMap.
Definition: methods_aux.cc:482
MdRecord::MdRecord
MdRecord()
Default constructor.
Definition: methods.h:46
MdRecord::mgintype
ArrayOfIndex mgintype
Generic Workspace Input.
Definition: methods.h:180
get_short_wsv_description
void get_short_wsv_description(String &s, const String &desc)
Definition: methods_aux.cc:533
DEBUG_ONLY
#define DEBUG_ONLY(...)
Definition: arts.h:146
Array< Index >
MdRecord::minout
ArrayOfIndex minout
Indexes of Input-Output variables.
Definition: methods.h:199
MdRecord::mname
String mname
The name of this method.
Definition: methods.h:149
MdRecord::ActualGroups
const String & ActualGroups() const
Definition: methods.h:112
MdRecord::minput
ArrayOfIndex minput
Workspace Input.
Definition: methods.h:174
my_basic_string
The implementation for String, the ARTS string class.
Definition: mystring.h:62
NODEF
#define NODEF
Definition: methods.h:36
MdRecord::GInDescription
const Array< String > & GInDescription() const
Definition: methods.h:102
get_wsv_group_ids
void get_wsv_group_ids(ArrayOfIndex &ids, String name)
Definition: groups.cc:155
wsv_group_names
ArrayOfString wsv_group_names
Definition: groups.cc:40
MdRawMap
map< String, Index > MdRawMap
The map associated with md_data_raw.
Definition: globals_2.cc:68
make_array.h
Implements the class MakeArray, which is a derived class of Array, allowing explicit initialization.
MdRecord::Name
const String & Name() const
Definition: methods.h:89
MdRecord::In
const ArrayOfIndex & In() const
Definition: methods.h:97
MdRecord::InOnly
const ArrayOfIndex & InOnly() const
Definition: methods.h:103
MdRecord::mgin
ArrayOfString mgin
Generic Workspace Input Names.
Definition: methods.h:177
MdRecord::GOutDescription
const Array< String > & GOutDescription() const
Definition: methods.h:96
max
#define max(a, b)
Definition: continua.cc:13097
my_basic_string::nelem
Index nelem() const
Number of elements.
Definition: mystring.h:242
MdRecord::GInDefault
const Array< String > & GInDefault() const
Definition: methods.h:101
MdRecord::mgout
ArrayOfString mgout
Generic Workspace Output Names.
Definition: methods.h:161
md_data
Array< MdRecord > md_data
Lookup information for workspace methods.
Definition: globals_2.cc:62
MdRecord::mgindefault
ArrayOfString mgindefault
Generic Workspace Input Defaults.
Definition: methods.h:187
MdRecord::GIn
const ArrayOfString & GIn() const
Definition: methods.h:98
operator<<
ostream & operator<<(ostream &os, const MdRecord &mdr)
Output operator for MdRecord.
Definition: methods_aux.cc:641
format_paragraph
bool format_paragraph(String &s, const String &indent, const size_t linelen, const size_t offset)
Definition: methods_aux.cc:494
workspace_ng.h
This file contains the declaration and partly the implementation of the workspace class.
MdRecord
All information for one workspace method.
Definition: methods.h:42
MdRecord::subst_any_with_specific_group
void subst_any_with_specific_group(Index g)
Expand supergeneric record for given Index in GOutSpecType and GInSpecType.
Definition: methods_aux.cc:313
String
my_basic_string< char > String
The String type for ARTS.
Definition: mystring.h:305
MdRecord::GInSpecType
const ArrayOfArrayOfIndex & GInSpecType() const
Definition: methods.h:100
expand_md_data_raw_to_md_data
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
Definition: methods_aux.cc:364
MdRecord::subst_any_with_group
void subst_any_with_group(Index g)
Expand supergeneric record for given group.
Definition: methods_aux.cc:268
MdMap
map< String, Index > MdMap
The map associated with md_data.
Definition: globals_2.cc:65
MdRecord::PrintTemplate
ostream & PrintTemplate(ostream &os, bool show_description=true) const
Print method template for the control file.
Definition: methods_aux.cc:556
MdRecord::mginspectype
ArrayOfArrayOfIndex mginspectype
Generic Workspace Input Types (Contains the valid types if the method.
Definition: methods.h:184
MakeArray
Explicit construction of Arrays.
Definition: make_array.h:52
MdRecord::mactual_groups
String mactual_groups
The actual groups of a supergeneric method.
Definition: methods.h:248
MdRecord::msupergeneric
bool msupergeneric
Flag, whether this method is supergeneric.
Definition: methods.h:220
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
MdRecord::Out
const ArrayOfIndex & Out() const
Definition: methods.h:92
my_basic_string::npos
static const Index npos
Define npos:
Definition: mystring.h:96
MdRecord::minonly
ArrayOfIndex minonly
Indexes of Input-only variables.
Definition: methods.h:193
get_wsv_group_id
Index get_wsv_group_id(const String &name)
Definition: groups.cc:192
MdRecord::moutput
ArrayOfIndex moutput
Workspace Output.
Definition: methods.h:158
MdRecord::Description
const String & Description() const
Definition: methods.h:90
define_md_map
void define_md_map()
Define MdMap.
Definition: methods_aux.cc:440
Array::nelem
Index nelem() const
Number of elements.
Definition: array.h:172
methods.h
Declaration of the class MdRecord.
wsv_aux.h
Auxiliary header stuff related to workspace variable groups.
MdRecord::Authors
const ArrayOfString & Authors() const
Definition: methods.h:91
arts.h
The global header file for ARTS.
MdRecord::moutonly
ArrayOfIndex moutonly
Indexes of Output-only variables.
Definition: methods.h:196