Skip to content

Grid Class

Jacob Fields edited this page Jun 4, 2020 · 1 revision

Public Methods

Method Description
Grid(const pair2<double> &bounds, unsigned int sz[2], unsigned nghosts) Construct a new Grid with the specified bounds (a pair of ordered pairs) with (sz[0],sz[1]) physical points, and nghosts ghost points.
Grid(const Grid& other) A copy constructor for Grid. Because memory is allocated, it performs a deep copy.
~Grid() A destructor for Grid. It deletes the memory allocated for the points.
const double* const* getPoints() const An array, organized as points[axis][index], containing the physical coordinates for this Grid.
const unsigned int* getSize() const Get the number of grid points, including ghost points, organized as (nx, ny).
const pair2<double>& getBounds() const Get the boundaries for this particular Grid, excluding ghost points. This may differ from the Domain boundaries, as it refers to the boundaries for the local processor, not the entire problem.
const double* getSpacing() const Get the grid spacing (dx,dy).
unsigned int getIndex(unsigned int i, unsigned int j) const Calculate a Fortran-style array index according to this Grid object's size.
unsigned int getIndex(unsigned int i, unsigned int j, unsigned int d) const Calculate a Fortran-style array index according to this Grid object's size. If d=0, then i is the x-index and j is the y-index. These definitions are flipped for d=1.

Clone this wiki locally