YAC 3.13.0
Yet Another Coupler
Loading...
Searching...
No Matches
toy_multi_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
5#include <math.h>
6
8 char const * comp_name, int comp_id, int grid_id,
9 int cell_point_id, int corner_point_id,
10 double * cell_point_data, double * corner_point_data,
11 YAC_VTK_FILE * vtk_file);
12
13static inline void LLtoXYZ(double lon, double lat, double p_out[]) {
14
15 while (lon < -M_PI) lon += 2.0 * M_PI;
16 while (lon >= M_PI) lon -= 2.0 * M_PI;
17
18 double cos_lat = cos(lat);
19 p_out[0] = cos_lat * cos(lon);
20 p_out[1] = cos_lat * sin(lon);
21 p_out[2] = sin(lat);
22}
23
24static inline void XYZtoLL (double const p_in[], double * lon, double * lat) {
25
26 *lon = atan2(p_in[1] , p_in[0]);
27 *lat = M_PI_2 - acos(p_in[2]);
28}
29
30#define MIN(a,b) ((a) < (b) ? (a) : (b))
int grid_id
int cell_point_id
int comp_id
int run_toy_multi_common(char const *comp_name, int comp_id, int grid_id, int cell_point_id, int corner_point_id, double *cell_point_data, double *corner_point_data, YAC_VTK_FILE *vtk_file)
static void LLtoXYZ(double lon, double lat, double p_out[])
static void XYZtoLL(double const p_in[], double *lon, double *lat)