Update CFSimpleIndexer authored by Martin Pokorny's avatar Martin Pokorny
......@@ -4,11 +4,11 @@ Indexing of elements of convolution functions that are used for gridding by `HPG
## `CFSimpleIndexer`
The `CFSimpleIndexer` is a widely applicable index transformation class (and the only one implemented at this time.) It can be used to transform indexes between indexes in `CFStore2 x CFBuffer` that name a `CFCell` and indexes in `hpg::CFArray`. Note that the `CFSimpleIndexer` class indexes planes and points in a plane, just as the `CFCell` identifies a plane. Once a `CFSimpleIndexer` instance has been created, it can be used to convert between the two index schemes. However, note that no bounds checking is performed by the class methods, and it is the user's responsibility to ensure that valid index arguments are provided to these methods. Because the `hpg::GridderState` class maintains the convolution function values in dense arrays, it is necessary to partition the set of convolution functions provided by a `CFArray`instance according to the size of the convolution function support. While it is acceptable to over-partition the set of convolution functions, limitations in the current implementation of `HPG` set a hard upper limit on the number of partitions that can be used, and therefore it is recommended to reduce the number of partitions as far as is practicable.
The `hpg::CFSimpleIndexer` is a widely applicable index transformation class (and the only one implemented at this time.) It can be used to transform indexes between indexes in `CFStore2 x CFBuffer` that name a `CFCell`, and indexes in `hpg::CFArray`. Note that the `CFSimpleIndexer` class indexes two-dimensional planes and not points in a plane, just as the `CFCell` identifies a plane. Once a `CFSimpleIndexer` instance has been created, it can be used to convert between the two index schemes. Note that no bounds checking is performed by the class methods, and it is the user's responsibility to ensure that valid index arguments are provided to the conversion methods. Because the `hpg::GridderState` class maintains the convolution function values in dense arrays, it is necessary to partition the set of convolution functions provided by a `CFArray` instance according to the size of the convolution function support. While it is acceptable to over-partition the set of convolution functions, limitations in the current implementation of `HPG` set a hard upper limit on the number of partitions that can be used, and therefore it is recommended to reduce the number of partitions as far as is practicable.
The class is defined in the file `hpg_indexing.hpp`.
All of the following source code quotations are from the file `hpg_indexing.hpp`.
The signature of the constructor of `CFSimpleIterator` is the following
The signature of the `CFSimpleIterator` constructor is the following
```c++
// pair elements: (axis length, allows variable-size CF)
using axis_desc_t = std::pair<unsigned, bool>;
......@@ -21,9 +21,9 @@ The signature of the constructor of `CFSimpleIterator` is the following
const axis_desc_t& mcol,
const axis_desc_t& mrow);
```
The arguments of the constructor correspond (largely) to dimensions in the space of `CFStore2 x CFBuffer`. Each of the arguments is a value of type `CFSimpleIndexer::axis_desc_t`, which defines the size of the axis, and a flag to indicate whether the convolution function support sizes may be variable on that axis.
The arguments of the constructor correspond (largely) to dimensions in the space of `CFStore2 x CFBuffer`. Each of the arguments is a value of type `CFSimpleIndexer::axis_desc_t`, which combines the size of the axis and a flag to indicate whether the convolution function support sizes may be variable along that axis. Note that each axis is assumed to be densely occupied, and any conversion of an index on these axes to or from an index in `CFStore2 x CFBuffer` is unspecified. The "variable-size CF" flag **must** be set if the support size of the convolution functions is not constant as the index on that axis changes while the remaining indexes stay fixed.
The index type that is related to `hpg::CFArray` is `CFSimpleIndexer::cf_index_t`, which comprises three elements that correspond to the `mrow`, `cube` and `group` arguments of the `CFArray` indexing operator. The `CFSimpleIndexer` method that converts from a CASA index to a `CFArray` index is then
The index type that is related to `hpg::CFArray` is `CFSimpleIndexer::cf_index_t`, which comprises three elements that correspond to the `mrow`, `cube` and `group` arguments of the `CFArray` indexing operator. The `CFSimpleIndexer` method that converts from a CASA-like index to a `CFArray` index is then
```c++
// array elements: (mrow, cube, grp)
using cf_index_t = std::array<unsigned, 3>;
......@@ -47,6 +47,8 @@ and the `CFSimpleIndexer` method that converts from a `CFArray` index to a CASA
CFCellIndex
cell_index(cf_index_t index) const;
```
Note that a `CFCellIndex` value only provides relative indexes within the subset of the full `CFStore2 x CFBuffer` that is accessed by a `CFArray` instance as described by the `CFSimpleIndexer` constructor! Global index transformations to and from `CFCellIndex` and `CFStore2 x CFBuffer` are the responsibility of the user.
Note that a `CFCellIndex` value only provides indexes within the range of each dimension as defined by the `CFSimpleIndexer` constructor! Global index transformations to and from `CFCellIndex` and `CFStore2 x CFBuffer` are the responsibility of the user.
TODO: describe `mrow` and `mcol`, and how they relate to CASA and `hpg` indexing.
\ No newline at end of file
### Note on `mrow` and `mcol` indexes
The `mrow` and `mcol` indexes refer to the rows and columns of a Mueller matrix. In general, the `mcol` values are associated with a polarization product index in the visibility data. Examples of index names on that axes in common usage are `[RR, LL]', `[XX, XY, YX, YY]'. Similarly, the `mrow` values are associated with a polarization product index in the image space.
\ No newline at end of file