Loading [MathJax]/extensions/TeX/AMSmath.js
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
FieldAccessorsSinglePrecisionCUDA.cuh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023-2024 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// f36fa0a68bae59f0b516f6587ea8fa7c24a41141
24
25/**
26 * @file
27 * Lattice field accessors.
28 * Adapted from the waLBerla source file
29 * https://i10git.cs.fau.de/walberla/walberla/-/blob/a16141524c58ab88386e2a0f8fdd7c63c5edd704/python/lbmpy_walberla/templates/LatticeModel.tmpl.h
30 */
31
32#pragma once
33
34#include <core/DataTypes.h>
35#include <core/cell/Cell.h>
36#include <core/cell/CellInterval.h>
37#include <core/math/Matrix3.h>
38#include <core/math/Vector3.h>
39
40#include <gpu/GPUField.h>
41
42#include <array>
43#include <tuple>
44#include <vector>
45
46namespace walberla {
47namespace lbm {
48namespace accessor {
49
50namespace Population {
51/** @brief Get populations from a single cell. */
52std::array<float, 19u> get(gpu::GPUField<float> const *pdf_field,
53 Cell const &cell);
54/** @brief Set populations on a single cell. */
55void set(gpu::GPUField<float> *pdf_field, std::array<float, 19u> const &pop,
56 Cell const &cell);
57/** @brief Set populations and recalculate velocities on a single cell. */
58void set(gpu::GPUField<float> *pdf_field, gpu::GPUField<float> *velocity_field,
59 gpu::GPUField<float> const *force_field,
60 std::array<float, 19u> const &pop, Cell const &cell);
61/** @brief Initialize all cells with the same value. */
62void initialize(gpu::GPUField<float> *pdf_field,
63 std::array<float, 19u> const &pop);
64/** @brief Get populations from a cell interval. */
65std::vector<float> get(gpu::GPUField<float> const *pdf_field,
66 CellInterval const &ci);
67/** @brief Set populations on a cell interval. */
68void set(gpu::GPUField<float> *pdf_field, std::vector<float> const &values,
69 CellInterval const &ci);
70/** @brief Set populations and recalculate velocities on a cell interval. */
71void set(gpu::GPUField<float> *pdf_field, gpu::GPUField<float> *velocity_field,
72 gpu::GPUField<float> const *force_field,
73 std::vector<float> const &values, CellInterval const &ci);
74} // namespace Population
75
76namespace Vector {
77/** @brief Get value from a single cell. */
78Vector3<float> get(gpu::GPUField<float> const *field, Cell const &cell);
79/** @brief Set value on a single cell. */
80void set(gpu::GPUField<float> *field, Vector3<float> const &vec,
81 Cell const &cell);
82/** @brief Add value to a single cell. */
83void add(gpu::GPUField<float> *field, Vector3<float> const &vec,
84 Cell const &cell);
85/** @brief Initialize all cells with the same value. */
86void initialize(gpu::GPUField<float> *field, Vector3<float> const &vec);
87/** @brief Add value to all cells. */
88void add_to_all(gpu::GPUField<float> *field, Vector3<float> const &vec);
89/** @brief Get values from a cell interval. */
90std::vector<float> get(gpu::GPUField<float> const *vec_field,
91 CellInterval const &ci);
92/** @brief Set values on a cell interval. */
93void set(gpu::GPUField<float> *vec_field, std::vector<float> const &values,
94 CellInterval const &ci);
95
96} // namespace Vector
97
98namespace Interpolation {
99std::vector<float> get(gpu::GPUField<float> const *vec_field,
100 std::vector<float> const &pos, uint gl);
101void set(gpu::GPUField<float> const *vec_field, std::vector<float> const &pos,
102 std::vector<float> const &forces, uint gl);
103} // namespace Interpolation
104
105namespace Density {
106float get(gpu::GPUField<float> const *pdf_field, Cell const &cell);
107void set(gpu::GPUField<float> *pdf_field, float const rho, Cell const &cell);
108std::vector<float> get(gpu::GPUField<float> const *pdf_field,
109 CellInterval const &ci);
110void set(gpu::GPUField<float> *pdf_field, std::vector<float> const &values,
111 CellInterval const &ci);
112} // namespace Density
113
114namespace Velocity {
115Vector3<float> get(gpu::GPUField<float> const *pdf_field,
116 gpu::GPUField<float> const *force_field, Cell const &cell);
117std::vector<float> get(gpu::GPUField<float> const *pdf_field,
118 gpu::GPUField<float> const *force_field,
119 CellInterval const &ci);
120void set(gpu::GPUField<float> *pdf_field, gpu::GPUField<float> *velocity_field,
121 gpu::GPUField<float> const *force_field, Vector3<float> const &u,
122 Cell const &cell);
123void set(gpu::GPUField<float> *pdf_field, gpu::GPUField<float> *velocity_field,
124 gpu::GPUField<float> const *force_field,
125 std::vector<float> const &values, CellInterval const &ci);
126} // namespace Velocity
127
128namespace Force {
129void set(gpu::GPUField<float> const *pdf_field,
130 gpu::GPUField<float> *velocity_field,
131 gpu::GPUField<float> *force_field, Vector3<float> const &u,
132 Cell const &cell);
133void set(gpu::GPUField<float> const *pdf_field,
134 gpu::GPUField<float> *velocity_field,
135 gpu::GPUField<float> *force_field, std::vector<float> const &values,
136 CellInterval const &ci);
137} // namespace Force
138
139namespace DensityAndVelocity {
140std::tuple<float, Vector3<float>> get(gpu::GPUField<float> const *pdf_field,
141 gpu::GPUField<float> const *force_field,
142 Cell const &cell);
143void set(gpu::GPUField<float> *pdf_field, gpu::GPUField<float> *force_field,
144 Vector3<float> const &u, float const rho, Cell const &cell);
145} // namespace DensityAndVelocity
146
147namespace DensityAndMomentumDensity {
148std::tuple<float, Vector3<float>> get(gpu::GPUField<float> const *pdf_field,
149 gpu::GPUField<float> const *force_field,
150 Cell const &cell);
151} // namespace DensityAndMomentumDensity
152
153namespace MomentumDensity {
154Vector3<float> reduce(gpu::GPUField<float> const *pdf_field,
155 gpu::GPUField<float> const *force_field);
156} // namespace MomentumDensity
157
158namespace PressureTensor {
159Matrix3<float> get(gpu::GPUField<float> const *pdf_field, Cell const &cell);
160std::vector<float> get(gpu::GPUField<float> const *pdf_field,
161 CellInterval const &ci);
162Matrix3<float> reduce(gpu::GPUField<float> const *pdf_field);
163} // namespace PressureTensor
164
165} // namespace accessor
166} // namespace lbm
167} // namespace walberla
Definition Cell.hpp:96
std::tuple< double, Vector3< double > > get(gpu::GPUField< double > const *pdf_field, gpu::GPUField< double > const *force_field, Cell const &cell)
void set(gpu::GPUField< double > *pdf_field, gpu::GPUField< double > *force_field, Vector3< double > const &u, double const rho, Cell const &cell)
std::tuple< double, Vector3< double > > get(gpu::GPUField< double > const *pdf_field, gpu::GPUField< double > const *force_field, Cell const &cell)
void set(GhostLayerField< double, uint_t{19u}> *pdf_field, double const rho_in, Cell const &cell)
double get(GhostLayerField< double, uint_t{19u}> const *pdf_field, Cell const &cell)
void set(GhostLayerField< double, uint_t{19u}> const *pdf_field, GhostLayerField< double, uint_t{3u}> *velocity_field, GhostLayerField< double, uint_t{3u}> *force_field, Vector3< double > const &force, Cell const &cell)
std::vector< double > get(gpu::GPUField< double > const *vec_field, std::vector< double > const &pos, uint gl)
void set(gpu::GPUField< double > const *vec_field, std::vector< double > const &pos, std::vector< double > const &forces, uint gl)
auto reduce(GhostLayerField< double, uint_t{19u}> const *pdf_field, GhostLayerField< double, uint_t{3u}> const *force_field)
void set(GhostLayerField< double, uint_t{19u}> *pdf_field, std::array< double, 19u > const &pop, Cell const &cell)
auto get(GhostLayerField< double, uint_t{19u}> const *pdf_field, Cell const &cell)
void initialize(GhostLayerField< double, uint_t{19u}> *pdf_field, std::array< double, 19u > const &pop)
auto get(GhostLayerField< double, uint_t{19u}> const *pdf_field, Cell const &cell)
auto reduce(GhostLayerField< double, uint_t{19u}> const *pdf_field)
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 set(GhostLayerField< double, uint_t{3u}> *vec_field, Vector3< double > const &vec, Cell const &cell)
auto get(GhostLayerField< double, uint_t{3u}> const *vec_field, Cell const &cell)
void add_to_all(GhostLayerField< double, uint_t{3u}> *vec_field, Vector3< double > const &vec)
void set(GhostLayerField< double, uint_t{19u}> *pdf_field, GhostLayerField< double, uint_t{3u}> *velocity_field, GhostLayerField< double, uint_t{3u}> const *force_field, Vector3< double > const &u, Cell const &cell)
auto get(GhostLayerField< double, uint_t{19u}> const *pdf_field, GhostLayerField< double, uint_t{3u}> const *force_field, Cell const &cell)
\file PackInfoPdfDoublePrecision.cpp \author pystencils