1 /*
2   This file is part of CDO. CDO is a collection of Operators to manipulate and analyse Climate model Data.
3 
4   Author: Uwe Schulzweida
5 
6 */
7 #ifndef REMAP_STORE_LINK_H
8 #define REMAP_STORE_LINK_H
9 
10 #include <vector>
11 
12 // Predeclarations
13 struct RemapVars;
14 
15 struct Addweight
16 {
17   size_t add;
18   double weight;
19 };
20 
21 struct Addweight4
22 {
23   size_t add;
24   double weight[4];
25 };
26 
27 struct WeightLinks
28 {
29   size_t nlinks;
30   size_t offset;
31   Addweight *addweights;
32 };
33 
34 struct WeightLinks4
35 {
36   size_t nlinks;
37   size_t offset;
38   Addweight4 *addweights;
39 };
40 
41 void weight_links_alloc(size_t numNeighbors, size_t gridSize, std::vector<WeightLinks> &weightLinks);
42 void weight_links_4_alloc(size_t gridSize, std::vector<WeightLinks4> &weightLinks);
43 void store_weightlinks(int lalloc, size_t numWeights, size_t *srch_add, double *weights, size_t cell_add,
44                        std::vector<WeightLinks> &weightLinks);
45 void store_weightlinks_bicubic(size_t *srch_add, double (&weights)[4][4], size_t cell_add, std::vector<WeightLinks4> &weightLinks);
46 void weight_links_to_remap_links(int lalloc, size_t gridSize, std::vector<WeightLinks> &weightLinks, RemapVars &rv);
47 void weight_links_4_to_remap_links(size_t gridSize, std::vector<WeightLinks4> &weightLinks, RemapVars &rv);
48 void sort_weights(size_t numWeights, size_t *src_add, double *weights);
49 void sort_weights_n4(size_t *src_add, double *weights);
50 void sort_weights_bicubic(size_t *src_add, double (&weights)[4][4]);
51 
52 #endif /* REMAP_STORE_LINK */
53