33 #ifndef gridded_fields_h 34 #define gridded_fields_h 49 #define CHECK_ERROR_BOILERPLATE \ 50 "size mismatch between grids and data.\n" \ 51 "Note that a grid is allowed to be empty, but in the\n" \ 52 "data that dimension must have exactly one element.\n" 124 switch (mgridtypes[i])
127 ret = mnumericgrids[i].
nelem();
break;
217 std::ostringstream os;
218 os <<
"GriddedField1 ";
225 os <<
" = " << data.nelem();
226 throw std::runtime_error(os.str());
270 std::ostringstream os;
271 os <<
"GriddedField2 ";
274 for (
Index i = 0; i < 2; i++)
281 os <<
" = " << data.nrows() <<
", " << data.ncols();
282 throw std::runtime_error(os.str());
336 std::ostringstream os;
337 os <<
"GriddedField3 ";
340 for (
Index i = 0; i < 3; i++)
347 os <<
" = " << data.npages() <<
", " << data.nrows() <<
", " << data.ncols();
348 throw std::runtime_error(os.str());
365 data.resize(p, r, c);
398 std::ostringstream os;
399 os <<
"GriddedField4 ";
402 for (
Index i = 0; i < 4; i++)
409 os <<
" = " << data.nbooks() <<
", " << data.npages() <<
", ";
410 os << data.nrows() <<
", " << data.ncols();
411 throw std::runtime_error(os.str());
429 data.resize(b, p, r, c);
464 std::ostringstream os;
465 os <<
"GriddedField5 ";
468 for (
Index i = 0; i < 5; i++)
475 os <<
" = " << data.nshelves() <<
", " << data.nbooks() <<
", ";
476 os << data.npages() <<
", " << data.nrows() <<
", " << data.ncols();
477 throw std::runtime_error(os.str());
496 data.resize(s, b, p, r, c);
533 std::ostringstream os;
534 os <<
"GriddedField6 ";
537 for (
Index i = 0; i < 5; i++)
544 os <<
" = " << data.nvitrines() << data.nshelves() <<
", " << data.nbooks() <<
", ";
545 os << data.npages() <<
", " << data.nrows() <<
", " << data.ncols();
546 throw std::runtime_error(os.str());
566 data.resize(v, s, b, p, r, c);
596 #undef CHECK_ERROR_BOILERPLATE INDEX Index
The type to use for all integer numbers and indices.
GriddedField5()
Construct an empty GriddedField5.
Index nelem() const
Number of elements.
virtual bool checksize() const =0
Consistency check.
Array< GriddedField3 > ArrayOfGriddedField3
void resize(const GriddedField1 &gf)
Make this GriddedField1 the same size as the given one.
GriddedField(const Index d, const String &s)
Construct a GriddedField.
virtual void checksize_strict() const
Strict consistency check.
Array< GriddedField2 > ArrayOfGriddedField2
#define CHECK_ERROR_BOILERPLATE
ConstVectorView get_numeric_grid(Index i) const
Get a numeric grid.
const ArrayOfString & get_string_grid(Index i) const
Get a string grid.
virtual void checksize_strict() const =0
Strict consistency check.
virtual void checksize_strict() const
Strict consistency check.
void resize(const GriddedField6 &gf)
Make this GriddedField6 the same size as the given one.
virtual bool checksize() const
Consistency check.
GriddedField1()
Construct an empty GriddedField1.
GriddedField()
Construct an empty GriddedField.
GridType get_grid_type(Index i) const
Get grid type.
virtual bool checksize() const
Consistency check.
Array< Array< GriddedField2 > > ArrayOfArrayOfGriddedField2
Array< GriddedField4 > ArrayOfGriddedField4
void resize(const GriddedField4 &gf)
Make this GriddedField4 the same size as the given one.
Array< GriddedField1 > ArrayOfGriddedField1
void copy_grids(const GriddedField &gf)
Copy grids.
This file contains the definition of Array.
GriddedField6()
Construct an empty GriddedField6.
const String & get_name() const
Get the name of this gridded field.
Index get_dim() const
Get the dimension of this gridded field.
GriddedField2()
Construct an empty GriddedField2.
virtual bool checksize() const
Consistency check.
virtual bool checksize() const
Consistency check.
GriddedField5(const String &s)
Construct an empty GriddedField5 with the given name.
void resize(Index r, Index c)
Resize the data matrix.
GriddedField3(const String &s)
Construct an empty GriddedField3 with the given name.
Array< GridType > ArrayOfGridType
GriddedField3()
Construct an empty GriddedField3.
ArrayOfVector mnumericgrids
GriddedField4()
Construct an empty GriddedField4.
void resize(Index v, Index s, Index b, Index p, Index r, Index c)
Resize the data tensor.
void set_grid(Index i, const Vector &g)
Set a numeric grid.
Index get_grid_size(Index i) const
Get the size of a grid.
GriddedField3 & operator=(Numeric n)
Array< ArrayOfString > mstringgrids
void resize(const GriddedField2 &gf)
Make this GriddedField2 the same size as the given one.
virtual void checksize_strict() const
Strict consistency check.
virtual void checksize_strict() const
Strict consistency check.
void resize(Index b, Index p, Index r, Index c)
Resize the data tensor.
NUMERIC Numeric
The type to use for all floating point numbers.
GriddedField6(const String &s)
Construct an empty GriddedField6 with the given name.
friend std::ostream & operator<<(std::ostream &os, const GriddedField &gf)
Array< Array< GriddedField3 > > ArrayOfArrayOfGriddedField3
virtual bool checksize() const
Consistency check.
GriddedField2(const String &s)
Construct an empty GriddedField2 with the given name.
GriddedField4(const String &s)
Construct an empty GriddedField4 with the given name.
void resize(Index p, Index r, Index c)
Resize the data tensor.
void resize(Index n)
Resize the data vector.
const String & get_grid_name(Index i) const
Get grid name.
void resize(Index s, Index b, Index p, Index r, Index c)
Resize the data tensor.
A constant view of a Vector.
void set_name(const String &s)
Set name of this gridded field.
GriddedField1(const String &s)
Construct an empty GriddedField1 with the given name.
void set_grid_name(Index i, const String &s)
Set grid name.
Array< Array< GriddedField1 > > ArrayOfArrayOfGriddedField1
virtual void checksize_strict() const
Strict consistency check.
void resize(const GriddedField5 &gf)
Make this GriddedField5 the same size as the given one.
virtual void checksize_strict() const
Strict consistency check.
virtual bool checksize() const
Consistency check.
void resize(const GriddedField3 &gf)
Make this GriddedField3 the same size as the given one.
virtual ~GriddedField()
GriddedField virtual destructor.
Array< GridType > mgridtypes
This file contains the definition of String, the ARTS string class.