------------------------------------------------------------------------------ Description: Returns the double array
| 72 | // Description: |
| 73 | // Returns the double array |
| 74 | static void GetDoubleArrayByName(const hid_t rootIdx, const char* name, std::vector<double>& array) |
| 75 | { |
| 76 | // turn off warnings |
| 77 | void* pContext = nullptr; |
| 78 | H5E_auto_t erorFunc; |
| 79 | H5Eget_auto(&erorFunc, &pContext); |
| 80 | H5Eset_auto(nullptr, nullptr); |
| 81 | |
| 82 | hid_t arrayIdx = H5Dopen(rootIdx, name); |
| 83 | if (arrayIdx < 0) |
| 84 | { |
| 85 | vtkGenericWarningMacro("Cannot open array: " << name << "\n"); |
| 86 | return; |
| 87 | } |
| 88 | |
| 89 | // turn warnings back on |
| 90 | H5Eset_auto(erorFunc, pContext); |
| 91 | pContext = nullptr; |
| 92 | |
| 93 | // get the number of particles |
| 94 | hsize_t dimValus[3]; |
| 95 | hid_t spaceIdx = H5Dget_space(arrayIdx); |
| 96 | H5Sget_simple_extent_dims(spaceIdx, dimValus, nullptr); |
| 97 | int numbPnts = dimValus[0]; |
| 98 | |
| 99 | array.resize(numbPnts); |
| 100 | H5Dread(arrayIdx, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, array.data()); |
| 101 | |
| 102 | // H5Dclose( spaceIdx ); |
| 103 | // H5Dclose( arrayIdx ); |
| 104 | } |
| 105 | |
| 106 | //------------------------------------------------------------------------------ |
| 107 | // END of HDF5 Utility Routine definitions |
no test coverage detected