------------------------------------------------------------------------------
| 1751 | |
| 1752 | //------------------------------------------------------------------------------ |
| 1753 | int vtkDataWriter::WriteTensorData(ostream* fp, vtkDataArray* tensors, vtkIdType num) |
| 1754 | { |
| 1755 | char* tensorsName; |
| 1756 | // Buffer size is size of array name times four because |
| 1757 | // in theory there could be array name consisting of only |
| 1758 | // weird symbols. |
| 1759 | if (!this->TensorsName) |
| 1760 | { |
| 1761 | if (tensors->GetName() && strlen(tensors->GetName())) |
| 1762 | { |
| 1763 | tensorsName = new char[strlen(tensors->GetName()) * 4 + 1]; |
| 1764 | this->EncodeString(tensorsName, tensors->GetName()); |
| 1765 | } |
| 1766 | else |
| 1767 | { |
| 1768 | tensorsName = new char[strlen("tensors") + 1]; |
| 1769 | strcpy(tensorsName, "tensors"); |
| 1770 | } |
| 1771 | } |
| 1772 | else |
| 1773 | { |
| 1774 | tensorsName = new char[strlen(this->TensorsName) * 4 + 1]; |
| 1775 | this->EncodeString(tensorsName, this->TensorsName); |
| 1776 | } |
| 1777 | |
| 1778 | *fp << "TENSORS"; |
| 1779 | int numComp = 9; |
| 1780 | if (tensors->GetNumberOfComponents() == 6) |
| 1781 | { |
| 1782 | *fp << "6"; |
| 1783 | numComp = 6; |
| 1784 | } |
| 1785 | *fp << " "; |
| 1786 | char format[1024]; |
| 1787 | auto result = vtk::format_to_n(format, sizeof(format), "{:s} {:s}\n", tensorsName, "{:s}"); |
| 1788 | *result.out = '\0'; |
| 1789 | delete[] tensorsName; |
| 1790 | |
| 1791 | return this->WriteArray(fp, tensors->GetDataType(), tensors, format, num, numComp); |
| 1792 | } |
| 1793 | |
| 1794 | //------------------------------------------------------------------------------ |
| 1795 | int vtkDataWriter::WriteGlobalIdData(ostream* fp, vtkDataArray* globalIds, vtkIdType num) |
no test coverage detected