Go to the documentation of this file.
7 #ifndef INCLUDE_JET_SIZE2_H_
8 #define INCLUDE_JET_SIZE2_H_
33 constexpr
Size2(
size_t x_,
size_t y_) :
x(x_),
y(y_) {}
37 Size2(
const std::initializer_list<U>& lst);
52 void set(
const std::initializer_list<U>& lst);
129 const size_t&
at(
size_t i)
const;
132 size_t&
at(
size_t i);
167 template <
typename U>
261 #include "detail/size2-inl.h"
263 #endif // INCLUDE_JET_SIZE2_H_
size_t sum() const
Returns the sum of all the components (i.e. x + y).
void idiv(const Size2 &v)
Computes this /= (v.x, v.y).
Point2< T > ceil(const Point2< T > &a)
Returns element-wise ceiled point.
constexpr Size2(const Size2 &v)
Copy constructor.
Definition: size2.h:40
void set(const std::initializer_list< U > &lst)
Set x and y components with given initializer list.
void iadd(const Size2 &v)
Computes this += (v.x, v.y).
Size2 rsub(size_t v) const
Computes (v, v) - this.
void isub(const Size2 &v)
Computes this -= (v.x, v.y).
Size2 mul(const Size2 &v) const
Computes this * (v.x, v.y).
size_t & at(size_t i)
Returns reference to the i -th element of the size.
size_t & operator[](size_t i)
Returns reference to the i -th element of the size.
Point2< T > max(const Point2< T > &a, const Point2< T > &b)
Returns element-wise max point: (max(a.x, b.x), max(a.y, b.y)).
void imul(const Size2 &v)
Computes this *= (v.x, v.y).
Size2 & operator/=(size_t v)
Computes this /= (v, v)
void imul(size_t v)
Computes this *= (v, v).
Size2 div(const Size2 &v) const
Computes this / (v.x, v.y).
Size2 sub(size_t v) const
Computes this - (v, v).
void idiv(size_t v)
Computes this /= (v, v).
constexpr Size2()
Constructs default size (0, 0).
Definition: size2.h:30
void set(size_t s)
Set both x and y components to s.
Size2 rdiv(size_t v) const
Computes (v, v) / this.
size_t absmax() const
Returns the absolute maximum value among x and y.
bool isEqual(const Size2 &other) const
Returns true if other is the same as this size.
Definition: advection_solver2.h:18
Size2 & operator+=(size_t v)
Computes this += (v, v)
Size2 & operator=(const Size2 &v)
Set x and y with other size pt.
size_t x
X (or the first) component of the size.
Definition: size2.h:22
constexpr Size2(size_t x_, size_t y_)
Constructs size with given parameters x_ and y_.
Definition: size2.h:33
size_t y
Y (or the second) component of the size.
Definition: size2.h:25
size_t subminantAxis() const
Returns the index of the subminant axis.
Size2 rsub(const Size2 &v) const
Computes (v.x, v.y) - this.
T clamp(T val, T low, T high)
Returns the clamped value.
Size2 add(size_t v) const
Computes this + (v, v).
void isub(size_t v)
Computes this -= (v, v).
Size2 add(const Size2 &v) const
Computes this + (v.x, v.y).
Matrix2x2< T > operator+(const Matrix2x2< T > &a, const Matrix2x2< T > &b)
Returns a + b (element-size).
void iadd(size_t v)
Computes this += (v, v).
Point2< T > floor(const Point2< T > &a)
Returns element-wise floored point.
bool operator==(const Size2 &v) const
Returns true if other is the same as this size.
Size2 & operator+=(const Size2 &v)
Computes this += (v.x, v.y)
Size2 & operator-=(const Size2 &v)
Computes this -= (v.x, v.y)
Size2 sub(const Size2 &v) const
Computes this - (v.x, v.y).
Size2 & operator=(const std::initializer_list< U > &lst)
Set x and y components with given initializer list.
Size2 rdiv(const Size2 &v) const
Computes (v.x, v.y) / this.
Size2 & operator-=(size_t v)
Computes this -= (v, v)
size_t dominantAxis() const
Returns the index of the dominant axis.
bool operator!=(const Size2 &v) const
Returns true if other is the not same as this size.
2-D size class.
Definition: size2.h:19
Size2 div(size_t v) const
Computes this / (v, v).
size_t max() const
Returns the maximum value among x and y.
Size2 mul(size_t v) const
Computes this * (v, v).
size_t min() const
Returns the minimum value among x and y.
Matrix2x2< T > operator/(const Matrix2x2< T > &a, T b)
Returns a' / b, where every element of matrix a' is a.
Size2 & operator*=(const Size2 &v)
Computes this *= (v.x, v.y)
Size2(const std::initializer_list< U > &lst)
Constructs size with initializer list.
Point2< T > min(const Point2< T > &a, const Point2< T > &b)
Returns element-wise min point: (min(a.x, b.x), min(a.y, b.y)).
void set(size_t x, size_t y)
Set x and y components with given parameters.
const size_t & at(size_t i) const
Returns const reference to the i -th element of the size.
Matrix2x2< T > operator-(const Matrix2x2< T > &a)
Returns a matrix with opposite sign.
size_t absmin() const
Returns the absolute minimum value among x and y.
Size2 & operator*=(size_t v)
Computes this *= (v, v)
const size_t & operator[](size_t i) const
Returns const reference to the i -th element of the size.
Matrix2x2< T > operator*(const Matrix2x2< T > &a, T b)
Returns a * b', where every element of matrix b' is b.
void setZero()
Set both x and y to zero.
void set(const Size2 &pt)
Set x and y with other size pt.
Size2 & operator/=(const Size2 &v)
Computes this /= (v.x, v.y)