Changeset 1624 for XIOS/branchs/xios-2.5/src/io/nc4_data_output.cpp
- Timestamp:
- 12/14/18 11:20:33 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/branchs/xios-2.5/src/io/nc4_data_output.cpp
r1509 r1624 154 154 */ 155 155 156 CArray< size_t, 1>& indexToWrite = domain->localIndexToWriteOnServer;156 CArray<int, 1>& indexToWrite = domain->localIndexToWriteOnServer; 157 157 int nbWritten = indexToWrite.numElements(); 158 158 CArray<double,1> writtenLat, writtenLon; … … 166 166 for (int idx = 0; idx < nbWritten; ++idx) 167 167 { 168 if (idx < domain->latvalue.numElements())169 170 writtenLat(idx) = domain->latvalue(indexToWrite(idx));171 writtenLon(idx) = domain->lonvalue(indexToWrite(idx));172 173 174 175 writtenLat(idx) = 0.;176 writtenLon(idx) = 0.;177 168 if (indexToWrite(idx) < 0) 169 { 170 writtenLat(idx) = -1.; // hole 171 writtenLon(idx) = -1.; 172 } 173 else 174 { 175 writtenLat(idx) = domain->latvalue(indexToWrite(idx)); 176 writtenLon(idx) = domain->lonvalue(indexToWrite(idx)); 177 } 178 178 } 179 180 179 181 180 if (domain->hasBounds) … … 189 188 for (int nv = 0; nv < nvertex; ++nv) 190 189 { 191 if (idx < boundslat.columns()) 192 { 190 if (indexToWrite(idx) < 0) 191 { 192 writtenBndsLat(nv, idx) = -1.; // hole 193 writtenBndsLon(nv, idx) = -1.; 194 } 195 else 196 { 193 197 writtenBndsLat(nv, idx) = boundslat(nv, int(indexToWrite(idx))); 194 198 writtenBndsLon(nv, idx) = boundslon(nv, int(indexToWrite(idx))); 195 } 196 else 197 { 198 writtenBndsLat(nv, idx) = 0.; 199 writtenBndsLon(nv, idx) = 0.; 200 } 199 } 201 200 } 202 201 } … … 208 207 for (int idx = 0; idx < nbWritten; ++idx) 209 208 { 210 if (i dx < domain->areavalue.numElements())211 writtenArea(idx) = domain->areavalue(indexToWrite(idx));209 if (indexToWrite(idx) < 0) 210 writtenArea(idx) = -1.; 212 211 else 213 writtenArea(idx) = 0.;212 writtenArea(idx) = domain->areavalue(indexToWrite(idx)); 214 213 } 215 214 } … … 221 220 case (MULTI_FILE) : 222 221 { 223 // if (domain->isEmpty()) return;224 225 if (server->intraCommSize > 1)226 {227 // SuperClassWriter::addDimension(lonid, domain->zoom_ni.getValue());228 // SuperClassWriter::addDimension(latid, domain->zoom_nj.getValue());229 }230 231 222 switch (domain->type) 232 223 { … … 434 425 std::vector<StdSize> start(2) ; 435 426 std::vector<StdSize> count(2) ; 436 if (domain->isEmpty()) 437 { 438 start[0]=0 ; start[1]=0 ; 439 count[0]=0 ; count[1]=0 ; 440 } 441 else 427 // Comment out because it is not working for a hole 428 // if (domain->isEmpty()) 429 // { 430 // start[0]=0 ; start[1]=0 ; 431 // count[0]=0 ; count[1]=0 ; 432 // } 433 // else 442 434 { 443 435 start[1]=domain->zoom_ibegin-domain->global_zoom_ibegin; … … 883 875 case (MULTI_FILE) : 884 876 { 877 ERROR("CNc4DataOutput::writeDomain(domain)", 878 << "[ type = multiple_file ]" 879 << " is not yet implemented for UGRID files !"); 885 880 break; 886 881 } … … 948 943 int nvertex = (domain->nvertex.isEmpty()) ? 0 : domain->nvertex; 949 944 950 CArray< size_t, 1>& indexToWrite = domain->localIndexToWriteOnServer;945 CArray<int, 1>& indexToWrite = domain->localIndexToWriteOnServer; 951 946 int nbWritten = indexToWrite.numElements(); 952 947 CArray<double,1> writtenLat, writtenLon; … … 960 955 for (int idx = 0; idx < nbWritten; ++idx) 961 956 { 962 if (i dx < domain->latvalue.numElements())963 {964 writtenLat(idx) = domain->latvalue(indexToWrite(idx));965 writtenLon(idx) = domain->lonvalue(indexToWrite(idx));966 }967 else968 {969 writtenLat(idx) = 0.;970 writtenLon(idx) = 0.;971 }957 if (indexToWrite(idx) < 0) 958 { 959 writtenLat(idx) = -1.; 960 writtenLon(idx) = -1.; 961 } 962 else 963 { 964 writtenLat(idx) = domain->latvalue(indexToWrite(idx)); 965 writtenLon(idx) = domain->lonvalue(indexToWrite(idx)); 966 } 972 967 } 973 968 } … … 984 979 for (int nv = 0; nv < nvertex; ++nv) 985 980 { 986 if (idx < boundslat.columns()) 981 if (indexToWrite(idx) < 0) 982 { 983 writtenBndsLat(nv, idx) = -1.; 984 writtenBndsLon(nv, idx) = -1.; 985 } 986 else 987 987 { 988 988 writtenBndsLat(nv, idx) = boundslat(nv, int(indexToWrite(idx))); 989 989 writtenBndsLon(nv, idx) = boundslon(nv, int(indexToWrite(idx))); 990 }991 else992 {993 writtenBndsLat(nv, idx) = 0.;994 writtenBndsLon(nv, idx) = 0.;995 990 } 996 991 } … … 1003 998 for (int idx = 0; idx < nbWritten; ++idx) 1004 999 { 1005 if (idx < domain->areavalue.numElements())1006 writtenArea(idx) = domain->areavalue(indexToWrite(idx));1007 1008 writtenArea(idx) = 0.;1000 if (indexToWrite(idx) < 0) 1001 writtenArea(idx) = -1.; 1002 else 1003 writtenArea(idx) = domain->areavalue(indexToWrite(idx)); 1009 1004 } 1010 1005 } … … 1288 1283 SuperClassWriter::definition_end(); 1289 1284 1290 CArray< size_t, 1>& indexToWrite = axis->localIndexToWriteOnServer;1285 CArray<int, 1>& indexToWrite = axis->localIndexToWriteOnServer; 1291 1286 int nbWritten = indexToWrite.numElements(); 1292 1287 CArray<double,1> axis_value(indexToWrite.numElements()); … … 1295 1290 for (int i = 0; i < nbWritten; i++) 1296 1291 { 1297 if (i < axis->value.numElements()) 1292 if (indexToWrite(i) < 0) 1293 axis_value(i) = -1; // Some value in case of a hole 1294 else 1298 1295 axis_value(i) = axis->value(indexToWrite(i)); 1299 else1300 axis_value(i) = 0.;1301 1296 } 1302 1297 } … … 1308 1303 for (int i = 0; i < nbWritten; i++) 1309 1304 { 1310 if (i < axis->label.numElements()) 1305 if (indexToWrite(i) < 0) 1306 axis_label(i) = boost::lexical_cast<string>(-1); // Some value in case of a hole 1307 else 1311 1308 axis_label(i) = axis->label(indexToWrite(i)); 1312 else1313 axis_label(i) = boost::lexical_cast<string>(0); // Write 0 as a label1314 1309 } 1315 1310 } … … 1329 1324 for (int i = 0; i < nbWritten; ++i) 1330 1325 { 1331 if (i < axis->bounds.columns()) 1326 if (indexToWrite(i) < 0) 1327 { 1328 axis_bounds(0, i) = -1.; // Some value in case of a hole 1329 axis_bounds(1, i) = -1.; 1330 } 1331 else 1332 1332 { 1333 1333 axis_bounds(0, i) = axis->bounds(0, int(indexToWrite(i))); 1334 1334 axis_bounds(1, i) = axis->bounds(1, int(indexToWrite(i))); 1335 }1336 else1337 {1338 axis_bounds(0, i) = 0.;1339 axis_bounds(1, i) = 0.;1340 1341 1335 } 1342 1336 } … … 1369 1363 for (int i = 0; i < nbWritten; ++i) 1370 1364 { 1371 if (i < axis->bounds.columns()) 1365 if (indexToWrite(i) < 0) 1366 { 1367 axis_bounds(0, i) = -1.; 1368 axis_bounds(1, i) = -1.; 1369 } 1370 else 1372 1371 { 1373 1372 axis_bounds(0, i) = axis->bounds(0, int(indexToWrite(i))); 1374 1373 axis_bounds(1, i) = axis->bounds(1, int(indexToWrite(i))); 1375 }1376 else1377 {1378 axis_bounds(0, i) = 0.;1379 axis_bounds(1, i) = 0.;1380 1374 } 1381 1375 } … … 2512 2506 if ( wtimeData) 2513 2507 { 2514 // SuperClassWriter::writeData(time_data, timeAxisId, isCollective, field->getNStep() - 1);2515 // SuperClassWriter::writeData(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1);2516 2508 SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, field->getNStep() - 1, isRoot); 2517 2509 SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1, isRoot); … … 2519 2511 if (wtimeCounter) 2520 2512 { 2521 // SuperClassWriter::writeData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1);2522 // if (timeCounterType!=record) SuperClassWriter::writeData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1);2523 2513 SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1,isRoot); 2524 2514 if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1, isRoot); … … 2596 2586 count.push_back(nZoomSizeServer[idx]); 2597 2587 } 2598 2599 2588 --idxAxis; 2600 2589 --idx; … … 2610 2599 int numElement = axisDomainOrder.numElements(); 2611 2600 int idxDomain = domainList.size() - 1, idxAxis = axisList.size() - 1; 2612 int idx = domainList.size() * 2 + axisList.size() - 1; // nZoomBeginGlobal.size() - 1;2601 int idx = domainList.size() * 2 + axisList.size() - 1; 2613 2602 2614 2603 start.reserve(nZoomBeginGlobal.size()); … … 2662 2651 if ( wtimeData) 2663 2652 { 2664 // SuperClassWriter::writeData(time_data, timeAxisId, isCollective, field->getNStep() - 1);2665 // SuperClassWriter::writeData(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1);2666 2653 SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, field->getNStep() - 1, isRoot); 2667 2654 SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1, isRoot); … … 2669 2656 if (wtimeCounter) 2670 2657 { 2671 // SuperClassWriter::writeData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1);2672 // if (timeCounterType!=record) SuperClassWriter::writeData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1);2673 2658 SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1,isRoot); 2674 2659 if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1, isRoot);
Note: See TracChangeset
for help on using the changeset viewer.