------------------------------------------------------------------------------
| 61 | |
| 62 | //------------------------------------------------------------------------------ |
| 63 | int vtkXMLHyperTreeGridWriter::WriteData() |
| 64 | { |
| 65 | // write XML header and VTK file header and file attributes |
| 66 | if (!this->StartFile()) |
| 67 | { |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | vtkIndent indent = vtkIndent().GetNextIndent(); |
| 72 | |
| 73 | // Header attributes |
| 74 | if (!this->StartPrimaryElement(indent)) |
| 75 | { |
| 76 | return 0; |
| 77 | } |
| 78 | |
| 79 | // Coordinates for grid (can be replaced by origin and scale) |
| 80 | if (!this->WriteGrid(indent.GetNextIndent())) |
| 81 | { |
| 82 | return 0; |
| 83 | } |
| 84 | |
| 85 | if (this->GetDataSetMajorVersion() == 0 && !this->WriteTrees_0(indent.GetNextIndent())) |
| 86 | { |
| 87 | return 0; |
| 88 | } |
| 89 | else if (this->GetDataSetMajorVersion() == 1 && !this->WriteTrees_1(indent.GetNextIndent())) |
| 90 | { |
| 91 | return 0; |
| 92 | } |
| 93 | else if (this->GetDataSetMajorVersion() >= 2 && !this->WriteTrees_2(indent.GetNextIndent())) |
| 94 | { |
| 95 | return 0; |
| 96 | } |
| 97 | |
| 98 | this->WriteFieldData(indent.GetNextIndent()); |
| 99 | |
| 100 | if (!this->FinishPrimaryElement(indent)) |
| 101 | { |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | // Write all appended data by tree using Helper function |
| 106 | if (this->DataMode == vtkXMLWriter::Appended) |
| 107 | { |
| 108 | vtkHyperTreeGrid* input = this->GetInput(); |
| 109 | vtkCellData* pd = input->GetCellData(); |
| 110 | vtkIdType numberOfCellDataArrays = pd->GetNumberOfArrays(); |
| 111 | |
| 112 | this->StartAppendedData(); |
| 113 | |
| 114 | // Write the field data arrays. |
| 115 | if (this->FieldDataOM->GetNumberOfElements()) |
| 116 | { |
| 117 | vtkNew<vtkFieldData> fieldDataCopy; |
| 118 | this->UpdateFieldData(fieldDataCopy); |
| 119 | |
| 120 | this->WriteFieldDataAppendedData(fieldDataCopy, this->CurrentTimeIndex, this->FieldDataOM); |
nothing calls this directly
no test coverage detected