Commit 2c0b6ade authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

expr::fldSTAT: changed Field to vector.

parent d526ee04
......@@ -133,15 +133,15 @@ static func_t fun_sym_tbl[] = {
{ FT_CONST, 0, "missval", reinterpret_cast<void (*)(void)>(&pt_missval) }, // Returns the missing value of a variable
// CDO field functions (Reduce grid to point)
{ FT_FLD, 0, "fldmin", reinterpret_cast<void (*)(void)>(&fldmin) },
{ FT_FLD, 0, "fldmax", reinterpret_cast<void (*)(void)>(&fldmax) },
{ FT_FLD, 0, "fldsum", reinterpret_cast<void (*)(void)>(&fldsum) },
{ FT_FLD, 1, "fldmean", reinterpret_cast<void (*)(void)>(&fldmeanw) },
{ FT_FLD, 1, "fldavg", reinterpret_cast<void (*)(void)>(&fldavgw) },
{ FT_FLD, 1, "fldstd", reinterpret_cast<void (*)(void)>(&fldstdw) },
{ FT_FLD, 1, "fldstd1", reinterpret_cast<void (*)(void)>(&fldstd1w) },
{ FT_FLD, 1, "fldvar", reinterpret_cast<void (*)(void)>(&fldvarw) },
{ FT_FLD, 1, "fldvar1", reinterpret_cast<void (*)(void)>(&fldvar1w) },
{ FT_FLD, 0, "fldmin", reinterpret_cast<void (*)(void)>(&vfldmin) },
{ FT_FLD, 0, "fldmax", reinterpret_cast<void (*)(void)>(&vfldmax) },
{ FT_FLD, 0, "fldsum", reinterpret_cast<void (*)(void)>(&vfldsum) },
{ FT_FLD, 1, "fldmean", reinterpret_cast<void (*)(void)>(&vfldmeanw) },
{ FT_FLD, 1, "fldavg", reinterpret_cast<void (*)(void)>(&vfldavgw) },
{ FT_FLD, 1, "fldstd", reinterpret_cast<void (*)(void)>(&vfldstdw) },
{ FT_FLD, 1, "fldstd1", reinterpret_cast<void (*)(void)>(&vfldstd1w) },
{ FT_FLD, 1, "fldvar", reinterpret_cast<void (*)(void)>(&vfldvarw) },
{ FT_FLD, 1, "fldvar1", reinterpret_cast<void (*)(void)>(&vfldvar1w) },
// CDO zonal functions (Reduce grid to point)
{ FT_ZON, 0, "zonmin", reinterpret_cast<void (*)(void)>(&zonmin) },
......@@ -887,17 +887,17 @@ ex_fun_var(const int init, const int funcID, nodeType *p1)
else if (functype == FT_FLD)
{
Field field;
double *weights = nullptr;
field.resize(ngp);
if (funcflag == 1)
{
weights = p1->param.weight;
assert(weights != nullptr);
assert(p1->param.weight != nullptr);
field.weightv.resize(ngp);
}
double (*exprfunc)(const Field &) = (double (*)(const Field &)) fun_sym_tbl[funcID].func;
for (size_t k = 0; k < nlev; k++)
{
fld_field_init(field, nmiss, missval, ngp, p1data + k * ngp, weights);
fld_field_init(field, nmiss, missval, ngp, p1data + k * ngp, p1->param.weight);
pdata[k] = exprfunc(field);
}
}
......
......@@ -25,9 +25,10 @@ fld_field_init(Field &field, size_t nmiss, double missval, size_t ngp, double *a
field.nmiss = nmiss;
field.missval = missval;
field.ptr = array;
field.weight = w;
if (array) for (size_t i = 0; i < ngp; ++i) field.vec[i] = array[i];
if (w) for (size_t i = 0; i < ngp; ++i) field.weightv[i] = w[i];
}
/*
double *
fld_weights(int gridID, size_t ngp)
{
......@@ -47,7 +48,7 @@ fld_weights(int gridID, size_t ngp)
return weights;
}
*/
int getLayerThickness(bool useweights, bool genbounds, int index, int zaxisID, int nlev, double *thickness, double *weights);
void
......
......@@ -22,7 +22,6 @@
#include "field.h"
void fld_field_init(Field &field, size_t nmiss, double missval, size_t ngp, double *array, double *w);
double *fld_weights(int gridID, size_t ngp);
void vert_weights(int zaxisID, size_t nlev, std::vector<double> &weights);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment