VTK  9.4.20241226
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
24VTK_ABI_NAMESPACE_BEGIN
25
26class vtkCellGrid;
27
28class VTKIOCELLGRID_EXPORT vtkCellGridWriter : public vtkWriter
29{
30public:
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
69protected:
72
73 int FillInputPortInformation(int port, vtkInformation* info) override;
74 void WriteData() override;
75
76 char* FileName{ nullptr };
77 Format FileFormat{ Format::PlainText };
78
79private:
80 vtkCellGridWriter(const vtkCellGridWriter&) = delete;
81 void operator=(const vtkCellGridWriter&) = delete;
82};
83
84VTK_ABI_NAMESPACE_END
85
86#endif // vtkCellGridWriter_h
Write a cell-grid file.
static vtkCellGridWriter * New()
~vtkCellGridWriter() override
bool ToJSON(nlohmann::json &data, vtkCellGrid *grid)
Populate the JSON data with a representation of the input grid.
vtkCellGrid * GetInput(int port)
vtkGetEnumMacro(FileFormat, Format)
Format
On-disk formats for the cell-grid data.
@ PlainText
Human-readable text.
@ MessagePack
Binary message-pack data.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSetEnumMacro(FileFormat, Format)
void WriteData() override
vtkCellGrid * GetInput()
Visualization data composed of cells of arbitrary type.
Definition vtkCellGrid.h:49
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
abstract class to write data to file(s)
Definition vtkWriter.h:35