Alexandria  2.27.0
SDC-CH common library for the Euclid project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions | Variables
Euclid::GridContainer Namespace Reference

Classes

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

Functions

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. More...
 
template<typename GridType >
GridType gridFitsImport (const boost::filesystem::path &filename, int hdu_index)
 Imports a Grid from a FITS file. More...
 
template<typename... AxesTypes>
std::tuple< GridAxis
< AxesTypes >...> 
fixAxis (const std::tuple< GridAxis< AxesTypes >...> &original, size_t axis, size_t index)
 
template<typename GridCellManager , typename... AxesTypes>
Table::Table gridContainerToTable (const GridContainer< GridCellManager, AxesTypes...> &grid)
 
template<typename IterFrom , typename IterTo , int I>
static void fixSameAxes (IterFrom &from, IterTo &to, const TemplateLoopCounter< I > &)
 
template<typename IterFrom , typename IterTo >
static void fixSameAxes (IterFrom &, IterTo &, const TemplateLoopCounter<-1 > &)
 
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. More...
 
template<typename GridType , typename IArchive >
GridType gridImport (std::istream &in)
 Imports from the given stream a grid. More...
 
template<typename GridCellManager , typename... AxesTypes>
void gridBinaryExport (std::ostream &out, const GridContainer< GridCellManager, AxesTypes...> &grid)
 Exports to the given output stream the given grid. More...
 
template<typename GridType >
GridType gridBinaryImport (std::istream &in)
 Imports from the given stream a grid. More...
 

Variables

 m_axes_fixed {fixAxis(other.m_axes, axis, index)}
 
 m_fixed_indices {other.m_fixed_indices}
 
 m_cell_manager
 
 m_axes_index_factors
 

Function Documentation

template<typename... AxesTypes>
std::tuple<GridAxis<AxesTypes>...> Euclid::GridContainer::fixAxis ( const std::tuple< GridAxis< AxesTypes >...> &  original,
size_t  axis,
size_t  index 
)

Definition at line 57 of file GridContainer.icpp.

template<typename IterFrom , typename IterTo , int I>
static void Euclid::GridContainer::fixSameAxes ( IterFrom &  from,
IterTo &  to,
const TemplateLoopCounter< I > &   
)
static
template<typename IterFrom , typename IterTo >
static void Euclid::GridContainer::fixSameAxes ( IterFrom &  ,
IterTo &  ,
const TemplateLoopCounter<-1 > &   
)
static

Definition at line 181 of file GridIterator.icpp.

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.

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.

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.

Definition at line 120 of file GridContainerToTable.icpp.

References Euclid::GridContainer::GridCellToTable< T, Enable >::addColumnDescriptions(), Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::begin(), std::move(), std::vector< T >::reserve(), and Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::size().

Here is the call graph for this function:

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.

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

Definition at line 128 of file FitsSerialize.icpp.

References Euclid::GridContainer::GridAxesToFitsHelper< AxesTypes >::addGridAxesToFitsFile(), std::vector< T >::begin(), Euclid::GridContainer::GridConstructionHelper< Axes >::createAxesSizesVector(), Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::getAxesTuple(), and Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::size().

Here is the call graph for this function:

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

Definition at line 216 of file FitsSerialize.icpp.

References std::move(), and Euclid::GridContainer::GridAxisFitsReader< GridType >::readAllAxes().

Here is the call graph for this function:

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:

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.

Variable Documentation

Euclid::GridContainer::m_axes_fixed {fixAxis(other.m_axes, axis, index)}

Definition at line 74 of file GridContainer.icpp.

Euclid::GridContainer::m_axes_index_factors
Initial value:
{GridConstructionHelper<AxesTypes...>::createAxisIndexFactorVector(
axes_tuple, TemplateLoopCounter<sizeof...(AxesTypes)>{})}

Definition at line 34 of file GridIndexHelper.icpp.

Euclid::GridContainer::m_cell_manager

Definition at line 76 of file GridContainer.icpp.

Euclid::GridContainer::m_fixed_indices {other.m_fixed_indices}

Definition at line 75 of file GridContainer.icpp.