Commit d785944d authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Defer loading of x/y value data in base implementation as long as possible.

parent 43d3d3b4
...@@ -1422,11 +1422,13 @@ gridInqXValsSerial(grid_t *gridptr, double *xvals) ...@@ -1422,11 +1422,13 @@ gridInqXValsSerial(grid_t *gridptr, double *xvals)
if ( CDI_Debug && size == 0 ) if ( CDI_Debug && size == 0 )
Warning("size undefined for gridID = %d", gridptr->self); Warning("size undefined for gridID = %d", gridptr->self);
const double *gridptr_xvals = gridptr->vtable->inqXValsPtr(gridptr); if ( gridptr->xvals )
if (gridptr_xvals)
{ {
if ( size && xvals ) if ( size && xvals )
memcpy(xvals, gridptr_xvals, (size_t)size * sizeof (double)); {
const double *gridptr_xvals = gridptr->vtable->inqXValsPtr(gridptr);
memcpy(xvals, gridptr_xvals, (size_t)size * sizeof (double));
}
} }
else else
size = 0; size = 0;
...@@ -1518,7 +1520,10 @@ gridInqYValsSerial(grid_t *gridptr, double *yvals) ...@@ -1518,7 +1520,10 @@ gridInqYValsSerial(grid_t *gridptr, double *yvals)
if ( gridptr->yvals ) if ( gridptr->yvals )
{ {
if ( size && yvals ) if ( size && yvals )
memcpy(yvals, gridptr->yvals, (size_t)size * sizeof (double)); {
const double *gridptr_yvals = gridptr->vtable->inqYValsPtr(gridptr);
memcpy(yvals, gridptr_yvals, (size_t)size * sizeof (double));
}
} }
else else
size = 0; size = 0;
......
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