Commit d2174fdb authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added operator runrange.

parent 2de2ed8f
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* New operator seasrange: seasonal range (seasmax-seasmin) * New operator seasrange: seasonal range (seasmax-seasmin)
* New operator timselrange: time selection range (timmax-timmin) * New operator timselrange: time selection range (timmax-timmin)
* New operator runrange: running range (runmax-runmin)
2017-05-26 Uwe Schulzweida 2017-05-26 Uwe Schulzweida
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
/* /*
This module contains the following operators: This module contains the following operators:
Runstat runrange Running range
Runstat runmin Running minimum Runstat runmin Running minimum
Runstat runmax Running maximum Runstat runmax Running maximum
Runstat runsum Running sum Runstat runsum Running sum
...@@ -34,6 +35,12 @@ ...@@ -34,6 +35,12 @@
#include "pstream.h" #include "pstream.h"
typedef struct {
short varID;
short levelID;
} recinfo_t;
void *Runstat(void *argument) void *Runstat(void *argument)
{ {
int timestat_date = TIMESTAT_MEAN; int timestat_date = TIMESTAT_MEAN;
...@@ -52,6 +59,7 @@ void *Runstat(void *argument) ...@@ -52,6 +59,7 @@ void *Runstat(void *argument)
if ( envval == 1 ) runstat_nomiss = 1; if ( envval == 1 ) runstat_nomiss = 1;
} }
cdoOperatorAdd("runrange", func_range, 0, NULL);
cdoOperatorAdd("runmin", func_min, 0, NULL); cdoOperatorAdd("runmin", func_min, 0, NULL);
cdoOperatorAdd("runmax", func_max, 0, NULL); cdoOperatorAdd("runmax", func_max, 0, NULL);
cdoOperatorAdd("runsum", func_sum, 0, NULL); cdoOperatorAdd("runsum", func_sum, 0, NULL);
...@@ -68,9 +76,10 @@ void *Runstat(void *argument) ...@@ -68,9 +76,10 @@ void *Runstat(void *argument)
operatorInputArg("number of timesteps"); operatorInputArg("number of timesteps");
int ndates = parameter2int(operatorArgv()[0]); int ndates = parameter2int(operatorArgv()[0]);
int lmean = operfunc == func_mean || operfunc == func_avg; bool lrange = operfunc == func_range;
int lstd = operfunc == func_std || operfunc == func_std1; bool lmean = operfunc == func_mean || operfunc == func_avg;
int lvarstd = operfunc == func_std || operfunc == func_var || operfunc == func_std1 || operfunc == func_var1; bool lstd = operfunc == func_std || operfunc == func_std1;
bool lvarstd = operfunc == func_std || operfunc == func_var || operfunc == func_std1 || operfunc == func_var1;
int divisor = operfunc == func_std1 || operfunc == func_var1; int divisor = operfunc == func_std1 || operfunc == func_var1;
int streamID1 = streamOpenRead(cdoStreamName(0)); int streamID1 = streamOpenRead(cdoStreamName(0));
...@@ -94,11 +103,9 @@ void *Runstat(void *argument) ...@@ -94,11 +103,9 @@ void *Runstat(void *argument)
streamDefVlist(streamID2, vlistID2); streamDefVlist(streamID2, vlistID2);
int nvars = vlistNvars(vlistID1); int maxrecs = vlistNrecs(vlistID1);
int nrecords = vlistNrecs(vlistID1);
int *recVarID = (int*) Malloc(nrecords*sizeof(int)); recinfo_t *recinfo = (recinfo_t *) Malloc(maxrecs*sizeof(recinfo_t));
int *recLevelID = (int*) Malloc(nrecords*sizeof(int));
dtlist_type *dtlist = dtlist_new(); dtlist_type *dtlist = dtlist_new();
dtlist_set_stat(dtlist, timestat_date); dtlist_set_stat(dtlist, timestat_date);
...@@ -108,7 +115,7 @@ void *Runstat(void *argument) ...@@ -108,7 +115,7 @@ void *Runstat(void *argument)
field_type ***vars2 = NULL, ***samp1 = NULL; field_type ***vars2 = NULL, ***samp1 = NULL;
if ( !runstat_nomiss ) if ( !runstat_nomiss )
samp1 = (field_type ***) Malloc((ndates+1)*sizeof(field_type **)); samp1 = (field_type ***) Malloc((ndates+1)*sizeof(field_type **));
if ( lvarstd ) if ( lvarstd || lrange )
vars2 = (field_type ***) Malloc((ndates+1)*sizeof(field_type **)); vars2 = (field_type ***) Malloc((ndates+1)*sizeof(field_type **));
for ( int its = 0; its < ndates; its++ ) for ( int its = 0; its < ndates; its++ )
...@@ -116,7 +123,7 @@ void *Runstat(void *argument) ...@@ -116,7 +123,7 @@ void *Runstat(void *argument)
vars1[its] = field_malloc(vlistID1, FIELD_PTR); vars1[its] = field_malloc(vlistID1, FIELD_PTR);
if ( !runstat_nomiss ) if ( !runstat_nomiss )
samp1[its] = field_malloc(vlistID1, FIELD_PTR); samp1[its] = field_malloc(vlistID1, FIELD_PTR);
if ( lvarstd ) if ( lvarstd || lrange )
vars2[its] = field_malloc(vlistID1, FIELD_PTR); vars2[its] = field_malloc(vlistID1, FIELD_PTR);
} }
...@@ -137,25 +144,32 @@ void *Runstat(void *argument) ...@@ -137,25 +144,32 @@ void *Runstat(void *argument)
if ( tsID == 0 ) if ( tsID == 0 )
{ {
recVarID[recID] = varID; recinfo[recID].varID = varID;
recLevelID[recID] = levelID; recinfo[recID].levelID = levelID;
} }
streamReadRecord(streamID1, vars1[tsID][varID][levelID].ptr, &nmiss); field_type *pvars1 = &vars1[tsID][varID][levelID];
vars1[tsID][varID][levelID].nmiss = nmiss; field_type *pvars2 = vars2 ? &vars2[tsID][varID][levelID] : NULL;
int gridsize = pvars1->size;
streamReadRecord(streamID1, pvars1->ptr, &nmiss);
pvars1->nmiss = nmiss;
if ( lrange )
{
pvars2->nmiss = pvars1->nmiss;
for ( int i = 0; i < gridsize; i++ )
pvars2->ptr[i] = pvars1->ptr[i];
}
if ( runstat_nomiss && nmiss > 0 ) cdoAbort("Missing values supported swichted off!"); if ( runstat_nomiss && nmiss > 0 ) cdoAbort("Missing values supported swichted off!");
if ( !runstat_nomiss ) if ( !runstat_nomiss )
{ {
int gridsize = gridInqSize(vars1[0][varID][levelID].grid); double missval = pvars1->missval;
double missval = vars1[0][varID][levelID].missval;
for ( int i = 0; i < gridsize; i++ ) for ( int i = 0; i < gridsize; i++ )
if ( DBL_IS_EQUAL(vars1[tsID][varID][levelID].ptr[i], missval) ) imask[i] = !DBL_IS_EQUAL(pvars1->ptr[i], missval);
imask[i] = false;
else
imask[i] = true;
for ( int i = 0; i < gridsize; i++ ) for ( int i = 0; i < gridsize; i++ )
samp1[tsID][varID][levelID].ptr[i] = (double) imask[i]; samp1[tsID][varID][levelID].ptr[i] = (double) imask[i];
...@@ -173,24 +187,35 @@ void *Runstat(void *argument) ...@@ -173,24 +187,35 @@ void *Runstat(void *argument)
if ( lvarstd ) if ( lvarstd )
{ {
farmoq(&vars2[tsID][varID][levelID], vars1[tsID][varID][levelID]); farmoq(pvars2, *pvars1);
#if defined(_OPENMP) #if defined(_OPENMP)
#pragma omp parallel for default(none) shared(tsID,vars1,vars2,varID,levelID) #pragma omp parallel for default(none) shared(tsID,vars1,vars2,varID,levelID,pvars1)
#endif #endif
for ( int inp = 0; inp < tsID; inp++ ) for ( int inp = 0; inp < tsID; inp++ )
{ {
farsumq(&vars2[inp][varID][levelID], vars1[tsID][varID][levelID]); farsumq(&vars2[inp][varID][levelID], *pvars1);
farsum(&vars1[inp][varID][levelID], vars1[tsID][varID][levelID]); farsum(&vars1[inp][varID][levelID], *pvars1);
}
}
else if ( lrange )
{
#if defined(_OPENMP)
#pragma omp parallel for default(none) shared(tsID,vars1,vars2,varID,levelID,pvars1)
#endif
for ( int inp = 0; inp < tsID; inp++ )
{
farmin(&vars2[inp][varID][levelID], *pvars1);
farmax(&vars1[inp][varID][levelID], *pvars1);
} }
} }
else else
{ {
#if defined(_OPENMP) #if defined(_OPENMP)
#pragma omp parallel for default(none) shared(tsID,vars1,operfunc,varID,levelID) #pragma omp parallel for default(none) shared(tsID,vars1,operfunc,varID,levelID,pvars1)
#endif #endif
for ( int inp = 0; inp < tsID; inp++ ) for ( int inp = 0; inp < tsID; inp++ )
{ {
farfun(&vars1[inp][varID][levelID], vars1[tsID][varID][levelID], operfunc); farfun(&vars1[inp][varID][levelID], *pvars1, operfunc);
} }
} }
} }
...@@ -200,54 +225,66 @@ void *Runstat(void *argument) ...@@ -200,54 +225,66 @@ void *Runstat(void *argument)
while ( TRUE ) while ( TRUE )
{ {
if ( lmean ) if ( lmean )
for ( varID = 0; varID < nvars; varID++ ) for ( int recID = 0; recID < maxrecs; recID++ )
{ {
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[0][varID][levelID];
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue; if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
int nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
for ( levelID = 0; levelID < nlevel; levelID++ )
{
if ( runstat_nomiss ) if ( runstat_nomiss )
farcdiv(&vars1[0][varID][levelID], (double)ndates); farcdiv(pvars1, (double)ndates);
else else
fardiv(&vars1[0][varID][levelID], samp1[0][varID][levelID]); fardiv(pvars1, samp1[0][varID][levelID]);
}
} }
else if ( lvarstd ) else if ( lvarstd )
for ( varID = 0; varID < nvars; varID++ ) for ( int recID = 0; recID < maxrecs; recID++ )
{ {
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[0][varID][levelID];
field_type *pvars2 = &vars2[0][varID][levelID];
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue; if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
int nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
for ( levelID = 0; levelID < nlevel; levelID++ )
{
if ( runstat_nomiss ) if ( runstat_nomiss )
{ {
if ( lstd ) if ( lstd ) farcstd(pvars1, *pvars2, ndates, divisor);
farcstd(&vars1[0][varID][levelID], vars2[0][varID][levelID], ndates, divisor); else farcvar(pvars1, *pvars2, ndates, divisor);
else
farcvar(&vars1[0][varID][levelID], vars2[0][varID][levelID], ndates, divisor);
} }
else else
{ {
if ( lstd ) if ( lstd ) farstd(pvars1, *pvars2, samp1[0][varID][levelID], divisor);
farstd(&vars1[0][varID][levelID], vars2[0][varID][levelID], samp1[0][varID][levelID], divisor); else farvar(pvars1, *pvars2, samp1[0][varID][levelID], divisor);
else
farvar(&vars1[0][varID][levelID], vars2[0][varID][levelID], samp1[0][varID][levelID], divisor);
} }
} }
else if ( lrange )
for ( int recID = 0; recID < maxrecs; recID++ )
{
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[0][varID][levelID];
field_type *pvars2 = &vars2[0][varID][levelID];
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
farsub(pvars1, *pvars2);
} }
dtlist_stat_taxisDefTimestep(dtlist, taxisID2, ndates); dtlist_stat_taxisDefTimestep(dtlist, taxisID2, ndates);
streamDefTimestep(streamID2, otsID); streamDefTimestep(streamID2, otsID);
for ( int recID = 0; recID < nrecords; recID++ ) for ( int recID = 0; recID < maxrecs; recID++ )
{ {
varID = recVarID[recID]; int varID = recinfo[recID].varID;
levelID = recLevelID[recID]; int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[0][varID][levelID];
if ( otsID && vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue; if ( otsID && vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
streamDefRecord(streamID2, varID, levelID); streamDefRecord(streamID2, varID, levelID);
streamWriteRecord(streamID2, vars1[0][varID][levelID].ptr, vars1[0][varID][levelID].nmiss); streamWriteRecord(streamID2, pvars1->ptr, pvars1->nmiss);
} }
otsID++; otsID++;
...@@ -257,7 +294,7 @@ void *Runstat(void *argument) ...@@ -257,7 +294,7 @@ void *Runstat(void *argument)
vars1[ndates] = vars1[0]; vars1[ndates] = vars1[0];
if ( !runstat_nomiss ) if ( !runstat_nomiss )
samp1[ndates] = samp1[0]; samp1[ndates] = samp1[0];
if ( lvarstd ) if ( lvarstd || lrange )
vars2[ndates] = vars2[0]; vars2[ndates] = vars2[0];
for ( int inp = 0; inp < ndates; inp++ ) for ( int inp = 0; inp < ndates; inp++ )
...@@ -265,7 +302,7 @@ void *Runstat(void *argument) ...@@ -265,7 +302,7 @@ void *Runstat(void *argument)
vars1[inp] = vars1[inp+1]; vars1[inp] = vars1[inp+1];
if ( !runstat_nomiss ) if ( !runstat_nomiss )
samp1[inp] = samp1[inp+1]; samp1[inp] = samp1[inp+1];
if ( lvarstd ) if ( lvarstd || lrange )
vars2[inp] = vars2[inp+1]; vars2[inp] = vars2[inp+1];
} }
...@@ -278,21 +315,28 @@ void *Runstat(void *argument) ...@@ -278,21 +315,28 @@ void *Runstat(void *argument)
{ {
streamInqRecord(streamID1, &varID, &levelID); streamInqRecord(streamID1, &varID, &levelID);
streamReadRecord(streamID1, vars1[ndates-1][varID][levelID].ptr, &nmiss); field_type *pvars1 = &vars1[ndates-1][varID][levelID];
vars1[ndates-1][varID][levelID].nmiss = nmiss; field_type *pvars2 = vars2 ? &vars2[ndates-1][varID][levelID] : NULL;
int gridsize = pvars1->size;
streamReadRecord(streamID1, pvars1->ptr, &nmiss);
pvars1->nmiss = nmiss;
if ( lrange )
{
pvars2->nmiss = pvars1->nmiss;
for ( int i = 0; i < gridsize; i++ )
pvars2->ptr[i] = pvars1->ptr[i];
}
if ( runstat_nomiss && nmiss > 0 ) cdoAbort("Missing values supported swichted off!"); if ( runstat_nomiss && nmiss > 0 ) cdoAbort("Missing values supported swichted off!");
if ( !runstat_nomiss ) if ( !runstat_nomiss )
{ {
int gridsize = gridInqSize(vars1[0][varID][levelID].grid); double missval = pvars1->missval;
double missval = vars1[0][varID][levelID].missval;
for ( int i = 0; i < gridsize; i++ ) for ( int i = 0; i < gridsize; i++ )
if ( DBL_IS_EQUAL(vars1[ndates-1][varID][levelID].ptr[i], missval) ) imask[i] = !DBL_IS_EQUAL(pvars1->ptr[i], missval);
imask[i] = false;
else
imask[i] = true;
for ( int i = 0; i < gridsize; i++ ) for ( int i = 0; i < gridsize; i++ )
samp1[ndates-1][varID][levelID].ptr[i] = (double) imask[i]; samp1[ndates-1][varID][levelID].ptr[i] = (double) imask[i];
...@@ -310,24 +354,35 @@ void *Runstat(void *argument) ...@@ -310,24 +354,35 @@ void *Runstat(void *argument)
if ( lvarstd ) if ( lvarstd )
{ {
farmoq(&vars2[ndates-1][varID][levelID], vars1[ndates-1][varID][levelID]); farmoq(pvars2, *pvars1);
#if defined(_OPENMP) #if defined(_OPENMP)
#pragma omp parallel for default(none) shared(ndates,vars1,vars2,varID,levelID) #pragma omp parallel for default(none) shared(ndates,vars1,vars2,varID,levelID,pvars1)
#endif #endif
for ( int inp = 0; inp < ndates-1; inp++ ) for ( int inp = 0; inp < ndates-1; inp++ )
{ {
farsumq(&vars2[inp][varID][levelID], vars1[ndates-1][varID][levelID]); farsumq(&vars2[inp][varID][levelID], *pvars1);
farsum(&vars1[inp][varID][levelID], vars1[ndates-1][varID][levelID]); farsum(&vars1[inp][varID][levelID], *pvars1);
}
}
else if ( lrange )
{
#if defined(_OPENMP)
#pragma omp parallel for default(none) shared(ndates,vars1,vars2,varID,levelID,pvars1)
#endif
for ( int inp = 0; inp < ndates-1; inp++ )
{
farmin(&vars2[inp][varID][levelID], *pvars1);
farmax(&vars1[inp][varID][levelID], *pvars1);
} }
} }
else else
{ {
#if defined(_OPENMP) #if defined(_OPENMP)
#pragma omp parallel for default(none) shared(ndates,vars1,varID,levelID,operfunc) #pragma omp parallel for default(none) shared(ndates,vars1,varID,levelID,operfunc,pvars1)
#endif #endif
for ( int inp = 0; inp < ndates-1; inp++ ) for ( int inp = 0; inp < ndates-1; inp++ )
{ {
farfun(&vars1[inp][varID][levelID], vars1[ndates-1][varID][levelID], operfunc); farfun(&vars1[inp][varID][levelID], *pvars1, operfunc);
} }
} }
} }
...@@ -339,19 +394,19 @@ void *Runstat(void *argument) ...@@ -339,19 +394,19 @@ void *Runstat(void *argument)
{ {
field_free(vars1[its], vlistID1); field_free(vars1[its], vlistID1);
if ( !runstat_nomiss ) field_free(samp1[its], vlistID1); if ( !runstat_nomiss ) field_free(samp1[its], vlistID1);
if ( lvarstd ) field_free(vars2[its], vlistID1); if ( lvarstd || lrange ) field_free(vars2[its], vlistID1);
} }
Free(vars1); Free(vars1);
if ( !runstat_nomiss ) Free(samp1); if ( !runstat_nomiss ) Free(samp1);
if ( lvarstd ) Free(vars2); if ( lvarstd || lrange ) Free(vars2);
if ( recVarID ) Free(recVarID);
if ( recLevelID ) Free(recLevelID);
if ( imask ) Free(imask); if ( imask ) Free(imask);
dtlist_delete(dtlist); dtlist_delete(dtlist);
Free(recinfo);
streamClose(streamID2); streamClose(streamID2);
streamClose(streamID1); streamClose(streamID1);
......
...@@ -162,7 +162,7 @@ void *Seasstat(void *argument) ...@@ -162,7 +162,7 @@ void *Seasstat(void *argument)
field_type *pvars1 = &vars1[varID][levelID]; field_type *pvars1 = &vars1[varID][levelID];
field_type *pvars2 = vars2 ? &vars2[varID][levelID] : NULL; field_type *pvars2 = vars2 ? &vars2[varID][levelID] : NULL;
gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID)); gridsize = pvars1->size;
if ( nsets == 0 ) if ( nsets == 0 )
{ {
...@@ -170,7 +170,7 @@ void *Seasstat(void *argument) ...@@ -170,7 +170,7 @@ void *Seasstat(void *argument)
pvars1->nmiss = (size_t)nmiss; pvars1->nmiss = (size_t)nmiss;
if ( lrange ) if ( lrange )
{ {
pvars2->nmiss = (size_t)nmiss; pvars2->nmiss = pvars1->nmiss;
for ( int i = 0; i < gridsize; i++ ) for ( int i = 0; i < gridsize; i++ )
pvars2->ptr[i] = pvars1->ptr[i]; pvars2->ptr[i] = pvars1->ptr[i];
} }
......
...@@ -104,11 +104,11 @@ void *Timselstat(void *argument) ...@@ -104,11 +104,11 @@ void *Timselstat(void *argument)
dtlist_set_stat(dtlist, timestat_date); dtlist_set_stat(dtlist, timestat_date);
dtlist_set_calendar(dtlist, taxisInqCalendar(taxisID1)); dtlist_set_calendar(dtlist, taxisInqCalendar(taxisID1));
int gridsize = vlistGridsizeMax(vlistID1); int gridsizemax = vlistGridsizeMax(vlistID1);
field_type field; field_type field;
field_init(&field); field_init(&field);
field.ptr = (double*) Malloc(gridsize*sizeof(double)); field.ptr = (double*) Malloc(gridsizemax*sizeof(double));
field_type **samp1 = field_malloc(vlistID1, FIELD_NONE); field_type **samp1 = field_malloc(vlistID1, FIELD_NONE);
field_type **vars1 = field_malloc(vlistID1, FIELD_PTR); field_type **vars1 = field_malloc(vlistID1, FIELD_PTR);
...@@ -161,7 +161,7 @@ void *Timselstat(void *argument) ...@@ -161,7 +161,7 @@ void *Timselstat(void *argument)
field_type *pvars1 = &vars1[varID][levelID]; field_type *pvars1 = &vars1[varID][levelID];
field_type *pvars2 = vars2 ? &vars2[varID][levelID] : NULL; field_type *pvars2 = vars2 ? &vars2[varID][levelID] : NULL;
gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID)); int gridsize = pvars1->size;
if ( nsets == 0 ) if ( nsets == 0 )
{ {
......
...@@ -97,7 +97,6 @@ void *Timstat(void *argument) ...@@ -97,7 +97,6 @@ void *Timstat(void *argument)
int nwpv; // number of words per value; real:1 complex:2 int nwpv; // number of words per value; real:1 complex:2
char indate1[DATE_LEN+1], indate2[DATE_LEN+1]; char indate1[DATE_LEN+1], indate2[DATE_LEN+1];
double vfrac = 1; double vfrac = 1;
double missval;
cdoInitialize(argument); cdoInitialize(argument);
...@@ -243,8 +242,8 @@ void *Timstat(void *argument) ...@@ -243,8 +242,8 @@ void *Timstat(void *argument)
dtlist_set_stat(dtlist, timestat_date); dtlist_set_stat(dtlist, timestat_date);
dtlist_set_calendar(dtlist, taxisInqCalendar(taxisID1)); dtlist_set_calendar(dtlist, taxisInqCalendar(taxisID1));
int gridsize = vlistGridsizeMax(vlistID1); int gridsizemax = vlistGridsizeMax(vlistID1);
if ( vlistNumber(vlistID1) != CDI_REAL ) gridsize *= 2; if ( vlistNumber(vlistID1) != CDI_REAL ) gridsizemax *= 2;
int FIELD_MEMTYPE = 0; int FIELD_MEMTYPE = 0;
if ( CDO_Memtype == MEMTYPE_FLOAT ) FIELD_MEMTYPE = MEMTYPE_FLOAT; if ( CDO_Memtype == MEMTYPE_FLOAT ) FIELD_MEMTYPE = MEMTYPE_FLOAT;
...@@ -253,9 +252,9 @@ void *Timstat(void *argument) ...@@ -253,9 +252,9 @@ void *Timstat(void *argument)
field_init(&field); field_init(&field);
field.memtype = FIELD_MEMTYPE; field.memtype = FIELD_MEMTYPE;
if ( FIELD_MEMTYPE == MEMTYPE_FLOAT ) if ( FIELD_MEMTYPE == MEMTYPE_FLOAT )
field.ptrf = (float*) Malloc(gridsize*sizeof(float)); field.ptrf = (float*) Malloc(gridsizemax*sizeof(float));
else else
field.ptr = (double*) Malloc(gridsize*sizeof(double)); field.ptr = (double*) Malloc(gridsizemax*sizeof(double));