[vtkusers] Writing an array for each point as PointData in an Unstructured Grid.

Bhargav Vaidya coolastro at gmail.com
Thu Nov 20 06:53:01 EST 2014


Hello, 

I have very recently started to look into the .vtu file formats to write 
particle data in an Unstructured grid.  
I have managed to write a simple xml file following standard examples. 
This works perfectly fine as I can visualize the particles and also plot velocity vectors.

However, now I desire to write in the XML data file an array of (say 100 points) for each particle.
Let me illustrate this better with a sample .vtu file 

/------------- section of my .vtu file  ------- / 
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
<UnstructuredGrid>
<Piece NumberOfPoints="16" NumberOfCells="16">
<Points>
<DataArray name="Position" type="Float32" NumberOfComponents="3" format="ascii">

 / * Here comes the particle positions (px, py, pz) */

</DataArray>
</Points>

<PointData  Scalars=" Identity" Vectors="Velocity">
<DataArray type="Float32" Name="Velocity" NumberOfComponents="3" format="ascii">

 /* Here comes the particle velocity (vx, vy, vz) */  

</DataArray>

<DataArray type="Int32" Name="Identity" format="ascii">

/* Here comes the particle ids (unique integer for each particle) */

</DataArray>
</PointData>
/---------------------------------------------------------- */

What I would like to have is another block of DataArray such that each element is 
itself an array of say 100 float values for each particle..
Since I have 16 particles in the above file... 
Can I just write 16*100 float values using 

<DataArray type="Float32" Name="Energy" format="ascii">
/* Here comes 16*100 float values  */
</DataArray>

Is it  possible to write such a data in this format ?  If yes how can I incorporate the information that the reader should consider 
100 values as one chunk of data and associate it with a particular particle. 

Regards,
Bhargav Vaidya
Postdoc fellow
Dept. of Physics, Uni. Torino








More information about the vtkusers mailing list