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

Method SetupFileView

IO/MPIImage/vtkMPIImageReader.cxx:203–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201//------------------------------------------------------------------------------
202#ifdef VTK_USE_MPI_IO
203void vtkMPIImageReader::SetupFileView(vtkMPIOpaqueFileHandle& file, const int extent[6])
204{
205 int arrayOfSizes[3];
206 int arrayOfSubSizes[3];
207 int arrayOfStarts[3];
208
209 for (int i = 0; i < this->GetFileDimensionality(); i++)
210 {
211 arrayOfSizes[i] = this->DataExtent[i * 2 + 1] - this->DataExtent[i * 2] + 1;
212 arrayOfSubSizes[i] = extent[i * 2 + 1] - extent[i * 2] + 1;
213 arrayOfStarts[i] = extent[i * 2];
214 }
215 // Adjust for base size of data type and tuple size.
216 int baseSize = this->GetDataScalarTypeSize() * this->NumberOfScalarComponents;
217 arrayOfSizes[0] *= baseSize;
218 arrayOfSubSizes[0] *= baseSize;
219 arrayOfStarts[0] *= baseSize;
220
221 // Create a view in MPIIO.
222 MPI_Datatype view;
223 MPICall(MPI_Type_create_subarray(this->GetFileDimensionality(), arrayOfSizes, arrayOfSubSizes,
224 arrayOfStarts, MPI_ORDER_FORTRAN, MPI_BYTE, &view));
225 MPICall(MPI_Type_commit(&view));
226 MPICall(MPI_File_set_view(file.Handle, this->GetHeaderSize(file), MPI_BYTE, view,
227 const_cast<char*>("native"), MPI_INFO_NULL));
228 MPICall(MPI_Type_free(&view));
229}
230#else // VTK_USE_MPI_IO
231void vtkMPIImageReader::SetupFileView(vtkMPIOpaqueFileHandle&, const int[6])
232{

Callers 1

ReadSliceMethod · 0.95

Calls 2

GetDataScalarTypeSizeMethod · 0.95
GetHeaderSizeMethod · 0.95

Tested by

no test coverage detected