#include <nav.hpp>

Inheritance diagram for Coord2D:
Inheritance graph

Public Member Functions

 Coord2D (int i_, int j_)
 
int i () const
 
int j () const
 
bool operator== (const Coord2D &rhs) const
 

Protected Attributes

const int m_i
 
const int m_j
 

Friends

std::ostream & operator<< (std::ostream &s, const Coord2D &c)
 

Detailed Description

There are three types of indices used in this module:

(1) Cartesian coordinate (2) Cartesian index (3) Global identity

The Cartesian coordinate is an (i,j)-tuple into the cornerpoint grid structure.

The Cartesian index, is a flat integer which has is determined solely by the structure of the grid, regardless of whether there are any active elements. It can be calculated from the coordinates if the extent of the grid is known. We use this to efficiently store data for each possible position in the grid without using a predefined size or dynamic structure for each column.

The global identity is the index which is assigned to it in the grid structure, after inactive elements are discarded. This is the 'identity' of the cell in the rest of the simulator. Cells that aren't active are not assigned an identity.

The value types defined here provide a way to address location in the grid in a type-safe manner to let the compiler help us keep track of the real meaning of indices.

The navigation classes provide a way to define an enumeration of the grid without resorting to inline integer arithmetic inside the other functions. An optimizing compiler should be able to generate equally fast code as hand-coded index calculations, when using these classes. Index tuple in two-dimensional cornerpoint grid

This structure represents the carrier of Cartesian coordinates. They should be thought of as an integral type, along the lines of complex numbers.

Constructor & Destructor Documentation

Coord2D::Coord2D ( int  i_,
int  j_ 
)
inline

Member Function Documentation

int Coord2D::i ( ) const
inline

References m_i.

Referenced by Cart2D::cart_ndx(), Cart2D::face_ndx(), and Cart2D::node_ndx().

int Coord2D::j ( ) const
inline

References m_j.

Referenced by Cart2D::cart_ndx(), Cart2D::face_ndx(), and Cart2D::node_ndx().

bool Coord2D::operator== ( const Coord2D rhs) const
inline

Compare two coordinates

References m_i, and m_j.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const Coord2D c 
)
friend

Member Data Documentation

const int Coord2D::m_i
protected

Referenced by i(), and operator==().

const int Coord2D::m_j
protected

Referenced by j(), and operator==().


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