Definition at line 108 of file wave_simulation_real.cpp.
108 {
111
112
113 curr[0] = curr[1];
115
116
118
119 i32 mCourantSq32 =
static_cast<i32
>(
mCourantSq);
120
121 for (fl::size i = 1; i <
length + 1; i++) {
122
123
124 i32 lap =
125 (i32)curr[i + 1] - ((i32)curr[i] << 1) + curr[i - 1];
126
127
128 i32 term = (mCourantSq32 * lap) >> 15;
129
130
131
132 i32 f = -(i32)next[i] + ((i32)curr[i] << 1) + term;
133
134
135 f = f - (f / dampening_factor);
136
137
138 if (f > 32767)
139 f = 32767;
140 else if (f < -32768)
141 f = -32768;
142
143 next[i] = (i16)f;
144 }
145
147
148 for (fl::size i = 1; i <
length + 1; i++) {
149 if (next[i] < 0) {
150 next[i] = 0;
151 }
152 }
153 }
154
155
157}
References grid1, grid2, length, mCourantSq, mDampenening, mHalfDuplex, and whichGrid.