Changeset 1050 for XIOS/trunk/src/io
- Timestamp:
- 02/07/17 11:52:03 (7 years ago)
- Location:
- XIOS/trunk/src/io
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/io/nc4_data_output.cpp
r1048 r1050 1060 1060 else if (axis->prec==8) typePrec = NC_DOUBLE ; 1061 1061 1062 if (!axis->label.isEmpty()) typePrec = NC_CHAR ; 1063 string strId="str_len" ; 1062 1064 try 1063 1065 { 1064 1066 SuperClassWriter::addDimension(axisid, zoom_size); 1067 if (!axis->label.isEmpty()) SuperClassWriter::addDimension(strId, stringArrayLen); 1065 1068 if (axis->hasValue) 1066 1069 { 1067 1070 dims.push_back(axisid); 1071 if (!axis->label.isEmpty()) dims.push_back(strId); 1068 1072 SuperClassWriter::addVariable(axisid, typePrec, dims); 1069 1073 … … 1104 1108 CArray<double,1> axis_value(zoom_size_srv); 1105 1109 for (int i = 0; i < zoom_size_srv; i++) axis_value(i) = axis->value_srv(i); 1106 SuperClassWriter::writeData(axis_value, axisid, isCollective, 0);1107 1108 if (!axis->bounds.isEmpty() )1110 if (axis->label.isEmpty()) SuperClassWriter::writeData(axis_value, axisid, isCollective, 0); 1111 1112 if (!axis->bounds.isEmpty() && axis->label.isEmpty()) 1109 1113 SuperClassWriter::writeData(axis->bound_srv, axisBoundsId, isCollective, 0); 1110 1114 1115 if (! axis->label.isEmpty()) SuperClassWriter::writeData(axis->label_srv, axisid, isCollective, 0); 1116 1111 1117 SuperClassWriter::definition_start(); 1112 1113 1118 break; 1114 1119 } … … 1124 1129 startBounds[1] = 0; 1125 1130 countBounds[1] = 2; 1126 SuperClassWriter::writeData(axis_value, axisid, isCollective, 0, &start, &count);1127 1128 if (!axis->bounds.isEmpty() )1131 if (axis->label.isEmpty()) SuperClassWriter::writeData(axis_value, axisid, isCollective, 0, &start, &count); 1132 1133 if (!axis->bounds.isEmpty()&& axis->label.isEmpty()) 1129 1134 SuperClassWriter::writeData(axis->bound_srv, axisBoundsId, isCollective, 0, &startBounds, &countBounds); 1135 1136 if (! axis->label.isEmpty()) SuperClassWriter::writeData(axis->label_srv, axisid, isCollective, 0); 1130 1137 1131 1138 SuperClassWriter::definition_start(); -
XIOS/trunk/src/io/netCdfInterface.cpp
r972 r1050 967 967 } 968 968 969 template<> 970 int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, char* data) 971 { 972 return nc_get_vara_text(ncid, varid, start, count, data); 973 } 974 969 975 // Some specializations of putVariableType 970 976 template<> … … 984 990 { 985 991 return nc_put_vara_int(ncid, varid, start, count, data); 992 } 993 994 template<> 995 int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const char* data) 996 { 997 return nc_put_vara_text(ncid, varid, start, count, data); 986 998 } 987 999 -
XIOS/trunk/src/io/netCdfInterface_decl.cpp
r686 r1050 33 33 macroPutVar(float) 34 34 macroPutVar(int) 35 35 macroPutVar(char) 36 36 37 #define macroType(type, ncType) \ 37 38 template<> nc_type CNetCdfInterface::getNcType<type>() { return ncType; } -
XIOS/trunk/src/io/onetcdf4.cpp
r878 r1050 503 503 void CONetCDF4::writeData_(int grpid, int varid, 504 504 const std::vector<StdSize>& sstart, 505 const std::vector<StdSize>& scount, char* data) 506 { 507 CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); 508 } 509 510 template <> 511 512 void CONetCDF4::writeData_(int grpid, int varid, 513 const std::vector<StdSize>& sstart, 505 514 const std::vector<StdSize>& scount, const int* data) 506 515 { 507 516 CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); 508 517 } 509 510 518 //--------------------------------------------------------------- 511 519 -
XIOS/trunk/src/io/onetcdf4_decl.cpp
r924 r1050 14 14 macro(double, 2) 15 15 macro(double, 3) 16 macro(StdString, 1) 16 17 17 18 template void CONetCDF4::setDefaultValue<double>(const StdString & varname, const double* value) ; -
XIOS/trunk/src/io/onetcdf4_impl.hpp
r685 r1050 36 36 } 37 37 38 template <> 39 void CONetCDF4::writeData(const CArray<StdString, 1>& data, const StdString & name, 40 bool collective, StdSize record, 41 const std::vector<StdSize> * start, 42 const std::vector<StdSize> * count) 43 { 44 int grpid = this->getCurrentGroup(); 45 int varid = this->getVariable(name); 46 StdSize array_size = 1; 47 std::vector<StdSize> sstart, scount; 48 49 if (this->wmpi && collective) 50 CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); 51 if (this->wmpi && !collective) 52 CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); 53 54 this->getWriteDataInfos 55 (name, record, array_size, sstart, scount, start, count); 56 if (data.numElements()*stringArrayLen != array_size) 57 { 58 ERROR("CONetCDF4::writeData(...)", 59 << "[ input array size = " << data.numElements() 60 << ", intern array size = " << array_size 61 << " ] Invalid input data !" ); 62 } 63 char* ArrayStr ; 64 char *PtrArrayStr ; 65 PtrArrayStr=ArrayStr=new char[data.numElements()*stringArrayLen] ; 66 Array<StdString,1>::const_iterator it, itb=data.begin(), ite=data.end() ; 67 for(it=itb;it!=ite;++it,PtrArrayStr+=stringArrayLen) 68 { 69 it->copy(PtrArrayStr,it->size()) ; 70 PtrArrayStr[it->size()]='\0' ; 71 } 72 this->writeData_(grpid, varid, sstart, scount, ArrayStr); 73 delete [] ArrayStr ; 74 } 75 38 76 //---------------------------------------------------------------- 39 77
Note: See TracChangeset
for help on using the changeset viewer.