Changeset 249 for XMLIO_V2/dev


Ignore:
Timestamp:
07/06/11 13:55:03 (13 years ago)
Author:
hozdoba
Message:

Ajout d'une partie d'Interface fortran pour la version 4
Ajout des sorties netcdf4 pour la version 4

Location:
XMLIO_V2/dev/dev_rv
Files:
13 added
2 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/Makefile.wk

    r242 r249  
    1515VTK       = yes 
    1616GUI       = no 
    17 NPROC     = 1 
     17NPROC     = 5 
    1818#VERSION   = 4 
    1919CSUITE    = gnu 
     
    394394 
    395395ifeq ($(VERSION), 4) 
    396         ELEMS_FOR = domain_interface domaingroup_interface \ 
    397                     field_interface  fieldgroup_interface  \ 
    398                     file_interface   filegroup_interface   \ 
    399                     axis_interface   axisgroup_interface   axis  \ 
    400                     context_interface xml_tree 
     396        ELEMS_FOR = idate \ 
     397               domain_interface domaingroup_interface idomain \ 
     398               field_interface  fieldgroup_interface  ifield  \ 
     399               file_interface   filegroup_interface   ifile   \ 
     400               axis_interface   axisgroup_interface   iaxis   \ 
     401               grid_interface   gridgroup_interface   igrid   \ 
     402               context_interface icontext ixml_tree idata     
    401403endif 
    402404             
     
    406408 
    407409ifeq ($(VERSION), 4) 
    408         ELEMS_CPP = object exception xml_node xml_parser inetcdf4 inetcdf4_adv lscereader mpi_interface 
     410        ELEMS_CPP = object exception xml_node xml_parser inetcdf4 inetcdf4_adv onetcdf4 lscereader mpi_interface 
    409411endif 
    410412 
  • XMLIO_V2/dev/dev_rv/src4/xmlio/fortran/axis_interface.f90

    r242 r249  
    66      SUBROUTINE xios_set_axis_name(axis_hdl, name, name_size) BIND(C) 
    77         USE ISO_C_BINDING 
    8          INTEGER  (kind = C_INTPTR_T), VALUE       :: axis_hdl 
    9          CHARACTER(kind = C_CHAR)   , DIMENSION(*) :: name 
    10          INTEGER  (kind = C_INT)                   :: name_size 
     8         INTEGER  (kind = C_INTPTR_T), VALUE        :: axis_hdl 
     9         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: name 
     10         INTEGER  (kind = C_INT)     , VALUE        :: name_size 
    1111      END SUBROUTINE xios_set_axis_name 
    1212 
    1313      SUBROUTINE xios_set_axis_standard_name(axis_hdl, standard_name, standard_name_size) BIND(C) 
    1414         USE ISO_C_BINDING 
    15          INTEGER  (kind = C_INTPTR_T), VALUE       :: axis_hdl 
    16          CHARACTER(kind = C_CHAR)   , DIMENSION(*) :: standard_name 
    17          INTEGER  (kind = C_INT)                   :: standard_name_size 
     15         INTEGER  (kind = C_INTPTR_T), VALUE        :: axis_hdl 
     16         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: standard_name 
     17         INTEGER  (kind = C_INT)     , VALUE        :: standard_name_size 
    1818      END SUBROUTINE xios_set_axis_standard_name 
    1919 
     
    2121         USE ISO_C_BINDING 
    2222         INTEGER  (kind = C_INTPTR_T), VALUE       :: axis_hdl 
    23          CHARACTER(kind = C_CHAR)   , DIMENSION(*) :: long_name 
    24          INTEGER  (kind = C_INT)                   :: long_name_size 
     23         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: long_name 
     24         INTEGER  (kind = C_INT)     , VALUE        :: long_name_size 
    2525      END SUBROUTINE xios_set_axis_long_name 
    2626 
     
    2828         USE ISO_C_BINDING 
    2929         INTEGER  (kind = C_INTPTR_T), VALUE       :: axis_hdl 
    30          CHARACTER(kind = C_CHAR)   , DIMENSION(*) :: unit 
    31          INTEGER  (kind = C_INT)                   :: unit_size 
     30         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: unit 
     31         INTEGER  (kind = C_INT)     , VALUE        :: unit_size 
    3232      END SUBROUTINE xios_set_axis_unit 
    3333 
     
    3535         USE ISO_C_BINDING 
    3636         INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl 
    37          INTEGER (kind = C_INT)             :: size 
     37         INTEGER (kind = C_INT)     , VALUE :: size 
    3838      END SUBROUTINE xios_set_axis_size 
    3939 
     
    4242         INTEGER (kind = C_INTPTR_T), VALUE        :: axis_hdl 
    4343         REAL    (kind = C_DOUBLE)  , DIMENSION(*) :: zvalue 
    44          INTEGER (kind = C_INT)                    :: zvalue_extent1 
     44         INTEGER (kind = C_INT)     , VALUE        :: zvalue_extent1 
    4545      END SUBROUTINE xios_set_axis_zvalue 
    4646       
     
    5151         INTEGER  (kind = C_INT)     , VALUE        :: idt_size 
    5252      END SUBROUTINE xios_axis_handle_create 
    53       
     53        
    5454   END INTERFACE 
    5555      
  • XMLIO_V2/dev/dev_rv/src4/xmlio/fortran/axisgroup_interface.f90

    r242 r249  
    77         USE ISO_C_BINDING 
    88         INTEGER  (kind = C_INTPTR_T), VALUE       :: axisgroup_hdl 
    9          CHARACTER(kind = C_CHAR)   , DIMENSION(*) :: name 
    10          INTEGER  (kind = C_INT)                   :: name_size 
     9         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: name 
     10         INTEGER  (kind = C_INT)     , VALUE       :: name_size 
    1111      END SUBROUTINE xios_set_axisgroup_name 
    1212 
    1313      SUBROUTINE xios_set_axisgroup_standard_name(axisgroup_hdl, standard_name, standard_name_size) BIND(C) 
    1414         USE ISO_C_BINDING 
    15          INTEGER  (kind = C_INTPTR_T), VALUE       :: axisgroup_hdl 
    16          CHARACTER(kind = C_CHAR)   , DIMENSION(*) :: standard_name 
    17          INTEGER  (kind = C_INT)                   :: standard_name_size 
     15         INTEGER  (kind = C_INTPTR_T), VALUE        :: axisgroup_hdl 
     16         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: standard_name 
     17         INTEGER  (kind = C_INT)     , VALUE        :: standard_name_size 
    1818      END SUBROUTINE xios_set_axisgroup_standard_name 
    1919 
    2020      SUBROUTINE xios_set_axisgroup_long_name(axisgroup_hdl, long_name, long_name_size) BIND(C) 
    2121         USE ISO_C_BINDING 
    22          INTEGER  (kind = C_INTPTR_T), VALUE       :: axisgroup_hdl 
    23          CHARACTER(kind = C_CHAR)   , DIMENSION(*) :: long_name 
    24          INTEGER  (kind = C_INT)                   :: long_name_size 
     22         INTEGER  (kind = C_INTPTR_T), VALUE        :: axisgroup_hdl 
     23         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: long_name 
     24         INTEGER  (kind = C_INT)     , VALUE        :: long_name_size 
    2525      END SUBROUTINE xios_set_axisgroup_long_name 
    2626 
    2727      SUBROUTINE xios_set_axisgroup_unit(axisgroup_hdl, unit, unit_size) BIND(C) 
    2828         USE ISO_C_BINDING 
    29          INTEGER  (kind = C_INTPTR_T), VALUE       :: axisgroup_hdl 
    30          CHARACTER(kind = C_CHAR)   , DIMENSION(*) :: unit 
    31          INTEGER  (kind = C_INT)                   :: unit_size 
     29         INTEGER  (kind = C_INTPTR_T), VALUE        :: axisgroup_hdl 
     30         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: unit 
     31         INTEGER  (kind = C_INT)     , VALUE        :: unit_size 
    3232      END SUBROUTINE xios_set_axisgroup_unit 
    3333 
     
    3535         USE ISO_C_BINDING 
    3636         INTEGER (kind = C_INTPTR_T), VALUE :: axisgroup_hdl 
    37          INTEGER (kind = C_INT)             :: size 
     37         INTEGER (kind = C_INT)     , VALUE :: size 
    3838      END SUBROUTINE xios_set_axisgroup_size 
    3939 
     
    4242         INTEGER (kind = C_INTPTR_T), VALUE        :: axisgroup_hdl 
    4343         REAL    (kind = C_DOUBLE)  , DIMENSION(*) :: zvalue 
    44          INTEGER (kind = C_INT)                    :: zvalue_extent1 
     44         INTEGER (kind = C_INT)     , VALUE        :: zvalue_extent1 
    4545      END SUBROUTINE xios_set_axisgroup_zvalue 
    4646   
  • XMLIO_V2/dev/dev_rv/src4/xmlio/fortran/context_interface.f90

    r242 r249  
    2424         INTEGER  (kind = C_INT)                    :: output_dir_size 
    2525      END SUBROUTINE xios_set_context_output_dir 
     26       
     27      SUBROUTINE xios_context_handle_create(ret, idt, idt_size) BIND(C) 
     28         import C_CHAR, C_INTPTR_T, C_INT 
     29         INTEGER  (kind = C_INTPTR_T)               :: ret 
     30         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: idt 
     31         INTEGER  (kind = C_INT)     , VALUE        :: idt_size 
     32      END SUBROUTINE xios_context_handle_create 
     33       
     34      SUBROUTINE xios_context_set_current(context, withswap) BIND(C) 
     35         import C_BOOL, C_INT, C_INTPTR_T 
     36         INTEGER (kind = C_INTPTR_T), VALUE :: context 
     37         LOGICAL (kind = C_BOOL)    , VALUE :: withswap 
     38      END SUBROUTINE xios_context_set_current 
     39 
     40      SUBROUTINE xios_context_create(context, context_id, context_id_size, calendar_type, & 
     41                                     year, month, day, hour, minute, second) BIND(C) 
     42         import C_CHAR, C_INT, C_INTPTR_T 
     43         INTEGER  (kind = C_INTPTR_T)               :: context 
     44         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: context_id 
     45         INTEGER  (kind = C_INT)     , VALUE        :: context_id_size 
     46         INTEGER  (kind = C_INT)     , VALUE        :: calendar_type, year, month, day, hour, minute, second 
     47      END SUBROUTINE xios_context_create 
    2648      
    2749   END INTERFACE 
  • XMLIO_V2/dev/dev_rv/src4/xmlio/fortran/domain_interface.f90

    r242 r249  
    200200      END SUBROUTINE xios_set_domain_latvalue 
    201201        
     202      SUBROUTINE xios_domain_handle_create(ret, idt, idt_size) BIND(C) 
     203         import C_CHAR, C_INTPTR_T, C_INT 
     204         INTEGER  (kind = C_INTPTR_T)               :: ret 
     205         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: idt 
     206         INTEGER  (kind = C_INT)     , VALUE        :: idt_size 
     207      END SUBROUTINE xios_domain_handle_create 
     208        
    202209   END INTERFACE 
    203210        
  • XMLIO_V2/dev/dev_rv/src4/xmlio/fortran/domaingroup_interface.f90

    r242 r249  
    199199         INTEGER (kind = C_INT)                    :: latvalue_extent1 
    200200      END SUBROUTINE xios_set_domaingroup_latvalue 
     201       
     202      SUBROUTINE xios_domaingroup_handle_create(ret, idt, idt_size) BIND(C) 
     203         import C_CHAR, C_INTPTR_T, C_INT 
     204         INTEGER  (kind = C_INTPTR_T)               :: ret 
     205         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: idt 
     206         INTEGER  (kind = C_INT)     , VALUE        :: idt_size 
     207      END SUBROUTINE xios_domaingroup_handle_create 
    201208        
    202209   END INTERFACE 
  • XMLIO_V2/dev/dev_rv/src4/xmlio/fortran/field_interface.f90

    r242 r249  
    9898      END SUBROUTINE xios_set_field_default_value 
    9999    
     100      SUBROUTINE xios_field_handle_create(ret, idt, idt_size) BIND(C) 
     101         import C_CHAR, C_INTPTR_T, C_INT 
     102         INTEGER  (kind = C_INTPTR_T)               :: ret 
     103         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: idt 
     104         INTEGER  (kind = C_INT)     , VALUE        :: idt_size 
     105      END SUBROUTINE xios_field_handle_create 
     106    
    100107   END INTERFACE 
    101108    
  • XMLIO_V2/dev/dev_rv/src4/xmlio/fortran/fieldgroup_interface.f90

    r242 r249  
    9797         REAL    (kind = C_DOUBLE)          :: default_value 
    9898      END SUBROUTINE xios_set_fieldgroup_default_value 
     99       
     100      SUBROUTINE xios_domaingroup_handle_create(ret, idt, idt_size) BIND(C) 
     101         import C_CHAR, C_INTPTR_T, C_INT 
     102         INTEGER  (kind = C_INTPTR_T)               :: ret 
     103         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: idt 
     104         INTEGER  (kind = C_INT)     , VALUE        :: idt_size 
     105      END SUBROUTINE xios_domaingroup_handle_create 
    99106    
    100107   END INTERFACE 
  • XMLIO_V2/dev/dev_rv/src4/xmlio/fortran/file_interface.f90

    r242 r249  
    3737      END SUBROUTINE xios_set_file_enabled 
    3838    
     39      SUBROUTINE xios_file_handle_create(ret, idt, idt_size) BIND(C) 
     40         import C_CHAR, C_INTPTR_T, C_INT 
     41         INTEGER  (kind = C_INTPTR_T)               :: ret 
     42         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: idt 
     43         INTEGER  (kind = C_INT)     , VALUE        :: idt_size 
     44      END SUBROUTINE xios_file_handle_create 
     45     
    3946   END INTERFACE 
    4047    
  • XMLIO_V2/dev/dev_rv/src4/xmlio/fortran/filegroup_interface.f90

    r242 r249  
    3636         LOGICAL (kind = C_BOOL)            :: enabled 
    3737      END SUBROUTINE xios_set_filegroup_enabled 
    38     
     38       
     39      SUBROUTINE xios_filegroup_handle_create(ret, idt, idt_size) BIND(C) 
     40         import C_CHAR, C_INTPTR_T, C_INT 
     41         INTEGER  (kind = C_INTPTR_T)               :: ret 
     42         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: idt 
     43         INTEGER  (kind = C_INT)     , VALUE        :: idt_size 
     44      END SUBROUTINE xios_filegroup_handle_create 
     45 
    3946   END INTERFACE 
    4047    
  • XMLIO_V2/dev/dev_rv/src4/xmlio/fortran/grid_interface.f90

    r242 r249  
    3131         INTEGER  (kind = C_INT)                    :: axis_ref_size 
    3232      END SUBROUTINE xios_set_grid_axis_ref 
     33       
     34      SUBROUTINE xios_grid_handle_create(ret, idt, idt_size) BIND(C) 
     35         import C_CHAR, C_INTPTR_T, C_INT 
     36         INTEGER  (kind = C_INTPTR_T)               :: ret 
     37         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: idt 
     38         INTEGER  (kind = C_INT)     , VALUE        :: idt_size 
     39      END SUBROUTINE xios_grid_handle_create 
    3340      
    3441   END INTERFACE 
  • XMLIO_V2/dev/dev_rv/src4/xmlio/fortran/gridgroup_interface.f90

    r242 r249  
    3131         INTEGER  (kind = C_INT)                    :: axis_ref_size 
    3232      END SUBROUTINE xios_set_gridgroup_axis_ref 
    33       
     33       
     34      SUBROUTINE xios_domaingroup_handle_create(ret, idt, idt_size) BIND(C) 
     35         import C_CHAR, C_INTPTR_T, C_INT 
     36         INTEGER  (kind = C_INTPTR_T)               :: ret 
     37         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: idt 
     38         INTEGER  (kind = C_INT)     , VALUE        :: idt_size 
     39      END SUBROUTINE xios_domaingroup_handle_create 
     40       
    3441   END INTERFACE 
    3542      
  • XMLIO_V2/dev/dev_rv/src4/xmlio/main_server.cpp

    r242 r249  
    1616#include "xmlioserver_spl.hpp" 
    1717 
    18 #include "inetcdf4.hpp" 
    19 #include "inetcdf4_impl.hpp" 
    20 #include "inetcdf4_adv.hpp" 
    21 #include "inetcdf4_adv_impl.hpp" 
    22 #include "lscereader.hpp" 
     18#include "mpi_interface.hpp" 
     19#include "onetcdf4.hpp" 
     20#include "onetcdf4_impl.hpp" 
    2321 
    2422namespace xios = xmlioserver; 
     
    2725//~ using namespace xios::tree; 
    2826//~ using namespace xios::xml; 
    29 //~ using namespace xios::comm; 
     27using namespace xios::comm; 
    3028//~ using namespace xios::func; 
    31 using namespace xios::vtk; 
    3229 
    3330// Point d'entrée du programme serveur principal. 
    34 int main (int XIOS_UNUSED (argc), char ** XIOS_UNUSED (argv), char ** XIOS_UNUSED (env)) 
     31int main (int argc, char ** argv, char ** XIOS_UNUSED (env)) 
    3532{ 
    3633   try 
    3734   { 
     35      CMPIManager::Initialise(&argc, &argv); 
     36      { 
     37         MPI_Comm cworld = CMPIManager::GetCommWorld(); 
     38         int rank = CMPIManager::GetCommRank(); 
     39         int size = CMPIManager::GetCommSize(); 
     40          
     41         CONetCDF4 output("wk/data/herve.nc", false, &cworld); 
     42          
     43         CONetCDF4::CNetCDF4Path path; 
     44         path.push_back("ozdoba"); 
     45          
     46         output.addGroup("ozdoba"); 
     47         output.setCurrentPath(path); 
     48         output.addDimension("time"); 
     49         output.addDimension("x", 10); 
     50         output.addDimension("y", 10); 
     51          
     52         std::vector<std::string> dims; 
     53         dims.push_back("time"); 
     54         dims.push_back("x"); 
     55         dims.push_back("y"); 
     56          
     57         std::string toto("toto"); 
     58         output.addVariable(toto, NC_INT, dims); 
    3859 
     60         output.writeAttribute("att1", "llo"); 
     61          
     62         std::vector<int> vvv; 
     63         vvv.push_back(1); 
     64         output.writeAttribute("att1", vvv, &toto); 
     65         vvv.push_back(5); 
     66         output.writeAttribute("att5", vvv, &toto); 
     67          
     68         boost::multi_array<int, 2> data(boost::extents[2][10]); 
     69         boost::multi_array<int, 2>::iterator it = data.begin(), end = data.end(); 
     70          
     71         for (std::size_t i = 0; i < data.num_elements(); i++) data.data()[i] = rank; 
    3972 
     73         std::vector<std::size_t> _start; 
     74         std::vector<std::size_t> _count; 
     75         _start.push_back(10*rank/size); 
     76         _count.push_back(2); 
     77         _start.push_back(0); 
     78         _count.push_back(10); 
     79          
     80         output.writeData( data, toto, 0, false, &_start, &_count); 
     81      } 
    4082 
     83      CMPIManager::Finalize(); 
    4184   } 
    4285   catch (xios::CException & _exception) 
    4386   { 
    4487      std::cerr << _exception.getMessage() << std::endl; 
     88      CMPIManager::Finalize(); 
    4589      return (-1); 
    4690   } 
  • XMLIO_V2/dev/dev_rv/src4/xmlio/netcdf/inetcdf4.cpp

    r241 r249  
    2020namespace io { 
    2121     
     22     
     23   // ------------------------------ Constructeurs ----------------------------- 
     24    
    2225   CINetCDF4::CINetCDF4(const std::string & filename) 
    2326   { 
     
    2528   } 
    2629 
     30   // ------------------------------- Destructeur ------------------------------ 
     31    
    2732   CINetCDF4::~CINetCDF4(void) 
    2833   { 
    2934       CheckError(nc_close(this->ncidp)); 
    3035   } 
     36    
     37   // --------------------- Vérification des erreurs NetCDF -------------------- 
    3138    
    3239   void CINetCDF4::CheckError(int _status) throw (CException) 
     
    3946      } 
    4047   } 
     48    
     49   // --------------------------- Accesseurs protégés -------------------------- 
    4150    
    4251   int CINetCDF4::getCurrentGroup(void) 
     
    107116   } 
    108117    
     118   bool CINetCDF4::varExist(const std::string & _varname) 
     119   { 
     120      int varid = 0; 
     121      int grpid = this->getCurrentGroup(); 
     122      return (nc_inq_varid (grpid, _varname.c_str(), &varid) == NC_NOERR); 
     123   } 
     124    
     125   // ------------------------------- Accesseurs ------------------------------- 
     126    
    109127   const CINetCDF4::CNetCDF4Path & CINetCDF4::getCurrentPath(void) const 
    110128   {  
     
    112130   } 
    113131 
     132   // ------------------------------- Mutateurs -------------------------------- 
     133 
    114134   void CINetCDF4::setCurrentPath(const CNetCDF4Path & path) 
    115135   {  
    116136       this->path = path;  
    117137   } 
     138    
     139   // ----------------- Obtention des informations de lecture ------------------ 
    118140    
    119141   void CINetCDF4::getReadDataInfos(const std::string & _varname, 
     
    159181   } 
    160182    
     183   // ------------------------- Lecture des données -------------------------- 
     184    
     185   template <> 
     186      void CINetCDF4::readData_(int _grpid, int _varid, 
     187                                const std::vector<std::size_t> & _sstart, 
     188                                const std::vector<std::size_t> & _scount, 
     189                                float * _data) 
     190   { 
     191      CheckError(nc_get_vara_float(_grpid, _varid, &(_sstart[0]), &(_scount[0]), _data));        
     192   } 
     193    
     194   template <> 
     195      void CINetCDF4::readData_(int _grpid, int _varid, 
     196                                const std::vector<std::size_t> & _sstart, 
     197                                const std::vector<std::size_t> & _scount, 
     198                                int * _data) 
     199   { 
     200      CheckError(nc_get_vara_int(_grpid, _varid, &(_sstart[0]), &(_scount[0]), _data));        
     201   } 
     202    
     203   template <> 
     204      void CINetCDF4::readData_(int _grpid, int _varid, 
     205                                const std::vector<std::size_t> & _sstart, 
     206                                const std::vector<std::size_t> & _scount, 
     207                                double * _data) 
     208   { 
     209      CheckError(nc_get_vara_double(_grpid, _varid, &(_sstart[0]), &(_scount[0]), _data));        
     210   } 
     211 
     212   // ------------------------- Lecture des attributs -------------------------- 
    161213   void CINetCDF4::readAttribute 
    162214      (const std::string & _attname, std::string & _value, const std::string * _varname) 
     
    166218        _value.assign(&(chart[0]), chart.size()); 
    167219   } 
     220    
     221   template <> 
     222      void CINetCDF4::readAttribute_ 
     223         (const std::string & _attname, double * _value, int _grpid, int _varid) 
     224   {        
     225        CheckError(nc_get_att_double(_grpid, _varid, _attname.c_str(), _value)); 
     226   } 
     227    
     228   template <> 
     229      void CINetCDF4::readAttribute_ 
     230         (const std::string & _attname, float * _value, int _grpid, int _varid) 
     231   { 
     232       CheckError(nc_get_att_float(_grpid, _varid, _attname.c_str(), _value)); 
     233   } 
     234    
     235   template <> 
     236      void CINetCDF4::readAttribute_ 
     237         (const std::string & _attname, int * _value, int _grpid, int _varid) 
     238   { 
     239       CheckError(nc_get_att_int(_grpid, _varid, _attname.c_str(), _value)); 
     240   } 
     241    
     242   template <> 
     243      void CINetCDF4::readAttribute_ 
     244         (const std::string & _attname, char * _value, int _grpid, int _varid) 
     245   { 
     246       CheckError(nc_get_att_text(_grpid, _varid, _attname.c_str(), _value)); 
     247   } 
     248    
     249   // ----------------- Accesseur de parcours (d'exploration) ------------------ 
    168250 
    169251   std::vector<std::string> CINetCDF4::getAttributes(const std::string * const _varname) 
     
    187269      } 
    188270      return (retvalue); 
    189    } 
    190     
     271   }    
    191272    
    192273   std::map<std::string, std::size_t> CINetCDF4::getDimensions(const std::string * const _varname) 
     
    322403   } 
    323404    
    324    template <> 
    325       void CINetCDF4::readData_(int _grpid, int _varid, 
    326                                 const std::vector<std::size_t> & _sstart, 
    327                                 const std::vector<std::size_t> & _scount, 
    328                                 float * _data) 
    329    { 
    330       CheckError(nc_get_vara_float(_grpid, _varid, &(_sstart[0]), &(_scount[0]), _data));        
    331    } 
    332     
    333    template <> 
    334       void CINetCDF4::readData_(int _grpid, int _varid, 
    335                                 const std::vector<std::size_t> & _sstart, 
    336                                 const std::vector<std::size_t> & _scount, 
    337                                 int * _data) 
    338    { 
    339       CheckError(nc_get_vara_int(_grpid, _varid, &(_sstart[0]), &(_scount[0]), _data));        
    340    } 
    341     
    342    template <> 
    343       void CINetCDF4::readData_(int _grpid, int _varid, 
    344                                 const std::vector<std::size_t> & _sstart, 
    345                                 const std::vector<std::size_t> & _scount, 
    346                                 double * _data) 
    347    { 
    348       CheckError(nc_get_vara_double(_grpid, _varid, &(_sstart[0]), &(_scount[0]), _data));        
    349    } 
    350     
    351    template <> 
    352       void CINetCDF4::readAttribute_ 
    353          (const std::string & _attname, double * _value, int _grpid, int _varid) 
    354    {        
    355         CheckError(nc_get_att_double(_grpid, _varid, _attname.c_str(), _value)); 
    356    } 
    357     
    358    template <> 
    359       void CINetCDF4::readAttribute_ 
    360          (const std::string & _attname, float * _value, int _grpid, int _varid) 
    361    { 
    362        CheckError(nc_get_att_float(_grpid, _varid, _attname.c_str(), _value)); 
    363    } 
    364     
    365    template <> 
    366       void CINetCDF4::readAttribute_ 
    367          (const std::string & _attname, int * _value, int _grpid, int _varid) 
    368    { 
    369        CheckError(nc_get_att_int(_grpid, _varid, _attname.c_str(), _value)); 
    370    } 
    371     
    372    template <> 
    373       void CINetCDF4::readAttribute_ 
    374          (const std::string & _attname, char * _value, int _grpid, int _varid) 
    375    { 
    376        CheckError(nc_get_att_text(_grpid, _varid, _attname.c_str(), _value)); 
    377    } 
    378     
    379    bool CINetCDF4::varExist(const std::string & _varname) 
    380    { 
    381       int varid = 0; 
    382       int grpid = this->getCurrentGroup(); 
    383       return (nc_inq_varid (grpid, _varname.c_str(), &varid) == NC_NOERR); 
    384    } 
    385     
    386405} // namespace io 
    387406} // namespace xmlioserver 
  • XMLIO_V2/dev/dev_rv/src4/xmlio/netcdf/inetcdf4.hpp

    r238 r249  
    125125               void readData( boost::multi_array<DataType, ndim> & _data, 
    126126                              const std::string                  & _varname, 
    127                               std::size_t                          _record = 1, 
     127                              std::size_t                          _record = 0, 
    128128                              const std::vector<std::size_t>     * _start  = NULL, 
    129129                              const std::vector<std::size_t>     * _count  = NULL); 
     
    199199                                  const std::vector<std::size_t> * _count); 
    200200             
    201          private : // Lecture 
     201         private : // Lecture privée 
    202202              
    203203             template <class DataType> 
Note: See TracChangeset for help on using the changeset viewer.