Changeset 1873


Ignore:
Timestamp:
05/06/20 11:16:20 (4 years ago)
Author:
aclsce
Message:

Reported bugfix [1633] [1630#file18] from trunk to branch in order to solve writing axis and scalar labels problems.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/branchs/xios-2.5/src/io/onetcdf4_impl.hpp

    r1442 r1873  
    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 ; 
     78 
     79// pb with iterator with blitz++ string array  with recent compiler 
     80/* 
    7681    Array<StdString,1>::const_iterator it, itb=data.begin(), ite=data.end() ; 
    77     int lineNb = 0; 
    78     for(it=itb;it!=ite;++it) 
     82    for(it=itb;it!=ite;++it, offset+=stringArrayLen) 
    7983    { 
    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; 
     84      it->copy(PtrArrayStr+offset,it->size()) ; 
     85      PtrArrayStr[offset+it->size()]='\0' ; 
    9086    } 
     87*/ 
     88     for(int i=0;i<data.numElements();i++,offset+=stringArrayLen) 
     89     { 
     90       data(i).copy(PtrArrayStr+offset,data(i).size()) ; 
     91       PtrArrayStr[offset+data(i).size()]='\0' ; 
     92     }  
     93     CTimer::get("CONetCDF4::writeData writeData_").resume(); 
     94     this->writeData_(grpid, varid, sstart, scount, PtrArrayStr); 
     95     CTimer::get("CONetCDF4::writeData writeData_").suspend(); 
     96 
    9197    delete []  PtrArrayStr; 
    9298  } 
Note: See TracChangeset for help on using the changeset viewer.