OpenLB 1.8.1
Loading...
Searching...
No Matches
superD.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2024 Adrian Kummerlaender
4 *
5 * E-mail contact: info@openlb.net
6 * The most recent release of OpenLB can be downloaded at
7 * <http://www.openlb.net/>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23*/
24
25#ifndef SUPER_D_H
26#define SUPER_D_H
27
28#include "blockD.h"
29
30namespace olb {
31
32template <typename T, typename DESCRIPTOR>
33class SuperD {
34private:
35 std::vector<std::unique_ptr<BlockD<T,DESCRIPTOR>>> _block;
36
37public:
38 using value_t = T;
39 using descriptor_t = DESCRIPTOR;
40
41 SuperD(const std::vector<std::pair<Vector<std::size_t,DESCRIPTOR::d>,Platform>>& blocks) {
42 for (auto [extent, platform] : blocks) {
44 platform, extent, 0));
45 }
46 }
47
48 SuperD(const LoadBalancer<T>& load) {
49 for (int iB = 0; iB < load.size(); ++iB) {
51 load.platform(iB), 0, 0));
52 }
53 }
54
55 std::size_t size() const {
56 return _block.size();
57 }
58
60 return *_block.at(iB);
61 }
62
63 template <typename OPERATOR>
64 void apply() {
65 OPERATOR{}.apply(*this);
66 }
67
69 for (auto& block : _block) {
70 block->setProcessingContext(context);
71 }
72 }
73
74};
75
76}
77
78#endif
#define OPERATOR(OP, rhs)
Definition aDiffTape.h:64
Base class for all LoadBalancer.
Definition vtiWriter.h:42
virtual Platform platform(int loc) const
SuperD(const std::vector< std::pair< Vector< std::size_t, DESCRIPTOR::d >, Platform > > &blocks)
Definition superD.h:41
SuperD(const LoadBalancer< T > &load)
Definition superD.h:48
void apply()
Definition superD.h:64
BlockD< T, DESCRIPTOR > & getBlock(unsigned iB)
Definition superD.h:59
DESCRIPTOR descriptor_t
Definition superD.h:39
void setProcessingContext(ProcessingContext context)
Definition superD.h:68
std::size_t size() const
Definition superD.h:55
Plain old scalar vector.
Top level namespace for all of OpenLB.
ProcessingContext
OpenLB processing contexts.
Definition platform.h:54
Platform
OpenLB execution targets.
Definition platform.h:35
CONCRETIZABLE::base_t * constructUsingConcretePlatform(Platform platform, ARGS &&... args)
Definition dispatch.h:107
Curried ConcreteBlockD eemplate for use in callUsingConcretePlatform.
Definition blockD.h:35