Definition at line 226 of file wave_simulation_real.cpp.
226 {
229
230
231 for (
size_t j = 0; j <
height + 2; ++j) {
235 } else {
238 }
239 }
240
241
242 for (
size_t i = 0; i <
width + 2; ++i) {
245 }
246
247
249 int32_t mCourantSq32 =
static_cast<int32_t
>(
mCourantSq);
250
251
252 for (
size_t j = 1; j <=
height; ++j) {
253 for (
size_t i = 1; i <=
width; ++i) {
254 int index = j *
stride + i;
255
256 int32_t laplacian = (int32_t)curr[index + 1] + curr[index - 1] +
258 ((int32_t)curr[index] << 2);
259
260
261
262 int32_t term = (mCourantSq32 * laplacian) >> 15;
263 int32_t f =
264 -(int32_t)next[index] + ((int32_t)curr[index] << 1) + term;
265
266
267 f = f - (f / dampening_factor);
268
269
270 if (f > 32767)
271 f = 32767;
272 else if (f < -32768)
273 f = -32768;
274
275 next[index] = (int16_t)f;
276 }
277 }
278
280
281 for (
size_t j = 1; j <=
height; ++j) {
282 for (
size_t i = 1; i <=
width; ++i) {
283 int index = j *
stride + i;
284 if (next[index] < 0) {
285 next[index] = 0;
286 }
287 }
288 }
289 }
290
291
293}
fl::vector< int16_t, fl::allocator_psram< int16_t > > grid2
fl::vector< int16_t, fl::allocator_psram< int16_t > > grid1
References grid1, grid2, height, mCourantSq, mDampening, mHalfDuplex, mXCylindrical, stride, whichGrid, and width.