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

Method GetBlockAttribute

IO/AMR/vtkAMReXGridReaderInternal.cxx:942–1057  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

940}
941
942void vtkAMReXGridReaderInternal::GetBlockAttribute(
943 const char* attribute, int blockIdx, vtkDataSet* pDataSet)
944{
945 if (this->headersAreRead)
946 {
947 if (attribute == nullptr || blockIdx < 0 || pDataSet == nullptr ||
948 blockIdx >= this->GetNumberOfBlocks())
949 {
950 return;
951 }
952
953 //
954 // orders.
955 //
956 // int big_float_order[] = { 1, 2, 3, 4 };
957 constexpr int little_float_order[] = { 4, 3, 2, 1 };
958 // int mid_float_order_2[] = { 2, 1, 4, 3 };
959 // int big_double_order[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
960 constexpr int little_double_order[] = { 8, 7, 6, 5, 4, 3, 2, 1 };
961 // int mid_double_order_2[] = { 2, 1, 4, 3, 6, 5, 8, 7 };
962 //
963 // formats.
964 //
965 constexpr long ieee_float[] = { 32L, 8L, 23L, 0L, 1L, 9L, 0L, 0x7FL };
966 constexpr long ieee_double[] = { 64L, 11L, 52L, 0L, 1L, 12L, 0L, 0x3FFL };
967
968 vtkIdType offsetOfAttribute = this->GetOffsetOfAttribute(attribute);
969 int theLevel = this->GetBlockLevel(blockIdx);
970 int blockIdxWithinLevel = this->GetBlockIndexWithinLevel(blockIdx, theLevel);
971 if (debugReader)
972 std::cout << "blockIdx " << blockIdx << " attribute " << attribute << " offset of attribute "
973 << offsetOfAttribute << " Level " << theLevel << " blockIdx within Level "
974 << blockIdxWithinLevel << std::endl;
975 const std::string FABFileName = this->FileName + "/" + this->Header->levelPrefix[theLevel] +
976 "/" + this->LevelHeader[theLevel]->levelFABFile[blockIdxWithinLevel];
977 if (debugReader)
978 std::cout << "FABFile " << FABFileName << " Offset "
979 << this->LevelHeader[theLevel]->levelFileOffset[blockIdxWithinLevel] << std::endl;
980 std::filebuf fb;
981 if (fb.open(FABFileName, std::ios::binary | std::ios::in))
982 {
983 std::istream is(&fb);
984 is.seekg(this->LevelHeader[theLevel]->levelFileOffset[blockIdxWithinLevel]);
985 //
986 // Read FAB Header
987 //
988 this->ReadFAB(is);
989 // int version =
990 this->ReadVersion(is);
991 int dimension = this->Header->dim;
992 RealDescriptor* ird = this->ReadRealDescriptor(is);
993 std::vector<int> boxArray(3 * dimension);
994 std::vector<int> boxArrayDim(dimension);
995 const auto numberOfPoints = ReadBoxArray(is, boxArray.data(), boxArrayDim.data());
996 // int numberOfAttributes =
997 this->ReadNumberOfAttributes(is);
998
999 //

Callers

nothing calls this directly

Calls 15

GetNumberOfBlocksMethod · 0.95
GetOffsetOfAttributeMethod · 0.95
GetBlockLevelMethod · 0.95
ReadFABMethod · 0.95
ReadVersionMethod · 0.95
ReadRealDescriptorMethod · 0.95
ReadBlockAttributeMethod · 0.95
numBytesMethod · 0.80
openMethod · 0.45

Tested by

no test coverage detected