Changeset 2506 for XIOS2/trunk/extern/remap/src/elt.hpp
- Timestamp:
- 05/31/23 12:20:29 (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS2/trunk/extern/remap/src/elt.hpp
r1614 r2506 3 3 #include <list> 4 4 #include "triple.hpp" 5 #include <vector> 5 6 6 #define NMAX 10 /**< maximum number of vertices for polygons */7 #define NMAX 0 /**< maximum number of vertices for polygons */ 7 8 8 9 #define NOT_FOUND -1 … … 58 59 { 59 60 int k = 0; 61 vertex.resize(max_num_vert) ; 60 62 vertex[k++] = xyz(bounds_lon[0], bounds_lat[0]); 61 63 for (int i = 1; i < max_num_vert; i++) … … 72 74 } 73 75 n = k; 74 x = barycentre(vertex, n); 76 vertex.resize(n) ; 77 vertex.shrink_to_fit(); 78 allocate() ; 79 80 x = barycentre(vertex.data(), n); 75 81 } 76 82 void allocate(void) 83 { 84 vertex.resize(n) ; 85 neighbour.resize(n) ; 86 d.resize(n) ; 87 edge.resize(n) ; 88 gradNeigh.resize(n) ; 89 neighId.resize(n) ; 90 } 77 91 Elt& operator=(const Elt& rhs) 78 92 { … … 87 101 is = rhs.is; 88 102 89 for(int i = 0; i < NMAX; i++) 90 { 91 neighbour[i] = rhs.neighbour[i]; 92 d[i] = rhs.d[i]; 93 edge[i] = rhs.edge[i]; 94 vertex[i] = rhs.vertex[i]; 95 gradNeigh[i] = rhs.gradNeigh[i]; 96 } 103 neighbour = rhs.neighbour; 104 d = rhs.d; 105 edge = rhs.edge; 106 vertex = rhs.vertex; 107 gradNeigh = rhs.gradNeigh; 97 108 return *this; 98 109 } … … 109 120 void insert_vertex(int i, const Coord& v) 110 121 { 122 vertex.resize(n+1) ; 123 edge.resize(n+1) ; 124 d.resize(n+1) ; 125 neighbour.resize(n+1) ; 126 gradNeigh.resize(n+1) ; 127 neighId.resize(n+1) ; 128 111 129 for(int j=n; j > i ; j--) 112 130 { … … 120 138 } 121 139 122 int neighbour[NMAX];123 double d[NMAX]; /**< distance of centre of small circle to origin, zero if great circle */140 std::vector<int> neighbour; 141 std::vector<double> d; /**< distance of centre of small circle to origin, zero if great circle */ 124 142 double val; /**< value (sample if src element, interpolated if dest element) */ 125 Coord vertex[NMAX];126 Coord edge[NMAX]; /**< edge normals: if great circle tangential to sphere, if small circle parallel to pole */143 std::vector<Coord> vertex; 144 std::vector<Coord> edge; /**< edge normals: if great circle tangential to sphere, if small circle parallel to pole */ 127 145 Coord grad; /**< gradient of the reconstructed linear function over this element */ 128 Coord gradNeigh[NMAX]; /**< for weight computation: gradients for val=1 at individual neighbours */129 st ruct GloId neighId[NMAX]; /**< weight computation needs to know global IDs for all sources with "link" */146 std::vector<Coord> gradNeigh; /**< for weight computation: gradients for val=1 at individual neighbours */ 147 std::vector<struct GloId> neighId; /**< weight computation needs to know global IDs for all sources with "link" */ 130 148 std::list<Polyg*> is; /**< intersections */ 131 149 };
Note: See TracChangeset
for help on using the changeset viewer.