[Paraview] RE : vtk ascii to binary
BOUSSOIR Jonathan 167706
Jonathan.BOUSSOIR at cea.fr
Wed Aug 5 04:26:13 EDT 2009
Hi,
Sorry to introduce me in this conversation but it's very interesting for me.
I have a little query about the functions reader VTK.
Can I use a mmap to import the data file ?
Like this code
import mmap
import os
import time
from paraview.simple import *
filename = "sphere.vtk"
file = open(filename, "r+")
size = os.path.getsize(filename)
data = mmap.mmap(file.fileno(), size, flags=mmap.MAP_SHARED, prot=mmap.PROT_READ) #Linux
r = LegacyVTKReader()
???
But after, I don't see how I can do...
Thanks in advance for your kind help.
Regards,
Jona
-------- Message d'origine--------
De: paraview-bounces at paraview.org de la part de Berk Geveci
Date: mar. 04/08/2009 18:21
À: Rafael Pacheco
Cc: paraview at paraview.org
Objet : Re: [Paraview] vtk ascii to binary
With ParaView 3.6, you can do:
from paraview.simple import *
r = LegacyVTKReader()
r.FileNames = ["foo.vtk"]
w = servermanager.writers.DataSetWriter()
w.Input = r
w.FileName = "bar.vtk"
w.UpdatePipeline()
You will have to create a loop where you do the following 3:
for index in range...:
r.FileNames = ["foo%d.vtk" % index]
w.FileName = "bar%d.vtk % index
w.UpdatePipeline
To convert binary to ascii, do
w.FileType = 'Ascii'
-berk
On Mon, Aug 3, 2009 at 8:51 PM, Rafael Pacheco<rpacheco at asu.edu> wrote:
> Berk
>
> regarding your email below, could you please be kind to provide me an
> example on how to load the ascii file in ParaView and saving it as binary
> format using a python script? I have a series of output files a00*.vtk (vtk
> legacy) written in fortran and I would like to create movie, but loading
> the files take long time and space.
>
> Thank you!
> Rafael
>
>
>>> Date: Sun, 2 Nov 2008 07:30:16 -0400
>>> From: [EMAIL PROTECTED]
>>> To: [EMAIL PROTECTED]
>>> Subject: Re: [Paraview] Writing binary VTK
>>> CC: [EMAIL PROTECTED]; paraview at paraview.org
>>>
>>> If you already have the ascii VTK file, you can convert it to binary
>>> by loading it in ParaView and saving it out as binary format. It is
>>> pretty easy to automate this using Python. Let me know if you need an
>>> example.
>>>
>>> -berk
>>>
>
> _______________________________________________
> 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 ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
_______________________________________________
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 ParaView Wiki at: http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
More information about the ParaView
mailing list