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

Renamed rowlon to reducedPoints.

parent 9e1dd26f
......@@ -345,8 +345,8 @@ cdfLazyGridCopyArrayFields(grid_t *gridptrOrig, grid_t *gridptrDup)
if ( reducedPointsSize )
{
gridptrDup->rowlon = (int *)Malloc(reducedPointsSize * sizeof (int));
memcpy(gridptrDup->rowlon, gridptrOrig->rowlon, reducedPointsSize * sizeof(int));
gridptrDup->reducedPoints = (int *)Malloc(reducedPointsSize * sizeof (int));
memcpy(gridptrDup->reducedPoints, gridptrOrig->reducedPoints, reducedPointsSize * sizeof(int));
}
if ( gridptrOrig->x.vals != NULL && gridptrOrig->x.vals != cdfPendingLoad )
......
......@@ -996,8 +996,8 @@ void gridDefYbounds(int gridID, const double ybounds[]);
size_t gridInqYbounds(int gridID, double ybounds[]);
size_t gridInqYboundsPart(int gridID, int start, size_t size, double ybounds[]);
void gridDefReducedPoints(int gridID, int reducedPointsSize, const int rowlon[]);
void gridInqReducedPoints(int gridID, int rowlon[]);
void gridDefReducedPoints(int gridID, int reducedPointsSize, const int reducedPoints[]);
void gridInqReducedPoints(int gridID, int reducedPoints[]);
void gridChangeType(int gridID, int gridtype);
void gridDefComplexPacking(int gridID, int lpack);
......
......@@ -594,8 +594,8 @@ static int gridInqYboundsPart_fwrap(int gridID, int start, int size, double ybou
return size_t_c2f(v);
}
FCALLSCFUN4 (INT, gridInqYboundsPart_fwrap, GRIDINQYBOUNDSPART, gridinqyboundspart, INT, INT, INT, DOUBLEV)
FCALLSCSUB3 (gridDefReducedPoints, GRIDDEFROWLON, griddefrowlon, INT, INT, INTV)
FCALLSCSUB2 (gridInqReducedPoints, GRIDINQROWLON, gridinqrowlon, INT, INTV)
FCALLSCSUB3 (gridDefReducedPoints, GRIDDEFROWLON, griddefreducedPoints, INT, INT, INTV)
FCALLSCSUB2 (gridInqReducedPoints, GRIDINQROWLON, gridinqreducedPoints, INT, INTV)
FCALLSCSUB2 (gridChangeType, GRIDCHANGETYPE, gridchangetype, INT, INT)
FCALLSCSUB2 (gridDefComplexPacking, GRIDDEFCOMPLEXPACKING, griddefcomplexpacking, INT, INT)
FCALLSCFUN1 (INT, gridInqComplexPacking, GRIDINQCOMPLEXPACKING, gridinqcomplexpacking, INT)
......
......@@ -533,11 +533,11 @@ void gribapiGetGridGaussianReduced(grib_handle *gh, grid_t *grid, int editionNum
grid->size = numberOfPoints;
grid->reducedPointsSize = (int)nlat;
grid->rowlon = (int *) Malloc(nlat * sizeof(int));
grid->reducedPoints = (int *) Malloc(nlat * sizeof(int));
long *pl = (long *) Malloc(nlat * sizeof(long));
size_t dummy = nlat;
FAIL_ON_GRIB_ERROR(grib_get_long_array, gh, "pl", pl, &dummy);
for ( size_t i = 0; i < nlat; ++i ) grid->rowlon[i] = (int)pl[i];
for ( size_t i = 0; i < nlat; ++i ) grid->reducedPoints[i] = (int)pl[i];
Free(pl);
grid->y.size = nlat;
......
......@@ -147,7 +147,7 @@ void grid_init(grid_t *gridptr)
grid_axis_init(&gridptr->y);
gridptr->area = NULL;
gridptr->rowlon = NULL;
gridptr->reducedPoints = NULL;
gridptr->reducedPointsSize = 0;
gridptr->gme.nd = 0;
......@@ -196,7 +196,7 @@ void grid_free_components(grid_t *gridptr)
gridptr->x.cvals, gridptr->y.cvals,
#endif
gridptr->x.bounds, gridptr->y.bounds,
gridptr->rowlon, gridptr->area,
gridptr->reducedPoints, gridptr->area,
gridptr->reference, gridptr->name};
for ( size_t i = 0; i < sizeof(p2free)/sizeof(p2free[0]); ++i )
......@@ -1388,13 +1388,13 @@ int gridInqNP(int gridID)
@EndFunction
*/
void gridDefReducedPoints(int gridID, int reducedPointsSize, const int rowlon[])
void gridDefReducedPoints(int gridID, int reducedPointsSize, const int reducedPoints[])
{
grid_t *gridptr = grid_to_pointer(gridID);
gridptr->rowlon = (int *) Malloc((size_t)reducedPointsSize * sizeof(int));
gridptr->reducedPoints = (int *) Malloc((size_t)reducedPointsSize * sizeof(int));
gridptr->reducedPointsSize = reducedPointsSize;
memcpy(gridptr->rowlon, rowlon, (size_t)reducedPointsSize * sizeof(int));
memcpy(gridptr->reducedPoints, reducedPoints, (size_t)reducedPointsSize * sizeof(int));
gridMark4Update(gridID);
}
......@@ -1408,13 +1408,13 @@ void gridDefReducedPoints(int gridID, int reducedPointsSize, const int rowlon[])
@EndFunction
*/
void gridInqReducedPoints(int gridID, int *rowlon)
void gridInqReducedPoints(int gridID, int *reducedPoints)
{
grid_t *gridptr = grid_to_pointer(gridID);
if ( gridptr->rowlon == 0 ) Error("undefined pointer!");
if ( gridptr->reducedPoints == 0 ) Error("undefined pointer!");
memcpy(rowlon, gridptr->rowlon, (size_t)gridptr->reducedPointsSize * sizeof(int));
memcpy(reducedPoints, gridptr->reducedPoints, (size_t)gridptr->reducedPointsSize * sizeof(int));
}
static size_t
......@@ -2833,7 +2833,7 @@ int gridGenerate(const grid_t *grid)
if ( gridtype == GRID_PROJECTION )
gridptr->name = strdup(grid->name);
if ( gridtype == GRID_GAUSSIAN_REDUCED )
gridDefReducedPoints(gridID, grid->y.size, grid->rowlon);
gridDefReducedPoints(gridID, grid->y.size, grid->reducedPoints);
gridptr->trunc = grid->trunc;
gridptr->lcomplex = grid->lcomplex;
gridptr->gme.nd = grid->gme.nd;
......@@ -2859,8 +2859,8 @@ grid_copy_base_array_fields(grid_t *gridptrOrig, grid_t *gridptrDup)
int irregular = gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED;
if ( reducedPointsSize )
{
gridptrDup->rowlon = (int*) Malloc(reducedPointsSize * sizeof(int));
memcpy(gridptrDup->rowlon, gridptrOrig->rowlon, reducedPointsSize * sizeof(int));
gridptrDup->reducedPoints = (int*) Malloc(reducedPointsSize * sizeof(int));
memcpy(gridptrDup->reducedPoints, gridptrOrig->reducedPoints, reducedPointsSize * sizeof(int));
}
if ( gridptrOrig->x.vals != NULL )
......@@ -4325,7 +4325,7 @@ static int gridGetComponentFlags(const grid_t * gridP)
| (gridHasXBoundsFlag & (int)((unsigned)(gridP->x.bounds == NULL) - 1U))
| (gridHasYBoundsFlag & (int)((unsigned)(gridP->y.bounds == NULL) - 1U))
| (gridHasReferenceFlag & (int)((unsigned)(gridP->reference == NULL) - 1U))
| (gridHasRowLonFlag & (int)((unsigned)(gridP->rowlon == NULL) - 1U))
| (gridHasRowLonFlag & (int)((unsigned)(gridP->reducedPoints == NULL) - 1U))
| (gridHasUUIDFlag & (int)((unsigned)cdiUUIDIsNull(gridP->uuid) - 1U));
return flags;
}
......@@ -4339,7 +4339,7 @@ gridGetPackSize(void * voidP, void *context)
packBuffSize += serializeGetSize(gridNint, CDI_DATATYPE_INT, context)
+ serializeGetSize(1, CDI_DATATYPE_UINT32, context);
if (gridP->rowlon)
if (gridP->reducedPoints)
{
xassert(gridP->reducedPointsSize);
packBuffSize += serializeGetSize(gridP->reducedPointsSize, CDI_DATATYPE_INT, context)
......@@ -4496,12 +4496,12 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
if (memberMask & gridHasRowLonFlag)
{
xassert(gridP->reducedPointsSize);
gridP->rowlon = (int *) Malloc((size_t)gridP->reducedPointsSize * sizeof (int));
gridP->reducedPoints = (int *) Malloc((size_t)gridP->reducedPointsSize * sizeof (int));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->rowlon, gridP->reducedPointsSize , CDI_DATATYPE_INT, context);
gridP->reducedPoints, gridP->reducedPointsSize , CDI_DATATYPE_INT, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, CDI_DATATYPE_UINT32, context);
xassert(cdiCheckSum(CDI_DATATYPE_INT, gridP->reducedPointsSize, gridP->rowlon) == d);
xassert(cdiCheckSum(CDI_DATATYPE_INT, gridP->reducedPointsSize, gridP->reducedPoints) == d);
}
{
......@@ -4691,9 +4691,9 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
{
size = gridP->reducedPointsSize;
xassert(size > 0);
serializePack(gridP->rowlon, size, CDI_DATATYPE_INT,
serializePack(gridP->reducedPoints, size, CDI_DATATYPE_INT,
packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(CDI_DATATYPE_INT , size, gridP->rowlon);
d = cdiCheckSum(CDI_DATATYPE_INT , size, gridP->reducedPoints);
serializePack(&d, 1, CDI_DATATYPE_UINT32,
packBuffer, packBufferSize, packBufferPos, context);
}
......
......@@ -102,7 +102,7 @@ struct grid_t {
int nvertex;
char *reference;
unsigned char uuid[CDI_UUID_SIZE]; /* uuid for grid reference */
int *rowlon;
int *reducedPoints;
int reducedPointsSize;
int np; /* number of parallels between a pole and the equator */
signed char isCyclic; /* three possible states:
......
......@@ -2325,19 +2325,19 @@ module mo_cdi
integer(c_size_t) :: f_result
end function gridInqYboundsPart
subroutine gridDefReducedPoints(gridID_dummy, reducedPointsSize_dummy, rowlon_dummy) bind(c,&
subroutine gridDefReducedPoints(gridID_dummy, reducedPointsSize_dummy, reducedPoints_dummy) bind(c,&
& name = 'gridDefReducedPoints')
import c_int
integer(c_int), value :: gridID_dummy
integer(c_int), value :: reducedPointsSize_dummy
integer(c_int), intent(in) :: rowlon_dummy(*)
integer(c_int), intent(in) :: reducedPoints_dummy(*)
end subroutine gridDefReducedPoints
subroutine gridInqReducedPoints(gridID_dummy, rowlon_dummy) bind(c, name =&
subroutine gridInqReducedPoints(gridID_dummy, reducedPoints_dummy) bind(c, name =&
& 'gridInqReducedPoints')
import c_int
integer(c_int), value :: gridID_dummy
integer(c_int), intent(inout) :: rowlon_dummy(*)
integer(c_int), intent(inout) :: reducedPoints_dummy(*)
end subroutine gridInqReducedPoints
subroutine gridChangeType(gridID_dummy, gridtype_dummy) bind(c, name =&
......
......@@ -355,7 +355,7 @@ bool cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, i
uvRelativeToGrid = gribbyte_get_bit(ISEC2_ResFlag, 5);
grid->np = ISEC2_NumPar;
grid->size = (size_t)ISEC4_NumValues;
grid->rowlon = ISEC2_RowLonPtr;
grid->reducedPoints = ISEC2_RowLonPtr;
grid->reducedPointsSize = (size_t)ISEC2_NumLat;
grid->y.size = (size_t)ISEC2_NumLat;
grid->x.inc = 0;
......@@ -500,9 +500,9 @@ void cgribexAddRecord(stream_t *streamptr, cgribexrec_t *cgribexp, int param, si
if ( gridptr->reducedPointsSize )
{
const size_t reducedPointsSize = (size_t) gridptr->reducedPointsSize;
int *rowlon = gridptr->rowlon;
gridptr->rowlon = (int*) Malloc(reducedPointsSize * sizeof(int));
memcpy(gridptr->rowlon, rowlon, reducedPointsSize * sizeof(int));
int *reducedPoints = gridptr->reducedPoints;
gridptr->reducedPoints = (int*) Malloc(reducedPointsSize * sizeof(int));
memcpy(gridptr->reducedPoints, reducedPoints, reducedPointsSize * sizeof(int));
}
else if ( gridptr->projtype == CDI_PROJ_RLL )
{
......
......@@ -1896,15 +1896,15 @@ void gribapiDefGridRegular(grib_handle *gh, int gridID, int gridtype, bool gridI
{
nlon = 0;
int *rowlon = (int *) Malloc(nlat*sizeof(int));
int *reducedPoints = (int *) Malloc(nlat*sizeof(int));
long *pl = (long *) Malloc(nlat*sizeof(long));
gridInqReducedPoints(gridID, rowlon);
for ( size_t i = 0; i < nlat; ++i ) pl[i] = rowlon[i];
gridInqReducedPoints(gridID, reducedPoints);
for ( size_t i = 0; i < nlat; ++i ) pl[i] = reducedPoints[i];
GRIB_CHECK(grib_set_long_array(gh, "pl", pl, nlat), 0);
Free(pl);
Free(rowlon);
Free(reducedPoints);
xfirst = 0;
xinc = 360. * 0.5 / (double)nlat;
......
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