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,12 +1422,14 @@ gridInqXValsSerial(grid_t *gridptr, double *xvals)
if ( CDI_Debug && size == 0 )
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 )
{
const double *gridptr_xvals = gridptr->vtable->inqXValsPtr(gridptr);
memcpy(xvals, gridptr_xvals, (size_t)size * sizeof (double));
}
}
else
size = 0;
return (int)size;
......@@ -1518,7 +1520,10 @@ gridInqYValsSerial(grid_t *gridptr, double *yvals)
if ( gridptr->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
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