XMLIOSERVER 0.4
Serveur d'Entrées/Sorties parallèles
|
Classe permettant d'écrire des fichiers de données au format netCDF-4. Plus de détails...
#include <onetcdf4.hpp>
Types publics | |
typedef std::vector< std::string > | CNetCDF4Path |
Redéfinition de std::vector<std::string> pour simplification d'écriture. | |
Fonctions membres publiques | |
CONetCDF4 (void) | |
Constructeur simple. | |
CONetCDF4 (const std::string &_filename, bool exist=false, const MPI_Comm *_comm_server=NULL) | |
Constructeur à partir d'un nom de fichier au format netCDF4. | |
CONetCDF4 (const CONetCDF4 &_onetcdf4) | |
Constructeur par copie . | |
CONetCDF4 (const CONetCDF4 *const _onetcdf4_ptr) | |
Constructeur par copie. | |
virtual | ~CONetCDF4 (void) |
Destructeur de l'objet (le fichier est clos lors de son appel). | |
void | setCurrentPath (const CNetCDF4Path &_path) |
int | addDimension (const std::string &_name, std::size_t _size=UNLIMITED_DIM) |
int | addVariable (const std::string &_name, nc_type _type, const std::vector< std::string > &_dims) |
int | addGroup (const std::string &_name) |
const CNetCDF4Path & | getCurrentPath (void) const |
std::string | getUnlimitedDimensionName (void) |
std::vector< std::string > | getDimensionsIdList (const std::string *_varname) |
template<class DataType > | |
void | writeAttribute (const std::string &_attname, const std::vector< DataType > &_value, const std::string *_varname=NULL) |
void | writeAttribute (const std::string &_attname, const std::string &_value, const std::string *_varname=NULL) |
template<class DataType , std::size_t ndim> | |
void | writeData (const boost::multi_array< DataType, ndim > &_data, const std::string &_varname, std::size_t _record=0, bool _collective=true, const std::vector< std::size_t > *_start=NULL, const std::vector< std::size_t > *_count=NULL) |
void | definition_start (void) |
void | definition_end (void) |
template<> | |
void | writeData_ (int _grpid, int _varid, const std::vector< std::size_t > &_sstart, const std::vector< std::size_t > &_scount, const float *_data) |
template<> | |
void | writeData_ (int _grpid, int _varid, const std::vector< std::size_t > &_sstart, const std::vector< std::size_t > &_scount, const int *_data) |
template<> | |
void | writeData_ (int _grpid, int _varid, const std::vector< std::size_t > &_sstart, const std::vector< std::size_t > &_scount, const double *_data) |
template<> | |
void | writeAttribute_ (const std::string &_attname, const double *_value, std::size_t _size, int _grpid, int _varid) |
template<> | |
void | writeAttribute_ (const std::string &_attname, const float *_value, std::size_t _size, int _grpid, int _varid) |
template<> | |
void | writeAttribute_ (const std::string &_attname, const int *_value, std::size_t _size, int _grpid, int _varid) |
template<> | |
void | writeAttribute_ (const std::string &_attname, const char *_value, std::size_t _size, int _grpid, int _varid) |
Attributs publics | |
boost::optional< MPI_Comm > | comm_server |
std::vector< std::string > | path |
int | ncidp |
Fonctions membres protégées | |
int | getCurrentGroup (void) |
Retourne l'identifiant du groupe courant (le chemin est gardée en mémoire dans la variable path). | |
int | getGroup (const CNetCDF4Path &_path) |
Retourne l'identifiant du groupe dont le chemin est passé en argument. | |
int | getVariable (const std::string &_varname) |
Retourne l'identifiant d'une variable dans le groupe courant. | |
int | getDimension (const std::string &_dimname) |
Retourne l'identifiant d'une dimension dans le groupe courant. | |
std::vector< std::size_t > | getDimensions (const std::string &_varname) |
Retourne les dimensions d'une variable. | |
int | getUnlimitedDimension (void) |
Retourne l'identifiant de la dimension non limité dans le fichier. | |
bool | varExist (const std::string &_varname) |
Indique si une variable existe dans le groupe courant. | |
Fonctions membres privées | |
template<class DataType > | |
void | writeData_ (int _grpid, int _varid, const std::vector< std::size_t > &_sstart, const std::vector< std::size_t > &_scount, const DataType *_data) |
template<class DataType > | |
void | writeAttribute_ (const std::string &_attname, const DataType *_value, std::size_t _size, int _grpid, int _varid=NC_GLOBAL) |
void | getWriteDataInfos (const std::string &_varname, std::size_t _record, std::size_t &_array_size, std::vector< std::size_t > &_sstart, std::vector< std::size_t > &_scount, const std::vector< std::size_t > *_start, const std::vector< std::size_t > *_count) |
Fonctions membres privées statiques | |
static void | CheckError (int _status) throw (CException) |
Classe permettant d'écrire des fichiers de données au format netCDF-4.
Définition à la ligne 46 du fichier onetcdf4.hpp.
typedef std::vector<std::string> xmlioserver::io::CONetCDF4::CNetCDF4Path |
Redéfinition de std::vector<std::string> pour simplification d'écriture.
Définition à la ligne 51 du fichier onetcdf4.hpp.
xmlioserver::io::CONetCDF4::CONetCDF4 | ( | void | ) |
Constructeur simple.
xmlioserver::io::CONetCDF4::CONetCDF4 | ( | const std::string & | _filename, |
bool | exist = false , |
||
const MPI_Comm * | _comm_server = NULL |
||
) | [explicit] |
Constructeur à partir d'un nom de fichier au format netCDF4.
_filename | : un nom de fichier au format netCDF4. |
Définition à la ligne 16 du fichier onetcdf4.cpp.
Références CheckError(), comm_server, et ncidp.
xmlioserver::io::CONetCDF4::CONetCDF4 | ( | const CONetCDF4 & | _onetcdf4 | ) |
Constructeur par copie .
_onetcdf4 | : référence de l'objet à copier. |
xmlioserver::io::CONetCDF4::CONetCDF4 | ( | const CONetCDF4 *const | _onetcdf4_ptr | ) |
Constructeur par copie.
_onetcdf4_ptr | : le pointeur sur l'objet à copier. |
xmlioserver::io::CONetCDF4::~CONetCDF4 | ( | void | ) | [virtual] |
Destructeur de l'objet (le fichier est clos lors de son appel).
Définition à la ligne 40 du fichier onetcdf4.cpp.
Références CheckError(), et ncidp.
int xmlioserver::io::CONetCDF4::addDimension | ( | const std::string & | _name, |
std::size_t | _size = UNLIMITED_DIM |
||
) |
Définition à la ligne 128 du fichier onetcdf4.cpp.
Références CheckError(), getCurrentGroup(), et UNLIMITED_DIM.
int xmlioserver::io::CONetCDF4::addGroup | ( | const std::string & | _name | ) |
Définition à la ligne 158 du fichier onetcdf4.cpp.
Références CheckError(), et getCurrentGroup().
int xmlioserver::io::CONetCDF4::addVariable | ( | const std::string & | _name, |
nc_type | _type, | ||
const std::vector< std::string > & | _dims | ||
) |
Définition à la ligne 139 du fichier onetcdf4.cpp.
Références CheckError(), getCurrentGroup(), et getDimension().
void xmlioserver::io::CONetCDF4::CheckError | ( | int | _status | ) | throw (CException) [static, private] |
Définition à la ligne 47 du fichier onetcdf4.cpp.
Références XIOS_ERROR.
Référencé par addDimension(), addGroup(), addVariable(), CONetCDF4(), definition_end(), definition_start(), getDimension(), getDimensions(), getDimensionsIdList(), getGroup(), getUnlimitedDimension(), getUnlimitedDimensionName(), getVariable(), writeData(), writeData_(), et ~CONetCDF4().
void xmlioserver::io::CONetCDF4::definition_end | ( | void | ) |
Définition à la ligne 64 du fichier onetcdf4.cpp.
Références CheckError(), et ncidp.
void xmlioserver::io::CONetCDF4::definition_start | ( | void | ) |
Définition à la ligne 59 du fichier onetcdf4.cpp.
Références CheckError(), et ncidp.
int xmlioserver::io::CONetCDF4::getCurrentGroup | ( | void | ) | [protected] |
Retourne l'identifiant du groupe courant (le chemin est gardée en mémoire dans la variable path).
Définition à la ligne 168 du fichier onetcdf4.cpp.
Références getCurrentPath(), et getGroup().
Référencé par addDimension(), addGroup(), addVariable(), getDimension(), getDimensions(), getDimensionsIdList(), getUnlimitedDimension(), getVariable(), varExist(), et writeData().
const CONetCDF4::CNetCDF4Path & xmlioserver::io::CONetCDF4::getCurrentPath | ( | void | ) | const |
Définition à la ligne 71 du fichier onetcdf4.cpp.
Références path.
Référencé par getCurrentGroup().
int xmlioserver::io::CONetCDF4::getDimension | ( | const std::string & | _dimname | ) | [protected] |
Retourne l'identifiant d'une dimension dans le groupe courant.
_dimname | : Le nom d'une dimension dans le fichier de données. |
Définition à la ligne 196 du fichier onetcdf4.cpp.
Références CheckError(), et getCurrentGroup().
Référencé par addVariable().
std::vector< std::size_t > xmlioserver::io::CONetCDF4::getDimensions | ( | const std::string & | _varname | ) | [protected] |
Retourne les dimensions d'une variable.
_varname | : Le nom d'une variable dans le fichier de données. |
Définition à la ligne 212 du fichier onetcdf4.cpp.
Références CheckError(), getCurrentGroup(), getVariable(), et UNLIMITED_DIM.
Référencé par getWriteDataInfos().
std::vector< std::string > xmlioserver::io::CONetCDF4::getDimensionsIdList | ( | const std::string * | _varname | ) |
Définition à la ligne 89 du fichier onetcdf4.cpp.
Références CheckError(), getCurrentGroup(), et getVariable().
Référencé par getWriteDataInfos().
int xmlioserver::io::CONetCDF4::getGroup | ( | const CNetCDF4Path & | _path | ) | [protected] |
Retourne l'identifiant du groupe dont le chemin est passé en argument.
_path | : Un chemin dans la structure de donnée netCDF. |
Exemple d'utilisation:
//> Retourne l'identifiant d'un group. CINetCDF4 ncinput(std::string("mon_fichier.nc")); CNetCDF4Path path; path.push_back("mes_donnees"); path.push_back("mes_tableaux"); int groupid = ncinput.getGroup(path);
Définition à la ligne 173 du fichier onetcdf4.cpp.
Références CheckError(), et ncidp.
Référencé par getCurrentGroup(), et getUnlimitedDimensionName().
int xmlioserver::io::CONetCDF4::getUnlimitedDimension | ( | void | ) | [protected] |
Retourne l'identifiant de la dimension non limité dans le fichier.
Définition à la ligne 204 du fichier onetcdf4.cpp.
Références CheckError(), et getCurrentGroup().
Référencé par getUnlimitedDimensionName().
std::string xmlioserver::io::CONetCDF4::getUnlimitedDimensionName | ( | void | ) |
Définition à la ligne 76 du fichier onetcdf4.cpp.
Références CheckError(), getGroup(), getUnlimitedDimension(), et path.
Référencé par getWriteDataInfos().
int xmlioserver::io::CONetCDF4::getVariable | ( | const std::string & | _varname | ) | [protected] |
Retourne l'identifiant d'une variable dans le groupe courant.
_varname | : Le nom d'une variable dans le fichier de données. |
Définition à la ligne 188 du fichier onetcdf4.cpp.
Références CheckError(), et getCurrentGroup().
Référencé par getDimensions(), getDimensionsIdList(), et writeData().
void xmlioserver::io::CONetCDF4::getWriteDataInfos | ( | const std::string & | _varname, |
std::size_t | _record, | ||
std::size_t & | _array_size, | ||
std::vector< std::size_t > & | _sstart, | ||
std::vector< std::size_t > & | _scount, | ||
const std::vector< std::size_t > * | _start, | ||
const std::vector< std::size_t > * | _count | ||
) | [private] |
Définition à la ligne 244 du fichier onetcdf4.cpp.
Références getDimensions(), getDimensionsIdList(), et getUnlimitedDimensionName().
Référencé par writeData().
void xmlioserver::io::CONetCDF4::setCurrentPath | ( | const CNetCDF4Path & | _path | ) |
Définition à la ligne 123 du fichier onetcdf4.cpp.
Références path.
bool xmlioserver::io::CONetCDF4::varExist | ( | const std::string & | _varname | ) | [protected] |
Indique si une variable existe dans le groupe courant.
_varname | : Le nom d'une variable dans le fichier de données. |
Définition à la ligne 235 du fichier onetcdf4.cpp.
Références getCurrentGroup().
void xmlioserver::io::CONetCDF4::writeAttribute | ( | const std::string & | _attname, |
const std::string & | _value, | ||
const std::string * | _varname = NULL |
||
) |
Définition à la ligne 346 du fichier onetcdf4.cpp.
void xmlioserver::io::CONetCDF4::writeAttribute | ( | const std::string & | _attname, |
const std::vector< DataType > & | _value, | ||
const std::string * | _varname = NULL |
||
) |
Définition à la ligne 41 du fichier onetcdf4_impl.hpp.
void xmlioserver::io::CONetCDF4::writeAttribute_ | ( | const std::string & | _attname, |
const int * | _value, | ||
std::size_t | _size, | ||
int | _grpid, | ||
int | _varid | ||
) |
Définition à la ligne 333 du fichier onetcdf4.cpp.
void xmlioserver::io::CONetCDF4::writeAttribute_ | ( | const std::string & | _attname, |
const char * | _value, | ||
std::size_t | _size, | ||
int | _grpid, | ||
int | _varid | ||
) |
Définition à la ligne 340 du fichier onetcdf4.cpp.
void xmlioserver::io::CONetCDF4::writeAttribute_ | ( | const std::string & | _attname, |
const DataType * | _value, | ||
std::size_t | _size, | ||
int | _grpid, | ||
int | _varid = NC_GLOBAL |
||
) | [private] |
void xmlioserver::io::CONetCDF4::writeAttribute_ | ( | const std::string & | _attname, |
const float * | _value, | ||
std::size_t | _size, | ||
int | _grpid, | ||
int | _varid | ||
) |
Définition à la ligne 326 du fichier onetcdf4.cpp.
void xmlioserver::io::CONetCDF4::writeAttribute_ | ( | const std::string & | _attname, |
const double * | _value, | ||
std::size_t | _size, | ||
int | _grpid, | ||
int | _varid | ||
) |
Définition à la ligne 319 du fichier onetcdf4.cpp.
void xmlioserver::io::CONetCDF4::writeData | ( | const boost::multi_array< DataType, ndim > & | _data, |
const std::string & | _varname, | ||
std::size_t | _record = 0 , |
||
bool | _collective = true , |
||
const std::vector< std::size_t > * | _start = NULL , |
||
const std::vector< std::size_t > * | _count = NULL |
||
) |
Définition à la ligne 17 du fichier onetcdf4_impl.hpp.
Références CheckError(), comm_server, getCurrentGroup(), getVariable(), getWriteDataInfos(), et writeData_().
void xmlioserver::io::CONetCDF4::writeData_ | ( | int | _grpid, |
int | _varid, | ||
const std::vector< std::size_t > & | _sstart, | ||
const std::vector< std::size_t > & | _scount, | ||
const float * | _data | ||
) |
Définition à la ligne 289 du fichier onetcdf4.cpp.
Références CheckError().
void xmlioserver::io::CONetCDF4::writeData_ | ( | int | _grpid, |
int | _varid, | ||
const std::vector< std::size_t > & | _sstart, | ||
const std::vector< std::size_t > & | _scount, | ||
const DataType * | _data | ||
) | [private] |
void xmlioserver::io::CONetCDF4::writeData_ | ( | int | _grpid, |
int | _varid, | ||
const std::vector< std::size_t > & | _sstart, | ||
const std::vector< std::size_t > & | _scount, | ||
const int * | _data | ||
) |
Définition à la ligne 298 du fichier onetcdf4.cpp.
Références CheckError().
void xmlioserver::io::CONetCDF4::writeData_ | ( | int | _grpid, |
int | _varid, | ||
const std::vector< std::size_t > & | _sstart, | ||
const std::vector< std::size_t > & | _scount, | ||
const double * | _data | ||
) |
Définition à la ligne 307 du fichier onetcdf4.cpp.
Références CheckError().
boost::optional<MPI_Comm> xmlioserver::io::CONetCDF4::comm_server |
Définition à la ligne 217 du fichier onetcdf4.hpp.
Référencé par CONetCDF4(), et writeData().
Définition à la ligne 219 du fichier onetcdf4.hpp.
Référencé par CONetCDF4(), definition_end(), definition_start(), getGroup(), et ~CONetCDF4().
std::vector<std::string> xmlioserver::io::CONetCDF4::path |
Définition à la ligne 218 du fichier onetcdf4.hpp.
Référencé par getCurrentPath(), getUnlimitedDimensionName(), et setCurrentPath().