[vtkusers] python-vtk and reading vtk files
Rodrigo Valiña Gutiérrez
rodrigo.valina at usc.es
Wed Jun 2 03:26:15 EDT 2010
reader.ReadAllScalarsOn(), reader.ReadAllVectorsOn() (...) before
d = datas.GetCellData()
d = datas.GetPointData()
array = d.GetArray(name)
size = array.GetNumberOfTuples()
comp = array.GetNumberOfComponents()
for i in range(size):
On Wed, Jun 2, 2010 at 4:53 AM, Xavier Barthelemy <xabart at gmail.com> wrote:
> Greetings everyone,
> I am a new subscriber to this list, and i need some help.
> I want to make a post process calculation from the exits of a code, in python.
> my code, which is a Bem formulation, gives an output in .vtk files.
> Theses files have all the information I need, obviously at the
> Others output of the code is in a regular grid inside the domain, and
> has no evident relation between the boundary mesh.
> What i want to do is read the different infos on the boundaries, and
> then doing some calculations with the inner grid, and probably write a
> vtk file.
> All of that at each time step.
> that brings me to my questions:
> i know this is an unstructured grid,
> my python code is:
> import vtk
> reader = vtk.vtkDataSetReader()
> ncells = datas.GetNumberOfCells()
> print "Number of tensorss: " , ntensors
> for i in xrange(nscalars):
> print "Scalarnames",i,Scalarnames
> for i in xrange(nvectors):
> print "vectornames",i,Vectornames
> until there everything is okey
> but when i want to access to the datas: points coordinates,cell and
> connectivity, mesh, and values of the scalars and vectors at the
> points, let's say everything. I don't understand how it is working
> for example
> tells me it needs a vtkDataset, but vtkDataSet is a superclass, and i
> don't really understand how to create it
> i have been looking over the differents mailing list, test, examples,
> wikis, and even the headers of the C++ code, but still I don't
> Is someone know how to read these files?
> I thanks you in advance,
> Powered by www.kitware.com
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
More information about the vtkusers