| 71 | } |
| 72 | |
| 73 | vtkSmartPointer<vtkDataSet> createTestData() |
| 74 | { |
| 75 | //-------------------------------------------------------------------------- |
| 76 | // create a test data set with known structure and data values |
| 77 | // the structure will look like a Rubix' cube |
| 78 | // the values will be: |
| 79 | // three double arrays containing X,Y,and Z coordinates for |
| 80 | // each point and cell, where the cell coordinates are the center of the cell |
| 81 | // two id type arrays containing Id's or labels that range from 10 to |
| 82 | // numpts/cells+10, with one array being the reverse of the other |
| 83 | // the scalars datasetattibute will be the X array |
| 84 | // the globalids datasetattribute will be the forward running id array |
| 85 | |
| 86 | auto sampleData = vtkSmartPointer<vtkImageData>::New(); |
| 87 | sampleData->Initialize(); |
| 88 | sampleData->SetSpacing(1.0, 1.0, 1.0); |
| 89 | sampleData->SetOrigin(0.0, 0.0, 0.0); |
| 90 | sampleData->SetDimensions(XCELLS + 1, YCELLS + 1, ZCELLS + 1); |
| 91 | sampleData->AllocateScalars(VTK_DOUBLE, 1); |
| 92 | |
| 93 | vtkNew<vtkIdTypeArray> pia; |
| 94 | pia->SetNumberOfComponents(1); |
| 95 | pia->SetName("Point Counter"); |
| 96 | sampleData->GetPointData()->AddArray(pia); |
| 97 | |
| 98 | vtkNew<vtkIdTypeArray> piaF; |
| 99 | piaF->SetNumberOfComponents(1); |
| 100 | piaF->SetName("Forward Point Ids"); |
| 101 | sampleData->GetPointData()->AddArray(piaF); |
| 102 | |
| 103 | vtkNew<vtkIdTypeArray> piaR; |
| 104 | piaR->SetNumberOfComponents(1); |
| 105 | piaR->SetName("Reverse Point Ids"); |
| 106 | sampleData->GetPointData()->AddArray(piaR); |
| 107 | |
| 108 | vtkNew<vtkDoubleArray> pxa; |
| 109 | pxa->SetNumberOfComponents(1); |
| 110 | pxa->SetName("Point X"); |
| 111 | sampleData->GetPointData()->AddArray(pxa); |
| 112 | |
| 113 | vtkNew<vtkDoubleArray> pya; |
| 114 | pya->SetNumberOfComponents(1); |
| 115 | pya->SetName("Point Y"); |
| 116 | sampleData->GetPointData()->AddArray(pya); |
| 117 | |
| 118 | vtkNew<vtkDoubleArray> pza; |
| 119 | pza->SetNumberOfComponents(1); |
| 120 | pza->SetName("Point Z"); |
| 121 | sampleData->GetPointData()->AddArray(pza); |
| 122 | |
| 123 | // vtkPoints *points = vtkPoints::New(); |
| 124 | vtkIdType pcnt = 0; |
| 125 | for (int i = 0; i < ZCELLS + 1; i++) |
| 126 | { |
| 127 | for (int j = 0; j < YCELLS + 1; j++) |
| 128 | { |
| 129 | for (int k = 0; k < XCELLS + 1; k++) |
| 130 | { |
no test coverage detected