ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
EK_FieldAccessors_single_precision_CUDA.cuh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023-2025 The ESPResSo project
3 * Copyright (C) 2020 The waLBerla project
4 *
5 * This file is part of ESPResSo.
6 *
7 * ESPResSo is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * ESPResSo is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21// kernel generated with pystencils v1.3.7, lbmpy v1.3.7, sympy v1.12.1,
22// lbmpy_walberla/pystencils_walberla from waLBerla commit
23// c69cb11d6a95d32b2280544d3d9abde1fe5fdbb5
24
25/*
26 * Lattice field accessors.
27 * Adapted from the waLBerla source file
28 * https://i10git.cs.fau.de/walberla/walberla/-/blob/a16141524c58ab88386e2a0f8fdd7c63c5edd704/python/lbmpy_walberla/templates/LatticeModel.tmpl.h
29 */
30
31#pragma once
32
33#include <core/DataTypes.h>
34#include <core/cell/Cell.h>
35#include <core/cell/CellInterval.h>
36#include <core/math/Matrix3.h>
37#include <core/math/Vector3.h>
38
39#include <gpu/GPUField.h>
40
41#include <array>
42#include <tuple>
43#include <vector>
44
45namespace walberla {
46namespace ek {
47namespace accessor {
48
49namespace Scalar {
50/** @brief Get value from a single cell. */
51float get(gpu::GPUField<float> const *field, Cell const &cell);
52/** @brief Set value on a single cell. */
53void set(gpu::GPUField<float> *field, float value, Cell const &cell);
54/** @brief Add value to a single cell. */
55void add(gpu::GPUField<float> *field, float value, Cell const &cell);
56/** @brief Initialize all cells with the same value. */
57void initialize(gpu::GPUField<float> *field, float value);
58/** @brief Add value to all cells. */
59void add_to_all(gpu::GPUField<float> *field, float value);
60/** @brief Get values from a cell interval. */
61std::vector<float> get(gpu::GPUField<float> const *ield,
62 CellInterval const &ci);
63/** @brief Set values on a cell interval. */
64void set(gpu::GPUField<float> *field, std::vector<float> const &values,
65 CellInterval const &ci);
66
67} // namespace Scalar
68
69namespace Vector {
70/** @brief Get value from a single cell. */
71Vector3<float> get(gpu::GPUField<float> const *field, Cell const &cell);
72/** @brief Set value on a single cell. */
73void set(gpu::GPUField<float> *field, Vector3<float> const &vec,
74 Cell const &cell);
75/** @brief Add value to a single cell. */
76void add(gpu::GPUField<float> *field, Vector3<float> const &vec,
77 Cell const &cell);
78/** @brief Initialize all cells with the same value. */
79void initialize(gpu::GPUField<float> *field, Vector3<float> const &vec);
80/** @brief Add value to all cells. */
81void add_to_all(gpu::GPUField<float> *field, Vector3<float> const &vec);
82/** @brief Get values from a cell interval. */
83std::vector<float> get(gpu::GPUField<float> const *vec_field,
84 CellInterval const &ci);
85/** @brief Set values on a cell interval. */
86void set(gpu::GPUField<float> *vec_field, std::vector<float> const &values,
87 CellInterval const &ci);
88
89} // namespace Vector
90
91namespace Flux {
92/** @brief Get value from a single cell. */
93std::array<float, 13> get(gpu::GPUField<float> const *flux_field,
94 Cell const &cell);
95
96/** @brief Initialize all cells with the same value. */
97void initialize(gpu::GPUField<float> *flux_field,
98 std::array<float, 13> const &flux);
99/** @brief Get values from a cell interval. */
100std::vector<float> get(gpu::GPUField<float> const *flux_field,
101 CellInterval const &ci);
102
103/** @brief Get flux vector from a single cell. */
104Vector3<float> get_vector(gpu::GPUField<float> const *flux_field,
105 Cell const &cell);
106
107/** @brief Get flux vector from a cell interval. */
108std::vector<float> get_vector(gpu::GPUField<float> const *flux_field,
109 CellInterval const &ci);
110
111} // namespace Flux
112
113} // namespace accessor
114} // namespace ek
115} // namespace walberla
Definition Cell.hpp:96
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
auto get_vector(GhostLayerField< double, uint_t{13u}> const *flux_field, Cell const &cell)
void initialize(GhostLayerField< double, uint_t{13u}> *flux_field, std::array< double, 13 > const &values)
auto get(GhostLayerField< double, uint_t{13u}> const *flux_field, Cell const &cell)
void add_to_all(GhostLayerField< double, 1u > *scalar_field, double const &value)
void initialize(GhostLayerField< double, 1u > *scalar_field, double const &value)
void set(GhostLayerField< double, 1u > *scalar_field, double const &value, Cell const &cell)
auto get(GhostLayerField< double, 1u > const *scalar_field, Cell const &cell)
void add(GhostLayerField< double, 1u > *scalar_field, double const &value, Cell const &cell)
void set(GhostLayerField< double, uint_t{3u}> *vec_field, Vector3< double > const &vec, Cell const &cell)
void initialize(GhostLayerField< double, uint_t{3u}> *vec_field, Vector3< double > const &vec)
void add(GhostLayerField< double, uint_t{3u}> *vec_field, Vector3< double > const &vec, Cell const &cell)
void add_to_all(GhostLayerField< double, uint_t{3u}> *vec_field, Vector3< double > const &vec)
auto get(GhostLayerField< double, uint_t{3u}> const *vec_field, Cell const &cell)
\file PackInfoPdfDoublePrecision.cpp \author pystencils