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