Ignore:
Timestamp:
06/06/17 17:58:16 (6 years ago)
Author:
oabramkina
Message:

Two server levels: merging with trunk r1137.
There are bugs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/io/onetcdf4_impl.hpp

    r685 r1158  
    44#include "onetcdf4.hpp" 
    55#include "netCdfInterface.hpp" 
     6#include "timer.hpp" 
    67 
    78namespace xios 
     
    2324    CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); 
    2425 
     26    CTimer::get("Files : get data infos").resume(); 
    2527    this->getWriteDataInfos 
    2628    (name, record, array_size,  sstart, scount, start, count); 
     29    CTimer::get("Files : get data infos").suspend(); 
     30 
    2731    if (data.numElements() != array_size) 
    2832    { 
     
    3438 
    3539    this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 
     40  } 
     41 
     42  template <> 
     43  void CONetCDF4::writeData(const CArray<StdString, 1>& data, const StdString & name, 
     44                            bool collective, StdSize record, 
     45                            const std::vector<StdSize> * start, 
     46                            const std::vector<StdSize> * count) 
     47  { 
     48    int grpid = this->getCurrentGroup(); 
     49    int varid = this->getVariable(name); 
     50    StdSize array_size = 1; 
     51    std::vector<StdSize> sstart, scount; 
     52 
     53    if (this->wmpi && collective) 
     54    CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); 
     55    if (this->wmpi && !collective) 
     56    CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); 
     57 
     58    CTimer::get("CONetCDF4::writeData getWriteDataInfos").resume(); 
     59    this->getWriteDataInfos(name, record, array_size,  sstart, scount, start, count); 
     60    CTimer::get("CONetCDF4::writeData getWriteDataInfos").suspend(); 
     61  
     62    if (data.numElements()*stringArrayLen != array_size) 
     63    { 
     64      ERROR("CONetCDF4::writeData(...)", 
     65      << "[ input array size = "  << data.numElements() 
     66      << ", intern array size = " << array_size 
     67      << " ] Invalid input data !" ); 
     68    } 
     69    char* ArrayStr ; 
     70    char *PtrArrayStr ; 
     71    PtrArrayStr=ArrayStr=new char[data.numElements()*stringArrayLen] ; 
     72    Array<StdString,1>::const_iterator it, itb=data.begin(), ite=data.end() ; 
     73    for(it=itb;it!=ite;++it,PtrArrayStr+=stringArrayLen) 
     74    { 
     75      it->copy(PtrArrayStr,it->size()) ; 
     76      PtrArrayStr[it->size()]='\0' ; 
     77    } 
     78    CTimer::get("CONetCDF4::writeData writeData_").resume(); 
     79    this->writeData_(grpid, varid, sstart, scount, ArrayStr); 
     80    CTimer::get("CONetCDF4::writeData writeData_").suspend(); 
     81    delete [] ArrayStr ; 
    3682  } 
    3783 
Note: See TracChangeset for help on using the changeset viewer.