------------------------------------------------------------------------------ Description: Helper function that reads the particle coordinates NOTE: it is assumed that H5DOpen has been called on the internal file index this->FileIndex.
| 25 | // NOTE: it is assumed that H5DOpen has been called on the |
| 26 | // internal file index this->FileIndex. |
| 27 | VTK_ABI_NAMESPACE_BEGIN |
| 28 | static void GetParticleCoordinates(hid_t& dataIdx, std::vector<double>& xcoords, |
| 29 | std::vector<double>& ycoords, std::vector<double>& zcoords, vtkFlashReaderInternal* iReader, |
| 30 | int NumParticles) |
| 31 | { |
| 32 | |
| 33 | assert("pre: internal reader should not be nullptr" && (iReader != nullptr)); |
| 34 | |
| 35 | hid_t theTypes[3]; |
| 36 | theTypes[0] = theTypes[1] = theTypes[2] = H5I_UNINIT; |
| 37 | xcoords.resize(NumParticles); |
| 38 | ycoords.resize(NumParticles); |
| 39 | zcoords.resize(NumParticles); |
| 40 | |
| 41 | if (iReader->FileFormatVersion < FLASH_READER_FLASH3_FFV8) |
| 42 | { |
| 43 | theTypes[0] = H5Tcreate(H5T_COMPOUND, sizeof(double)); |
| 44 | theTypes[1] = H5Tcreate(H5T_COMPOUND, sizeof(double)); |
| 45 | theTypes[2] = H5Tcreate(H5T_COMPOUND, sizeof(double)); |
| 46 | H5Tinsert(theTypes[0], "particle_x", 0, H5T_NATIVE_DOUBLE); |
| 47 | H5Tinsert(theTypes[1], "particle_y", 0, H5T_NATIVE_DOUBLE); |
| 48 | H5Tinsert(theTypes[2], "particle_z", 0, H5T_NATIVE_DOUBLE); |
| 49 | } |
| 50 | |
| 51 | // Read the coordinates from the file |
| 52 | switch (iReader->NumberOfDimensions) |
| 53 | { |
| 54 | case 1: |
| 55 | if (iReader->FileFormatVersion < FLASH_READER_FLASH3_FFV8) |
| 56 | { |
| 57 | H5Dread(dataIdx, theTypes[0], H5S_ALL, H5S_ALL, H5P_DEFAULT, xcoords.data()); |
| 58 | } |
| 59 | else |
| 60 | { |
| 61 | iReader->ReadParticlesComponent(dataIdx, "Particles/posx", xcoords.data()); |
| 62 | } |
| 63 | break; |
| 64 | case 2: |
| 65 | if (iReader->FileFormatVersion < FLASH_READER_FLASH3_FFV8) |
| 66 | { |
| 67 | H5Dread(dataIdx, theTypes[0], H5S_ALL, H5S_ALL, H5P_DEFAULT, xcoords.data()); |
| 68 | H5Dread(dataIdx, theTypes[1], H5S_ALL, H5S_ALL, H5P_DEFAULT, ycoords.data()); |
| 69 | } |
| 70 | else |
| 71 | { |
| 72 | iReader->ReadParticlesComponent(dataIdx, "Particles/posx", xcoords.data()); |
| 73 | iReader->ReadParticlesComponent(dataIdx, "Particles/posy", ycoords.data()); |
| 74 | } |
| 75 | break; |
| 76 | case 3: |
| 77 | if (iReader->FileFormatVersion < FLASH_READER_FLASH3_FFV8) |
| 78 | { |
| 79 | H5Dread(dataIdx, theTypes[0], H5S_ALL, H5S_ALL, H5P_DEFAULT, xcoords.data()); |
| 80 | H5Dread(dataIdx, theTypes[1], H5S_ALL, H5S_ALL, H5P_DEFAULT, ycoords.data()); |
| 81 | H5Dread(dataIdx, theTypes[2], H5S_ALL, H5S_ALL, H5P_DEFAULT, zcoords.data()); |
| 82 | } |
| 83 | else |
| 84 | { |
no test coverage detected