| 210 | } |
| 211 | |
| 212 | void 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 | |
| 251 | void vtkBYUWriter::WriteScalarFile(int numPts) |
| 252 | { |
no test coverage detected