! . */
| 2373 | |
| 2374 | /*! . */ |
| 2375 | GMT_LOCAL size_t gmtapi_set_grdarray_size (struct GMT_CTRL *GMT, struct GMT_GRID_HEADER *h, unsigned int mode, double *wesn) { |
| 2376 | /* Determines size of grid given grid spacing and grid domain in h. |
| 2377 | * However, if wesn is given and not empty we compute size using the sub-region instead. |
| 2378 | * Finally, the current pad is used when calculating the grid size. |
| 2379 | * NOTE: This function leaves h unchanged by testing on a temporary header. */ |
| 2380 | struct GMT_GRID_HEADER *h_tmp = NULL; |
| 2381 | size_t size; |
| 2382 | |
| 2383 | /* Must duplicate header and possibly reset wesn, then set pad and recalculate all dims */ |
| 2384 | h_tmp = gmt_get_header (GMT); |
| 2385 | gmt_copy_gridheader (GMT, h_tmp, h); |
| 2386 | h_tmp->complex_mode = (mode & GMT_GRID_IS_COMPLEX_MASK); /* Set the mode-to-be so that if complex the size is doubled */ |
| 2387 | |
| 2388 | if (!full_region (wesn)) { |
| 2389 | gmt_M_memcpy (h_tmp->wesn, wesn, 4, double); /* Use wesn instead of header info */ |
| 2390 | gmt_adjust_loose_wesn (GMT, wesn, h); /* Subset requested; make sure wesn matches header spacing */ |
| 2391 | gmt_M_memcpy(h_tmp->wesn, wesn, 4, double); /* And update the eventually adjusted wesn */ |
| 2392 | } |
| 2393 | gmt_M_grd_setpad (GMT, h_tmp, GMT->current.io.pad); /* Use the system pad setting by default */ |
| 2394 | gmt_set_grddim (GMT, h_tmp); /* Computes all integer parameters */ |
| 2395 | size = h_tmp->size; /* This is the size needed to hold grid + padding */ |
| 2396 | gmt_M_free (GMT, h_tmp->hidden); |
| 2397 | gmt_M_free (GMT, h_tmp); |
| 2398 | return (size); |
| 2399 | } |
| 2400 | |
| 2401 | /*! . */ |
| 2402 | GMT_LOCAL int gmtapi_open_grd (struct GMT_CTRL *GMT, char *file, struct GMT_GRID *G, char mode, unsigned int access_mode) { |
no test coverage detected