OpenLB 1.7
Loading...
Searching...
No Matches
column.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2021 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 CPU_SIMD_COLUMN_HH
26#define CPU_SIMD_COLUMN_HH
27
28#include "column.h"
29
30namespace olb {
31
32namespace cpu {
33
34namespace simd {
35
36template<typename T>
37std::size_t Column<T>::getNblock() const
38{
39 return 2;
40}
41
42template<typename T>
44{
45 return _count * sizeof(T) + sizeof(std::size_t);
46}
47
48template<typename T>
49bool* Column<T>::getBlock(std::size_t iBlock, std::size_t& sizeBlock, bool loadingMode)
50{
51 std::size_t currentBlock = 0;
52 bool* dataPtr = nullptr;
53
54 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _count);
55 if (loadingMode && iBlock == 1) {
56 resize(_count);
57 }
58 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, *data(), _count);
59
60 return dataPtr;
61}
62
63
64template<typename T>
65std::size_t CyclicColumn<T>::getNblock() const
66{
67 return 3;
68}
69
70template<typename T>
72{
73 return 2*_size + sizeof(std::ptrdiff_t) + sizeof(std::size_t);
74}
75
76template<typename T>
77bool* CyclicColumn<T>::getBlock(std::size_t iBlock, std::size_t& sizeBlock, bool loadingMode)
78{
79 std::size_t currentBlock = 0;
80 bool* dataPtr = nullptr;
81
82 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _shift);
83 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _count);
84 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, *_base, 2*_count);
85
86 return dataPtr;
87}
88
89}
90
91}
92
93}
94
95#endif
bool * getBlock(std::size_t iBlock, std::size_t &sizeBlock, bool loadingMode) override
Return a pointer to the memory of the current block and its size for the serializable interface.
Definition column.hh:51
std::size_t getSerializableSize() const override
Binary size for the serializer.
Definition column.hh:45
std::size_t getNblock() const override
Number of data blocks for the serializable interface.
Definition column.hh:39
std::size_t getNblock() const override
Number of data blocks for the serializable interface.
Definition column.hh:67
bool * getBlock(std::size_t iBlock, std::size_t &sizeBlock, bool loadingMode) override
Return a pointer to the memory of the current block and its size for the serializable interface.
Definition column.hh:79
std::size_t getSerializableSize() const override
Binary size for the serializer.
Definition column.hh:73
Top level namespace for all of OpenLB.