Blender  V2.93
ocean_intern.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #ifdef WITH_OCEANSIM
28 # include "BLI_threads.h"
29 # include "fftw3.h"
30 # define GRAVITY 9.81f
31 
32 typedef struct Ocean {
33  /* ********* input parameters to the sim ********* */
34  float _V;
35  float _l;
36  float _w;
37  float _A;
38  float _damp_reflections;
39  float _wind_alignment;
40  float _depth;
41 
42  float _wx;
43  float _wz;
44 
45  float _L;
46 
47  /* dimensions of computational grid */
48  int _M;
49  int _N;
50 
51  /* spatial size of computational grid */
52  float _Lx;
53  float _Lz;
54 
55  float normalize_factor; /* init w */
56  float time;
57 
58  short _do_disp_y;
59  short _do_normals;
60  short _do_spray;
61  short _do_chop;
62  short _do_jacobian;
63 
64  /* Which spectral model we are using. */
65  int _spectrum;
66 
67  /* JONSWAP common parameters. */
68  float _fetch_jonswap;
69  float _sharpen_peak_jonswap;
70 
71  /* mutex for threaded texture access */
72  ThreadRWMutex oceanmutex;
73 
74  /* ********* sim data arrays ********* */
75 
76  /* two dimensional arrays of complex */
77  fftw_complex *_fft_in; /* init w sim w */
78  fftw_complex *_fft_in_x; /* init w sim w */
79  fftw_complex *_fft_in_z; /* init w sim w */
80  fftw_complex *_fft_in_jxx; /* init w sim w */
81  fftw_complex *_fft_in_jzz; /* init w sim w */
82  fftw_complex *_fft_in_jxz; /* init w sim w */
83  fftw_complex *_fft_in_nx; /* init w sim w */
84  fftw_complex *_fft_in_nz; /* init w sim w */
85  fftw_complex *_htilda; /* init w sim w (only once) */
86 
87  /* fftw "plans" */
88  fftw_plan _disp_y_plan; /* init w sim r */
89  fftw_plan _disp_x_plan; /* init w sim r */
90  fftw_plan _disp_z_plan; /* init w sim r */
91  fftw_plan _N_x_plan; /* init w sim r */
92  fftw_plan _N_z_plan; /* init w sim r */
93  fftw_plan _Jxx_plan; /* init w sim r */
94  fftw_plan _Jxz_plan; /* init w sim r */
95  fftw_plan _Jzz_plan; /* init w sim r */
96 
97  /* two dimensional arrays of float */
98  double *_disp_y; /* init w sim w via plan? */
99  double *_N_x; /* init w sim w via plan? */
100  /* all member of this array has same values,
101  * so convert this array to a float to reduce memory usage (MEM01). */
102  /*float * _N_y; */
103  double _N_y; /* sim w ********* can be rearranged? */
104  double *_N_z; /* init w sim w via plan? */
105  double *_disp_x; /* init w sim w via plan? */
106  double *_disp_z; /* init w sim w via plan? */
107 
108  /* two dimensional arrays of float */
109  /* Jacobian and minimum eigenvalue */
110  double *_Jxx; /* init w sim w */
111  double *_Jzz; /* init w sim w */
112  double *_Jxz; /* init w sim w */
113 
114  /* one dimensional float array */
115  float *_kx; /* init w sim r */
116  float *_kz; /* init w sim r */
117 
118  /* two dimensional complex array */
119  fftw_complex *_h0; /* init w sim r */
120  fftw_complex *_h0_minus; /* init w sim r */
121 
122  /* two dimensional float array */
123  float *_k; /* init w sim r */
124 } Ocean;
125 #else
126 /* stub */
127 typedef struct Ocean {
128  /* need some data here, C does not allow empty struct */
129  int stub;
131 #endif
132 
133 #ifdef __cplusplus
134 }
135 #endif
pthread_rwlock_t ThreadRWMutex
Definition: BLI_threads.h:126
double time
struct Ocean Ocean
int stub
Definition: ocean_intern.h:129