Definition at line 226 of file wave_simulation_real.cpp.
226 {
229
230
231 for (fl::size j = 0; j <
height + 2; ++j) {
235 } else {
238 }
239 }
240
241
242 for (fl::size i = 0; i <
width + 2; ++i) {
245 }
246
247
249 i32 mCourantSq32 =
static_cast<i32
>(
mCourantSq);
250
251
252 for (fl::size j = 1; j <=
height; ++j) {
253 for (fl::size i = 1; i <=
width; ++i) {
254 int index = j *
stride + i;
255
256 i32 laplacian = (i32)curr[index + 1] + curr[index - 1] +
258 ((i32)curr[index] << 2);
259
260
261
262 i32 term = (mCourantSq32 * laplacian) >> 15;
263 i32 f =
264 -(i32)next[index] + ((i32)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] = (i16)f;
276 }
277 }
278
280
281 for (fl::size j = 1; j <=
height; ++j) {
282 for (fl::size 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< i16, fl::allocator_psram< i16 > > grid1
fl::vector< i16, fl::allocator_psram< i16 > > grid2
References grid1, grid2, height, mCourantSq, mDampening, mHalfDuplex, mXCylindrical, stride, whichGrid, and width.