forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkDataObjectGenerator.h
120 lines (100 loc) · 4.54 KB
/
vtkDataObjectGenerator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*=========================================================================
Program: Visualization Toolkit
Module: vtkDataObjectGenerator.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkDataObjectGenerator - produces simple (composite or atomic) data
// sets for testing.
// .SECTION Description
// vtkDataObjectGenerator parses a string and produces dataobjects from the
// dataobject template names it sees in the string. For example, if the string
// contains "ID1" the generator will create a vtkImageData. "UF1", "RG1",
// "SG1", "PD1", and "UG1" will produce vtkUniformGrid, vtkRectilinearGrid,
// vtkStructuredGrid, vtkPolyData and vtkUnstructuredGrid respectively.
// "PD2" will produce an alternate vtkPolyData. You
// can compose composite datasets from the atomic ones listed above
// by placing them within one of the two composite dataset identifiers
// - "MB{}" or "HB[]". "MB{ ID1 PD1 MB{} }" for example will create a
// vtkMultiBlockDataSet consisting of three blocks: image data, poly data,
// multi-block (empty). Hierarchical Box data sets additionally require
// the notion of groups, declared within "()" braces, to specify AMR depth.
// "HB[ (UF1)(UF1)(UF1) ]" will create a vtkHierarchicalBoxDataSet representing
// an octree that is three levels deep, in which the firstmost cell in each level
// is refined.
#ifndef __vtkDataObjectGenerator_h
#define __vtkDataObjectGenerator_h
#include "vtkFiltersCoreModule.h" // For export macro
#include "vtkDataObjectAlgorithm.h"
class vtkInternalStructureCache;
class VTKFILTERSCORE_EXPORT vtkDataObjectGenerator
: public vtkDataObjectAlgorithm
{
public:
static vtkDataObjectGenerator *New();
vtkTypeMacro(vtkDataObjectGenerator,vtkDataObjectAlgorithm);
void PrintSelf(ostream &os, vtkIndent indent);
// Description:
// The string that will be parsed to specify a dataobject structure.
vtkSetStringMacro(Program);
vtkGetStringMacro(Program);
protected:
vtkDataObjectGenerator();
~vtkDataObjectGenerator();
virtual int RequestData(vtkInformation *req,
vtkInformationVector **inV,
vtkInformationVector *outV);
virtual int RequestDataObject(vtkInformation *req,
vtkInformationVector **inV,
vtkInformationVector *outV);
virtual int RequestInformation(vtkInformation *req,
vtkInformationVector **inV,
vtkInformationVector *outV);
virtual int RequestUpdateExtent(vtkInformation *req,
vtkInformationVector **inV,
vtkInformationVector *outV);
//the string to parse to create a structure
char *Program;
//a record of the structure
vtkInternalStructureCache *Structure;
//Helper for RequestDataObject
vtkDataObject *
CreateOutputDataObjects(vtkInternalStructureCache *structure);
//Helper for RequestData
vtkDataObject *
FillOutputDataObjects(vtkInternalStructureCache *structure,
int level,
int stripe=0);
//to determine which composite data stripe to fill in
vtkIdType Rank;
vtkIdType Processors;
//create the templated atomic data sets
void MakeImageData1(vtkDataSet *ds);
void MakeImageData2(vtkDataSet *ds);
void MakeUniformGrid1(vtkDataSet *ds);
void MakeRectilinearGrid1(vtkDataSet *ds);
void MakeStructuredGrid1(vtkDataSet *ds);
void MakePolyData1(vtkDataSet *ds);
void MakePolyData2(vtkDataSet *ds);
void MakeUnstructuredGrid1(vtkDataSet *ds);
void MakeUnstructuredGrid2(vtkDataSet *ds);
void MakeUnstructuredGrid3(vtkDataSet *ds);
void MakeUnstructuredGrid4(vtkDataSet *ds);
//used to spatially separate sub data sets within composites
double XOffset; //increases for each dataset index
double YOffset; //increases for each sub data set
double ZOffset; //increases for each group index
//used to filling in point and cell values with unique Ids
vtkIdType CellIdCounter;
vtkIdType PointIdCounter;
//assign point and cell values to each point and cell
void MakeValues(vtkDataSet *ds);
private:
vtkDataObjectGenerator(const vtkDataObjectGenerator&); // Not implemented.
void operator=(const vtkDataObjectGenerator&); // Not implemented.
};
#endif