remap_store_link.h 1.97 KB
Newer Older
1
2
3
4
/*
  This file is part of CDO. CDO is a collection of Operators to
  manipulate and analyse Climate model Data.

Uwe Schulzweida's avatar
Uwe Schulzweida committed
5
  Copyright (C) 2003-2020 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
6
7
8
9
10
11
12
13
14
15
16
  See COPYING file for copying and redistribution conditions.

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; version 2 of the License.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
*/
17
18
#ifndef REMAP_STORE_LINK_H
#define REMAP_STORE_LINK_H
Uwe Schulzweida's avatar
Uwe Schulzweida committed
19

20
21
#include <vector>

22
// Predeclarations
23
24
struct RemapVars;

25
struct Addweight
Uwe Schulzweida's avatar
Uwe Schulzweida committed
26
{
27
  size_t add;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
28
  double weight;
29
};
Uwe Schulzweida's avatar
Uwe Schulzweida committed
30

31
struct Addweight4
32
{
33
  size_t add;
34
  double weight[4];
35
};
36

37
struct WeightLinks
38
{
39
40
  size_t nlinks;
  size_t offset;
41
  Addweight *addweights;
42
};
43

44
struct WeightLinks4
45
{
46
47
  size_t nlinks;
  size_t offset;
48
  Addweight4 *addweights;
49
50
};

51
52
void weightLinksAlloc(size_t numNeighbors, size_t gridSize, std::vector<WeightLinks> &weightLinks);
void weightLinks4Alloc(size_t gridSize, std::vector<WeightLinks4> &weightLinks);
53
54
void store_weightlinks(int lalloc, size_t numWeights, size_t *srch_add, double *weights, size_t cell_add,
                       std::vector<WeightLinks> &weightLinks);
55
void store_weightlinks_bicubic(size_t *srch_add, double (&weights)[4][4], size_t cell_add, std::vector<WeightLinks4> &weightLinks);
56
57
void weightLinksToRemapLinks(int lalloc, size_t gridSize, std::vector<WeightLinks> &weightLinks, RemapVars &rv);
void weightLinks4ToRemapLinks(size_t gridSize, std::vector<WeightLinks4> &weightLinks, RemapVars &rv);
58
59
60
void sort_weights(size_t numWeights, size_t *src_add, double *weights);
void sort_weights_n4(size_t *src_add, double *weights);
void sort_weights_bicubic(size_t *src_add, double (&weights)[4][4]);
61

62
#endif /* REMAP_STORE_LINK */