Changeset 1618


Ignore:
Timestamp:
11/28/18 18:38:47 (6 years ago)
Author:
ymipsl
Message:

Bug fix : writing label axis as string was not working in parallel writing mode.

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/io/onetcdf4_impl.hpp

    r1442 r1618  
    7373    } 
    7474    char *PtrArrayStr ; 
    75     PtrArrayStr=new char[stringArrayLen] ; 
     75    PtrArrayStr=new char[stringArrayLen*data.numElements()] ; 
     76    memset (PtrArrayStr,' ',stringArrayLen*data.numElements()); 
     77    size_t offset=0 ; 
    7678    Array<StdString,1>::const_iterator it, itb=data.begin(), ite=data.end() ; 
    77     int lineNb = 0; 
    78     for(it=itb;it!=ite;++it) 
     79    for(it=itb;it!=ite;++it, offset+=stringArrayLen) 
    7980    { 
    80       it->copy(PtrArrayStr,it->size()) ; 
    81       PtrArrayStr[it->size()]='\0' ; 
    82       sstart[0] = lineNb; 
    83       sstart[dimArrayLen] = 0; 
    84       scount[0] = 1; 
    85       scount[dimArrayLen] = it->size() + 1; 
    86       CTimer::get("CONetCDF4::writeData writeData_").resume(); 
    87       this->writeData_(grpid, varid, sstart, scount, PtrArrayStr); 
    88       CTimer::get("CONetCDF4::writeData writeData_").suspend(); 
    89       ++lineNb; 
     81      it->copy(PtrArrayStr+offset,it->size()) ; 
     82      PtrArrayStr[offset+it->size()]='\0' ; 
    9083    } 
     84 
     85     CTimer::get("CONetCDF4::writeData writeData_").resume(); 
     86     this->writeData_(grpid, varid, sstart, scount, PtrArrayStr); 
     87     CTimer::get("CONetCDF4::writeData writeData_").suspend(); 
     88 
    9189    delete []  PtrArrayStr; 
    9290  } 
Note: See TracChangeset for help on using the changeset viewer.