Changeset 17288
- Timestamp:
- 10/21/13 13:27:01 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/zofits.h
r17285 r17288 182 182 SetInt( "ZSHRINK", 1, "Catalog shrink factor"); 183 183 184 fCatalogSize = 0; 184 fCatalogSize = 0; 185 fRealRowWidth = 0; 186 fCatalogOffset = 0; 187 fCatalogSize = 0; 188 fCheckOffset = 0; 189 190 fRealColumns.clear(); 185 191 fCatalog.clear(); 192 fCatalogSum.reset(); 186 193 fRawSum.reset(); 187 194 } … … 286 293 std::rethrow_exception(fThreadsException); 287 294 #endif 295 288 296 //copy current row to pool or rows waiting for compression 289 297 char* target_location = fSmartBuffer.get() + fRealRowWidth*(fTable.num_rows%fNumRowsPerTile); … … 362 370 363 371 /// Shrinks a catalog that is too long to fit into the reserved space at the beginning of the file. 364 voidShrinkCatalog()372 const uint32_t ShrinkCatalog() 365 373 { 366 374 //add empty row to get either the target number of rows, or a multiple of the allowed size … … 370 378 //did we write more rows than what the catalog could host ? 371 379 if (fCatalogSize <= fNumTiles) // nothing to do 372 return ;380 return 1; 373 381 374 382 //always exact as extra rows were added just above … … 409 417 SetInt("ZTILELEN", fNumRowsPerTile); 410 418 SetInt("ZSHRINK", shrink_factor); 419 420 return shrink_factor; 411 421 } 412 422 … … 457 467 } 458 468 459 ShrinkCatalog();469 const uint32_t shrink_factor = ShrinkCatalog(); 460 470 461 471 //update header keywords … … 471 481 SetInt("NAXIS1", total_catalog_width); 472 482 SetInt("NAXIS2", total_num_tiles_written); 473 SetStr("RAWSUM", std::to_string( fRawSum.val()));483 SetStr("RAWSUM", std::to_string((long long int)(fRawSum.val()))); 474 484 475 485 const float compression_ratio = (float)(fRealRowWidth*fTable.num_rows)/(float)heap_size; … … 489 499 490 500 std::ofstream::close(); 501 502 fSmartBuffer = std::shared_ptr<char>(); 503 504 //restore the number of rows per tile in case the catalog has been shrinked 505 if (shrink_factor != 1) 506 fNumRowsPerTile /= shrink_factor; 491 507 492 508 if ((checksm+fDataSum).valid()) … … 530 546 fRealColumns.emplace_back(col, comp); 531 547 532 SetStr("ZFORM"+std::to_string( fRealColumns.size()), std::to_string(cnt)+typechar, "format of "+name+" "+CommentFromType(typechar));533 SetStr("ZCTYP"+std::to_string( fRealColumns.size()), "FACT", "Compression type: FACT");548 SetStr("ZFORM"+std::to_string((long long int)(fRealColumns.size())), std::to_string((long long int)(cnt))+typechar, "format of "+name+" "+CommentFromType(typechar)); 549 SetStr("ZCTYP"+std::to_string((long long int)(fRealColumns.size())), "FACT", "Compression type: FACT"); 534 550 535 551 return true;
Note:
See TracChangeset
for help on using the changeset viewer.