Legion Runtime
Loading...
Searching...
No Matches
transforms.h
1/* Copyright 2026 Stanford University, NVIDIA Corporation
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef __LEGION_TRANSFORMS_H__
17#define __LEGION_TRANSFORMS_H__
18
19#include "legion/api/geometry.h"
20
21namespace Legion {
22
30 template<int M, int N, typename T = coord_t>
32 private:
33 static_assert(M > 0, "M must be positive");
34 static_assert(N > 0, "N must be positive");
35 static_assert(std::is_integral<T>::value, "must be integral type");
36 public:
37 __LEGION_CUDA_HD__
38 AffineTransform(void); // default to identity transform
39 // allow type coercions where possible
40 template<typename T2>
41 __LEGION_CUDA_HD__ AffineTransform(const AffineTransform<M, N, T2>& rhs);
42 template<typename T2, typename T3>
43 __LEGION_CUDA_HD__ AffineTransform(
44 const Transform<M, N, T2> transform, const Point<M, T3> offset);
45 public:
46 template<typename T2>
47 __LEGION_CUDA_HD__ AffineTransform<M, N, T>& operator=(
48 const AffineTransform<M, N, T2>& rhs);
49 public:
50 // Apply the transformation to a point
51 template<typename T2>
52 __LEGION_CUDA_HD__ Point<M, T> operator[](const Point<N, T2> point) const;
53 // Compose the transform with another transform
54 template<int P>
55 __LEGION_CUDA_HD__ AffineTransform<M, P, T> operator()(
56 const AffineTransform<N, P, T>& rhs) const;
57 // Test whether this is the identity transform
58 __LEGION_CUDA_HD__
59 bool is_identity(void) const;
60 public:
61 // Transform = Ax + b
62 Transform<M, N, T> transform; // A
63 Point<M, T> offset; // b
64 };
65
78 template<int M, int N, typename T = coord_t>
80 private:
81 static_assert(M > 0, "M must be positive");
82 static_assert(M > 0, "N must be positive");
83 static_assert(std::is_integral<T>::value, "must be integral type");
84 public:
85 __LEGION_CUDA_HD__
86 ScaleTransform(void); // default to identity transform
87 // allow type coercions where possible
88 template<typename T2>
89 __LEGION_CUDA_HD__ ScaleTransform(const ScaleTransform<M, N, T2>& rhs);
90 template<typename T2, typename T3, typename T4>
91 __LEGION_CUDA_HD__ ScaleTransform(
92 const Transform<M, N, T2> transform, const Rect<M, T3> extent,
93 const Point<M, T4> divisor);
94 public:
95 template<typename T2>
96 __LEGION_CUDA_HD__ ScaleTransform<M, N, T>& operator=(
97 const ScaleTransform<M, N, T2>& rhs);
98 public:
99 // Apply the transformation to a point
100 template<typename T2>
101 __LEGION_CUDA_HD__ Rect<M, T> operator[](const Point<N, T2> point) const;
102 // Test whether this is the identity transform
103 __LEGION_CUDA_HD__
104 bool is_identity(void) const;
105 public:
106 Transform<M, N, T> transform; // A
107 Rect<M, T> extent; // [b=lo, c=hi]
108 Point<M, T> divisor; // d
109 };
110
111 // If we've got c++11 we can just include this directly
112
119 public:
120 __LEGION_CUDA_HD__
121 DomainTransform(void);
122 __LEGION_CUDA_HD__
124 template<int M, int N, typename T>
125 __LEGION_CUDA_HD__ DomainTransform(const Transform<M, N, T>& rhs);
126 public:
127 __LEGION_CUDA_HD__
128 DomainTransform& operator=(const DomainTransform& rhs);
129 template<int M, int N, typename T>
130 __LEGION_CUDA_HD__ DomainTransform& operator=(
131 const Transform<M, N, T>& rhs);
132 __LEGION_CUDA_HD__
133 bool operator==(const DomainTransform& rhs) const;
134 __LEGION_CUDA_HD__
135 bool operator!=(const DomainTransform& rhs) const;
136 public:
137 template<int M, int N, typename T>
138 __LEGION_CUDA_HD__ operator Transform<M, N, T>(void) const;
139 public:
140 __LEGION_CUDA_HD__
141 DomainPoint operator*(const DomainPoint& p) const;
142 __LEGION_CUDA_HD__
143 Domain operator*(const Domain& domain) const;
144 __LEGION_CUDA_HD__
145 DomainTransform operator*(const DomainTransform& transform) const;
146 public:
147 __LEGION_CUDA_HD__
148 bool is_identity(void) const;
149 public:
150 int m, n;
151 coord_t matrix[LEGION_MAX_DIM * LEGION_MAX_DIM];
152 };
153
160 public:
161 __LEGION_CUDA_HD__
163 __LEGION_CUDA_HD__
165 __LEGION_CUDA_HD__
167 template<int M, int N, typename T>
168 __LEGION_CUDA_HD__ DomainAffineTransform(
169 const AffineTransform<M, N, T>& transform);
170 public:
171 __LEGION_CUDA_HD__
172 DomainAffineTransform& operator=(const DomainAffineTransform& rhs);
173 template<int M, int N, typename T>
174 __LEGION_CUDA_HD__ DomainAffineTransform& operator=(
175 const AffineTransform<M, N, T>& rhs);
176 __LEGION_CUDA_HD__
177 bool operator==(const DomainAffineTransform& rhs) const;
178 __LEGION_CUDA_HD__
179 bool operator!=(const DomainAffineTransform& rhs) const;
180 public:
181 template<int M, int N, typename T>
182 __LEGION_CUDA_HD__ operator AffineTransform<M, N, T>(void) const;
183 public:
184 // Apply the transformation to a point
185 __LEGION_CUDA_HD__
186 DomainPoint operator[](const DomainPoint& p) const;
187 // Test for the identity
188 __LEGION_CUDA_HD__
189 bool is_identity(void) const;
190 public:
191 DomainTransform transform;
192 DomainPoint offset;
193 };
194
201 public:
202 __LEGION_CUDA_HD__
204 __LEGION_CUDA_HD__
206 __LEGION_CUDA_HD__
208 const DomainTransform& transform, const Domain& extent,
209 const DomainPoint& divisor);
210 template<int M, int N, typename T>
211 __LEGION_CUDA_HD__ DomainScaleTransform(
212 const ScaleTransform<M, N, T>& transform);
213 public:
214 __LEGION_CUDA_HD__
215 DomainScaleTransform& operator=(const DomainScaleTransform& rhs);
216 template<int M, int N, typename T>
217 __LEGION_CUDA_HD__ DomainScaleTransform& operator=(
218 const ScaleTransform<M, N, T>& rhs);
219 __LEGION_CUDA_HD__
220 bool operator==(const DomainScaleTransform& rhs) const;
221 __LEGION_CUDA_HD__
222 bool operator!=(const DomainScaleTransform& rhs) const;
223 public:
224 template<int M, int N, typename T>
225 __LEGION_CUDA_HD__ operator ScaleTransform<M, N, T>(void) const;
226 public:
227 // Apply the transformation to a point
228 __LEGION_CUDA_HD__
229 Domain operator[](const DomainPoint& p) const;
230 // Test for the identity
231 __LEGION_CUDA_HD__
232 bool is_identity(void) const;
233 public:
234 DomainTransform transform;
235 Domain extent;
236 DomainPoint divisor;
237 };
238
239} // namespace Legion
240
241#include "legion/api/transforms.inl"
242
243#endif // __LEGION_TRANSFORMS_H__
Definition transforms.h:159
Definition geometry.h:154
Definition geometry.h:29
Definition transforms.h:200
Definition transforms.h:118
Definition transforms.h:31
Definition transforms.h:79