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