VTK  9.0.1
vtkXMLHyperTreeGridWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkXMLHyperTreeGridWriter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
63 #ifndef vtkXMLHyperTreeGridWriter_h
64 #define vtkXMLHyperTreeGridWriter_h
65 
66 #include "vtkBitArray.h" // For ivar
67 #include "vtkIOXMLModule.h" // For export macro
68 #include "vtkXMLWriter.h"
69 
70 #include <vector> // std::vector
71 
74 class vtkHyperTree;
75 class vtkHyperTreeGrid;
78 
79 class VTKIOXML_EXPORT vtkXMLHyperTreeGridWriter : public vtkXMLWriter
80 {
81 public:
83  void PrintSelf(ostream& os, vtkIndent indent) override;
85 
90 
94  const char* GetDefaultFileExtension() override;
95 
104  vtkSetMacro(DataSetMajorVersion, int);
105  vtkSetMacro(DataSetMinorVersion, int);
106 
107 protected:
109  ~vtkXMLHyperTreeGridWriter() override;
110 
111  const char* GetDataSetName() override;
112 
119  int GetDataSetMajorVersion() override { return DataSetMajorVersion; }
120  int GetDataSetMinorVersion() override { return DataSetMinorVersion; }
121 
122  // Specify that we require HyperTreeGrid input
123  int FillInputPortInformation(int port, vtkInformation* info) override;
124 
125  // The most important method, make the XML file for my input.
126  int WriteData() override;
127 
128  // <HyperTreeGrid ...
129  int StartPrimaryElement(vtkIndent);
130 
131  // ... dim, size, origin>
132  void WritePrimaryElementAttributes(ostream&, vtkIndent) override;
133 
134  // Grid coordinates and mask
135  int WriteGrid(vtkIndent);
136 
137  // Tree Descriptor and PointData
138  int WriteTrees_0(vtkIndent);
139  int WriteTrees_1(vtkIndent);
140 
141  // </HyperTreeGrid>
142  int FinishPrimaryElement(vtkIndent);
143 
144  // Descriptors for individual hypertrees
145  std::vector<vtkBitArray*> Descriptors;
146 
147  // Descriptors for individual hypertrees
148  std::vector<vtkUnsignedLongArray*> NbVerticesbyLevels;
149 
150  // Masks for individual hypertrees
151  std::vector<vtkBitArray*> Masks;
152 
153  // Ids (index selection) for individual hypertrees
154  std::vector<vtkIdList*> Ids;
155 
156  // Helper to simplify writing appended array data
157  void WriteAppendedArrayDataHelper(vtkAbstractArray* array, OffsetsManager& offsets);
158 
159  void WritePointDataAppendedArrayDataHelper(
160  vtkAbstractArray* array, vtkIdType treeCount, OffsetsManager& offsets, vtkHyperTree* tree);
161 
167 
169 
170  // Default choice
171  int DataSetMajorVersion = 1;
172  int DataSetMinorVersion = 0;
173 
174 private:
176  void operator=(const vtkXMLHyperTreeGridWriter&) = delete;
177 };
178 
179 #endif
virtual const char * GetDataSetName()=0
std::vector< vtkIdList * > Ids
vtkDataObject * GetInput()
Assign a data object as input.
Definition: vtkXMLWriter.h:239
Store vtkAlgorithm input/output information.
std::vector< vtkUnsignedLongArray * > NbVerticesbyLevels
Abstract superclass for all arrays.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
Helper class due to PIMPL excess
int vtkIdType
Definition: vtkType.h:338
std::vector< vtkBitArray * > Descriptors
Objects for traversal a HyperTreeGrid.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int WriteData()
Definition: vtkXMLWriter.h:359
Superclass for VTK&#39;s XML file writers.
Definition: vtkXMLWriter.h:61
a simple class to control print indentation
Definition: vtkIndent.h:33
int GetDataSetMajorVersion() override
Methods to define the file&#39;s major and minor version numbers.
virtual void WritePrimaryElementAttributes(ostream &os, vtkIndent indent)
virtual const char * GetDefaultFileExtension()=0
Get the default file extension for files written by this writer.
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
dynamic, self-adjusting array of unsigned long
A data object structured as a tree.
Definition: vtkHyperTree.h:178
std::vector< vtkBitArray * > Masks
static vtkAlgorithm * New()
Write VTK XML HyperTreeGrid files.
OffsetsManagerGroup * NbVerticesbyLevelOMG