summaryrefslogtreecommitdiff
path: root/src/pattern/none.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2021-05-17 00:30:13 +0200
committerAdrian Kummerlaender2021-05-17 00:30:13 +0200
commita92271176a19e06611099c0eccc4e6a6887f4915 (patch)
tree54067b334bfae7d99c79cfb00da5891334f9514c /src/pattern/none.h
downloadSweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.tar
SweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.tar.gz
SweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.tar.bz2
SweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.tar.lz
SweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.tar.xz
SweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.tar.zst
SweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.zip
Extract public version of SweepLB
Diffstat (limited to 'src/pattern/none.h')
-rw-r--r--src/pattern/none.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/pattern/none.h b/src/pattern/none.h
new file mode 100644
index 0000000..8abc419
--- /dev/null
+++ b/src/pattern/none.h
@@ -0,0 +1,48 @@
+#pragma once
+
+#include "population.h"
+#include "propagation.h"
+
+#include <unistd.h>
+
+namespace pattern {
+
+template <concepts::Arithmetic T>
+class NONE {
+private:
+ Cuboid _cuboid;
+
+ T* _base;
+ T* _f[population::q];
+
+public:
+ using value_t = T;
+
+ NONE(Cuboid cuboid):
+ _cuboid(cuboid)
+ {
+ const std::size_t pagesize = sysconf(_SC_PAGESIZE);
+ const std::size_t padding = _cuboid.index(1,1,1);
+ _base = static_cast<T*>(
+ std::aligned_alloc(pagesize, population::q * (_cuboid.volume() + 2*padding) * sizeof(T)));
+ for (unsigned iPop=0; iPop < population::q; ++iPop) {
+ _f[iPop] = _base + iPop * (_cuboid.volume() + 2*padding) + padding;
+ }
+ }
+
+ ~NONE() {
+ delete [] _base;
+ }
+
+ T* get(unsigned iPop, stage::pre_collision) {
+ return _f[iPop];
+ }
+
+ T* get(unsigned iPop, stage::post_collision) {
+ return _f[iPop];
+ }
+
+ void stream() { }
+};
+
+}