[Paraview] Particle trajectories with Paraview

Biddiscombe, John A. biddisco at cscs.ch
Fri Feb 12 07:24:41 EST 2010


Alexander

https://svn.cscs.ch/vtkContrib/trunk/vtkCSCS/vtkCSCSCommon/

have a look at the code in there. You want vtkCSVBaseReader and the vtkCSVPolyDataReader. they are very old and vtk now has its own (more general) vtkDelimitedTextReader (which is what you have used when you load CSV data in paraview). The polyDataReader above will generate polylines as you require, but will need to be told when to stop one and start the next. Memory fails me but I seem to recall that you can put a 1 in a certain column at the start of each new polyline and it will trigger the reader to end one and start the next. Have a look at it and I'm sure you'll figure it out on your own.

Contact me off list after 20th feb for help if you need it.

JB


> -----Original Message-----
> From: Alexander Koschik [mailto:alexander.koschik at iis.ee.ethz.ch]
> Sent: 11 February 2010 17:09
> To: Biddiscombe, John A.
> Cc: paraview at paraview.org
> Subject: Re: Particle trajectories with Paraview
> 
> Hello John,
> 
> Thanks for the fast reply!
> 
> I can follow you, however, I am not sure that I can do solution a). In
> essence each line(row) of data in the csv-file is one time-step, because
> only one particle is followed at a time, hence 1 line = 1 file??? That
> does not really make sense, does it?
> 
> Anyway, since you will be away: Could you send me such a reader example,
> in case you have one? Like that I could get an idea of how to solve my task.
> 
> Concerning solution b): Could I also use a Programmable Filter to
> generate polylines from the particle positions using the ID as a key?
> Maybe you could really send me an reader example or something similar,
> such that I get a hint on how to construct the polylines from the input
> data. That would be great!
> 
> Hope is low already. :(
> Whatever you can send me to help me is extremely helpful! :)
> 
> Many thanks,
> ALEX
> 
> 
> 
> 
> Biddiscombe, John A. wrote:
> > Alex, (I'm cc'ing this back to the list as similar questions crop up from
> time to time)
> >
> >> I have a charged particle simulation code and I would like to visualize
> the
> >> resulting particle trajectories (basically positions in 3D) in Paraview.
> The
> >> attached CSV-file contains some sample data, columns have the following
> >> meaning:
> >> Field 0: Unique particle ID
> >> Field 1: Parent particle ID
> >> Field 2: Generation
> >> Field 3: Energy
> >> Field 4: X position
> >> Field 5: Y position
> >> Field 6: Z position
> >> Field 7: X direction cosine
> >> Field 8: Y direction cosine
> >> Field 9: Z direction cosine
> >
> > The pathline filter (vtkTemporalPathLineFilter) is intended to operate on
> a series of particles, say N of them. At timestep t, It generates a point
> representing each particle and stores it. Then the next time step arrives at
> t+1 and the pathline filter extends the (polyline) pathline to the new
> position, it incrementally builds up pathlines as you animate through a
> dataset.
> >
> > What you have got, is 'all' the timesteps inside one file, so it's not a
> 'temporal' data format (if you follow me).
> >
> > Question :
> > Is the original data stored as complete paths like the csv file you
> attached, or does the simulation generate one file per step? If it generates
> one file per step and you have collated it all into a csv file, then we can
> ...
> >
> > a) go back to the original data and knock up a reader which loads them one
> at a time and updates in a 'temporal' way - reading particles one step at a
> time - this creates nice animations in paraview with the trails incrementing
> as the particles move. The length of trail can be adjusted and each trail
> can be coloured nicely. If you store your data in h5part or some other
> format that is supported well by paraview, then even better.
> >
> > b) Load the csv file as you have done and generate polylines from the
> disjoint particles using the ID as a key. I have a csv reader I wrote a few
> years back which could be tweaked to do this (it assumes successive points
> are part of the same line - so it'd need a bit of work to recognize the Ids
> in your data). I don't think there's a filter already in paraview like
> 'table to points' (or vice versa) which will convert the points into
> polylines as you require.
> >
> > I would recommend a) and as you're from ETHZ I can help you with it.
> However I'm away all next week, so don't get your hopes up too high.
> >
> > JB
> >


More information about the ParaView mailing list