MCPcopy Create free account
hub / github.com/cselab/aphros / main_loop

Function main_loop

examples/107_wasm/diffusion.cpp:169–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169static void main_loop() {
170 auto state = g_state;
171 auto& s = *state;
172 if (s.pause) {
173 return;
174 }
175 std::memset(g_canvas->buf.data(), 0, g_canvas->size.prod() * 4);
176 SingleTimer timer;
177 s.distrsolver.Run();
178 const Scal tstep = timer.GetSeconds();
179
180 if (s.step % 10 == 0) {
181 std::cout << util::Format(
182 "step={:05} t={:.5f} dt={:.5f} diff={:.3f} vel={:.2f} "
183 "tstep={}ms",
184 s.step, s.time, s.dt, s.diffusion, s.velocity, tstep * 1e3)
185 << std::endl;
186 }
187 CopyToCanvas(g_canvas->buf.data(), g_canvas->size[0], g_canvas->size[1]);
188}
189
190extern "C" {
191Scal MulDiffusion(Scal factor) {

Callers

nothing calls this directly

Calls 6

FormatFunction · 0.85
prodMethod · 0.80
GetSecondsMethod · 0.80
CopyToCanvasFunction · 0.70
dataMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected