OpenLB 1.7
Loading...
Searching...
No Matches
pack.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2021 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 CPU_SIMD_PACK_H_
25#define CPU_SIMD_PACK_H_
26
27#ifdef __AVX512F__
28#include "512.h"
29#else
30#include "256.h"
31#endif
32
33namespace olb {
34
35namespace cpu {
36
37namespace simd {
38
39template <typename T, typename S>
41{
42 return Pack<T>(lhs) + rhs;
43}
44
45template <typename T, typename S>
47{
48 return lhs + Pack<T>(rhs);
49}
50
51template <typename T, typename S>
53{
54 return Pack<T>(lhs) - rhs;
55}
56
57template <typename T, typename S>
59{
60 return lhs - Pack<T>(rhs);
61}
62
63template <typename T, typename S>
65{
66 return lhs * Pack<T>(rhs);
67}
68
69template <typename T, typename S>
71{
72 return Pack<T>(lhs) * rhs;
73}
74
75template <typename T, typename S>
77{
78 return lhs / Pack<T>(rhs);
79}
80
81template <typename T, typename S>
83{
84 return Pack<T>(lhs) / rhs;
85}
86
87template <typename T>
89{
90 return x.sqrt();
91}
92
93}
94
95}
96
97namespace util {
98
99template <typename T>
101{
102 return value.sqrt();
103}
104
105template <typename T>
107{
108 return cpu::simd::fabs(value);
109}
110
111template <typename T>
116
117template <typename T, typename S>
122
123template <typename T>
128
129template <typename T>
134
135}
136
137}
138
139#endif
Pack< T > operator+(S lhs, Pack< T > rhs)
Definition pack.h:40
Pack< T > operator*(Pack< T > lhs, S rhs)
Definition pack.h:64
Pack< T > operator/(Pack< T > lhs, S rhs)
Definition pack.h:76
Pack< T > operator-(S lhs, Pack< T > rhs)
Definition pack.h:52
Pack< T > pow(Pack< T > base, Pack< T > exp)
Definition 256.h:395
Pack< T > min(Pack< T > rhs, Pack< T > lhs)
Definition 256.h:406
Pack< T > max(Pack< T > rhs, Pack< T > lhs)
Definition 256.h:416
Pack< T > fabs(Pack< T > x)
Definition 256.h:426
Pack< T > sqrt(Pack< T > x)
Definition pack.h:88
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100
cpu::simd::Pack< T > min(cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
Definition pack.h:124
cpu::simd::Pack< T > max(cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
Definition pack.h:130
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112
cpu::simd::Pack< T > fabs(cpu::simd::Pack< T > value)
Definition pack.h:106
ADf< T, DIM > exp(const ADf< T, DIM > &a)
Definition aDiff.h:455
Top level namespace for all of OpenLB.