Blender V4.3
ocean_intern.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#ifdef WITH_OCEANSIM
16# include "BLI_threads.h"
17# include "fftw3.h"
18# define GRAVITY 9.81f
19
20typedef struct Ocean {
21 /* ********* input parameters to the sim ********* */
22 float _V;
23 float _l;
24 float _w;
25 float _A;
26 float _damp_reflections;
27 float _wind_alignment;
28 float _depth;
29
30 float _wx;
31 float _wz;
32
33 float _L;
34
35 /* dimensions of computational grid */
36 int _M;
37 int _N;
38
39 /* spatial size of computational grid */
40 float _Lx;
41 float _Lz;
42
43 float normalize_factor; /* init w */
44 float time;
45
46 short _do_disp_y;
47 short _do_normals;
48 short _do_spray;
49 short _do_chop;
50 short _do_jacobian;
51
52 /* Which spectral model we are using. */
53 int _spectrum;
54
55 /* JONSWAP common parameters. */
56 float _fetch_jonswap;
57 float _sharpen_peak_jonswap;
58
59 /* mutex for threaded texture access */
60 ThreadRWMutex oceanmutex;
61
62 /* ********* sim data arrays ********* */
63
64 /* two dimensional arrays of complex */
65 fftw_complex *_fft_in; /* init w sim w */
66 fftw_complex *_fft_in_x; /* init w sim w */
67 fftw_complex *_fft_in_z; /* init w sim w */
68 fftw_complex *_fft_in_jxx; /* init w sim w */
69 fftw_complex *_fft_in_jzz; /* init w sim w */
70 fftw_complex *_fft_in_jxz; /* init w sim w */
71 fftw_complex *_fft_in_nx; /* init w sim w */
72 fftw_complex *_fft_in_nz; /* init w sim w */
73 fftw_complex *_htilda; /* init w sim w (only once) */
74
75 /* fftw "plans" */
76 fftw_plan _disp_y_plan; /* init w sim r */
77 fftw_plan _disp_x_plan; /* init w sim r */
78 fftw_plan _disp_z_plan; /* init w sim r */
79 fftw_plan _N_x_plan; /* init w sim r */
80 fftw_plan _N_z_plan; /* init w sim r */
81 fftw_plan _Jxx_plan; /* init w sim r */
82 fftw_plan _Jxz_plan; /* init w sim r */
83 fftw_plan _Jzz_plan; /* init w sim r */
84
85 /* two dimensional arrays of float */
86 double *_disp_y; /* init w sim w via plan? */
87 double *_N_x; /* init w sim w via plan? */
88 /* all member of this array has same values,
89 * so convert this array to a float to reduce memory usage (MEM01). */
90 // float * _N_y;
91 double _N_y; /* sim w ********* can be rearranged? */
92 double *_N_z; /* init w sim w via plan? */
93 double *_disp_x; /* init w sim w via plan? */
94 double *_disp_z; /* init w sim w via plan? */
95
96 /* two dimensional arrays of float */
97 /* Jacobian and minimum eigenvalue */
98 double *_Jxx; /* init w sim w */
99 double *_Jzz; /* init w sim w */
100 double *_Jxz; /* init w sim w */
101
102 /* one dimensional float array */
103 float *_kx; /* init w sim r */
104 float *_kz; /* init w sim r */
105
106 /* two dimensional complex array */
107 fftw_complex *_h0; /* init w sim r */
108 fftw_complex *_h0_minus; /* init w sim r */
109
110 /* two dimensional float array */
111 float *_k; /* init w sim r */
112} Ocean;
113#else
114/* stub */
115typedef struct Ocean {
116 /* need some data here, C does not allow empty struct */
117 int stub;
119#endif
120
121#ifdef __cplusplus
122}
123#endif
pthread_rwlock_t ThreadRWMutex
double time
struct Ocean Ocean