Commit 5bd0acd3 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

remapGridInit: read grid mask

parent 50d84935
......@@ -784,10 +784,6 @@ void *Remap(void *argument)
}
memcpy(remaps[r].grid.grid1_mask, imask, remaps[r].grid.grid1_size*sizeof(int));
/*
for ( i = 0; i < gridsize; i++ )
if ( remaps[r].grid.grid1_mask[i] ) remaps[r].grid.grid1_mask[i] = imask[i];
*/
if ( map_type == MAP_TYPE_CONSERV )
{
......
......@@ -937,6 +937,7 @@ int gridFromFile(FILE *gfp, const char *dname)
if ( size > 0 )
{
long count = 0;
pline = skipSeparator(pline + len);
grid.mask = (int *) malloc(size*sizeof(int));
......@@ -955,8 +956,15 @@ int gridFromFile(FILE *gfp, const char *dname)
lval = strtol(pline, &endptr, 10);
}
grid.mask[i] = (int)lval;
if ( grid.mask[i] == 1 ) count++;
pline = endptr;
}
if ( count == size )
{
free(grid.mask);
grid.mask = NULL;
}
}
else
Warning(func, "gridsize undefined!");
......
......@@ -970,10 +970,24 @@ void remapGridInit(int map_type, int lextrapolate, int gridID1, int gridID2, rem
/* Initialize logical mask */
if ( gridInqMask(rg->gridID2, NULL) )
{
gridInqMask(rg->gridID2, rg->grid2_mask);
for ( i = 0; i < grid2_size; i++ )
{
if ( rg->grid2_mask[i] > 0 && rg->grid2_mask[i] < 255 )
rg->grid2_mask[i] = TRUE;
else
rg->grid2_mask[i] = FALSE;
}
}
else
{
#if defined (_OPENMP)
#pragma omp parallel for default(none) shared(grid2_size, rg)
#endif
for ( i = 0; i < grid2_size; i++ ) rg->grid2_mask[i] = TRUE;
for ( i = 0; i < grid2_size; i++ ) rg->grid2_mask[i] = TRUE;
}
if ( gridInqType(rg->gridID2) == GRID_GME ) gridInqMaskGME(gridID2_gme, rg->grid2_vgpm);
......
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