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

Method WriteDisplacementFile

IO/Geometry/vtkBYUWriter.cxx:212–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212void vtkBYUWriter::WriteDisplacementFile(int numPts)
213{
214 FILE* dispFp;
215 int i;
216 double* v;
217 vtkDataArray* inVectors;
218 vtkPolyData* input = this->GetInput();
219
220 if (this->WriteDisplacement && this->DisplacementFileName &&
221 (inVectors = input->GetPointData()->GetVectors()) != nullptr)
222 {
223 if (!(dispFp = vtksys::SystemTools::Fopen(this->DisplacementFileName, "w")))
224 {
225 vtkErrorMacro(<< "Couldn't open displacement file");
226 this->SetErrorCode(vtkErrorCode::CannotOpenFileError);
227 return;
228 }
229 }
230 else
231 {
232 return;
233 }
234 //
235 // Write data
236 //
237 for (i = 0; i < numPts; i++)
238 {
239 v = inVectors->GetTuple(i);
240 vtk::print(dispFp, "{:e} {:e} {:e}", v[0], v[1], v[2]);
241 if ((i % 2))
242 {
243 vtk::print(dispFp, "\n");
244 }
245 }
246
247 vtkDebugMacro(<< "Wrote " << numPts << " displacements");
248 fclose(dispFp);
249}
250
251void vtkBYUWriter::WriteScalarFile(int numPts)
252{

Callers 1

WriteDataMethod · 0.95

Calls 5

GetInputMethod · 0.95
printFunction · 0.50
GetVectorsMethod · 0.45
GetPointDataMethod · 0.45
GetTupleMethod · 0.45

Tested by

no test coverage detected