Changeset 1631


Ignore:
Timestamp:
01/09/19 17:11:40 (4 months ago)
Author:
oabramkina
Message:

Backporting r1618 to dev.

Writing of axis and scalar labels still needs to be corrected as the three-digit null character is added to labels in the output files.

File:
1 edited

Legend:

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

    r1442 r1631  
    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.