Highly Efficient FFT for Exascale: HeFFTe v2.3
heffte::box3d< index > Struct Template Reference

A generic container that describes a 3d box of indexes. More...

#include <heffte_geometry.h>

Public Member Functions

 box3d (std::array< index, 3 > clow, std::array< index, 3 > chigh)
 Constructs a box from the low and high indexes, the span in each direction includes the low and high (uses default order).
 
 box3d (std::array< index, 3 > clow, std::array< index, 3 > chigh, std::array< int, 3 > corder)
 Constructs a box from the low and high indexes, also sets an order.
 
 box3d (std::array< index, 2 > clow, std::array< index, 2 > chigh)
 Constructor for the two dimensional case.
 
 box3d (std::array< index, 2 > clow, std::array< index, 2 > chigh, std::array< int, 2 > corder)
 Constructor for the two dimensional case, order is either (0, 1) or (1, 0).
 
bool empty () const
 Returns true if the box contains no indexes.
 
long long count () const
 Counts all indexes in the box, i.e., the volume.
 
box3d collide (box3d const other) const
 Creates a box that holds the intersection of this box and the other.
 
box3d r2c (int dimension) const
 Returns the box that is reduced in the given dimension according to the real-to-complex symmetry.
 
bool is2d () const
 Returns true if either dimension contains only a single index.
 
bool operator== (box3d const &other) const
 Compares two boxes, ignoring the order, returns true if all sizes and boundaries match.
 
bool operator!= (box3d const &other) const
 Compares two boxes, ignoring the order, returns true if either of the box boundaries do not match.
 
bool ordered_same_as (box3d const &other) const
 Compares the order of two boxes, ignores the dimensions, returns true if the order is the same.
 
int find_order (int dir) const
 Returns the effective order of the direction (dir), 0 -> fast, 1 -> mid, 2 -> slow.
 
index osize (int dimension) const
 Get the ordered size of the dimension, i.e., size[order[dimension]].
 

Public Attributes

std::array< index, 3 > const low
 The three lowest indexes.
 
std::array< index, 3 > const high
 The three highest indexes.
 
std::array< index, 3 > const size
 The number of indexes in each direction.
 
std::array< int, 3 > const order
 The order of the dimensions in the k * plane_stride + j * line_stride + i indexing.
 

Detailed Description

template<typename index = int>
struct heffte::box3d< index >

A generic container that describes a 3d box of indexes.

The box is defined by three low and three high indexes and holds all indexes from low to high including the low and high. For example,

box3d box({0, 0, 0}, {0, 1, 2});
// box will hold the 6 indexes
// (0, 0, 0), (0, 0, 1), (0, 0, 2)
// (0, 1, 0), (0, 1, 1), (0, 1, 2)
box3d(std::array< index, 3 > clow, std::array< index, 3 > chigh)
Constructs a box from the low and high indexes, the span in each direction includes the low and high ...
Definition: heffte_geometry.h:69

The box3d also defines a size field that holds the number of indexes in each direction, for the example above size will be {1, 2, 3}.

In addition to the low and high indexes, the box has orientation with respect to the i j k indexing, indicating which are the fast, middle and slow growing dimensions. For example, suppose we want to access the entries of a box stored in a data array

// if box.order is {0, 1, 2}
int const plane = box.size[0] * box.size[1];
int const lane = box.size[0];
for(int i = box.low[0]; i <= box.high[0]; i++)
for(int j = box.low[1]; j <= box.high[1]; j++)
for(int k = box.low[2]; j <= box.high[2]; j++)
std::cout << data[k * plane + j * line + i] << "\n";

However,

// if box.order is {2, 0, 1}
int const plane = box.size[box.order[0]] * box.size[box.order[1]];
int const lane = box.size[box.order[0]];
for(int i = box.low[0]; i <= box.high[0]; i++)
for(int j = box.low[1]; j <= box.high[1]; j++)
for(int k = box.low[2]; j <= box.high[2]; j++)
std::cout << data[j * plane + i * line + k] << "\n";

The order must always hold a permutation of the entries 0, 1, and 2.


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