YAC 3.18.0
Yet Another Coupler
Loading...
Searching...
No Matches
toy_common.h
Go to the documentation of this file.
1// Copyright (c) 2024 The YAC Authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5const char * fieldName[] = {"conserv_field_atm_oce",
6 "hcsbb_field_atm_oce",
7 "conserv_field_oce_atm",
8 "hcsbb_field_oce_atm"};
9int const num_fields = (int)(sizeof(fieldName)/sizeof(fieldName[0]));
10const int num_steps = 1;
11
12static inline void LLtoXYZ(double lon, double lat, double p_out[]) {
13
14 while (lon < -M_PI) lon += 2.0 * M_PI;
15 while (lon >= M_PI) lon -= 2.0 * M_PI;
16
17 double cos_lat = cos(lat);
18 p_out[0] = cos_lat * cos(lon);
19 p_out[1] = cos_lat * sin(lon);
20 p_out[2] = sin(lat);
21}
22
23static inline void XYZtoLL (double const p_in[], double * lon, double * lat) {
24
25 *lon = atan2(p_in[1] , p_in[0]);
26 *lat = M_PI_2 - acos(p_in[2]);
27}
28
29#define MIN(a,b) ((a) < (b) ? (a) : (b))
const int num_steps
Definition toy_common.h:10
int const num_fields
Definition toy_common.h:9
static void LLtoXYZ(double lon, double lat, double p_out[])
Definition toy_common.h:12
const char * fieldName[]
Definition toy_common.h:5
static void XYZtoLL(double const p_in[], double *lon, double *lat)
Definition toy_common.h:23