Legion Runtime
Loading...
Searching...
No Matches
transforms.h
Go to the documentation of this file.
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
24#include "legion/api/geometry.h"
25
26namespace Legion {
27
35 template<int M, int N, typename T = coord_t>
37 private:
38 static_assert(M > 0, "M must be positive");
39 static_assert(N > 0, "N must be positive");
40 static_assert(std::is_integral<T>::value, "must be integral type");
41 public:
42 __LEGION_CUDA_HD__
43 AffineTransform(void); // default to identity transform
44 // allow type coercions where possible
45 template<typename T2>
46 __LEGION_CUDA_HD__ AffineTransform(const AffineTransform<M, N, T2>& rhs);
47 template<typename T2, typename T3>
48 __LEGION_CUDA_HD__ AffineTransform(
49 const Transform<M, N, T2> transform, const Point<M, T3> offset);
50 public:
51 template<typename T2>
52 __LEGION_CUDA_HD__ AffineTransform<M, N, T>& operator=(
53 const AffineTransform<M, N, T2>& rhs);
54 public:
55 // Apply the transformation to a point
56 template<typename T2>
57 __LEGION_CUDA_HD__ Point<M, T> operator[](const Point<N, T2> point) const;
58 // Compose the transform with another transform
59 template<int P>
60 __LEGION_CUDA_HD__ AffineTransform<M, P, T> operator()(
61 const AffineTransform<N, P, T>& rhs) const;
62 // Test whether this is the identity transform
63 __LEGION_CUDA_HD__
64 bool is_identity(void) const;
65 public:
66 // Transform = Ax + b
67 Transform<M, N, T> transform; // A
68 Point<M, T> offset; // b
69 };
70
83 template<int M, int N, typename T = coord_t>
85 private:
86 static_assert(M > 0, "M must be positive");
87 static_assert(M > 0, "N must be positive");
88 static_assert(std::is_integral<T>::value, "must be integral type");
89 public:
90 __LEGION_CUDA_HD__
91 ScaleTransform(void); // default to identity transform
92 // allow type coercions where possible
93 template<typename T2>
94 __LEGION_CUDA_HD__ ScaleTransform(const ScaleTransform<M, N, T2>& rhs);
95 template<typename T2, typename T3, typename T4>
96 __LEGION_CUDA_HD__ ScaleTransform(
97 const Transform<M, N, T2> transform, const Rect<M, T3> extent,
98 const Point<M, T4> divisor);
99 public:
100 template<typename T2>
101 __LEGION_CUDA_HD__ ScaleTransform<M, N, T>& operator=(
102 const ScaleTransform<M, N, T2>& rhs);
103 public:
104 // Apply the transformation to a point
105 template<typename T2>
106 __LEGION_CUDA_HD__ Rect<M, T> operator[](const Point<N, T2> point) const;
107 // Test whether this is the identity transform
108 __LEGION_CUDA_HD__
109 bool is_identity(void) const;
110 public:
111 Transform<M, N, T> transform; // A
112 Rect<M, T> extent; // [b=lo, c=hi]
113 Point<M, T> divisor; // d
114 };
115
116 // If we've got c++11 we can just include this directly
117
124 public:
125 __LEGION_CUDA_HD__
126 DomainTransform(void);
127 __LEGION_CUDA_HD__
129 template<int M, int N, typename T>
130 __LEGION_CUDA_HD__ DomainTransform(const Transform<M, N, T>& rhs);
131 public:
132 __LEGION_CUDA_HD__
133 DomainTransform& operator=(const DomainTransform& rhs);
134 template<int M, int N, typename T>
135 __LEGION_CUDA_HD__ DomainTransform& operator=(
136 const Transform<M, N, T>& rhs);
137 __LEGION_CUDA_HD__
138 bool operator==(const DomainTransform& rhs) const;
139 __LEGION_CUDA_HD__
140 bool operator!=(const DomainTransform& rhs) const;
141 public:
142 template<int M, int N, typename T>
143 __LEGION_CUDA_HD__ operator Transform<M, N, T>(void) const;
144 public:
145 __LEGION_CUDA_HD__
146 DomainPoint operator*(const DomainPoint& p) const;
147 __LEGION_CUDA_HD__
148 Domain operator*(const Domain& domain) const;
149 __LEGION_CUDA_HD__
150 DomainTransform operator*(const DomainTransform& transform) const;
151 public:
152 __LEGION_CUDA_HD__
153 bool is_identity(void) const;
154 public:
155 int m, n;
156 coord_t matrix[LEGION_MAX_DIM * LEGION_MAX_DIM];
157 };
158
165 public:
166 __LEGION_CUDA_HD__
168 __LEGION_CUDA_HD__
170 __LEGION_CUDA_HD__
172 template<int M, int N, typename T>
173 __LEGION_CUDA_HD__ DomainAffineTransform(
174 const AffineTransform<M, N, T>& transform);
175 public:
176 __LEGION_CUDA_HD__
177 DomainAffineTransform& operator=(const DomainAffineTransform& rhs);
178 template<int M, int N, typename T>
179 __LEGION_CUDA_HD__ DomainAffineTransform& operator=(
180 const AffineTransform<M, N, T>& rhs);
181 __LEGION_CUDA_HD__
182 bool operator==(const DomainAffineTransform& rhs) const;
183 __LEGION_CUDA_HD__
184 bool operator!=(const DomainAffineTransform& rhs) const;
185 public:
186 template<int M, int N, typename T>
187 __LEGION_CUDA_HD__ operator AffineTransform<M, N, T>(void) const;
188 public:
189 // Apply the transformation to a point
190 __LEGION_CUDA_HD__
191 DomainPoint operator[](const DomainPoint& p) const;
192 // Test for the identity
193 __LEGION_CUDA_HD__
194 bool is_identity(void) const;
195 public:
196 DomainTransform transform;
197 DomainPoint offset;
198 };
199
206 public:
207 __LEGION_CUDA_HD__
209 __LEGION_CUDA_HD__
211 __LEGION_CUDA_HD__
213 const DomainTransform& transform, const Domain& extent,
214 const DomainPoint& divisor);
215 template<int M, int N, typename T>
216 __LEGION_CUDA_HD__ DomainScaleTransform(
217 const ScaleTransform<M, N, T>& transform);
218 public:
219 __LEGION_CUDA_HD__
220 DomainScaleTransform& operator=(const DomainScaleTransform& rhs);
221 template<int M, int N, typename T>
222 __LEGION_CUDA_HD__ DomainScaleTransform& operator=(
223 const ScaleTransform<M, N, T>& rhs);
224 __LEGION_CUDA_HD__
225 bool operator==(const DomainScaleTransform& rhs) const;
226 __LEGION_CUDA_HD__
227 bool operator!=(const DomainScaleTransform& rhs) const;
228 public:
229 template<int M, int N, typename T>
230 __LEGION_CUDA_HD__ operator ScaleTransform<M, N, T>(void) const;
231 public:
232 // Apply the transformation to a point
233 __LEGION_CUDA_HD__
234 Domain operator[](const DomainPoint& p) const;
235 // Test for the identity
236 __LEGION_CUDA_HD__
237 bool is_identity(void) const;
238 public:
239 DomainTransform transform;
240 Domain extent;
241 DomainPoint divisor;
242 };
243
244} // namespace Legion
245
246#include "legion/api/transforms.inl"
247
248#endif // __LEGION_TRANSFORMS_H__
Definition transforms.h:164
Definition geometry.h:159
Definition geometry.h:34
Definition transforms.h:205
Definition transforms.h:123
Definition accessors.h:29
Definition transforms.h:36
Definition transforms.h:84