Link streamlines with source seed ids

Dear all,

I’m generating a set of streamlines from a custom set of sources using the StreamTracerWithCustomSource filter:

streamTracer = StreamTracerWithCustomSource(Input=foam_source, SeedSource=seed_points)

In this case, my custom source is a ProgrammableSource that reads a GeoJSON file containing seed points, each associated with a unique ID.

I would like to link each generated streamline to the seed point it originated from. While one solution would be to match the seed points with the streamline points at integration time equal to zero, this approach would be too slow, as I’m working with thousands of points.

I’ve noticed that the seedId is preserved in the cellData of the streamlines, but I’m struggling to connect a row in the cellData to the corresponding rows in the pointData.

Any advice on how to efficiently make this connection would be greatly appreciated.

The final goal is to export a csv file containing row by row info about the streamline, like for example:
x0,y0,z0,integrationTime,seedId where seedId is the id of the point that generated this line

nb. I need to do that through a python script. I saw that using the option findData i can see the relationship between a cell and the relative points, but i could not extract the same data in my python script

The SeedIds are the actual point ids on the point source. If you reorder your point according to the unique ID you want, assuming they are contiguous, you could use this mechanism.

Alternatively, we could add a pretty simple feature in the stream tracer to copy seed point data to the stream cells data. This should be trivial to add.

hth,