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

Method readData

IO/Parallel/vtkNek5000Reader.cxx:542–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

540//----------------------------------------------------------------------------
541
542void vtkNek5000Reader::readData(char* dfName)
543{
544 long total_header_size = 136 + (this->numBlocks * 4);
545 long read_location;
546 long read_size;
547 std::ifstream dfPtr;
548 float* dataPtr;
549 double* tmpDblPtr = nullptr;
550
551 dfPtr.open(dfName, std::ifstream::binary);
552 if (dfPtr.is_open())
553 {
554 // if this data file includes the mesh, add it to header size
555 if (this->timestep_has_mesh[this->ActualTimeStep])
556 {
557 long offset1;
558 offset1 = this->numBlocks;
559 offset1 *= this->totalBlockSize;
560 if (this->MeshIs3D)
561 offset1 *= 3; // account for X, Y and Z
562 else
563 offset1 *= 2; // account only for X, Y
564 offset1 *= this->precision;
565 total_header_size += offset1;
566 }
567 // currently reading a block at a time, if we need doubles, allocate an array for a block
568 if (this->precision == 8)
569 {
570 tmpDblPtr = new double[this->totalBlockSize * 3];
571 }
572
573 // for each variable
574 long var_offset;
575 long l_blocksize, scalar_offset;
576 scalar_offset = this->numBlocks;
577 scalar_offset *= this->totalBlockSize;
578 scalar_offset *= this->precision;
579
580 for (auto i = 0; i < this->num_vars; i++)
581 {
582 if (i < 2)
583 { // if Velocity or Velocity Magnitude
584 var_offset = 0;
585 }
586 else
587 {
588 if (this->MeshIs3D)
589 var_offset = (3 + (i - 2)) * scalar_offset; // counts VxVyVz
590 else
591 var_offset = (2 + (i - 2)) * scalar_offset; // counts VxVy
592 }
593 dataPtr = this->dataArray[i];
594
595 if (dataPtr)
596 {
597 if (strcmp(this->var_names[i], "Velocity") == 0 && !this->MeshIs3D)
598 {
599 read_size = this->totalBlockSize * 2;

Callers 1

RequestDataMethod · 0.95

Calls 9

GetPointArrayStatusMethod · 0.95
fill_nFunction · 0.85
ByteSwap32Function · 0.85
ByteSwap64Function · 0.85
is_openMethod · 0.80
sqrtFunction · 0.50
openMethod · 0.45
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected