| 91 | // -------------------------------------------------------------------------- |
| 92 | |
| 93 | bool OpenFile() |
| 94 | { |
| 95 | if (this->FileId > -1) |
| 96 | { |
| 97 | // Already open, skip... |
| 98 | return true; |
| 99 | } |
| 100 | |
| 101 | hid_t fileAccessPropListID = H5Pcreate(H5P_FILE_ACCESS); |
| 102 | if (fileAccessPropListID < 0) |
| 103 | { |
| 104 | vtkErrorWithObjectMacro(this->Owner, "Couldn't H5Pcreate"); |
| 105 | return false; |
| 106 | } |
| 107 | herr_t err = H5Pset_fclose_degree(fileAccessPropListID, H5F_CLOSE_SEMI); |
| 108 | if (err < 0) |
| 109 | { |
| 110 | vtkErrorWithObjectMacro(this->Owner, "Couldn't set file close access"); |
| 111 | return false; |
| 112 | } |
| 113 | if ((this->FileId = H5Fopen(this->FileName.c_str(), H5F_ACC_RDONLY, fileAccessPropListID)) < 0) |
| 114 | { |
| 115 | vtkErrorWithObjectMacro(this->Owner, "Cannot be a VERA file (" << this->FileName << ")"); |
| 116 | return false; |
| 117 | } |
| 118 | H5Pclose(fileAccessPropListID); |
| 119 | return true; |
| 120 | } |
| 121 | |
| 122 | //---------------------------------------------------------------------------- |
| 123 |
no test coverage detected