StencilStream v3.0.0
SYCL-based Stencil Simulation Framework Targeting FPGAs
Loading...
Searching...
No Matches
GenericID.hpp
Go to the documentation of this file.
1/*
2 * Copyright © 2020-2024 Jan-Oliver Opdenhövel, Paderborn Center for Parallel Computing, Paderborn
3 * University
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6 * associated documentation files (the “Software”), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
8 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in all copies or
12 * substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
15 * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 */
20#pragma once
21#include "Index.hpp"
22#include <CL/sycl.hpp>
23
24namespace stencil {
25
32template <typename T> class GenericID {
33 public:
37 GenericID() : c(), r() {}
38
42 GenericID(T column, T row) : c(column), r(row) {}
43
47 GenericID(sycl::id<2> sycl_id) : c(sycl_id[0]), r(sycl_id[1]) {}
48
52 GenericID(sycl::range<2> sycl_range) : c(sycl_range[0]), r(sycl_range[1]) {}
53
57 bool operator==(GenericID const &other) const {
58 return this->c == other.c && this->r == other.r;
59 }
60
64 T c;
65
69 T r;
70};
71
76
81
82} // namespace stencil
A generic, two-dimensional index.
Definition GenericID.hpp:32
GenericID()
Create a new index with undefined contents.
Definition GenericID.hpp:37
T c
The column index.
Definition GenericID.hpp:64
GenericID(sycl::id< 2 > sycl_id)
Convert the SYCL ID.
Definition GenericID.hpp:47
GenericID(sycl::range< 2 > sycl_range)
Convert the SYCl range.
Definition GenericID.hpp:52
GenericID(T column, T row)
Create a new index with the given column and row indices.
Definition GenericID.hpp:42
bool operator==(GenericID const &other) const
Test if the other generic ID has equivalent coordinates to this ID.
Definition GenericID.hpp:57
T r
The row index.
Definition GenericID.hpp:69
Definition AccessorSubscript.hpp:24
GenericID< uindex_t > UID
An unsigned, two-dimensional index.
Definition GenericID.hpp:80
GenericID< index_t > ID
A signed, two-dimensional index.
Definition GenericID.hpp:75