Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Real2.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* Real2.h (C) 2000-2026 */
9/* */
10/* 2-dimensional vector of 'Real'. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_REAL2_H
13#define ARCANE_UTILS_REAL2_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/Numeric.h"
18
19#include <iosfwd>
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
31{
32 public:
33
34 Real x; //!< first component of the pair
35 Real y; //!< second component of the pair
36
37 /*!
38 * Read-only access to the @a i th component of the Real2POD
39 *
40 * @note only works for x, y ordered in the POD
41 *
42 * @param i component number to return
43 *
44 * @return (&x)[i]
45 */
46 ARCCORE_HOST_DEVICE Real operator[](Integer i) const
47 {
48 ARCCORE_CHECK_AT(i, 2);
49 return (&x)[i];
50 }
51
52 /*!
53 * Read-only access to the @a i th component of the Real2POD
54 *
55 * @note only works for x, y ordered in the POD
56 *
57 * @param i component number to return
58 *
59 * @return (&x)[i]
60 */
61 ARCCORE_HOST_DEVICE Real operator()(Integer i) const
62 {
63 ARCCORE_CHECK_AT(i, 2);
64 return (&x)[i];
65 }
66
67 /*!
68 * Access to the @a i th component of the Real2POD
69 *
70 * @note only works for x, y ordered in the POD
71 *
72 * @param i component number to return
73 *
74 * @return (&x)[i]
75 */
76 ARCCORE_HOST_DEVICE Real& operator[](Integer i)
77 {
78 ARCCORE_CHECK_AT(i, 2);
79 return (&x)[i];
80 }
81
82 /*!
83 * Access to the @a i th component of the Real2POD
84 *
85 * @note only works for x, y ordered in the POD
86 *
87 * @param i component number to return
88 *
89 * @return (&x)[i]
90 */
91 ARCCORE_HOST_DEVICE Real& operator()(Integer i)
92 {
93 ARCCORE_CHECK_AT(i, 2);
94 return (&x)[i];
95 }
96
97 //! Positions the \a i th component at \a value
98 ARCCORE_HOST_DEVICE void setComponent(Integer i, Real value)
99 {
100 ARCCORE_CHECK_AT(i, 2);
101 (&x)[i] = value;
102 }
103};
104
105/*---------------------------------------------------------------------------*/
106/*---------------------------------------------------------------------------*/
107
108/*!
109 * \brief Class managing a 2-dimensional real vector.
110
111 The vector includes two components \a x and \a y which are of
112 type \b Real.
113
114 \code
115 Real2 value (1.0,2.3); // Creates a pair (x=1.0, y=2.3)
116 cout << value.x; // Prints the x component
117 value.y += 3.2; // Adds 3.2 to the \b y component
118 \endcode
119 */
120class ARCANE_UTILS_EXPORT Real2
121: public Real2POD
122{
123 public:
124
125 //! Constructs the zero vector.
126 constexpr ARCCORE_HOST_DEVICE Real2()
127 : Real2POD()
128 {
129 x = 0.;
130 y = 0.;
131 }
132 //! Constructs the pair (ax,ay)
133 constexpr ARCCORE_HOST_DEVICE Real2(Real ax, Real ay)
134 : Real2POD()
135 {
136 x = ax;
137 y = ay;
138 }
139 //! Constructs a copy identical to \a f
140 Real2(const Real2& f) = default;
141 //! Constructs a copy identical to \a f
142 constexpr ARCCORE_HOST_DEVICE explicit Real2(const Real2POD& f)
143 : Real2POD()
144 {
145 x = f.x;
146 y = f.y;
147 }
148
149 //! Constructs the instance with the triplet (v,v,v).
150 constexpr ARCCORE_HOST_DEVICE explicit Real2(Real v)
151 : Real2POD()
152 {
153 x = y = v;
154 }
155
156 //! Constructs the instance using the first two components of Real3.
157 inline constexpr ARCCORE_HOST_DEVICE explicit Real2(const Real3& v);
158
159 //! Constructs the pair (av[0], av[1])
160 constexpr ARCCORE_HOST_DEVICE Real2(ConstArrayView<Real> av)
161 : Real2POD()
162 {
163 x = av[0];
164 y = av[1];
165 }
166
167 Real2& operator=(const Real2& f) = default;
168
169 //! Assigns the pair (v,v) to the instance.
170 constexpr ARCCORE_HOST_DEVICE Real2& operator=(Real v)
171 {
172 x = y = v;
173 return (*this);
174 }
175
176 public:
177
178 constexpr ARCCORE_HOST_DEVICE static Real2 null() { return Real2(0., 0.); }
179
180 public:
181
182 //! Returns a copy of the pair.
183 constexpr ARCCORE_HOST_DEVICE Real2 copy() const { return (*this); }
184
185 //! Resets the pair using default constructors.
186 constexpr ARCCORE_HOST_DEVICE Real2& reset()
187 {
188 x = y = 0.0;
189 return (*this);
190 }
191
192 //! Assigns the triplet (ax,ay,az) to the instance
193 constexpr ARCCORE_HOST_DEVICE Real2& assign(Real ax, Real ay)
194 {
195 x = ax;
196 y = ay;
197 return (*this);
198 }
199
200 //! Copies the pair \a f
201 constexpr ARCCORE_HOST_DEVICE Real2& assign(Real2 f)
202 {
203 x = f.x;
204 y = f.y;
205 return (*this);
206 }
207
208 //! Returns a view of the two elements of the vector.
209 constexpr ARCCORE_HOST_DEVICE ArrayView<Real> view()
210 {
211 return { 2, &x };
212 }
213
214 //! Returns a constant view of the two elements of the vector.
215 constexpr ARCCORE_HOST_DEVICE ConstArrayView<Real> constView() const
216 {
217 return { 2, &x };
218 }
219
220 //! Absolute value component by component.
221 ARCCORE_HOST_DEVICE Real2 absolute() const { return Real2(math::abs(x), math::abs(y)); }
222
223 /*!
224 * \brief Reads a pair from stream \a i
225 * The pair is read in the form of three values of type #value_type.
226 */
227 std::istream& assign(std::istream& i);
228
229 //! Writes the pair to stream \a o readable by an assign()
230 std::ostream& print(std::ostream& o) const;
231
232 //! Writes the pair to stream \a o in the form (x,y)
233 std::ostream& printXy(std::ostream& o) const;
234
235 //! Adds \a b to the pair
236 constexpr ARCCORE_HOST_DEVICE Real2& add(Real2 b)
237 {
238 x += b.x;
239 y += b.y;
240 return (*this);
241 }
242
243 //! Subtracts \a b from the pair
244 constexpr ARCCORE_HOST_DEVICE Real2& sub(Real2 b)
245 {
246 x -= b.x;
247 y -= b.y;
248 return (*this);
249 }
250
251 //! Multiplies each component of the pair by the corresponding component of \a b
252 constexpr ARCCORE_HOST_DEVICE Real2& mul(Real2 b)
253 {
254 x *= b.x;
255 y *= b.y;
256 return (*this);
257 }
258
259 //! Divides each component of the pair by the corresponding component of \a b
260 constexpr ARCCORE_HOST_DEVICE Real2& div(Real2 b)
261 {
262 x /= b.x;
263 y /= b.y;
264 return (*this);
265 }
266
267 //! Adds \a b to each component of the pair
268 constexpr ARCCORE_HOST_DEVICE Real2& addSame(Real b)
269 {
270 x += b;
271 y += b;
272 return (*this);
273 }
274
275 //! Subtracts \a b from each component of the pair
276 constexpr ARCCORE_HOST_DEVICE Real2& subSame(Real b)
277 {
278 x -= b;
279 y -= b;
280 return (*this);
281 }
282
283 //! Multiplies each component of the pair by b
284 constexpr ARCCORE_HOST_DEVICE Real2& mulSame(Real b)
285 {
286 x *= b;
287 y *= b;
288 return (*this);
289 }
290
291 //! Divides each component of the pair by b
292 constexpr ARCCORE_HOST_DEVICE Real2& divSame(Real b)
293 {
294 x /= b;
295 y /= b;
296 return (*this);
297 }
298
299 //! Adds b to the pair.
300 constexpr ARCCORE_HOST_DEVICE Real2& operator+=(Real2 b) { return add(b); }
301
302 //! Subtracts b from the pair
303 constexpr ARCCORE_HOST_DEVICE Real2& operator-=(Real2 b) { return sub(b); }
304
305 //! Multiplies each component of the pair by the corresponding component of b
306 constexpr ARCCORE_HOST_DEVICE Real2& operator*=(Real2 b) { return mul(b); }
307
308 //! Multiplies each component of the pair by the real number b
309 constexpr ARCCORE_HOST_DEVICE void operator*=(Real b)
310 {
311 x *= b;
312 y *= b;
313 }
314
315 //! Divides each component of the pair by the corresponding component of b
316 constexpr ARCCORE_HOST_DEVICE Real2& operator/=(Real2 b) { return div(b); }
317
318 //! Divides each component of the pair by the real number b
319 constexpr ARCCORE_HOST_DEVICE void operator/=(Real b)
320 {
321 x /= b;
322 y /= b;
323 }
324
325 //! Creates a pair that equals this pair added to b
326 constexpr ARCCORE_HOST_DEVICE Real2 operator+(Real2 b) const { return Real2(x + b.x, y + b.y); }
327
328 //! Creates a pair that equals b subtracted from this pair
329 constexpr ARCCORE_HOST_DEVICE Real2 operator-(Real2 b) const { return Real2(x - b.x, y - b.y); }
330
331 //! Creates a pair opposite to the current pair
332 constexpr ARCCORE_HOST_DEVICE Real2 operator-() const { return Real2(-x, -y); }
333
334 /*!
335 * \brief Creates a pair that equals this pair, where each component has been
336 * multiplied by the corresponding component of b.
337 */
338 constexpr ARCCORE_HOST_DEVICE Real2 operator*(Real2 b) const { return Real2(x * b.x, y * b.y); }
339
340 /*!
341 * \brief Creates a pair that equals this pair, where each component has been divided
342 * by the corresponding component of b.
343 */
344 constexpr ARCCORE_HOST_DEVICE Real2 operator/(Real2 b) const { return Real2(x / b.x, y / b.y); }
345
346 //! Multiplication by a scalar.
347 friend constexpr ARCCORE_HOST_DEVICE Real2 operator*(Real sca, Real2 vec)
348 {
349 return Real2(vec.x * sca, vec.y * sca);
350 }
351
352 //! Multiplication by a scalar.
353 friend constexpr ARCCORE_HOST_DEVICE Real2 operator*(Real2 vec, Real sca)
354 {
355 return Real2(vec.x * sca, vec.y * sca);
356 }
357
358 //! Division by a scalar.
359 friend constexpr ARCCORE_HOST_DEVICE Real2 operator/(Real2 vec, Real sca)
360 {
361 return Real2(vec.x / sca, vec.y / sca);
362 }
363
364 /*!
365 * \brief Comparison operator.
366 *
367 * This operator allows Real2 objects to be sorted for use, for example,
368 * in std::set
369 */
370 friend constexpr ARCCORE_HOST_DEVICE bool operator<(Real2 v1, Real2 v2)
371 {
372 if (v1.x == v2.x) {
373 return v1.y < v2.y;
374 }
375 return (v1.x < v2.x);
376 }
377
378 //! Writes the pair t to the stream o.
379 friend std::ostream& operator<<(std::ostream& o, Real2 t)
380 {
381 return t.printXy(o);
382 }
383
384 //! Reads the pair t from the stream o.
385 friend std::istream& operator>>(std::istream& i, Real2& t)
386 {
387 return t.assign(i);
388 }
389
390 /*!
391 * \brief Compares the current instance component by component to b.
392 *
393 * \retval true if this.x==b.x and this.y==b.y.
394 * \retval false otherwise.
395 */
396 constexpr ARCCORE_HOST_DEVICE bool operator==(Real2 b) const
397 {
398 return _eq(x, b.x) && _eq(y, b.y);
399 }
400
401 /*!
402 * \brief Compares two pairs.
403 * For the concept of equality, see operator==()
404 * \retval true if the two pairs are different,
405 * \retval false otherwise.
406 */
407 constexpr ARCCORE_HOST_DEVICE bool operator!=(Real2 b) const { return !operator==(b); }
408
409 public:
410
411 //! Returns the squared norm of the pair $\f$x^2+y^2+z^2$\f$
412 // TODO: make obsolete mid-2025: ARCANE_DEPRECATED_REASON("Y2024: Use math::squareNormL2(*this) instead")
413 constexpr ARCCORE_HOST_DEVICE Real squareNormL2() const { return x * x + y * y; }
414
415 //! Returns the squared norm of the pair $\f$x^2+y^2+z^2$\f$
416 ARCCORE_DEPRECATED_2021("Use math::squareNormL2(*this) instead")
417 ARCCORE_HOST_DEVICE Real abs2() const { return x * x + y * y; }
418
419 //! Returns the norm of the pair $\f$\sqrt{x^2+y^2+z^2}$\f$
420 ARCCORE_DEPRECATED_2021("Use math::normL2(*this) instead")
421 inline ARCCORE_HOST_DEVICE Real abs() const;
422
423 /*!
424 * \brief Indicates if the instance is close to the zero instance.
425 *
426 * \retval true if math::isNearlyZero() is true for every component.
427 * \retval false otherwise.
428 */
429 // TODO: make obsolete mid-2025: ARCANE_DEPRECATED_REASON("Y2024: Use math::isNearlyZero(const Real2&) instead")
430 inline constexpr ARCCORE_HOST_DEVICE bool isNearlyZero() const;
431
432 //! Returns the norm of the pair $\f$\sqrt{x^2+y^2+z^2}$\f$
433 // TODO: make obsolete mid-2025: ARCANE_DEPRECATED_REASON("Y2024: Use math::normL2(const Real2&) instead")
434 ARCCORE_HOST_DEVICE Real normL2() const;
435
436 // TODO: make obsolete mid-2026 ARCANE_DEPRECATED_REASON("Y2026: Use math::mutableNormalize(Real2&) instead")
437 /*!
438 * \brief Normalizes the pair.
439 *
440 * If the pair is non-zero, divides each component by the norm of the pair
441 * (abs()), such that after calling this method, abs() equals 1.
442 * If the pair is zero, does nothing.
443 */
444 inline Real2& normalize();
445
446 private:
447
448 /*!
449 * \brief Compares the values of a and b using the TypeEqualT comparator
450 * \retval true if a and b are equal,
451 * \retval false otherwise.
452 */
453 constexpr ARCCORE_HOST_DEVICE static bool _eq(Real a, Real b);
454
455 //! Returns the square root of a
456 ARCCORE_HOST_DEVICE static Real _sqrt(Real a);
457};
458
459/*---------------------------------------------------------------------------*/
460/*---------------------------------------------------------------------------*/
461
462namespace math
463{
464 /*!
465 * \brief Indicates if the instance is close to the zero instance.
466 *
467 * \retval true if math::isNearlyZero() is true for every component.
468 * \retval false otherwise.
469 */
470 inline constexpr ARCCORE_HOST_DEVICE bool isNearlyZero(const Real2& v)
471 {
472 return math::isNearlyZero(v.x) && math::isNearlyZero(v.y);
473 }
474
475 //! Returns the squared norm of the pair $\f$x^2+y^2+z^2$\f$
476 inline constexpr ARCCORE_HOST_DEVICE Real squareNormL2(const Real2& v)
477 {
478 return v.x * v.x + v.y * v.y;
479 }
480
481 //! Returns the norm of the pair $\f$\sqrt{x^2+y^2+z^2}$\f$
482 inline ARCCORE_HOST_DEVICE Real normL2(const Real2& v)
483 {
485 }
486
487 /*!
488 * \brief Normalizes the pair.
489 *
490 * If the pair is non-zero, divides each component by the norm of the pair
491 * (abs()), such that after calling this method, abs() equals 1.
492 * If the pair is zero, does nothing.
493 */
495 {
496 Real d = math::normL2(v);
497 if (!math::isZero(d))
498 v.divSame(d);
499 return v;
500 }
501
502 /*!
503 * \brief Returns the pair v normalized by the L2 norm.
504 *
505 * If `math::normL2(v)` is non-zero, returns the pair v divided by `math::normL2(v)`.
506 * Otherwise, returns v.
507 */
508 inline Real2 normalizeL2(const Real2& v)
509 {
510 Real d = math::normL2(v);
511 if (!math::isZero(d))
512 return v / d;
513 return v;
514 }
515} // namespace math
516
517/*---------------------------------------------------------------------------*/
518/*---------------------------------------------------------------------------*/
519
520inline constexpr ARCCORE_HOST_DEVICE bool Real2::
521isNearlyZero() const
522{
523 return math::isNearlyZero(*this);
524}
525
526inline constexpr ARCCORE_HOST_DEVICE bool Real2::
527_eq(Real a, Real b)
528{
529 return math::isEqual(a, b);
530}
531
532inline ARCCORE_HOST_DEVICE Real Real2::
533_sqrt(Real a)
534{
535 return math::sqrt(a);
536}
537
538inline ARCCORE_HOST_DEVICE Real Real2::
539normL2() const
540{
541 return math::normL2(*this);
542}
543
544inline Real2& Real2::
545normalize()
546{
547 return math::mutableNormalize(*this);
548}
549
550inline ARCCORE_HOST_DEVICE Real Real2::
551abs() const
552{
553 return math::normL2(*this);
554}
555
556/*---------------------------------------------------------------------------*/
557/*---------------------------------------------------------------------------*/
558
559} // End namespace Arcane
560
561/*---------------------------------------------------------------------------*/
562/*---------------------------------------------------------------------------*/
563
564#endif
Modifiable view of an array of type T.
Constant view of an array of type T.
Class managing a 2-dimensional real vector.
Definition Real2.h:122
constexpr __host__ __device__ Real2 operator-() const
Creates a pair opposite to the current pair.
Definition Real2.h:332
std::ostream & printXy(std::ostream &o) const
Writes the pair to stream o in the form (x,y).
Definition Real2.cc:47
constexpr __host__ __device__ Real2 & operator-=(Real2 b)
Subtracts b from the pair.
Definition Real2.h:303
constexpr __host__ __device__ bool operator!=(Real2 b) const
Compares two pairs. For the concept of equality, see operator==().
Definition Real2.h:407
constexpr __host__ __device__ Real2 & operator=(Real v)
Assigns the pair (v,v) to the instance.
Definition Real2.h:170
constexpr __host__ __device__ Real squareNormL2() const
Returns the squared norm of the pair $ .
Definition Real2.h:413
constexpr __host__ __device__ bool operator==(Real2 b) const
Compares the current instance component by component to b.
Definition Real2.h:396
constexpr __host__ __device__ Real2 & addSame(Real b)
Adds b to each component of the pair.
Definition Real2.h:268
friend std::ostream & operator<<(std::ostream &o, Real2 t)
Writes the pair t to the stream o.
Definition Real2.h:379
constexpr __host__ __device__ Real2 & reset()
Resets the pair using default constructors.
Definition Real2.h:186
constexpr __host__ __device__ Real2()
Constructs the zero vector.
Definition Real2.h:126
friend std::istream & operator>>(std::istream &i, Real2 &t)
Reads the pair t from the stream o.
Definition Real2.h:385
constexpr __host__ __device__ Real2 & operator/=(Real2 b)
Divides each component of the pair by the corresponding component of b.
Definition Real2.h:316
__host__ __device__ Real2 absolute() const
Absolute value component by component.
Definition Real2.h:221
constexpr __host__ __device__ Real2 & operator*=(Real2 b)
Multiplies each component of the pair by the corresponding component of b.
Definition Real2.h:306
constexpr __host__ __device__ Real2 & sub(Real2 b)
Subtracts b from the pair.
Definition Real2.h:244
constexpr __host__ __device__ Real2 operator*(Real2 b) const
Creates a pair that equals this pair, where each component has been multiplied by the corresponding c...
Definition Real2.h:338
constexpr __host__ __device__ Real2(Real v)
Constructs the instance with the triplet (v,v,v).
Definition Real2.h:150
constexpr __host__ __device__ Real2(ConstArrayView< Real > av)
Constructs the pair (av[0], av[1]).
Definition Real2.h:160
constexpr __host__ __device__ Real2 & subSame(Real b)
Subtracts b from each component of the pair.
Definition Real2.h:276
constexpr __host__ __device__ Real2 & assign(Real2 f)
Copies the pair f.
Definition Real2.h:201
constexpr __host__ __device__ Real2 & div(Real2 b)
Divides each component of the pair by the corresponding component of b.
Definition Real2.h:260
constexpr __host__ __device__ Real2 & mul(Real2 b)
Multiplies each component of the pair by the corresponding component of b.
Definition Real2.h:252
constexpr __host__ __device__ ConstArrayView< Real > constView() const
Returns a constant view of the two elements of the vector.
Definition Real2.h:215
constexpr __host__ __device__ Real2 & add(Real2 b)
Adds b to the pair.
Definition Real2.h:236
constexpr __host__ __device__ ArrayView< Real > view()
Returns a view of the two elements of the vector.
Definition Real2.h:209
constexpr __host__ __device__ Real2 operator/(Real2 b) const
Creates a pair that equals this pair, where each component has been divided by the corresponding comp...
Definition Real2.h:344
friend constexpr __host__ __device__ Real2 operator*(Real sca, Real2 vec)
Multiplication by a scalar.
Definition Real2.h:347
constexpr __host__ __device__ Real2 operator+(Real2 b) const
Creates a pair that equals this pair added to b.
Definition Real2.h:326
constexpr __host__ __device__ Real2(const Real2POD &f)
Constructs a copy identical to f.
Definition Real2.h:142
constexpr __host__ __device__ Real2 operator-(Real2 b) const
Creates a pair that equals b subtracted from this pair.
Definition Real2.h:329
constexpr __host__ __device__ Real2 copy() const
Returns a copy of the pair.
Definition Real2.h:183
constexpr __host__ __device__ void operator/=(Real b)
Divides each component of the pair by the real number b.
Definition Real2.h:319
__host__ __device__ Real abs2() const
Returns the squared norm of the pair $ .
Definition Real2.h:417
friend constexpr __host__ __device__ Real2 operator/(Real2 vec, Real sca)
Division by a scalar.
Definition Real2.h:359
friend constexpr __host__ __device__ bool operator<(Real2 v1, Real2 v2)
Comparison operator.
Definition Real2.h:370
constexpr __host__ __device__ Real2 & mulSame(Real b)
Multiplies each component of the pair by b.
Definition Real2.h:284
constexpr __host__ __device__ Real2(Real ax, Real ay)
Constructs the pair (ax,ay).
Definition Real2.h:133
constexpr __host__ __device__ Real2 & operator+=(Real2 b)
Adds b to the pair.
Definition Real2.h:300
constexpr __host__ __device__ void operator*=(Real b)
Multiplies each component of the pair by the real number b.
Definition Real2.h:309
constexpr __host__ __device__ Real2 & assign(Real ax, Real ay)
Assigns the triplet (ax,ay,az) to the instance.
Definition Real2.h:193
constexpr __host__ __device__ Real2 & divSame(Real b)
Divides each component of the pair by b.
Definition Real2.h:292
Real2(const Real2 &f)=default
Constructs a copy identical to f.
friend constexpr __host__ __device__ Real2 operator*(Real2 vec, Real sca)
Multiplication by a scalar.
Definition Real2.h:353
Class managing a 3-dimensional real vector.
Definition Real3.h:132
Namespace for mathematical functions.
Definition MathUtils.h:36
Real2 normalizeL2(const Real2 &v)
Returns the pair v normalized by the L2 norm.
Definition Real2.h:508
constexpr __host__ __device__ Real squareNormL2(const Real2 &v)
Returns the squared norm of the pair $ .
Definition Real2.h:476
__host__ __device__ double sqrt(double v)
Square root of v.
Definition Math.h:142
bool isZero(const BuiltInProxy< _Type > &a)
Tests if a value is exactly equal to zero.
Real2 & mutableNormalize(Real2 &v)
Normalizes the pair.
Definition Real2.h:494
constexpr __host__ __device__ bool isEqual(const _Type &a, const _Type &b)
Tests the bit-by-bit equality between two values.
Definition Numeric.h:260
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
double Real
Type representing a real number.
Real y
second component of the pair
Definition Real2.h:35
Real x
first component of the pair
Definition Real2.h:34
__host__ __device__ Real operator[](Integer i) const
Definition Real2.h:46
__host__ __device__ void setComponent(Integer i, Real value)
Positions the i th component at value.
Definition Real2.h:98
__host__ __device__ Real & operator()(Integer i)
Definition Real2.h:91
__host__ __device__ Real operator()(Integer i) const
Definition Real2.h:61
__host__ __device__ Real & operator[](Integer i)
Definition Real2.h:76