75{
76 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
77 vtkInformation *outInfo = outputVector->GetInformationObject(0);
78
79 vtkPolyData *input = vtkPolyData::SafeDownCast(
80 inInfo->Get(vtkDataObject::DATA_OBJECT()));
81 vtkPolyData *output = vtkPolyData::SafeDownCast(
82 outInfo->Get(vtkDataObject::DATA_OBJECT()));
83
84 if (input->GetNumberOfPoints() < 1)
85 {
86 return 1;
87 }
88
90 {
91 vtkErrorMacro("Error: IntegrationTimeArrayName not specified");
92 return 1;
93 }
94
96
97 if (!integrationTimeArray)
98 {
99 vtkErrorMacro("Error: IntegrationTimeArray with name specified does not exist");
100 return 1;
101 }
102
103 vtkDataArray* velocityArray = NULL;
104
106 {
108
109 if (!velocityArray)
110 {
111 vtkErrorMacro("Error: VelocityArray with name specified does not exist");
112 return 1;
113 }
114 }
115
116 int numberOfCells = input->GetNumberOfCells();
117
118 vtkPoints* outputPoints = vtkPoints::New();
119 vtkCellArray* outputVerts = vtkCellArray::New();
120
121 vtkDoubleArray* outputTimeArray = vtkDoubleArray::New();
123
124 vtkDoubleArray* outputVelocityArray = vtkDoubleArray::New();
126 outputVelocityArray->SetNumberOfComponents(3);
127
128 int i;
130 {
132
133 vtkMaskPolyData* mask = vtkMaskPolyData::New();
134 mask->SetInputData(input);
136 mask->SetOffset(i);
137 mask->Update();
138
140
141 vtkPolyData* subset = mask->GetOutput();
142
143 int numberOfSubsetCells = subset->GetNumberOfCells();
144 int j;
145 for (j=0; j<numberOfSubsetCells; j++)
146 {
147 vtkPolyLine* polyLine = vtkPolyLine::SafeDownCast(subset->GetCell(j));
148 if (!polyLine)
149 {
150 continue;
151 }
152
153 vtkIdList* pointIds = polyLine->GetPointIds();
154 int numberOfPointIds = pointIds->GetNumberOfIds();
155
156 double integrationTime = injectionOffset;
157 int k;
158 for (k=0; k<numberOfPointIds-1; k++)
159 {
160 double time0 = integrationTimeArray->GetTuple1(pointIds->GetId(k));
161 double time1 = integrationTimeArray->GetTuple1(pointIds->GetId(k+1));
162 if (time0 < integrationTime && time1 < integrationTime)
163 {
164 continue;
165 }
166 if (time0 > integrationTime && time1 > integrationTime)
167 {
168 break;
169 }
170 bool valid = true;
171 while (valid)
172 {
173 double pcoord = (integrationTime - time0) / (time1 - time0);
174 double interpolatedPoint[3];
176 vtkIdType pointId = outputPoints->InsertNextPoint(interpolatedPoint);
177 outputVerts->InsertNextCell(1);
178 outputVerts->InsertCellPoint(pointId);
179 outputTimeArray->InsertNextValue(integrationTime + injectionOffset);
180 if (velocityArray)
181 {
182 double velocity[3];
184 outputVelocityArray->InsertNextTuple(velocity);
185 }
186 integrationTime += this->
DeltaT;
187 if (integrationTime > time1)
188 {
189 valid = false;
190 }
191 if (integrationTime + injectionOffset > this->
TracingEnd)
192 {
193 break;
194 }
195 }
196 if (integrationTime + injectionOffset > this->
TracingEnd)
197 {
198 break;
199 }
200 }
201 }
202 }
203
204 output->SetPoints(outputPoints);
205 output->SetVerts(outputVerts);
206 output->GetPointData()->AddArray(outputTimeArray);
207 if (velocityArray)
208 {
209 output->GetPointData()->AddArray(outputVelocityArray);
210 }
211
212 outputPoints->Delete();
213 outputVerts->Delete();
214 outputTimeArray->Delete();
215 if (velocityArray)
216 {
217 outputVelocityArray->Delete();
218 }
219
220 return 1;
221}
static void InterpolatePoint(vtkPolyData *centerlines, int cellId, int subId, double pcoord, double interpolatedPoint[3])
static void InterpolateTuple3(vtkPolyData *centerlines, const char *arrayName, int cellId, int subId, double pcoord, double interpolatedTuple3[3])