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

Virtualize grid value comparisons.

parent 51c865b4
......@@ -2224,9 +2224,7 @@ int gridCompare(int gridID, const grid_t *grid)
}
}
else if ( grid->xvals && grid->yvals )
{
differ = compareXYvals(gridRef, (grid_t *)grid);
}
differ = gridRef->vtable->compareXYFull(gridRef, (grid_t *)grid);
}
else
differ = 1;
......@@ -2237,7 +2235,7 @@ int gridCompare(int gridID, const grid_t *grid)
{
if ( grid->xdef == 1 && grid->ydef == 1
&& grid->xvals && grid->yvals )
differ = compareXYvals(gridRef, (grid_t *)grid);
differ = gridRef->vtable->compareXYFull(gridRef, (grid_t *)grid);
}
else if ( (grid->ysize == 0 || grid->ysize == 1) &&
grid->xsize == gridInqXsize(gridID)*gridInqYsize(gridID) )
......@@ -2262,9 +2260,7 @@ int gridCompare(int gridID, const grid_t *grid)
}
}
else if ( grid->xvals && grid->yvals )
{
differ = compareXYvals(gridRef, (grid_t *)grid);
}
differ = gridRef->vtable->compareXYFull(gridRef, (grid_t *)grid);
}
else
differ = 1;
......@@ -2287,7 +2283,7 @@ int gridCompare(int gridID, const grid_t *grid)
printf("grid nv %d\n", gridInqNvertex(gridID));
*/
if ( grid->xsize == gridInqXsize(gridID) && grid->ysize == gridInqYsize(gridID) )
differ = compareXYvals2(gridRef, (grid_t *)grid);
differ = gridRef->vtable->compareXYAO(gridRef, (grid_t *)grid);
}
else if ( grid->type == GRID_UNSTRUCTURED )
{
......@@ -2318,7 +2314,7 @@ int gridCompare(int gridID, const grid_t *grid)
differ = grid->nvertex != gridInqNvertex(gridID)
|| grid->number != gridInqNumber(gridID)
|| (grid->number > 0 && grid->position != gridInqPosition(gridID))
|| compareXYvals2(gridRef, (grid_t *)grid);
|| gridRef->vtable->compareXYAO(gridRef, (grid_t *)grid);
}
}
}
......@@ -4800,6 +4796,8 @@ const struct gridVirtTable cdiGridVtable
.inqYVals = gridInqYValsSerial,
.inqXValsPtr = gridInqXValsPtrSerial,
.inqYValsPtr = gridInqYValsPtrSerial,
.compareXYFull = compareXYvals,
.compareXYAO = compareXYvals2,
.inqArea = gridInqAreaSerial,
.inqAreaPtr = gridInqAreaPtrBase,
.hasArea = gridHasAreaBase,
......
......@@ -24,6 +24,11 @@ struct gridVirtTable
int (*inqYVals)(grid_t *gridptr, double *yvals);
const double *(*inqXValsPtr)(grid_t *gridptr);
const double *(*inqYValsPtr)(grid_t *gridptr);
/* return if for both grids, all xval and all yval are equal */
int (*compareXYFull)(grid_t *gridRef, grid_t *gridTest);
/* return if for both grids, x[0], y[0], x[size-1] and y[size-1] are
* respectively equal */
int (*compareXYAO)(grid_t *gridRef, grid_t *gridTest);
void (*inqArea)(grid_t *gridptr, double *area);
const double *(*inqAreaPtr)(grid_t *gridptr);
int (*hasArea)(grid_t *gridptr);
......
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