Skip to content

Commit 9100e51

Browse files
mo-jonasgandertonwdeconinck
authored andcommitted
Add pre-transposed lfric rotations
1 parent 96bfe71 commit 9100e51

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/atlas/grid/detail/grid/CubedSphere2.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ PointXYZ CubedSphere2::tangent_to_xyz_coord(const PointXY& tan_coord, idx_t tile
120120

121121
tan_point << tan_coord[0], tan_coord[1], 1;
122122

123-
xyz = lfric_rotations_[tile].transpose() * tan_point;
123+
xyz = lfric_rotations_transposed_[tile] * tan_point;
124124
xyz.normalize();
125125

126126
return {xyz(0), xyz(1), xyz(2)};

src/atlas/grid/detail/grid/CubedSphere2.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,15 @@ class CubedSphere2 : public Grid {
181181
Matrix({{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}})
182182
};
183183

184+
std::array<Matrix, 6> lfric_rotations_transposed_ = {
185+
Matrix({{0, 0, 1}, {1, 0, 0}, {0, -1, 0}}),
186+
Matrix({{-1, 0, 0}, {0, 0, 1}, {0, -1, 0}}),
187+
Matrix({{0, 0, -1}, {-1, 0, 0}, {0, -1, 0}}),
188+
Matrix({{1, 0, 0}, {0, 0, -1}, {0, -1, 0}}),
189+
Matrix({{-1, 0, 0}, {0, 1, 0}, {0, 0, 1}}),
190+
Matrix({{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}})
191+
};
192+
184193
};
185194

186195
} // namespace grid

0 commit comments

Comments
 (0)