YetAnotherCoupler 3.5.2
Loading...
Searching...
No Matches
grid_cloud.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 <string.h>
6
7#include "basic_grid_data.h"
8#include "geometry.h"
9#include "utils_common.h"
10
12 size_t nbr_points, double *x_points, double *y_points,
13 void (*LLtoXYZ_ptr)(double, double, double[])) {
14
16 xmalloc(nbr_points * sizeof(*vertex_coordinates));
17 for (size_t i = 0; i < nbr_points; ++i)
18 LLtoXYZ_ptr(
19 x_points[i], y_points[i], &(vertex_coordinates[i][0]));
20
21 struct yac_basic_grid_data grid;
23 grid.cell_ids = NULL;
24 grid.vertex_ids = NULL;
25 grid.edge_ids = NULL;
26 grid.num_cells = 0;
27 grid.num_vertices = nbr_points;
28 grid.num_edges = 0;
29 grid.core_cell_mask = NULL;
30 grid.core_vertex_mask = NULL;
31 grid.core_edge_mask = NULL;
32 grid.num_vertices_per_cell = NULL;
34 xcalloc(nbr_points, sizeof(*grid.num_cells_per_vertex));
35 grid.cell_to_vertex = NULL;
36 grid.cell_to_vertex_offsets = NULL;
37 grid.cell_to_edge = NULL;
38 grid.cell_to_edge_offsets = NULL;
39 grid.vertex_to_cell = NULL;
41 xcalloc(nbr_points, sizeof(*grid.vertex_to_cell_offsets));
42 grid.edge_to_vertex = NULL;
43 grid.edge_type = NULL;
44 grid.num_total_cells = 0;
45 grid.num_total_vertices = nbr_points;
46 grid.num_total_edges = 0;
47 return grid;
48}
49
51 size_t nbr_points, double *x_points, double *y_points) {
52
53 return
55 nbr_points, x_points, y_points, LLtoXYZ);
56}
57
59 size_t nbr_points, double *x_points, double *y_points) {
60
61 return
63 nbr_points, x_points, y_points, LLtoXYZ_deg);
64}
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
struct yac_basic_grid_data yac_generate_basic_grid_data_cloud(size_t nbr_points, double *x_points, double *y_points)
Definition grid_cloud.c:50
static struct yac_basic_grid_data yac_generate_basic_grid_data_cloud_(size_t nbr_points, double *x_points, double *y_points, void(*LLtoXYZ_ptr)(double, double, double[]))
Definition grid_cloud.c:11
struct yac_basic_grid_data yac_generate_basic_grid_data_cloud_deg(size_t nbr_points, double *x_points, double *y_points)
Definition grid_cloud.c:58
#define xcalloc(nmemb, size)
Definition ppm_xfuncs.h:64
#define xmalloc(size)
Definition ppm_xfuncs.h:66
yac_coordinate_pointer vertex_coordinates
size_t * vertex_to_cell_offsets
yac_size_t_2_pointer edge_to_vertex
enum yac_edge_type * edge_type
size_t * cell_to_vertex_offsets
double(* yac_coordinate_pointer)[3]
Definition yac_types.h:19