Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Classes | Functions
Euclid::GridContainer Namespace Reference

Classes

class  GridAxis
 Provides information related with an axis of a GridContainer. More...
 
struct  GridAxisToTable
 
struct  GridAxisToTable< Euclid::XYDataset::QualifiedName >
 
class  GridCellManagerTraits
 Class used by the GridContainer to access the different CellManagers. More...
 
struct  GridCellManagerTraits< GridCellManagerVectorOfVectors< T > >
 
struct  GridCellManagerTraits< std::vector< T > >
 
struct  GridCellManagerVectorOfVectors
 
struct  GridCellToTable
 
struct  GridCellToTable< T, typename std::enable_if< std::is_arithmetic< T >::value >::type >
 
class  GridConstructionHelper
 GridContainer construction helper class. More...
 
class  GridContainer
 Representation of a multi-dimensional grid which contains axis information. More...
 
class  GridIndexHelper
 Helper class for converting multi-dimensional grid coordinates to the index of a long data array and vice versa. More...
 
struct  TemplateLoopCounter
 
struct  VectorValueProxy
 

Functions

template<typename GridCellManager , typename... AxesTypes>
Table::Table gridContainerToTable (const GridContainer< GridCellManager, AxesTypes... > &grid)
 
template<typename... AxesTypes>
GridIndexHelper< AxesTypes... > makeGridIndexHelper (const std::tuple< GridAxis< AxesTypes >... > &axes_tuple)
 
template<typename OArchive , typename GridCellManager , typename... AxesTypes>
void gridExport (std::ostream &out, const GridContainer< GridCellManager, AxesTypes... > &grid)
 Export to the given output stream the given grid. The archive type is templated.
 
template<typename GridType , typename IArchive >
GridType gridImport (std::istream &in)
 Imports from the given stream a grid.
 
template<typename GridCellManager , typename... AxesTypes>
void gridBinaryExport (std::ostream &out, const GridContainer< GridCellManager, AxesTypes... > &grid)
 Exports to the given output stream the given grid.
 
template<typename GridType >
GridType gridBinaryImport (std::istream &in)
 Imports from the given stream a grid.
 
template<typename GridCellManager , typename... AxesTypes>
void gridFitsExport (const boost::filesystem::path &filename, const std::string &hdu_name, const GridContainer< GridCellManager, AxesTypes... > &grid)
 Exports a Grid as a FITS file.
 
template<typename GridType >
GridType gridFitsImport (const boost::filesystem::path &filename, int hdu_index)
 Imports a Grid from a FITS file.
 

Function Documentation

◆ gridBinaryExport()

template<typename GridCellManager , typename... AxesTypes>
void Euclid::GridContainer::gridBinaryExport ( std::ostream out,
const GridContainer< GridCellManager, AxesTypes... > &  grid 
)

Exports to the given output stream the given grid.

Template Parameters
GridCellManagerthe type of the cell manager of the GridContainer
AxesTypesthe types of the GridContainer axes knot values
Parameters
outThe stream to write the grid in
gridThe grid to export

Definition at line 103 of file serialize.h.

◆ gridBinaryImport()

template<typename GridType >
GridType Euclid::GridContainer::gridBinaryImport ( std::istream in)

Imports from the given stream a grid.

Template Parameters
GridTypethe type of the grid to read from the stream
Parameters
inThe stream to read the grid from
Returns
The grid red from the stream

Definition at line 115 of file serialize.h.

◆ gridContainerToTable()

template<typename GridCellManager , typename... AxesTypes>
Table::Table Euclid::GridContainer::gridContainerToTable ( const GridContainer< GridCellManager, AxesTypes... > &  grid)

Transform a GridContainer into a Table, with an entry for each cell. The content will be unfolded, so the knot values will be repeated.

◆ gridExport()

template<typename OArchive , typename GridCellManager , typename... AxesTypes>
void Euclid::GridContainer::gridExport ( std::ostream out,
const GridContainer< GridCellManager, AxesTypes... > &  grid 
)

Export to the given output stream the given grid. The archive type is templated.

The current implementation uses boost serialization and it requires that the GridCellManager and all the axes values are serializable. Also the GridCellManagerTraits specialization for the specific GridCellManager must have the enable_boost_serialize flag set to true.

Note that if any of the required types is not boost serializable, compilation of this method will fail. Non serializable grids of this type can still be used if there is no call to this method.

Template Parameters
OArchiveboost output archive type
GridCellManagerthe type of the cell manager of the GridContainer
AxesTypesthe types of the GridContainer axes knot values
Parameters
outThe stream to write the grid in
gridThe grid to export

Definition at line 58 of file serialize.h.

◆ gridFitsExport()

template<typename GridCellManager , typename... AxesTypes>
void Euclid::GridContainer::gridFitsExport ( const boost::filesystem::path &  filename,
const std::string hdu_name,
const GridContainer< GridCellManager, AxesTypes... > &  grid 
)

Exports a Grid as a FITS file.

The grid cell values are stored in an array HDU. Grids with cell types which are not one of the default FITS array types are not supported (compilation will fail). The name of this HDU is the name given with the parameter hdu_name.

The array HDU is followed with one binary table HDU per grid axis, where the axes knot values are stored. The names of these HDUs are following the format: <AXISNAME>_<hdu_name>, where the hdu_name is the one of the array HDU. Note that the axes knots must be of one of the default FITS binary table types. This behavior can be extended by specializing the GridAxisValueFitsHelper template (this is already done for the XYDataset::QualifiedName).

If the FITS file does not already exist, this method will create it. If it exists, the grid related HDUs will be appended to the file. Note that if the FITS file is being created, the primary HDU is left empty and the array HDU with the grid data is the first extension.

Parameters
filenameThe FITS file to store the grid
hdu_nameThe name of the array HDU
gridThe grid to store

◆ gridFitsImport()

template<typename GridType >
GridType Euclid::GridContainer::gridFitsImport ( const boost::filesystem::path &  filename,
int  hdu_index 
)

Imports a Grid from a FITS file.

The FITS file must follow the format as described in the gridFitsExport() documentation. The given HDU index is the index of the array HDU with the grid data.

Parameters
filenameThe FITS file containing the grid
hdu_indexThe index of the array HDU with the grid data
Returns
The grid

◆ gridImport()

template<typename GridType , typename IArchive >
GridType Euclid::GridContainer::gridImport ( std::istream in)

Imports from the given stream a grid.

The current implementation uses boost serialization and it requires that the GridCellManager and all the axes values are serializable. Also the GridCellManagerTraits specialization for the specific GridCellManager must have the enable_boost_serialize flag set to true.

Note that if any of the required types is not boost serializable, compilation of this method will fail. Non serializable grids of this type can still be used if there is no call to this method.

Template Parameters
GridTypethe type of the grid to read from the stream
IArchivethe type of the input archive
Parameters
inThe stream to read the grid from
Returns
The grid red from the stream

Definition at line 83 of file serialize.h.

References std::move().

Here is the call graph for this function:

◆ makeGridIndexHelper()

template<typename... AxesTypes>
GridIndexHelper< AxesTypes... > Euclid::GridContainer::makeGridIndexHelper ( const std::tuple< GridAxis< AxesTypes >... > &  axes_tuple)

Factory method for simplifying the creation of GridIndexHelper instances. It is equivalent with using the constructor by specifying the AxesTypes template parameters.

Template Parameters
AxesTypesthe types of the GridContainer axes
Parameters
axes_tuplethe information of the GridContainer axes
Returns
The GridIndexHelper instance

Definition at line 128 of file GridIndexHelper.h.