MCPcopy Create free account
hub / github.com/ProjectPhysX/FluidX3D / resolution

Function resolution

src/lbm.cpp:73–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 return bandwidth_bytes_per_cell;
72}
73uint3 resolution(const float3 box_aspect_ratio, const uint memory) { // input: simulation box aspect ratio and VRAM occupation in MB, output: grid resolution
74#ifndef D2Q9
75 float memory_required = (box_aspect_ratio.x*box_aspect_ratio.y*box_aspect_ratio.z)*(float)bytes_per_cell_device()/1048576.0f; // in MB
76 float scaling = cbrt((float)memory/memory_required);
77 return uint3(to_uint(scaling*box_aspect_ratio.x), to_uint(scaling*box_aspect_ratio.y), to_uint(scaling*box_aspect_ratio.z));
78#else // D2Q9
79 float memory_required = (box_aspect_ratio.x*box_aspect_ratio.y)*(float)bytes_per_cell_device()/1048576.0f; // in MB
80 float scaling = sqrt((float)memory/memory_required);
81 return uint3(to_uint(scaling*box_aspect_ratio.x), to_uint(scaling*box_aspect_ratio.y), 1u);
82#endif // D2Q9
83}
84
85string default_filename(const string& path, const string& name, const string& extension, const ulong t) { // generate a default filename with timestamp
86 string time = "00000000"+to_string(t);

Callers

nothing calls this directly

Calls 3

bytes_per_cell_deviceFunction · 0.85
uint3Class · 0.85
to_uintFunction · 0.85

Tested by

no test coverage detected