OpenLB 1.7
Loading...
Searching...
No Matches
blockDynamicsMap.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2019 Adrian Kummerlaender
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
24#ifndef BLOCK_DYNAMICS_MAP_H
25#define BLOCK_DYNAMICS_MAP_H
26
27#include <functional>
28#include <typeindex>
29#include <algorithm>
30
31#include "dynamics/dynamics.h"
32#include "platform/cpu/cell.h"
33
34namespace olb {
35
36template<typename T, typename DESCRIPTOR> struct AbstractCollisionO;
37template<typename T, typename DESCRIPTOR, Platform PLATFORM> struct BlockCollisionO;
38template<typename T, typename DESCRIPTOR, Platform PLATFORM> class ConcreteBlockLattice;
39template<typename T, Platform PLATFORM> class ConcreteBlockMask;
40template<typename T, typename DESCRIPTOR, Platform PLATFORM, typename DYNAMICS> class ConcreteBlockCollisionO;
41
43
48template <typename T, typename DESCRIPTOR, Platform PLATFORM>
49class LegacyConcreteDynamics final : public cpu::Dynamics<T,DESCRIPTOR,PLATFORM> {
50private:
52 Dynamics<T,DESCRIPTOR>* _dynamics;
53
54public:
56 Dynamics<T,DESCRIPTOR>* dynamics):
57 _lattice(lattice),
58 _dynamics{dynamics} {
59 }
60
62 auto abstractCell = _lattice.get(cell.getCellId());
63 return _dynamics->collide(abstractCell);
64 }
65
67 auto abstractCell = _lattice.get(cell.getCellId());
68 return _dynamics->computeRho(abstractCell);
69 }
70 void computeU(cpu::Cell<T,DESCRIPTOR,PLATFORM>& cell, T* u) override {
71 auto abstractCell = _lattice.get(cell.getCellId());
72 _dynamics->computeU(abstractCell, u);
73 }
74 void computeJ(cpu::Cell<T,DESCRIPTOR,PLATFORM>& cell, T* j) override {
75 auto abstractCell = _lattice.get(cell.getCellId());
76 _dynamics->computeJ(abstractCell, j);
77 }
78 void computeRhoU(cpu::Cell<T,DESCRIPTOR,PLATFORM>& cell, T& rho, T* u) override {
79 auto abstractCell = _lattice.get(cell.getCellId());
80 _dynamics->computeRhoU(abstractCell, rho, u);
81 }
82 void defineRho(cpu::Cell<T,DESCRIPTOR,PLATFORM>& cell, T& rho) override {
83 auto abstractCell = _lattice.get(cell.getCellId());
84 _dynamics->defineRho(abstractCell, rho);
85 }
86
87 void defineU(cpu::Cell<T,DESCRIPTOR,PLATFORM>& cell, T* u) override {
88 auto abstractCell = _lattice.get(cell.getCellId());
89 _dynamics->defineU(abstractCell, u);
90 }
91
92 void defineRhoU(cpu::Cell<T,DESCRIPTOR,PLATFORM>& cell, T& rho, T* u) override {
93 auto abstractCell = _lattice.get(cell.getCellId());
94 _dynamics->defineRhoU(abstractCell, rho, u);
95 }
96
97 void defineAllMomenta(cpu::Cell<T,DESCRIPTOR,PLATFORM>& cell, T& rho, T* u, T* pi) override {
98 auto abstractCell = _lattice.get(cell.getCellId());
99 _dynamics->defineAllMomenta(abstractCell, rho, u, pi);
100 }
101
102 void computeStress(cpu::Cell<T,DESCRIPTOR,PLATFORM>& cell, T& rho, T* u, T* pi) override {
103 auto abstractCell = _lattice.get(cell.getCellId());
104 _dynamics->computeStress(abstractCell, rho, u, pi);
105 }
106 void computeAllMomenta(cpu::Cell<T,DESCRIPTOR,PLATFORM>& cell, T& rho, T* u, T* pi) override {
107 auto abstractCell = _lattice.get(cell.getCellId());
108 _dynamics->computeAllMomenta(abstractCell, rho, u, pi);
109 }
110
111 T getOmegaOrFallback(T fallback) override {
112 throw std::runtime_error("getOmegaOrFallback not supported for legacy dynamics");
113 }
114
115 T computeEquilibrium(int iPop, T rho, T* u) override {
116 return _dynamics->computeEquilibrium(iPop, rho, u);
117 }
118
119 void inverseShiftRhoU(cpu::Cell<T,DESCRIPTOR,PLATFORM>& cell, T& rho, T* u) override {
120 auto abstractCell = _lattice.get(cell.getCellId());
121 _dynamics->inverseShiftRhoU(abstractCell, rho, u);
122 }
123};
124
126
132template <typename T, typename DESCRIPTOR, Platform PLATFORM>
133class LegacyBlockCollisionO final : public BlockCollisionO<T,DESCRIPTOR,PLATFORM> {
134private:
136 Dynamics<T,DESCRIPTOR>** const _legacyDynamics;
138
141 std::map<Dynamics<T,DESCRIPTOR>*,
142 std::unique_ptr<cpu::Dynamics<T,DESCRIPTOR,PLATFORM>>> _concreteDynamics;
143 cpu::Dynamics<T,DESCRIPTOR,PLATFORM>** _dynamicsOfCells;
144
147 {
148 auto iter = _concreteDynamics.find(_legacyDynamics[iCell]);
149 if (iter == _concreteDynamics.end()) {
150 iter = std::get<0>(_concreteDynamics.emplace(
151 _legacyDynamics[iCell],
153 _legacyDynamics[iCell])));
154 }
155 return std::get<1>(*iter).get();
156 }
157
158public:
159 LegacyBlockCollisionO(std::size_t count, Dynamics<T,DESCRIPTOR>** dynamics):
160 _mask{count},
161 _legacyDynamics{dynamics}
162 { }
163
164 std::type_index id() const override
165 {
166 return typeid(LegacyBlockCollisionO);
167 }
168
169 std::size_t weight() const override
170 {
171 return _mask.weight();
172 }
173
174 void set(CellID iCell, bool state, bool overlap) override
175 {
176 if (!overlap) {
177 _mask.set(iCell, state);
178 }
179 if (state) {
180 _dynamicsOfCells[iCell] = resolve(iCell);
181 }
182 }
183
185 {
186 return nullptr;
187 }
188
190 {
191 // Remember block in order to construct LegacyConcreteDynamics
192 _block = &block;
193 // Fetch pointer to concretized dynamic-dispatch field
194 _dynamicsOfCells = block.template getField<cpu::DYNAMICS<T,DESCRIPTOR,PLATFORM>>()[0].data();
195 }
196
198
204 CollisionDispatchStrategy strategy) override
205 {
206 if (strategy != CollisionDispatchStrategy::Dominant) {
207 throw std::runtime_error("LegacyBlockCollisionO only supports CollisionDispatchStrategy::Dominant");
208 }
209
210 typename LatticeStatistics<T>::Aggregatable statistics{};
211 #ifdef PARALLEL_MODE_OMP
212 #pragma omp declare reduction(+ : typename LatticeStatistics<T>::Aggregatable : omp_out += omp_in) initializer (omp_priv={})
213 #endif
214
215 if constexpr (DESCRIPTOR::d == 3) {
216 #ifdef PARALLEL_MODE_OMP
217 #pragma omp parallel for schedule(dynamic,1) reduction(+ : statistics)
218 #endif
219 for (int iX=0; iX < block.getNx(); ++iX) {
220 auto cell = block.get(iX,0,0);
221 for (int iY=0; iY < block.getNy(); ++iY) {
222 for (int iZ=0; iZ < block.getNz(); ++iZ) {
223 CellID iCell = block.getCellId(iX,iY,iZ);
224 if (_mask[iCell]) {
225 cell.setCellId(iCell);
226 if (auto cellStatistic = _legacyDynamics[iCell]->collide(cell)) {
227 statistics.increment(cellStatistic.rho, cellStatistic.uSqr);
228 }
229 } else {
230 cpu::Cell<T,DESCRIPTOR,PLATFORM> cell(block, iCell);
231 if (auto cellStatistic = _dynamicsOfCells[iCell]->collide(cell)) {
232 statistics.increment(cellStatistic.rho, cellStatistic.uSqr);
233 }
234 }
235 }
236 }
237 }
238 } else {
239 #ifdef PARALLEL_MODE_OMP
240 #pragma omp parallel for schedule(dynamic,1) reduction(+ : statistics)
241 #endif
242 for (int iX=0; iX < block.getNx(); ++iX) {
243 auto cell = block.get(iX,0);
244 for (int iY=0; iY < block.getNy(); ++iY) {
245 CellID iCell = block.getCellId(iX,iY);
246 if (_mask[iCell]) {
247 cell.setCellId(iCell);
248 if (auto cellStatistic = _legacyDynamics[iCell]->collide(cell)) {
249 statistics.increment(cellStatistic.rho, cellStatistic.uSqr);
250 }
251 } else {
252 cpu::Cell<T,DESCRIPTOR,PLATFORM> cell(block, iCell);
253 if (auto cellStatistic = _dynamicsOfCells[iCell]->collide(cell)) {
254 statistics.increment(cellStatistic.rho, cellStatistic.uSqr);
255 }
256 }
257 }
258 }
259 }
260
261 block.getStatistics().incrementStats(statistics);
262 }
263};
264
266
277template <typename T, typename DESCRIPTOR>
279protected:
280 std::type_index _id;
281 std::function<Dynamics<T,DESCRIPTOR>*()> _dynamicsConstructor;
282 std::function<AbstractCollisionO<T,DESCRIPTOR>*(Platform)> _operatorConstructor;
283
284public:
285 template <typename DYNAMICS>
287 _id(typeid(DYNAMICS)),
288 _dynamicsConstructor([]() -> Dynamics<T,DESCRIPTOR>* {
289 return new DYNAMICS();
290 }),
291 _operatorConstructor([](Platform platform) -> AbstractCollisionO<T,DESCRIPTOR>* {
292 static_assert(dynamics::is_generic_v<T,DESCRIPTOR,DYNAMICS>,
293 "Promised DYNAMICS must be generic");
294 switch (platform) {
295 #ifdef PLATFORM_CPU_SISD
297 return new ConcreteBlockCollisionO<T,DESCRIPTOR,Platform::CPU_SISD,DYNAMICS>();
298 #endif
299 #ifdef PLATFORM_CPU_SIMD
301 return new ConcreteBlockCollisionO<T,DESCRIPTOR,Platform::CPU_SIMD,DYNAMICS>();
302 #endif
303 #ifdef PLATFORM_GPU_CUDA
305 return new ConcreteBlockCollisionO<T,DESCRIPTOR,Platform::GPU_CUDA,DYNAMICS>();
306 #endif
307 default:
308 throw std::invalid_argument("Invalid PLATFORM");
309 }
310 })
311 { }
312
314 std::type_index id() const {
315 return _id;
316 }
317
322
324 template <Platform PLATFORM>
329
330};
331
332template <typename DYNAMICS>
334 typename DYNAMICS::descriptor_t>;
335
336
338
342 template <typename T, typename DESCRIPTOR, Platform PLATFORM>
344};
345
347
357template<typename T, typename DESCRIPTOR, Platform PLATFORM>
359private:
361
362 std::map<std::type_index,
363 std::unique_ptr<BlockCollisionO<T,DESCRIPTOR,PLATFORM>>> _map;
364
365 std::unique_ptr<Dynamics<T,DESCRIPTOR>*[]> _dynamicsOfCells;
366 std::unique_ptr<BlockCollisionO<T,DESCRIPTOR,PLATFORM>*[]> _operatorOfCells;
367
371 BlockCollisionO<T,DESCRIPTOR,PLATFORM>* _dominantCollisionO;
372
375 {
376 auto iter = _map.find(promise.id());
377 if (iter == _map.end()) {
378 iter = _map.emplace(std::piecewise_construct,
379 std::forward_as_tuple(promise.id()),
380 std::forward_as_tuple(promise.template realize<PLATFORM>())).first;
381 iter->second->setup(_lattice);
382 }
383 return *(iter->second);
384 }
385
387 void set(std::size_t iCell, BlockCollisionO<T,DESCRIPTOR,PLATFORM>& collisionO)
388 {
389 if (_operatorOfCells[iCell] != nullptr) {
390 _map.at(_operatorOfCells[iCell]->id())->set(iCell, false, !_coreMask[iCell]);
391 }
392 collisionO.set(iCell, true, !_coreMask[iCell]);
393 _operatorOfCells[iCell] = &collisionO;
394 if (Dynamics<T,DESCRIPTOR>* dynamics = collisionO.getDynamics()) {
395 _dynamicsOfCells[iCell] = dynamics;
396 }
397 }
398
399public:
402 _lattice(lattice),
403 _dynamicsOfCells(new Dynamics<T,DESCRIPTOR>* [_lattice.getNcells()] { nullptr }),
404 _operatorOfCells(new BlockCollisionO<T,DESCRIPTOR,PLATFORM>*[_lattice.getNcells()] { nullptr }),
405 _coreMask(lattice.template getData<CollisionSubdomainMask>()),
406 _dominantCollisionO(nullptr)
407 {
408 _lattice.forCoreSpatialLocations([&](LatticeR<DESCRIPTOR::d> lattice) {
409 _coreMask.set(_lattice.getCellId(lattice), true);
410 });
411
412 if constexpr (isPlatformCPU(PLATFORM)) {
414 using LegacyO = LegacyBlockCollisionO<T,DESCRIPTOR,PLATFORM>;
415 _map[typeid(LegacyO)] = std::make_unique<LegacyO>(_lattice.getNcells(),
416 _dynamicsOfCells.get());
417 _map[typeid(LegacyO)]->setup(_lattice);
418 }
419 }
420
422
426 {
427 return resolve(std::forward<decltype(promise)>(promise)).getDynamics();
428 }
429
430 const Dynamics<T,DESCRIPTOR>* get(std::size_t iCell) const
431 {
432 return _dynamicsOfCells[iCell];
433 }
434
435 Dynamics<T,DESCRIPTOR>* get(std::size_t iCell)
436 {
437 return _dynamicsOfCells[iCell];
438 }
439
441 void set(std::size_t iCell, DynamicsPromise<T,DESCRIPTOR>&& promise)
442 {
443 set(iCell, resolve(std::forward<decltype(promise)>(promise)));
444 _dominantCollisionO = nullptr;
445 }
446
448
452 void set(std::size_t iCell, Dynamics<T,DESCRIPTOR>* dynamics)
453 {
454 auto iter = _map.find(dynamics->id());
455 if (iter != _map.end()) { // Non-legacy dynamics
456 set(iCell, *iter->second);
457 } else { // Legacy dynamics
458 iter = _map.find(typeid(LegacyBlockCollisionO<T,DESCRIPTOR,PLATFORM>));
459 if (iter != _map.end()) {
460 // Order is important here as LegacyBlockCollisionO uses the dynamics
461 // pointer to construct matching LegacyConcreteDynamics internally.
462 _dynamicsOfCells[iCell] = dynamics;
463 set(iCell, *iter->second);
464 } else {
465 throw std::runtime_error("Legacy dynamics not supported on this platform");
466 }
467 }
468 _dominantCollisionO = nullptr;
469 }
470
472
481 {
482 switch (strategy) {
484 if (!_dominantCollisionO) {
485 _dominantCollisionO = std::max_element(_map.begin(),
486 _map.end(),
487 [](const auto& lhs, const auto& rhs) -> bool {
488 return lhs.second->weight() < rhs.second->weight();
489 })->second.get();
490 }
491 _dominantCollisionO->apply(_lattice, _coreMask, strategy);
492 break;
493
495 for (auto& [id, collisionO] : _map) {
496 if (collisionO->weight() > 0) {
497 collisionO->apply(_lattice, _coreMask, strategy);
498 }
499 }
500 break;
501
502 default:
503 throw std::runtime_error("Invalid collision dispatch strategy");
504 break;
505 }
506 }
507
509 std::string describe()
510 {
511 std::stringstream out;
512 for (auto& [_, collisionO] : _map) {
513 out << collisionO->getDynamics()->getName() << ", "
514 << static_cast<double>(collisionO.weight()) / (_coreMask.weight())
515 << std::endl;
516 }
517 return out.str();
518 }
519
520};
521
522
523}
524
525#endif
Map between cell indices and concrete dynamics.
void set(std::size_t iCell, DynamicsPromise< T, DESCRIPTOR > &&promise)
Assigns promised dynamics to cell index iCell.
void set(std::size_t iCell, Dynamics< T, DESCRIPTOR > *dynamics)
Assigns dynamics pointer to cell index iCell.
void collide(CollisionDispatchStrategy strategy)
Executes local collision step for entire non-overlap area of lattice.
const Dynamics< T, DESCRIPTOR > * get(std::size_t iCell) const
std::string describe()
Returns a human-readable string listing all managed dynamics and their assigned fraction of cells.
Dynamics< T, DESCRIPTOR > * get(DynamicsPromise< T, DESCRIPTOR > &&promise)
Returns a pointer to dynamics matching the promise.
BlockDynamicsMap(ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM > &lattice)
Constructor for a BlockDynamicsMap.
Dynamics< T, DESCRIPTOR > * get(std::size_t iCell)
Platform-abstracted block lattice for external access and inter-block interaction.
Cell< T, DESCRIPTOR > get(CellID iCell)
Get Cell interface for index iCell.
LatticeStatistics< T > & getStatistics()
Return a handle to the LatticeStatistics object.
std::size_t getNcells() const
Get number of cells.
int getNy() const
Read only access to block height.
void forCoreSpatialLocations(F f) const
int getNx() const
Read only access to block width.
CellID getCellId(LatticeR< D > latticeR) const
Get 1D cell ID.
int getNz() const
Read only access to block height.
Collision operation of concrete DYNAMICS on concrete block lattices of PLATFORM.
Implementation of BlockLattice on a concrete PLATFORM.
Factory for instances of a specific Dynamics type.
std::function< Dynamics< T, DESCRIPTOR > *()> _dynamicsConstructor
BlockCollisionO< T, DESCRIPTOR, PLATFORM > * realize()
Returns new instance of the collision operator for promised DYNAMICS.
Dynamics< T, DESCRIPTOR > * realize()
Returns new instance of the promised DYNAMICS.
std::function< AbstractCollisionO< T, DESCRIPTOR > *(Platform)> _operatorConstructor
std::type_index id() const
Returns type index of the promised DYNAMICS.
DynamicsPromise(meta::id< DYNAMICS > id=meta::id< DYNAMICS >{})
Concrete collision operator for legacy dynamics.
Dynamics< T, DESCRIPTOR > * getDynamics() override
LegacyBlockCollisionO(std::size_t count, Dynamics< T, DESCRIPTOR > **dynamics)
void apply(ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM > &block, ConcreteBlockMask< T, PLATFORM > &subdomain, CollisionDispatchStrategy strategy) override
Apply collision on subdomain of block.
std::type_index id() const override
std::size_t weight() const override
Returns number of assigned cells.
void set(CellID iCell, bool state, bool overlap) override
Set whether iCell is covered by the present collision step.
void setup(ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM > &block) override
Setup collision on block.
Concrete CPU dynamics for legacy dynamics.
void computeStress(cpu::Cell< T, DESCRIPTOR, PLATFORM > &cell, T &rho, T *u, T *pi) override
T getOmegaOrFallback(T fallback) override
void defineAllMomenta(cpu::Cell< T, DESCRIPTOR, PLATFORM > &cell, T &rho, T *u, T *pi) override
void computeU(cpu::Cell< T, DESCRIPTOR, PLATFORM > &cell, T *u) override
void defineRhoU(cpu::Cell< T, DESCRIPTOR, PLATFORM > &cell, T &rho, T *u) override
void defineRho(cpu::Cell< T, DESCRIPTOR, PLATFORM > &cell, T &rho) override
T computeRho(cpu::Cell< T, DESCRIPTOR, PLATFORM > &cell) override
LegacyConcreteDynamics(ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM > &lattice, Dynamics< T, DESCRIPTOR > *dynamics)
void computeAllMomenta(cpu::Cell< T, DESCRIPTOR, PLATFORM > &cell, T &rho, T *u, T *pi) override
void computeRhoU(cpu::Cell< T, DESCRIPTOR, PLATFORM > &cell, T &rho, T *u) override
void inverseShiftRhoU(cpu::Cell< T, DESCRIPTOR, PLATFORM > &cell, T &rho, T *u) override
void computeJ(cpu::Cell< T, DESCRIPTOR, PLATFORM > &cell, T *j) override
void defineU(cpu::Cell< T, DESCRIPTOR, PLATFORM > &cell, T *u) override
T computeEquilibrium(int iPop, T rho, T *u) override
CellStatistic< T > collide(cpu::Cell< T, DESCRIPTOR, PLATFORM > &cell) override
Cell concept for concrete block lattices on CPU platforms.
Definition cell.h:87
CellID getCellId() const
Definition cell.h:104
Top level namespace for all of OpenLB.
std::uint32_t CellID
Type for sequential block-local cell indices.
Platform
OpenLB execution targets.
Definition platform.h:36
@ CPU_SIMD
Basic scalar CPU.
@ GPU_CUDA
Vector CPU (AVX2 / AVX-512 collision)
constexpr bool isPlatformCPU(Platform platform)
Returns true if platform is equal to Platform::CPU_*.
Definition platform.h:154
CollisionDispatchStrategy
Collision dispatch strategy.
Definition operator.h:88
@ Individual
Apply all dynamics individually (async for Platform::GPU_CUDA)
@ Dominant
Apply dominant dynamics using mask and fallback to virtual dispatch for others.
DynamicsPromise(meta::id< DYNAMICS >) -> DynamicsPromise< typename DYNAMICS::value_t, typename DYNAMICS::descriptor_t >
virtual void set(CellID iCell, bool state, bool overlap)=0
Set whether iCell is covered by the present collision step.
virtual std::size_t weight() const =0
Returns number of assigned cells.
virtual Dynamics< T, DESCRIPTOR > * getDynamics()=0
Collision operation on concrete blocks of PLATFORM.
Definition operator.h:97
virtual void setup(ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM > &block)=0
Setup collision on block.
virtual void apply(ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM > &block, ConcreteBlockMask< T, PLATFORM > &subdomain, CollisionDispatchStrategy strategy)=0
Apply collision on subdomain of block using strategy.
Return value of any collision.
Definition interface.h:43
Mask describing the subdomain on which to apply the collision step.
Interface for per-cell dynamics.
Definition interface.h:54
virtual void inverseShiftRhoU(ConstCell< T, DESCRIPTOR > &cell, T &rho, T u[DESCRIPTOR::d]) const
Calculate population momenta s.t. the physical momenta are reproduced by the computeRhoU.
Definition interface.h:125
virtual T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const any_platform=0
Return iPop equilibrium for given first and second momenta.
virtual T computeRho(ConstCell< T, DESCRIPTOR > &cell) const =0
Compute particle density.
virtual std::type_index id()=0
Expose unique type-identifier for RTTI.
virtual void computeU(ConstCell< T, DESCRIPTOR > &cell, T u[DESCRIPTOR::d]) const =0
Compute fluid velocity.
virtual void computeStress(ConstCell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d], T pi[util::TensorVal< DESCRIPTOR >::n]) const =0
Compute stress tensor.
virtual void defineU(Cell< T, DESCRIPTOR > &cell, const T u[DESCRIPTOR::d])=0
Set fluid velocity.
virtual void defineRhoU(Cell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d])=0
Define fluid velocity and particle density.
virtual void computeRhoU(ConstCell< T, DESCRIPTOR > &cell, T &rho, T u[DESCRIPTOR::d]) const =0
Compute fluid velocity and particle density.
virtual void defineRho(Cell< T, DESCRIPTOR > &cell, T rho)=0
Set particle density.
virtual void computeAllMomenta(ConstCell< T, DESCRIPTOR > &cell, T &rho, T u[DESCRIPTOR::d], T pi[util::TensorVal< DESCRIPTOR >::n]) const =0
Compute all momenta up to second order.
virtual void computeJ(ConstCell< T, DESCRIPTOR > &cell, T j[DESCRIPTOR::d]) const =0
Compute fluid momentum.
virtual void defineAllMomenta(Cell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d], const T pi[util::TensorVal< DESCRIPTOR >::n])=0
Define all momenta up to second order.
virtual CellStatistic< T > collide(Cell< T, DESCRIPTOR > &cell)
Perform purely-local collision step on Cell interface (legacy, to be deprecated)
Definition interface.h:74
Virtual interface for dynamically-dispatched dynamics access on CPU targets.
Definition cell.h:39
Identity type to pass non-constructible types as value.
Definition meta.h:79