VTK  9.7.1
vtkCellGridWriter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
13 #ifndef vtkCellGridWriter_h
14 #define vtkCellGridWriter_h
15 
16 #include "vtkIOCellGridModule.h" // For export macro.
17 #include "vtkWriter.h"
18 
19 // clang-format off
20 #include <vtk_nlohmannjson.h> // For API.
21 #include VTK_NLOHMANN_JSON(json.hpp) // For API.
22 // clang-format on
23 
24 VTK_ABI_NAMESPACE_BEGIN
25 
26 class vtkCellGrid;
27 
28 class VTKIOCELLGRID_EXPORT vtkCellGridWriter : public vtkWriter
29 {
30 public:
31  vtkTypeMacro(vtkCellGridWriter, vtkWriter);
32  static vtkCellGridWriter* New();
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
40  vtkSetStringMacro(FileName);
41  vtkGetStringMacro(FileName);
43 
49 
51  bool ToJSON(nlohmann::json& data, vtkCellGrid* grid);
52 
56  enum Format : int
57  {
60  NumberOfFormats
61  };
62 
65  vtkSetEnumMacro(FileFormat, Format);
66  vtkGetEnumMacro(FileFormat, Format);
68 
69 protected:
71  ~vtkCellGridWriter() override;
72 
74  bool WriteDataAndReturn() override;
75 
76  char* FileName{ nullptr };
77  Format FileFormat{ Format::PlainText };
78 
79 private:
80  vtkCellGridWriter(const vtkCellGridWriter&) = delete;
81  void operator=(const vtkCellGridWriter&) = delete;
82 };
83 
84 VTK_ABI_NAMESPACE_END
85 
86 #endif // vtkCellGridWriter_h
Write a cell-grid file.
Store vtkAlgorithm input/output information.
Format
On-disk formats for the cell-grid data.
abstract class to write data to file(s)
Definition: vtkWriter.h:35
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Visualization data composed of cells of arbitrary type.
Definition: vtkCellGrid.h:48
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkDataObject * GetInput()
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
static vtkAlgorithm * New()
virtual bool WriteDataAndReturn()
Binary message-pack data.