Commit 0d821777 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Merge declaration and definition.

parent 3074abf1
......@@ -26,7 +26,7 @@
void *Deltime(void *argument)
{
int nrecs;
int recID, varID, levelID;
int varID, levelID;
int vdate /*, vtime */;
int copytimestep;
int gridsize;
......@@ -125,7 +125,7 @@ void *Deltime(void *argument)
streamDefTimestep(streamID2, tsID2++);
for ( recID = 0; recID < nrecs; recID++ )
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
streamDefRecord(streamID2, varID, levelID);
......
......@@ -38,7 +38,7 @@ void *Derivepar(void *argument)
{
int mode;
enum {ECHAM_MODE, WMO_MODE};
int recID, nrecs;
int nrecs;
int i, offset;
int varID, levelID;
int zaxisID;
......@@ -293,7 +293,7 @@ void *Derivepar(void *argument)
streamDefTimestep(streamID2, tsID);
for ( recID = 0; recID < nrecs; recID++ )
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
zaxisID = vlistInqVarZaxis(vlistID1, varID);
......
......@@ -34,18 +34,15 @@
static
void detrend(long nts, double missval1, double *array1, double *array2)
{
long n;
long j;
double zj;
double sumj, sumjj;
double sumx, sumjx;
double work1, work2;
double missval2 = missval1;
sumx = sumjx = 0;
sumj = sumjj = 0;
n = 0;
for ( j = 0; j < nts; j++ )
long n = 0;
for ( long j = 0; j < nts; j++ )
if ( !DBL_IS_EQUAL(array1[j], missval1) )
{
zj = j;
......@@ -56,11 +53,11 @@ void detrend(long nts, double missval1, double *array1, double *array2)
n++;
}
work1 = DIVMN( SUBMN(sumjx, DIVMN( MULMN(sumx, sumj), n) ),
SUBMN(sumjj, DIVMN( MULMN(sumj, sumj), n)) );
work2 = SUBMN( DIVMN(sumx, n), MULMN(work1, DIVMN(sumj, n)));
double work1 = DIVMN( SUBMN(sumjx, DIVMN( MULMN(sumx, sumj), n) ),
SUBMN(sumjj, DIVMN( MULMN(sumj, sumj), n)) );
double work2 = SUBMN( DIVMN(sumx, n), MULMN(work1, DIVMN(sumj, n)));
for ( j = 0; j < nts; j++ )
for ( long j = 0; j < nts; j++ )
array2[j] = SUBMN(array1[j], ADDMN(work2, MULMN(j, work1)));
}
......@@ -69,7 +66,7 @@ void *Detrend(void *argument)
{
int gridsize;
int nrecs;
int gridID, varID, levelID, recID;
int gridID, varID, levelID;
int i;
int nalloc = 0;
int nmiss;
......@@ -113,7 +110,7 @@ void *Detrend(void *argument)
vars[tsID] = field_malloc(vlistID1, FIELD_NONE);
for ( recID = 0; recID < nrecs; recID++ )
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
gridID = vlistInqVarGrid(vlistID1, varID);
......
......@@ -167,9 +167,8 @@ typedef struct
void *Distgrid(void *argument)
{
int gridID1;
int varID;
int varID, levelID;
int nrecs;
int recID, levelID;
char filesuffix[32];
char filename[8192];
const char *refname;
......@@ -307,7 +306,7 @@ void *Distgrid(void *argument)
for ( index = 0; index < nsplit; index++ )
streamDefTimestep(streamIDs[index], tsID);
for ( recID = 0; recID < nrecs; recID++ )
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
streamReadRecord(streamID1, array1, &nmiss);
......
......@@ -27,10 +27,9 @@
void *Duplicate(void *argument)
{
int nrecs;
int gridID, varID, levelID;
int varID, levelID;
int nalloc = 0;
int nmiss;
int nlevel;
int *vdate = NULL, *vtime = NULL;
int ndup = 2;
field_t ***vars = NULL;
......@@ -93,7 +92,7 @@ void *Duplicate(void *argument)
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
gridID = vlistInqVarGrid(vlistID1, varID);
int gridID = vlistInqVarGrid(vlistID1, varID);
int gridsize = gridInqSize(gridID);
vars[tsID][varID][levelID].ptr = (double*) Malloc(gridsize*sizeof(double));
streamReadRecord(streamID1, vars[tsID][varID][levelID].ptr, &nmiss);
......@@ -115,7 +114,7 @@ void *Duplicate(void *argument)
for ( varID = 0; varID < nvars; varID++ )
{
nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
int nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
for ( levelID = 0; levelID < nlevel; levelID++ )
{
if ( vars[tsID][varID][levelID].ptr )
......
Supports Markdown
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