Proto
Data Fields
Proto::Point Class Reference

Integer Valued Vector. More...

#include <Proto_Point.H>

Public Member Functions

Constructors
CUDA_DECORATION Point ()
 
CUDA_DECORATION Point (const int(&a_tuple)[DIM])
 C Array Constructor. More...
 
template<typename... vals>
CUDA_DECORATION Point (vals... args)
 Variadic Constructor. More...
 
CUDA_DECORATION Point (const Point &a_pt)
 Copy Constructor.
 
Accessors
CUDA_DECORATION const int & operator[] (unsigned char a_index) const
 Get Component (Const) More...
 
CUDA_DECORATION int & operator[] (unsigned char a_index)
 Get Component (Non-Const) More...
 
Operators
CUDA_DECORATION Pointoperator= (const Point &a_rhs)
 Asignment Operator. More...
 
CUDA_DECORATION bool operator< (const Point &a_rhs) const
 Less-Than Operator. More...
 
CUDA_DECORATION bool operator== (const Point &a_pt) const
 Equality Operator. More...
 
CUDA_DECORATION bool operator!= (const Point &a_pt) const
 Inequality Operator. More...
 
CUDA_DECORATION Point operator+ (const Point &a_rhs) const
 Componentwise Point Addition Operator. More...
 
CUDA_DECORATION Point operator- (const Point &a_rhs) const
 Componentwise Point Subtraction Operator. More...
 
CUDA_DECORATION Point operator* (const Point &a_pt) const
 Componentwise Point Multiplication Operator. More...
 
CUDA_DECORATION Point operator/ (const Point &a_pt) const
 Componentwise Point Division Operator. More...
 
CUDA_DECORATION Point operator% (const Point &a_pt) const
 Componentwise Point Modulus Operator. More...
 
Point operator+ (int a_nref) const
 Scalar Addition Operator. More...
 
Point operator- (int a_nref) const
 Scalar Subtraction Operator. More...
 
Point operator* (int a_nref) const
 Scalar Multiplication Operator. More...
 
Point operator/ (int a_nref) const
 Scalar Division Operator. More...
 
Point operator% (int a_nref) const
 Scalar Modulus Operator. More...
 
CUDA_DECORATION void operator+= (const Point &a_pt)
 In Place Componentwise Addition Operator.
 
CUDA_DECORATION void operator-= (const Point &a_pt)
 In Place Componentwise Subtraction Operator.
 
CUDA_DECORATION void operator*= (const Point &a_pt)
 In Place Componentwise Multiplication Operator.
 
CUDA_DECORATION void operator/= (const Point &a_pt)
 In Place Componentwise Division Operator. More...
 
CUDA_DECORATION void operator%= (const Point &a_pt)
 In Place Componentwise Modulus Operator.
 
void operator+= (int a_n)
 In Place Scalar Addition Operator.
 
void operator-= (int a_n)
 In Place Scalar Subtraction Operator.
 
void operator*= (int a_n)
 In Place Scalar Multiplication Operator.
 
void operator/= (int a_n)
 In Place Scalar Division Operator. More...
 
void operator%= (int a_n)
 In Place Scalar Modulus Operator.
 
Point coarsen (unsigned int a_refRatio) const
 Coarsen Operator. More...
 
size_t linearSize () const
 
void linearOut (char *a_buf) const
 
void linearIn (const char *a_buf)
 
int sum () const
 Sum Operator. More...
 
int absSum () const
 Absolute Value Sum Operator. More...
 
Utility
void print () const
 Print Function. More...
 

Static Public Member Functions

Static Methods
static Point Ones (int a_scale=1)
 Get Ones. More...
 
static Point Unit ()
 Get Unit Point. More...
 
static CUDA_DECORATION Point Zeros ()
 Get Zeros. More...
 
static Point Zeroes ()
 Get Zeros (Pedantic Spelling) More...
 
static Point Zero ()
 Get Zeros (Alternate Spelling) More...
 
static CUDA_DECORATION Point Basis (int a_dir, int a_scale=1)
 Get Basis. More...
 

Data Fields

int m_tuple [DIM]
 Integer coordinates of the Point.
 

Detailed Description

Integer Valued Vector.

An element of $\bf{p}\in\bf{Z}^{DIM}$

Constructor & Destructor Documentation

◆ Point() [1/3]

CUDA_DECORATION Proto::Point::Point ( )
inline

Default Constructor Returns the zero Point (0,0,...,0)

◆ Point() [2/3]

CUDA_DECORATION Proto::Point::Point ( const int(&)  a_tuple[DIM])
inline

C Array Constructor.

Allows "literal" construction of points. Note: Functionality is largely deprecated by the variadic constructor.

Example:

using namespace Proto;
//DIM=2
Point p = Point({-5,13}); //creates the point (-5,13)
Parameters
a_tupleinteger array representing a Point

◆ Point() [3/3]

template<typename... vals>
CUDA_DECORATION Proto::Point::Point ( vals...  args)
inlineexplicit

Variadic Constructor.

Builds a Point from the first DIM arguments given to this. Any trailing arguments are ignored. This constructor is very useful for building dimensionally independent test code.

Example:

Point p(1,2,3,4,5,6);
if (DIM == 1)
{
std::cout << p << std::endl; //prints (1)
} else if (DIM == 2) {
std::cout << p << std::endl; //prints (1, 2)
} else if (DIM == 3) {
std::cout << p << std::endl; //prints (1, 2, 3)
} //etc.
Parameters
argsat least DIM integer arguments representing a Point

Member Function Documentation

◆ absSum()

int Proto::Point::absSum ( ) const
inline

Absolute Value Sum Operator.

Computes the sum of the absolute values of the entries in *this

◆ Basis()

CUDA_DECORATION Point Proto::Point::Basis ( int  a_dir,
int  a_scale = 1 
)
inlinestatic

Get Basis.

Returns an axis-aligned Point $\bf{p}: \bf{p}[k] = scale*\delta_{dir}^k$.

Parameters
a_dirA spatial axis (0 for x, 1 for y, etc.)
a_scale(Optional) value to scale the unit vector by (default: no scaling)

◆ coarsen()

Point Proto::Point::coarsen ( unsigned int  a_refRatio) const
inline

Coarsen Operator.

Returns a new Point coarsened by a_refRatio. This function is identical to any of the division operators.

Parameters
a_refRatioA non-zero refinement ratio.

◆ Ones()

Point Proto::Point::Ones ( int  a_scale = 1)
inlinestatic

Get Ones.

Returns the unit Point scale*(1,1,...,1)

Parameters
a_scale(Optional) value to scale the vector by (default: 1)

◆ operator!=()

CUDA_DECORATION bool Proto::Point::operator!= ( const Point a_pt) const
inline

Inequality Operator.

Returns true if *this != a_pt.

Parameters
a_ptAnother Point

◆ operator%() [1/2]

CUDA_DECORATION Point Proto::Point::operator% ( const Point a_pt) const
inline

Componentwise Point Modulus Operator.

Creates the new Point by taking the modulus of *this by rhs componentwise. Quotients are rounded down. Modulo by 0 yields an error.

Parameters
a_ptAnother Point

◆ operator%() [2/2]

Point Proto::Point::operator% ( int  a_nref) const
inline

Scalar Modulus Operator.

Creates a new point by taking the modulus of each component of *this by nref. Quotients are rounded down. Modulo of any component by 0 yields an error.

Parameters
a_nrefAn Integer scalar

◆ operator*() [1/2]

CUDA_DECORATION Point Proto::Point::operator* ( const Point a_pt) const
inline

Componentwise Point Multiplication Operator.

Creates the new Point by multiplying *this and rhs componentwise.

Parameters
a_ptAnother Point

◆ operator*() [2/2]

Point Proto::Point::operator* ( int  a_nref) const
inline

Scalar Multiplication Operator.

Creates a new point by multiplying each component of *this by nref.

Parameters
a_nrefAn Integer scalar

◆ operator+() [1/2]

CUDA_DECORATION Point Proto::Point::operator+ ( const Point a_rhs) const
inline

Componentwise Point Addition Operator.

Creates the new Point by adding *this and rhs componentwise.

Parameters
a_rhsAnother Point

◆ operator+() [2/2]

Point Proto::Point::operator+ ( int  a_nref) const
inline

Scalar Addition Operator.

Creates a new point by adding nref to each component of *this.

Parameters
a_nrefAn Integer scalar

◆ operator-() [1/2]

CUDA_DECORATION Point Proto::Point::operator- ( const Point a_rhs) const
inline

Componentwise Point Subtraction Operator.

Creates the new Point by subtracting *this and rhs componentwise.

Parameters
a_rhsAnother Point

◆ operator-() [2/2]

Point Proto::Point::operator- ( int  a_nref) const
inline

Scalar Subtraction Operator.

Creates a new point by subtracting nref to each component of *this.

Parameters
a_nrefAn Integer scalar

◆ operator/() [1/2]

CUDA_DECORATION Point Proto::Point::operator/ ( const Point a_pt) const
inline

Componentwise Point Division Operator.

Creates the new Point by dividing *this by rhs componentwise. Quotients are rounded down. Division of any component by 0 yields an error.

Parameters
a_ptAnother Point

◆ operator/() [2/2]

Point Proto::Point::operator/ ( int  a_nref) const
inline

Scalar Division Operator.

Creates a new point by dividing each component of *this by nref. Quotients are rounded down. Division of any component by 0 yields an error.

Parameters
a_nrefAn Integer scalar

◆ operator/=() [1/2]

CUDA_DECORATION void Proto::Point::operator/= ( const Point a_pt)
inline

In Place Componentwise Division Operator.

Quotients are rounded down. Division of any component by 0 yields an error.

Parameters
a_ptAnother Point

◆ operator/=() [2/2]

void Proto::Point::operator/= ( int  a_n)
inline

In Place Scalar Division Operator.

Quotients are rounded down. Division of any component by 0 yields an error.

◆ operator<()

CUDA_DECORATION bool Proto::Point::operator< ( const Point a_rhs) const
inline

Less-Than Operator.

Used to define an ordering for placing Points in maps etc. Do not use to actually compare Points. Uses Lexical comparison. Note that Chombo lexLT is also lexical but uses the dimensions in the opposite way. Both work for maps and so on.

Parameters
a_rhsAnother Point

◆ operator=()

CUDA_DECORATION Point & Proto::Point::operator= ( const Point a_rhs)
inline

Asignment Operator.

Performs copy assignment.

Parameters
a_rhsAnother Point

◆ operator==()

CUDA_DECORATION bool Proto::Point::operator== ( const Point a_pt) const
inline

Equality Operator.

Returns true if: this[ $k$] == *a_pt[ $k$] $\forall\,k\,\in\,[0,DIM)$

Parameters
a_ptAnother Point

◆ operator[]() [1/2]

CUDA_DECORATION const int & Proto::Point::operator[] ( unsigned char  a_index) const
inline

Get Component (Const)

Returns a const reference to the a_index component of *this

Parameters
a_indexIndex in [0,DIM)

◆ operator[]() [2/2]

CUDA_DECORATION int & Proto::Point::operator[] ( unsigned char  a_index)
inline

Get Component (Non-Const)

Returns a mutable reference to the a_index component of *this

Parameters
a_indexIndex in [0,DIM)

◆ print()

void Proto::Point::print ( ) const
inline

Print Function.

Output is formatted: (p1,p2,...)

◆ sum()

int Proto::Point::sum ( ) const
inline

Sum Operator.

Computes the sum of the entries in *this

◆ Unit()

static Point Proto::Point::Unit ( )
inlinestatic

Get Unit Point.

Returns the Point (1,1,...,1)

◆ Zero()

static Point Proto::Point::Zero ( )
inlinestatic

Get Zeros (Alternate Spelling)

Identical to Zeros() but with alternative spelling.

◆ Zeroes()

static Point Proto::Point::Zeroes ( )
inlinestatic

Get Zeros (Pedantic Spelling)

Identical to Zeros() but with alternative spelling.

◆ Zeros()

CUDA_DECORATION Point Proto::Point::Zeros ( )
inlinestatic

Get Zeros.

Returns the zero Point (0,0,...,0)


The documentation for this class was generated from the following file: