------------------------------------------------------------------------------
| 1643 | |
| 1644 | //------------------------------------------------------------------------------ |
| 1645 | int vtkDataWriter::WriteVectorData(ostream* fp, vtkDataArray* vectors, vtkIdType num) |
| 1646 | { |
| 1647 | *fp << "VECTORS "; |
| 1648 | |
| 1649 | char* vectorsName; |
| 1650 | // Buffer size is size of array name times four because |
| 1651 | // in theory there could be array name consisting of only |
| 1652 | // weird symbols. |
| 1653 | if (!this->VectorsName) |
| 1654 | { |
| 1655 | if (vectors->GetName() && strlen(vectors->GetName())) |
| 1656 | { |
| 1657 | vectorsName = new char[strlen(vectors->GetName()) * 4 + 1]; |
| 1658 | this->EncodeString(vectorsName, vectors->GetName()); |
| 1659 | } |
| 1660 | else |
| 1661 | { |
| 1662 | vectorsName = new char[strlen("vectors") + 1]; |
| 1663 | strcpy(vectorsName, "vectors"); |
| 1664 | } |
| 1665 | } |
| 1666 | else |
| 1667 | { |
| 1668 | vectorsName = new char[strlen(this->VectorsName) * 4 + 1]; |
| 1669 | this->EncodeString(vectorsName, this->VectorsName); |
| 1670 | } |
| 1671 | |
| 1672 | char format[1024]; |
| 1673 | auto result = vtk::format_to_n(format, sizeof(format), "{:s} {:s}\n", vectorsName, "{:s}"); |
| 1674 | *result.out = '\0'; |
| 1675 | delete[] vectorsName; |
| 1676 | |
| 1677 | return this->WriteArray(fp, vectors->GetDataType(), vectors, format, num, 3); |
| 1678 | } |
| 1679 | |
| 1680 | int vtkDataWriter::WriteNormalData(ostream* fp, vtkDataArray* normals, vtkIdType num) |
| 1681 | { |
no test coverage detected