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

Method WriteVectorData

IO/Legacy/vtkDataWriter.cxx:1645–1678  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1643
1644//------------------------------------------------------------------------------
1645int 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
1680int vtkDataWriter::WriteNormalData(ostream* fp, vtkDataArray* normals, vtkIdType num)
1681{

Callers 5

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

Calls 5

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

Tested by

no test coverage detected