| 71 | return bandwidth_bytes_per_cell; |
| 72 | } |
| 73 | uint3 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 | |
| 85 | string 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); |
nothing calls this directly
no test coverage detected