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

Method OpenFileForDataRead

IO/MPIParallel/vtkMPIMultiBlockPLOT3DReader.cxx:182–212  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

180
181//------------------------------------------------------------------------------
182int vtkMPIMultiBlockPLOT3DReader::OpenFileForDataRead(void*& vfp, const char* fname)
183{
184 if (!this->CanUseMPIIO())
185 {
186 return this->Superclass::OpenFileForDataRead(vfp, fname);
187 }
188
189 vtkMPICommunicator* mpiComm =
190 vtkMPICommunicator::SafeDownCast(this->Controller->GetCommunicator());
191 assert(mpiComm);
192
193 vtkMPIOpaqueFileHandle* handle = new vtkMPIOpaqueFileHandle();
194 try
195 {
196 if (MPI_File_open(*mpiComm->GetMPIComm()->GetHandle(), const_cast<char*>(fname),
197 MPI_MODE_RDONLY, MPI_INFO_NULL, &handle->Handle) != MPI_SUCCESS)
198 {
199 this->SetErrorCode(vtkErrorCode::FileNotFoundError);
200 vtkErrorMacro("File: " << fname << " not found.");
201 throw MPIPlot3DException();
202 }
203 }
204 catch (const MPIPlot3DException&)
205 {
206 delete handle;
207 vfp = nullptr;
208 return VTK_ERROR;
209 }
210 vfp = handle;
211 return VTK_OK;
212}
213
214//------------------------------------------------------------------------------
215void vtkMPIMultiBlockPLOT3DReader::CloseFile(void* vfp)

Callers

nothing calls this directly

Calls 5

CanUseMPIIOMethod · 0.95
MPIPlot3DExceptionClass · 0.85
assertFunction · 0.50
GetCommunicatorMethod · 0.45
GetHandleMethod · 0.45

Tested by

no test coverage detected