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