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

Method WriteTensorData

IO/Legacy/vtkDataWriter.cxx:1753–1792  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1751
1752//------------------------------------------------------------------------------
1753int 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//------------------------------------------------------------------------------
1795int vtkDataWriter::WriteGlobalIdData(ostream* fp, vtkDataArray* globalIds, vtkIdType num)

Callers 5

WriteCellDataMethod · 0.95
WritePointDataMethod · 0.95
WriteVertexDataMethod · 0.95
WriteEdgeDataMethod · 0.95
WriteRowDataMethod · 0.95

Calls 6

WriteArrayMethod · 0.95
format_to_nFunction · 0.50
GetNameMethod · 0.45
EncodeStringMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetDataTypeMethod · 0.45

Tested by

no test coverage detected