X-Git-Url: http://git.rrze.uni-erlangen.de/gitweb/?p=LbmBenchmarkKernelsPublic.git;a=blobdiff_plain;f=src%2FLattice.c;fp=src%2FLattice.c;h=bc218eb51b7bf236f84227f14239f35f4d34b39f;hp=0000000000000000000000000000000000000000;hb=e3f82424829ebb623343ce0092238f83b4a1b8c2;hpb=ecf590ae9bb13ba2b2f01c3bf7a53056a8b1467b diff --git a/src/Lattice.c b/src/Lattice.c new file mode 100644 index 0000000..bc218eb --- /dev/null +++ b/src/Lattice.c @@ -0,0 +1,59 @@ +// -------------------------------------------------------------------------- +// +// Copyright +// Markus Wittmann, 2016-2017 +// RRZE, University of Erlangen-Nuremberg, Germany +// markus.wittmann -at- fau.de or hpc -at- rrze.fau.de +// +// Viktor Haag, 2016 +// LSS, University of Erlangen-Nuremberg, Germany +// +// This file is part of the Lattice Boltzmann Benchmark Kernels (LbmBenchKernels). +// +// LbmBenchKernels is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// LbmBenchKernels is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with LbmBenchKernels. If not, see . +// +// -------------------------------------------------------------------------- +#include "Lattice.h" + +// Dumps the layers [zStart, zStop] of lattice as ASCII. +// Specify zStart = -1 and zStop = -1 as begin/end of lattice. + +void LatDumpAscii(LatticeDesc * ld, int zStart, int zStop) +{ + Assert(ld != NULL); + + const char strLatCellType[] = "X.IxO"; // X = Obstacle, . = Fluid, I = inlet, O = outlet + + int localZStart = zStart; + int localZStop = zStop; + + int * dims = ld->Dims; + LatticeT * lattice = ld->Lattice; + + if (localZStart == -1) localZStart = 0; + if (localZStop == -1) localZStop = dims[2] - 1; + + for (int z = localZStop; z >= localZStart; --z) { + printf("plane % 2d\n", z); + + for (int y = dims[1] - 1; y >= 0; --y) { + printf(" %2d ", y); + for (int x = 0; x < dims[0]; ++x) { + printf("%c", strLatCellType[lattice[L_INDEX_4(dims, x, y, z)]]); + } + printf("\n"); + } + } +} +