1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-13 12:47:05 +01:00
Files
Grid/_pages/docs/API/coordinates.md
2018-03-15 17:01:59 +00:00

959 B

title, author_profile, excerpt, header, permalink, sidebar
title author_profile excerpt header permalink sidebar
API Documentation false Coordinates
overlay_color
#5DADE2
/docs/API/coordinates.html
nav
docs

The Grid is define on a N-dimensional set of integer coordinates.

The maximum dimension is eight, and indexes in this space make use of the Coordinate class. The coordinate class shares a similar interface to std::vector<int>, but contains all data within the object, and has a fixed maximum length (template parameter).

Example:

const int Nd=4;
Coordinate point(Nd);

for(int i=0;i<Nd;i++) 
   point[i] = 1;

std::cout<< point <<std::endl;
point.resize(3);
std::cout<< point <<std::endl;

This enables the coordinates to be manipulated without heap allocation or thread contention, and avoids introducing STL functions into GPU code, but does so at the expense of introducing a maximum dimensionality. This limit is easy to change (lib/util/Coordinate.h).