MCPcopy Create free account
hub / github.com/Kitware/VTK / Initialize

Method Initialize

IO/Parallel/vtkMultiBlockPLOT3DReaderInternals.cxx:394–489  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

392
393//------------------------------------------------------------------------------
394bool vtkMultiBlockPLOT3DReaderRecord::Initialize(FILE* fp, vtkTypeUInt64 offset,
395 const vtkMultiBlockPLOT3DReaderInternals::InternalSettings& settings,
396 vtkMultiProcessController* controller)
397{
398 this->SubRecords.clear();
399 if (!settings.BinaryFile || !settings.HasByteCount)
400 {
401 return true;
402 }
403 const int rank = controller ? controller->GetLocalProcessId() : 0;
404 int error = 0;
405 if (rank == 0)
406 {
407 vtkTypeUInt64 pos = vtk_ftell(fp);
408 unsigned int leadingLengthField;
409 int signBit = 0;
410 try
411 {
412 do
413 {
414 vtkSubRecord subrecord;
415 subrecord.HeaderOffset = offset;
416 vtkTypeUInt64 dataOffset = subrecord.HeaderOffset + sizeof(int);
417 vtk_fseek(fp, offset, SEEK_SET);
418 if (fread(&leadingLengthField, sizeof(unsigned int), 1, fp) != 1)
419 {
420 throw Plot3DException();
421 }
422 if (settings.ByteOrder == vtkMultiBlockPLOT3DReader::FILE_LITTLE_ENDIAN)
423 {
424 vtkByteSwap::Swap4LE(&leadingLengthField);
425 }
426 else
427 {
428 vtkByteSwap::Swap4BE(&leadingLengthField);
429 }
430 signBit = (0x80000000 & leadingLengthField) ? 1 : 0;
431 if (signBit)
432 {
433 unsigned int length = 0xffffffff ^ (leadingLengthField - 1);
434 subrecord.FooterOffset = dataOffset + length;
435 }
436 else
437 {
438 subrecord.FooterOffset = dataOffset + leadingLengthField;
439 }
440 this->SubRecords.push_back(subrecord);
441 offset = subrecord.FooterOffset + sizeof(int);
442 } while (signBit == 1);
443 }
444 catch (Plot3DException&)
445 {
446 error = 1;
447 }
448 vtk_fseek(fp, pos, SEEK_SET);
449 }
450
451 if (controller == nullptr)

Callers 15

RequestInformationMethod · 0.45
create_geometryMethod · 0.45
create_tracer_UGMethod · 0.45
create_amr_UG_1DMethod · 0.45
create_amr_UG_2DMethod · 0.45
create_amr_UG_3DMethod · 0.45
create_amr_HTGMethod · 0.45
TestPIOReaderHDF5Function · 0.45
RequestDataMethod · 0.45
PLSDynaReaderFunction · 0.45

Calls 8

Plot3DExceptionClass · 0.85
clearMethod · 0.45
GetLocalProcessIdMethod · 0.45
push_backMethod · 0.45
BroadcastMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
resizeMethod · 0.45