Cholla 3.0.1-dev
Cholla - Massively parallel hydro on GPUs
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
hydro_utilities::VectorXYZ< T > Struct Template Reference

A data only struct that acts as a simple 3 element vector. More...

#include <basic_structs.h>

Public Member Functions

__device__ __host__ T * data ()
 Returns the pointer to the data array.
 
__device__ __host__ T & operator[] (std::size_t i)
 Overload for the [] operator to allow array-like access. Const version is needed if the object instance is declared as const.
 
__device__ __host__ const T & operator[] (std::size_t i) const
 
__device__ __host__ T & x () noexcept
 Directly access the x, y, and z elements. Const version is needed if the object instance is declared as const.
 
__device__ __host__ const T & x () const noexcept
 
__device__ __host__ T & y () noexcept
 
__device__ __host__ const T & y () const noexcept
 
__device__ __host__ T & z () noexcept
 
__device__ __host__ const T & z () const noexcept
 

Public Attributes

arr_ [3]
 

Detailed Description

template<typename T>
struct hydro_utilities::VectorXYZ< T >

A data only struct that acts as a simple 3 element vector.

Because this is an aggregate type, you can construct it as:

VectorXYZ<double> my_var{1.0, 2.0, 3.0}
VectorXYZ<float> my_var2 = {1.0, 2.0, 3.0};
VectorXYZ<int> my_var3; // Using the default constructor. Based on a note from the docs of
// std::array, the values for a non-class type (like float/double/int)
// may be indeterminate in this case.
A data only struct that acts as a simple 3 element vector.
Definition basic_structs.h:32

Member Function Documentation

◆ data()

template<typename T >
__device__ __host__ T * hydro_utilities::VectorXYZ< T >::data ( )
inline

Returns the pointer to the data array.

To ensure this class is an aggregate, constructors are implicitly defined. The destructor & move/copy assignment operations are also implicitly defined

Returns
Real* The pointer to the data array

◆ operator[]()

template<typename T >
__device__ __host__ T & hydro_utilities::VectorXYZ< T >::operator[] ( std::size_t  i)
inline

Overload for the [] operator to allow array-like access. Const version is needed if the object instance is declared as const.

Parameters
iWhich element to access. Allowable values are 0, 1, and 2, all other values have undefined behaviour that will result in a segfault or illegally memory access
Returns
T& Reference to the vector element at the ith location

◆ x()

template<typename T >
__device__ __host__ T & hydro_utilities::VectorXYZ< T >::x ( )
inlinenoexcept

Directly access the x, y, and z elements. Const version is needed if the object instance is declared as const.

Returns
T& Reference to the vector element at the ith location

Member Data Documentation

◆ arr_

template<typename T >
T hydro_utilities::VectorXYZ< T >::arr_[3]

Tracks the values held by the class. To ensure the class is an aggregate, it needs to be public. With that said, it should be treated as an implementation detail and not accessed directly


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