#ifndef REMAP_VARS_H #define REMAP_VARS_H #include // size_t #include class RemapGradients { public: Varray grad_lat; Varray grad_lon; Varray grad_latlon; void init(size_t size) { grad_lat.resize(size); grad_lon.resize(size); grad_latlon.resize(size); } RemapGradients(size_t size) { init(size); } RemapGradients() {} }; enum class RemapMethod { UNDEF, BILINEAR, BICUBIC, DISTWGT, CONSERV, CONSERV_SCRIP }; enum class NormOpt { NONE, DESTAREA, FRACAREA }; struct RemapLink { bool option; size_t max_links; size_t num_blks; Varray num_links; Varray2D src_add; Varray2D dst_add; Varray2D w_index; }; struct RemapVars { bool sort_add; bool pinit; // true: if the pointers are initialized RemapMethod mapType; // identifier for remapping method NormOpt normOpt; // option for normalization (conserv only) long links_per_value; size_t max_links; // current size of link arrays size_t num_links; // actual number of links for remapping size_t num_wts; // num of weights used in remapping size_t resize_increment; // default amount to increase array size Varray src_cell_add; // source grid address for each link Varray tgt_cell_add; // target grid address for each link Varray wts; // map weights for each link [max_links*num_wts] RemapLink links; }; void remap(double *dst_array, double missval, size_t dst_size, const RemapVars &rv, const double *src_array, RemapGradients &gradients); void remap_laf(double *dst_array, double missval, size_t dst_size, const RemapVars &rv, const double *src_array); void remap_avg(double *dst_array, double missval, size_t dst_size, const RemapVars &rv, const double *src_array); void remapVarsInit(RemapMethod mapType, int remapOrder, RemapVars &rv); void remapVarsEnsureSize(RemapVars &rv, size_t size); void remapVarsResize(RemapVars &rv, size_t size); void remapVarsReorder(RemapVars &rv); void remapVarsFree(RemapVars &rv); void remapVarsCheckWeights(const RemapVars &rv); #endif /* REMAP_VARS_H */