ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
FieldAccessorsDoublePrecisionCUDA.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.3, lbmpy v1.3.3,
22// lbmpy_walberla/pystencils_walberla from waLBerla commit
23// b0842e1a493ce19ef1bbb8d2cf382fc343970a7f
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<double, 19u> get(gpu::GPUField<double> const *pdf_field,
53 Cell const &cell);
54/** @brief Set populations on a single cell. */
55void set(gpu::GPUField<double> *pdf_field, std::array<double, 19u> const &pop,
56 Cell const &cell);
57/** @brief Set populations and recalculate velocities on a single cell. */
58void set(gpu::GPUField<double> *pdf_field,
59 gpu::GPUField<double> *velocity_field,
60 gpu::GPUField<double> const *force_field,
61 std::array<double, 19u> const &pop, Cell const &cell);
62/** @brief Initialize all cells with the same value. */
63void initialize(gpu::GPUField<double> *pdf_field,
64 std::array<double, 19u> const &pop);
65/** @brief Get populations from a cell interval. */
66std::vector<double> get(gpu::GPUField<double> const *pdf_field,
67 CellInterval const &ci);
68/** @brief Set populations on a cell interval. */
69void set(gpu::GPUField<double> *pdf_field, std::vector<double> const &values,
70 CellInterval const &ci);
71/** @brief Set populations and recalculate velocities on a cell interval. */
72void set(gpu::GPUField<double> *pdf_field,
73 gpu::GPUField<double> *velocity_field,
74 gpu::GPUField<double> const *force_field,
75 std::vector<double> const &values, CellInterval const &ci);
76} // namespace Population
77
78namespace Vector {
79/** @brief Get value from a single cell. */
80Vector3<double> get(gpu::GPUField<double> const *field, Cell const &cell);
81/** @brief Set value on a single cell. */
82void set(gpu::GPUField<double> *field, Vector3<double> const &vec,
83 Cell const &cell);
84/** @brief Add value to a single cell. */
85void add(gpu::GPUField<double> *field, Vector3<double> const &vec,
86 Cell const &cell);
87/** @brief Initialize all cells with the same value. */
88void initialize(gpu::GPUField<double> *field, Vector3<double> const &vec);
89/** @brief Add value to all cells. */
90void add_to_all(gpu::GPUField<double> *field, Vector3<double> const &vec);
91/** @brief Get values from a cell interval. */
92std::vector<double> get(gpu::GPUField<double> const *vec_field,
93 CellInterval const &ci);
94/** @brief Set values on a cell interval. */
95void set(gpu::GPUField<double> *vec_field, std::vector<double> const &values,
96 CellInterval const &ci);
97
98} // namespace Vector
99
100namespace Interpolation {
101std::vector<double> get(gpu::GPUField<double> const *vec_field,
102 std::vector<double> const &pos, uint gl);
103void set(gpu::GPUField<double> const *vec_field, std::vector<double> const &pos,
104 std::vector<double> const &forces, uint gl);
105} // namespace Interpolation
106
107namespace Density {
108double get(gpu::GPUField<double> const *pdf_field, Cell const &cell);
109void set(gpu::GPUField<double> *pdf_field, double const rho, Cell const &cell);
110std::vector<double> get(gpu::GPUField<double> const *pdf_field,
111 CellInterval const &ci);
112void set(gpu::GPUField<double> *pdf_field, std::vector<double> const &values,
113 CellInterval const &ci);
114} // namespace Density
115
116namespace Velocity {
117Vector3<double> get(gpu::GPUField<double> const *pdf_field,
118 gpu::GPUField<double> const *force_field, Cell const &cell);
119std::vector<double> get(gpu::GPUField<double> const *pdf_field,
120 gpu::GPUField<double> const *force_field,
121 CellInterval const &ci);
122void set(gpu::GPUField<double> *pdf_field,
123 gpu::GPUField<double> *velocity_field,
124 gpu::GPUField<double> const *force_field, Vector3<double> const &u,
125 Cell const &cell);
126void set(gpu::GPUField<double> *pdf_field,
127 gpu::GPUField<double> *velocity_field,
128 gpu::GPUField<double> const *force_field,
129 std::vector<double> const &values, CellInterval const &ci);
130} // namespace Velocity
131
132namespace Force {
133void set(gpu::GPUField<double> const *pdf_field,
134 gpu::GPUField<double> *velocity_field,
135 gpu::GPUField<double> *force_field, Vector3<double> const &u,
136 Cell const &cell);
137void set(gpu::GPUField<double> const *pdf_field,
138 gpu::GPUField<double> *velocity_field,
139 gpu::GPUField<double> *force_field, std::vector<double> const &values,
140 CellInterval const &ci);
141} // namespace Force
142
143namespace DensityAndVelocity {
144std::tuple<double, Vector3<double>>
145get(gpu::GPUField<double> const *pdf_field,
146 gpu::GPUField<double> const *force_field, Cell const &cell);
147void set(gpu::GPUField<double> *pdf_field, gpu::GPUField<double> *force_field,
148 Vector3<double> const &u, double const rho, Cell const &cell);
149} // namespace DensityAndVelocity
150
151namespace DensityAndMomentumDensity {
152std::tuple<double, Vector3<double>>
153get(gpu::GPUField<double> const *pdf_field,
154 gpu::GPUField<double> const *force_field, Cell const &cell);
155} // namespace DensityAndMomentumDensity
156
157namespace MomentumDensity {
158Vector3<double> reduce(gpu::GPUField<double> const *pdf_field,
159 gpu::GPUField<double> const *force_field);
160} // namespace MomentumDensity
161
162namespace PressureTensor {
163Matrix3<double> get(gpu::GPUField<double> const *pdf_field, Cell const &cell);
164std::vector<double> get(gpu::GPUField<double> const *pdf_field,
165 CellInterval const &ci);
166} // namespace PressureTensor
167
168} // namespace accessor
169} // namespace lbm
170} // namespace walberla
Definition Cell.hpp:97
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)
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