-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparticle_path.patch
More file actions
45 lines (45 loc) · 1.79 KB
/
particle_path.patch
File metadata and controls
45 lines (45 loc) · 1.79 KB
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
diff --git a/VTK/Filters/FlowPaths/vtkParticlePathFilter.cxx b/VTK/Filters/FlowPaths/vtkParticlePathFilter.cxx
index 4e73f91..e1ab3b4 100644
--- a/VTK/Filters/FlowPaths/vtkParticlePathFilter.cxx
+++ b/VTK/Filters/FlowPaths/vtkParticlePathFilter.cxx
@@ -124,11 +124,38 @@ void ParticlePathFilterInternal::Finalize()
<< "\n" << "): " <<" no lines in the output"<< "\n\n";
return;
}
- for(unsigned int i=0; i<this->Paths.size(); i++)
+ // if we have a path that leaves a process and than comes back we need
+ // to add that as separate cells. we use the simulation time step to check
+ // on that assuming that the particle path filter is updated every time step.
+ vtkIntArray* sourceSimulationTimeStepArray = vtkArrayDownCast<vtkIntArray>(
+ this->Filter->Output->GetPointData()->GetArray("SimulationTimeStep"));
+ vtkNew<vtkIdList> tmpIds;
+ for(size_t i=0; i<this->Paths.size(); i++)
{
if(this->Paths[i]->GetNumberOfIds()>1)
{
- outLines->InsertNextCell(this->Paths[i]);
+ vtkIdList* ids = this->Paths[i];
+ int previousTimeStep = sourceSimulationTimeStepArray->GetTypedComponent(ids->GetId(0), 0);
+ tmpIds->Reset();
+ tmpIds->InsertNextId(ids->GetId(0));
+ for (vtkIdType j=1; j<ids->GetNumberOfIds(); j++)
+ {
+ int currentTimeStep = sourceSimulationTimeStepArray->GetTypedComponent(ids->GetId(j), 0);
+ if (currentTimeStep != (previousTimeStep + 1))
+ {
+ if (tmpIds->GetNumberOfIds() > 1)
+ {
+ outLines->InsertNextCell(tmpIds);
+ }
+ tmpIds->Reset();
+ }
+ tmpIds->InsertNextId(ids->GetId(j));
+ previousTimeStep = currentTimeStep;
+ }
+ if (tmpIds->GetNumberOfIds() > 1)
+ {
+ outLines->InsertNextCell(tmpIds);
+ }
}
}
}