33#ifndef gridded_fields_h
34#define gridded_fields_h
46#define CHECK_ERROR_BOILERPLATE \
47 "size mismatch between grids and data.\n" \
48 "Note that a grid is allowed to be empty, but in the\n" \
49 "data that dimension must have exactly one element.\n"
51template <Index N,
typename Gr
iddedFieldType>
53 std::ostringstream os;
54 os <<
"GriddedField" <<
N <<
" ";
55 if (gf.get_name().length()) os <<
"(" << gf.get_name() <<
") ";
57 for (
Index i = 0; i <
N; i++) {
59 if (gf.get_grid_name(i).nelem()) os <<
" (" << gf.get_grid_name(i) <<
")";
60 os <<
" = " << gf.get_grid_size(i) <<
"\n";
64 os <<
' ' <<gf.data.nlibraries();
66 os <<
' ' <<gf.data.nvitrines();
68 os <<
' ' <<gf.data.nshelves();
70 os <<
' ' <<gf.data.nbooks();
72 os <<
' ' <<gf.data.npages();
74 os <<
' ' <<gf.data.nrows() <<
' ' << gf.data.ncols();
76 os <<
' ' << gf.data.nelem();
500#undef CHECK_ERROR_BOILERPLATE
This file contains the definition of Array.
Index nelem() const ARTS_NOEXCEPT
Number of elements.
Index nrows() const noexcept
Index ncols() const noexcept
Index npages() const
Returns the number of pages.
Index nrows() const
Returns the number of rows.
Index ncols() const
Returns the number of columns.
Index ncols() const noexcept
Index nrows() const noexcept
Index nbooks() const noexcept
Index npages() const noexcept
Index nrows() const noexcept
Index ncols() const noexcept
Index npages() const noexcept
Index nbooks() const noexcept
Index nshelves() const noexcept
Index nbooks() const noexcept
Index nvitrines() const noexcept
Index ncols() const noexcept
Index npages() const noexcept
Index nshelves() const noexcept
Index nrows() const noexcept
Index nelem() const noexcept
Returns the number of elements.
void checksize_strict() const final
Strict consistency check.
void resize(Index n)
Resize the data vector.
GriddedField1(const String &s)
Construct an empty GriddedField1 with the given name.
void resize(const GriddedField1 &gf)
Make this GriddedField1 the same size as the given one.
friend std::ostream & operator<<(std::ostream &os, const GriddedField1 &gf)
GriddedField1()
Construct an empty GriddedField1.
bool checksize() const final
Consistency check.
void resize(const GriddedField2 &gf)
Make this GriddedField2 the same size as the given one.
void checksize_strict() const final
Strict consistency check.
void resize(Index r, Index c)
Resize the data matrix.
bool checksize() const final
Consistency check.
GriddedField2()
Construct an empty GriddedField2.
friend std::ostream & operator<<(std::ostream &os, const GriddedField2 &gf)
GriddedField2(const String &s)
Construct an empty GriddedField2 with the given name.
GriddedField3(const String &s)
Construct an empty GriddedField3 with the given name.
void resize(Index p, Index r, Index c)
Resize the data tensor.
void checksize_strict() const final
Strict consistency check.
GriddedField3 & operator=(Numeric n)
bool checksize() const final
Consistency check.
void resize(const GriddedField3 &gf)
Make this GriddedField3 the same size as the given one.
GriddedField3()
Construct an empty GriddedField3.
friend std::ostream & operator<<(std::ostream &os, const GriddedField3 &gf)
void checksize_strict() const final
Strict consistency check.
GriddedField4(const String &s)
Construct an empty GriddedField4 with the given name.
bool checksize() const final
Consistency check.
friend std::ostream & operator<<(std::ostream &os, const GriddedField4 &gf)
void resize(const GriddedField4 &gf)
Make this GriddedField4 the same size as the given one.
GriddedField4()
Construct an empty GriddedField4.
void resize(Index b, Index p, Index r, Index c)
Resize the data tensor.
GriddedField5()
Construct an empty GriddedField5.
void checksize_strict() const final
Strict consistency check.
GriddedField5(const String &s)
Construct an empty GriddedField5 with the given name.
void resize(Index s, Index b, Index p, Index r, Index c)
Resize the data tensor.
bool checksize() const final
Consistency check.
friend std::ostream & operator<<(std::ostream &os, const GriddedField5 &gf)
void resize(const GriddedField5 &gf)
Make this GriddedField5 the same size as the given one.
bool checksize() const final
Consistency check.
void resize(const GriddedField6 &gf)
Make this GriddedField6 the same size as the given one.
void checksize_strict() const final
Strict consistency check.
void resize(Index v, Index s, Index b, Index p, Index r, Index c)
Resize the data tensor.
GriddedField6()
Construct an empty GriddedField6.
GriddedField6(const String &s)
Construct an empty GriddedField6 with the given name.
friend std::ostream & operator<<(std::ostream &os, const GriddedField6 &gf)
ArrayOfVector mnumericgrids
Index get_grid_size(Index i) const
Get the size of a grid.
GriddedField()
Construct an empty GriddedField.
Array< ArrayOfString > mstringgrids
const String & get_name() const
Get the name of this gridded field.
virtual bool checksize() const =0
Consistency check.
GriddedField(const Index d, const String &s)
Construct a GriddedField.
friend std::ostream & operator<<(std::ostream &os, const GriddedField &gf)
void set_name(const String &s)
Set name of this gridded field.
const ArrayOfString & get_string_grid(Index i) const
Get a string grid.
Index get_dim() const
Get the dimension of this gridded field.
void copy_grids(const GriddedField &gf)
Copy grids.
void set_grid_name(Index i, const String &s)
Set grid name.
virtual void checksize_strict() const =0
Strict consistency check.
void set_grid(Index i, const Vector &g)
Set a numeric grid.
GridType get_grid_type(Index i) const
Get grid type.
const Vector & get_numeric_grid(Index i) const
Get a numeric grid.
virtual ~GriddedField()
GriddedField virtual destructor.
Array< GridType > mgridtypes
const String & get_grid_name(Index i) const
Get grid name.
void resize(Index r, Index c)
Resize function.
void resize(Index p, Index r, Index c)
Resize function.
void resize(Index b, Index p, Index r, Index c)
Resize function.
void resize(Index s, Index b, Index p, Index r, Index c)
Resize function.
void resize(Index v, Index s, Index b, Index p, Index r, Index c)
Resize function.
void resize(Index n)
Resize function.
#define ARTS_ASSERT(condition,...)
#define ARTS_USER_ERROR_IF(condition,...)
Array< Array< GriddedField1 > > ArrayOfArrayOfGriddedField1
Array< GriddedField5 > ArrayOfGriddedField5
std::ostream & operator<<(std::ostream &os, const GriddedField &gf)
Array< GriddedField2 > ArrayOfGriddedField2
#define CHECK_ERROR_BOILERPLATE
Array< Array< GriddedField2 > > ArrayOfArrayOfGriddedField2
Array< GriddedField3 > ArrayOfGriddedField3
Array< GriddedField1 > ArrayOfGriddedField1
Array< Array< GriddedField3 > > ArrayOfArrayOfGriddedField3
Array< GriddedField4 > ArrayOfGriddedField4
Array< GridType > ArrayOfGridType
String metaErrorData(const GriddedFieldType &gf)
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
This file contains the definition of String, the ARTS string class.