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

Method LoadVariableData

IO/MPIParallel/vtkPWindBladeReader.cxx:200–245  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Load one variable data array of BLOCK structure into ParaView ------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

198// Load one variable data array of BLOCK structure into ParaView
199//------------------------------------------------------------------------------
200void vtkPWindBladeReader::LoadVariableData(int var)
201{
202 if (!vtkMPIController::GetGlobalController()->IsA("vtkMPIController"))
203 {
204 this->Superclass::LoadVariableData(var);
205 return;
206 }
207
208 this->Data[var]->Delete();
209 this->Data[var] = vtkFloatArray::New();
210 this->Data[var]->SetName(VariableName[var].c_str());
211
212 // Skip to the appropriate variable block and read byte count
213 char native[7] = "native";
214 MPICall(MPI_File_set_view(this->PInternal->FilePtr, this->VariableOffset[var], MPI_BYTE, MPI_BYTE,
215 native, MPI_INFO_NULL));
216
217 int numberOfComponents = 0, planeSize = 0, rowSize;
218 float* varData = nullptr;
219 float* block = new float[this->BlockSize];
220 this->InitVariableData(var, numberOfComponents, varData, planeSize, rowSize);
221 for (int comp = 0; comp < numberOfComponents; comp++)
222 {
223 MPI_Status status;
224 MPICall(
225 MPI_File_read_all(this->PInternal->FilePtr, block, this->BlockSize, MPI_FLOAT, &status));
226
227 int pos = comp;
228 for (int k = this->SubExtent[4]; k <= this->SubExtent[5]; k++)
229 {
230 for (int j = this->SubExtent[2]; j <= this->SubExtent[3]; j++)
231 {
232 for (int i = this->SubExtent[0]; i <= this->SubExtent[1]; i++)
233 {
234 int index = (k * planeSize) + (j * rowSize) + i;
235 varData[pos] = block[index];
236 pos += numberOfComponents;
237 }
238 }
239 }
240
241 // Skip closing and opening byte sizes
242 MPICall(MPI_File_seek(this->PInternal->FilePtr, (2 * sizeof(int)), MPI_SEEK_CUR));
243 }
244 delete[] block;
245}
246
247//------------------------------------------------------------------------------
248// Load one variable data array of BLOCK structure into ParaView

Callers

nothing calls this directly

Calls 6

IsAMethod · 0.80
InitVariableDataMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
SetNameMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected