diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-16 17:40:15 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-16 18:27:26 +0300 |
commit | 4ff7c5eed6b546ae42692f3a869a5ccc095a9cb4 (patch) | |
tree | 03f8233788ae46e66672f711e3cf42d8d00d01cc /extern/mantaflow/preprocessed/kernel.h | |
parent | 6a3f2b30d206df23120cd212132adea821b6c20e (diff) |
Mantaflow [Part 1]: Added preprocessed Mantaflow source files
Includes preprocessed Mantaflow source files for both OpenMP and TBB (if OpenMP is not present, TBB files will be used instead).
These files come directly from the Mantaflow repository. Future updates to the core fluid solver will take place by updating the files.
Reviewed By: sergey, mont29
Maniphest Tasks: T59995
Differential Revision: https://developer.blender.org/D3850
Diffstat (limited to 'extern/mantaflow/preprocessed/kernel.h')
-rw-r--r-- | extern/mantaflow/preprocessed/kernel.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/extern/mantaflow/preprocessed/kernel.h b/extern/mantaflow/preprocessed/kernel.h new file mode 100644 index 00000000000..90e30cd21e1 --- /dev/null +++ b/extern/mantaflow/preprocessed/kernel.h @@ -0,0 +1,99 @@ + + +// DO NOT EDIT ! +// This file is generated using the MantaFlow preprocessor (prep generate). + +/****************************************************************************** + * + * MantaFlow fluid solver framework + * Copyright 2011-2014 Tobias Pfaff, Nils Thuerey + * + * This program is free software, distributed under the terms of the + * Apache License, Version 2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Function and macros for defining compution kernels over grids + * + ******************************************************************************/ + +#ifndef _KERNEL_H +#define _KERNEL_H + +#if TBB == 1 +# include <tbb/blocked_range3d.h> +# include <tbb/blocked_range.h> +# include <tbb/parallel_for.h> +# include <tbb/parallel_reduce.h> +#endif + +#if OPENMP == 1 +# include <omp.h> +#endif + +#include "general.h" + +namespace Manta { + +// fwd decl +class GridBase; +class Grid4dBase; +class ParticleBase; + +// simple iteration +#define FOR_IJK_BND(grid, bnd) \ + for (int k = ((grid).is3D() ? bnd : 0), \ + __kmax = ((grid).is3D() ? ((grid).getSizeZ() - bnd) : 1); \ + k < __kmax; \ + k++) \ + for (int j = bnd; j < (grid).getSizeY() - bnd; j++) \ + for (int i = bnd; i < (grid).getSizeX() - bnd; i++) + +#define FOR_IJK_REVERSE(grid) \ + for (int k = (grid).getSizeZ() - 1; k >= 0; k--) \ + for (int j = (grid).getSizeY() - 1; j >= 0; j--) \ + for (int i = (grid).getSizeX() - 1; i >= 0; i--) + +#define FOR_IDX(grid) \ + for (IndexInt idx = 0, total = (grid).getSizeX() * (grid).getSizeY() * (grid).getSizeZ(); \ + idx < total; \ + idx++) + +#define FOR_IJK(grid) FOR_IJK_BND(grid, 0) + +#define FOR_PARTS(parts) for (IndexInt idx = 0, total = (parts).size(); idx < total; idx++) + +// simple loop over 4d grids +#define FOR_IJKT_BND(grid, bnd) \ + for (int t = ((grid).is4D() ? bnd : 0); t < ((grid).is4D() ? ((grid).getSizeT() - bnd) : 1); \ + ++t) \ + for (int k = ((grid).is3D() ? bnd : 0); k < ((grid).is3D() ? ((grid).getSizeZ() - bnd) : 1); \ + ++k) \ + for (int j = bnd; j < (grid).getSizeY() - bnd; ++j) \ + for (int i = bnd; i < (grid).getSizeX() - bnd; ++i) + +//! Basic data structure for kernel data, initialized based on kernel type (e.g. single, idx, etc). +struct KernelBase { + int maxX, maxY, maxZ, minZ, maxT, minT; + int X, Y, Z, dimT; + IndexInt size; + + KernelBase(IndexInt num); + KernelBase(const GridBase *base, int bnd); + KernelBase(const Grid4dBase *base, int bnd); + + // specify in your derived classes: + + // kernel operators + // ijk mode: void operator() (int i, int j, int k) + // idx mode: void operator() (IndexInt idx) + + // reduce mode: + // void join(classname& other) + // void setup() +}; + +} // namespace Manta + +// all kernels will automatically be added to the "Kernels" group in doxygen + +#endif |