Definition at line 208 of file wave_simulation_real.cpp.
208 {
211
212
213 for (
size_t j = 0; j <
height + 2; ++j) {
216 }
217
218
219 for (
size_t i = 0; i <
width + 2; ++i) {
222 }
223
224
226 int32_t mCourantSq32 =
static_cast<int32_t
>(
mCourantSq);
227
228
229 for (
size_t j = 1; j <=
height; ++j) {
230 for (
size_t i = 1; i <=
width; ++i) {
231 int index = j *
stride + i;
232
233 int32_t laplacian = (int32_t)curr[index + 1] + curr[index - 1] +
235 ((int32_t)curr[index] << 2);
236
237
238
239 int32_t term = (mCourantSq32 * laplacian) >> 15;
240 int32_t f =
241 -(int32_t)next[index] + ((int32_t)curr[index] << 1) + term;
242
243
244 f = f - (f / dampening_factor);
245
246
247 if (f > 32767)
248 f = 32767;
249 else if (f < -32768)
250 f = -32768;
251
252 next[index] = (int16_t)f;
253 }
254 }
255
257
258 for (
size_t j = 1; j <=
height; ++j) {
259 for (
size_t i = 1; i <=
width; ++i) {
260 int index = j *
stride + i;
261 if (next[index] < 0) {
262 next[index] = 0;
263 }
264 }
265 }
266 }
267
268
270}
fl::scoped_array< int16_t > grid1
fl::scoped_array< int16_t > grid2
References grid1, grid2, height, mCourantSq, mDampening, mHalfDuplex, stride, whichGrid, and width.