XMLIOSERVER 0.4
Serveur d'Entrées/Sorties parallèles
inetcdf4_impl.hpp
Aller à la documentation de ce fichier.
00001 /* ************************************************************************** *
00002  *      Copyright © IPSL/LSCE, XMLIOServer, Avril 2010 - Octobre 2011         *
00003  * ************************************************************************** */
00004 
00005 #ifndef __INETCDF4_IMPL_HPP__
00006 #define __INETCDF4_IMPL_HPP__
00007 
00016 // XMLIOServer headers
00017 #include "xmlioserver_spl.hpp"
00018 
00019 // /////////////////////////////// Définitions ////////////////////////////// //
00020 
00021 namespace xmlioserver{
00022 namespace io {
00023    
00024    template <class DataType, std::size_t ndim>
00025       void CINetCDF4::readData(boost::multi_array<DataType, ndim> & _data,
00026                                const std::string & _varname,
00027                                std::size_t _record,
00028                                const std::vector<std::size_t> * _start,
00029                                const std::vector<std::size_t> * _count)
00030    {
00031       int grpid = this->getCurrentGroup();
00032       int varid = this->getVariable(_varname);
00033       std::size_t _array_size = 1;
00034       std::vector<std::size_t> _sstart, _scount;
00035       this->getReadDataInfos
00036          (_varname, _record, _array_size,  _sstart, _scount, _start, _count);
00037       
00038       _data.resize(boost::extents[_array_size]);
00039       this->readData_(grpid, varid, _sstart, _scount, _data.data());
00040    }
00041 
00042    template <class DataType>
00043       void CINetCDF4::readAttribute
00044           (const std::string & _attname, std::vector<DataType> & _value, const std::string * _varname)
00045    {
00046        std::pair<nc_type, std::size_t> attinfos;
00047        int grpid = this->getCurrentGroup();                                 
00048        int varid = (_varname != NULL) ? this->getVariable(*_varname) : NC_GLOBAL;
00049        CheckError(nc_inq_att(grpid, varid, _attname.c_str(), &attinfos.first, &attinfos.second));
00050        _value.resize(attinfos.second); 
00051        this->readAttribute_(_attname, &_value[0], grpid, varid);
00052        
00053    }
00054    
00055 } // namespace io
00056 } // namespace xmlioserver
00057 
00058 #endif  // __INETCDF4_IMPL_HPP__
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Définition de type Énumérations Valeurs énumérées Amis Macros