YetAnotherCoupler 3.5.2
Loading...
Searching...
No Matches
grid_curve2d.c
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 "basic_grid_data.h"
6#include "grid_reg2d_common.h"
7#include "geometry.h"
8#include "utils_common.h"
9
11 size_t nbr_vertices[2], int cyclic[2],
12 double *lon_vertices, double *lat_vertices,
13 void (*LLtoXYZ_ptr)(double, double, double[])) {
14
16 !cyclic[1],
17 "ERROR(yac_generate_basic_grid_data_curve_2d): "
18 "cyclic[1] != 0 not yet supported")
19
20 size_t num_cells_2d[2] =
21 {nbr_vertices[0] - (cyclic[0]?0:1), nbr_vertices[1] - (cyclic[1]?0:1)};
22 size_t num_vertices_2d[2] = {num_cells_2d[0] + 1, num_cells_2d[1] + 1};
23 size_t num_vertices = num_vertices_2d[0] * num_vertices_2d[1];
24 size_t num_edges =
25 (num_cells_2d[0] + 1) * num_cells_2d[1] +
26 num_cells_2d[0] * (num_cells_2d[1] + 1);
27
30 for (size_t i = 0; i < num_vertices; ++i)
31 LLtoXYZ_ptr(lon_vertices[i], lat_vertices[i],
32 &(vertex_coordinates[i][0]));
33
35 for (size_t i = 0; i < num_edges; ++i) edge_type[i] = YAC_GREAT_CIRCLE_EDGE;
36
37 struct yac_basic_grid_data grid =
40 grid.edge_type = edge_type;
41 return grid;
42}
43
45 size_t nbr_vertices[2], int cyclic[2],
46 double *lon_vertices, double *lat_vertices) {
47
48 return
50 nbr_vertices, cyclic, lon_vertices, lat_vertices, LLtoXYZ);
51}
52
54 size_t nbr_vertices[2], int cyclic[2],
55 double *lon_vertices, double *lat_vertices) {
56
57 return
59 nbr_vertices, cyclic, lon_vertices, lat_vertices, LLtoXYZ_deg);
60}
static void LLtoXYZ_deg(double lon, double lat, double p_out[])
Definition geometry.h:304
static void LLtoXYZ(double lon, double lat, double p_out[])
Definition geometry.h:287
yac_edge_type
Definition grid_cell.h:12
@ YAC_GREAT_CIRCLE_EDGE
great circle
Definition grid_cell.h:13
static struct yac_basic_grid_data yac_generate_basic_grid_data_curve_2d_(size_t nbr_vertices[2], int cyclic[2], double *lon_vertices, double *lat_vertices, void(*LLtoXYZ_ptr)(double, double, double[]))
struct yac_basic_grid_data yac_generate_basic_grid_data_curve_2d_deg(size_t nbr_vertices[2], int cyclic[2], double *lon_vertices, double *lat_vertices)
struct yac_basic_grid_data yac_generate_basic_grid_data_curve_2d(size_t nbr_vertices[2], int cyclic[2], double *lon_vertices, double *lat_vertices)
struct yac_basic_grid_data yac_generate_basic_grid_data_reg2d_common(size_t nbr_vertices[2], int cyclic[2])
#define xmalloc(size)
Definition ppm_xfuncs.h:66
yac_coordinate_pointer vertex_coordinates
enum yac_edge_type * edge_type
#define YAC_ASSERT(exp, msg)
Definition yac_assert.h:16
double(* yac_coordinate_pointer)[3]
Definition yac_types.h:19