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

Method GetExtraMultiFabBlockAttribute

IO/AMR/vtkAMReXGridReaderInternal.cxx:1059–1201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1057}
1058
1059void vtkAMReXGridReaderInternal::GetExtraMultiFabBlockAttribute(
1060 const char* attribute, int blockIdx, vtkDataSet* pDataSet)
1061{
1062 if (this->extraMultiFabHeadersAreRead)
1063 {
1064 if (attribute == nullptr || blockIdx < 0 || pDataSet == nullptr ||
1065 blockIdx >= this->GetNumberOfBlocks())
1066 {
1067 return;
1068 }
1069
1070 //
1071 // orders.
1072 //
1073 // int big_float_order[] = { 1, 2, 3, 4 };
1074 constexpr int little_float_order[] = { 4, 3, 2, 1 };
1075 // int mid_float_order_2[] = { 2, 1, 4, 3 };
1076 // int big_double_order[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
1077 constexpr int little_double_order[] = { 8, 7, 6, 5, 4, 3, 2, 1 };
1078 // int mid_double_order_2[] = { 2, 1, 4, 3, 6, 5, 8, 7 };
1079 //
1080 // formats.
1081 //
1082 constexpr long ieee_float[] = { 32L, 8L, 23L, 0L, 1L, 9L, 0L, 0x7FL };
1083 constexpr long ieee_double[] = { 64L, 11L, 52L, 0L, 1L, 12L, 0L, 0x3FFL };
1084
1085 // get the index of the extra multifab
1086 if (this->Header->extraMultiFabParsedVarNames[attribute].empty())
1087 {
1088 return; // variable is malformed or nonexistent
1089 }
1090 int fabIndex = this->Header->extraMultiFabParsedVarMap[std::string(attribute)];
1091 if (fabIndex == -1)
1092 {
1093 return; // variable not found in a multifab
1094 }
1095
1096 int theLevel = this->GetBlockLevel(blockIdx);
1097 int blockIdxWithinLevel = this->GetBlockIndexWithinLevel(blockIdx, theLevel);
1098
1099 // get file name
1100 const std::string FABFileName = this->FileName + "/" + this->Header->levelPrefix[theLevel] +
1101 "/" + this->ExtraMultiFabHeader[fabIndex][theLevel]->levelFABFile[blockIdxWithinLevel];
1102
1103 if (debugReader)
1104 {
1105 std::cout
1106 << "FABFile " << FABFileName << " Offset "
1107 << this->ExtraMultiFabHeader[fabIndex][theLevel]->levelFileOffset[blockIdxWithinLevel]
1108 << std::endl;
1109 }
1110
1111 std::filebuf fb;
1112 if (fb.open(FABFileName, std::ios::binary | std::ios::in))
1113 {
1114 std::istream is(&fb);
1115 is.seekg(this->ExtraMultiFabHeader[fabIndex][theLevel]->levelFileOffset[blockIdxWithinLevel]);
1116 //

Callers 1

GetAMRGridPointDataMethod · 0.80

Calls 15

GetNumberOfBlocksMethod · 0.95
GetBlockLevelMethod · 0.95
ReadFABMethod · 0.95
ReadVersionMethod · 0.95
ReadRealDescriptorMethod · 0.95
ReadBlockAttributeMethod · 0.95
numBytesMethod · 0.80
stringClass · 0.50

Tested by

no test coverage detected