[Paraview] How to link VTK I/O to fortran code with the interface ?

Stéphane Montésino Stephane.Montesino at hmg.inpg.fr
Fri Feb 10 11:32:51 EST 2006


I want to write scalar data on a rectilinear grid stretched.

Which library do I need to compile and link to my fortran code ?
Which call do I need to do ?
Does anyone has an example ?



Okay, the C/Fortran interface is now available.  A C program can do
>
> #include "vtkXMLWriterC.h"
>
> and link to vtkIO.  A Fortran program can use the interface (see the 
> example code below) but will need to compile one extra .c file to link 
> properly to vtkIO.  See VTK/IO/vtkXMLWriterF.h for instructions.
>
> -Brad
>
>      PROGRAM Hello
>      INTEGER writer
>      INTEGER success
>      INTEGER*8 numpoints/8/
>      INTEGER*8 numcells/1/
>      INTEGER*8 cellsSize/9/
>      REAL*4 pdata(8)/0,0,0,0,1,1,1,1/
>      REAL*4 points(24)/0,0,0, 1,0,0, 1,1,0, 0,1,0,
>     _                  0,0,1, 1,0,1, 1,1,1, 0,1,1/
>      INTEGER*8 cells(9)/8,0,1,2,3,4,5,6,7/
>      call vtkXMLWriterF_New(writer)
>      call vtkXMLWriterF_SetDataObjectType(writer, 4)
>      call vtkXMLWriterF_SetFileName(writer, 'test1.vtu')
>      call vtkXMLWriterF_SetPoints(writer, 10, points, numpoints)
>      call vtkXMLWriterF_SetCellsWithType(writer, 12, numcells, cells,
>     _                                    cellsSize)
>      call vtkXMLWriterF_SetPointData(writer, 'example data', 10, pdata,
>     _                                numpoints, 1, 'SCALARS')
>      call vtkXMLWriterF_Write(writer, success)
>      call vtkXMLWriterF_Delete(writer)
>      PRINT *, 'success =', success
>      END PROGRAM Hello
> 

-- 
Stephane MONTESINO

PhD Student                     tel:+33 4 76 82 52 91
LEGI                            fax:+33 4 76 82 70 22
BP 53
38041 Grenoble Cedex            email: stephane.montesino at hmg.inpg.fr
France                          http://www.legi.hmg.inpg.fr 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Stephane.Montesino.vcf
Type: text/x-vcard
Size: 308 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/paraview/attachments/20060210/24364a30/Stephane.Montesino.vcf


More information about the ParaView mailing list