15#ifndef gridded_fields_h
16#define gridded_fields_h
22#include "matpack_arrays.h"
23#include "matpack_data.h"
105#define CHECK_ERROR_BOILERPLATE \
106 "size mismatch between grids and data.\n" \
107 "Note that a grid is allowed to be empty, but in the\n" \
108 "data that dimension must have exactly one element.\n"
110template <Index N,
typename Gr
iddedFieldType>
112 std::ostringstream os;
113 os <<
"GriddedField" << N <<
" ";
114 if (gf.get_name().length()) os <<
"(" << gf.get_name() <<
") ";
116 for (Index i = 0; i < N; i++) {
118 if (gf.get_grid_name(i).nelem()) os <<
" (" << gf.get_grid_name(i) <<
")";
119 os <<
" = " << gf.get_grid_size(i) <<
"\n";
123 os <<
' ' <<gf.data.nlibraries();
125 os <<
' ' <<gf.data.nvitrines();
127 os <<
' ' <<gf.data.nshelves();
129 os <<
' ' <<gf.data.nbooks();
131 os <<
' ' <<gf.data.npages();
133 os <<
' ' <<gf.data.nrows() <<
' ' << gf.data.ncols();
135 os <<
' ' << gf.data.nelem();
249 void set_grid(Index i,
const Vector& g);
480 void resize(Index s, Index
b, Index p, Index r, Index
c) {
481 data.resize(s,
b, p, r,
c);
531 void resize(Index
v, Index s, Index
b, Index p, Index r, Index
c) {
553#undef CHECK_ERROR_BOILERPLATE
This file contains the definition of Array.
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)
GriddedField(const GriddedField &)=default
ArrayOfVector mnumericgrids
GriddedField & operator=(const GriddedField &)=default
Index get_grid_size(Index i) const
Get the size of a grid.
GriddedField()
Construct an empty GriddedField.
virtual ~GriddedField()=default
Defaulted con-/de-structors and assignments so unique pointers work w/o warnings.
Array< ArrayOfString > mstringgrids
GriddedField(const Index d, String s)
Construct a GriddedField.
const String & get_name() const
Get the name of this gridded field.
virtual bool checksize() const =0
Consistency check.
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.
GriddedField(GriddedField &&)=default
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.
GriddedField & operator=(GriddedField &&)=default
Array< GridType > mgridtypes
const String & get_grid_name(Index i) const
Get grid name.
#define ARTS_ASSERT(condition,...)
#define ARTS_USER_ERROR_IF(condition,...)
#define CHECK_ERROR_BOILERPLATE
String metaErrorData(const GriddedFieldType &gf)
This file contains the definition of String, the ARTS string class.
constexpr Index GFIELD3_LON_GRID
Global constant, Index of the longitude grid in GriddedField3.
constexpr Index GFIELD4_LAT_GRID
Global constant, Index of the latitude grid in GriddedField4.
constexpr Index GFIELD4_P_GRID
Global constant, Index of the pressure grid in GriddedField4.
constexpr Index GFIELD4_FIELD_NAMES
Global constant, Index of the field names in GriddedField4.
constexpr Index GFIELD1_F_GRID
Global constant, Index of the frequency grid in GriddedField1.
constexpr Index GFIELD4_ZA_GRID
Global constant, Index of the zenith angle grid in GriddedField4.
constexpr Index GFIELD4_IA_GRID
Global constant, Index of incidence angles in GriddedField4.
constexpr Index GFIELD4_F_GRID
Global constant, Index of the frequency grid in GriddedField4.
constexpr Index GFIELD4_AA_GRID
Global constant, Index of the azimuth angle grid in GriddedField4.
constexpr Index GFIELD3_P_GRID
Global constant, Index of the pressure grid in GriddedField3.
constexpr Index GFIELD4_LON_GRID
Global constant, Index of the longitude grid in GriddedField4.
constexpr Index GFIELD3_LAT_GRID
Global constant, Index of the latitude grid in GriddedField3.