XMLIOSERVER 0.4
Serveur d'Entrées/Sorties parallèles
|
00001 /* ************************************************************************** * 00002 * Copyright © IPSL/LSCE, XMLIOServer, Avril 2010 - Octobre 2011 * 00003 * ************************************************************************** */ 00004 00005 #ifndef __ONETCDF4_IMPL_HPP__ 00006 #define __ONETCDF4_IMPL_HPP__ 00007 00008 // XMLIOServer headers 00009 #include "xmlioserver_spl.hpp" 00010 00011 // /////////////////////////////// Définitions ////////////////////////////// // 00012 00013 namespace xmlioserver{ 00014 namespace io { 00015 00016 template <class DataType, std::size_t ndim> 00017 void CONetCDF4::writeData(const boost::multi_array<DataType, ndim> & _data, 00018 const std::string & _varname, 00019 std::size_t _record, 00020 bool _collective, 00021 const std::vector<std::size_t> * _start, 00022 const std::vector<std::size_t> * _count) 00023 { 00024 int grpid = this->getCurrentGroup(); 00025 int varid = this->getVariable(_varname); 00026 std::size_t _array_size = 1; 00027 std::vector<std::size_t> _sstart, _scount; 00028 00029 if (this->comm_server && _collective) 00030 CheckError(nc_var_par_access(grpid, varid, NC_COLLECTIVE)); 00031 if (this->comm_server && !_collective) 00032 CheckError(nc_var_par_access(grpid, varid, NC_INDEPENDENT)); 00033 00034 this->getWriteDataInfos 00035 (_varname, _record, _array_size, _sstart, _scount, _start, _count); 00036 this->writeData_(grpid, varid, _sstart, _scount, _data.data()); 00037 } 00038 00039 template <class DataType> 00040 void CONetCDF4::writeAttribute 00041 (const std::string & _attname, 00042 const std::vector<DataType> & _value, 00043 const std::string * _varname) 00044 { 00045 std::pair<nc_type, std::size_t> attinfos; 00046 int grpid = this->getCurrentGroup(); 00047 int varid = (_varname != NULL) ? this->getVariable(*_varname) : NC_GLOBAL; 00048 this->writeAttribute_(_attname, &_value[0], _value.size(), grpid, varid); 00049 } 00050 00051 } // namespace io 00052 } // namespace xmlioserver 00053 00054 #endif // __ONETCDF4_IMPL_HPP__