RES: [Paraview] Writing unformatted Fortran data

Benjamin REVEILLE benjamin.reveille at ifp.fr
Fri Feb 10 12:14:49 EST 2006


you need to todeclare one more parameter at the end of the C version of 
WriteEnsightGeometryBin

Fortran Version : call WriteEnsightGeometryBin ( arch, irank+1, nnos, nel, 3, 4, 
.                              ien(1,1), xyz(1,1) )

C version: void WriteEnsightGeometryBin ( char *arch, int irank, int nnos, int nel, 3, 4, 
.                              int *ien, real *xyz, int larch ) larch is the lenthg of arch that the fortran call will pass


then  char *string=(char *)malloc(sizeof(char)*(larch+1)) // +1 to put 
the null character
strncpy(string,arch,larch);
string[larch]='\0'
then use string instead of arch...

I use this very often...
Benjamin



Renato N. Elias wrote:

>Hi Stéphane,
>
>You're in a bad luck. Actually, most of the Fortran compilers has support to
>write "binary" files (I'm sure about: Compaq, Intel & PGF90). 
>
>I've already got this problem too, but it only happens with PV because
>Ensight can handle both types of binary data. I also got problem when tried
>to read, in PV, binary (form='binary') Ensight "GOLD" files written by
>Fortran routines. 
>
>I have not found a solution yet but I started to implement a C routine,
>only, to write Ensight's files from my Fortran code (I'm sending in attach).
>As you can see, the routines are very simple (I'm not a C/C++ programmer)
>and, I guess, you can easily modify them to fit in your problem. I know it's
>not the ideal solution but, up to now, it was the easiest solution for me.
>
>  
>
>>>>please Berk and PV team, help us, poor Fortran programmers, giving
>>>>        
>>>>
>support for both type of binaries in PV ;-) <<< I'm joking...
>
>NOTE: I'm still looking for a good way to pass a Fortran character to a C
>routine as a C string (null terminated). I've been doing the following:
>
>!----------------------------------------------------
>
>character :: arch*80, null*1
>external WriteEnsightGeometryBin
>
>null = char(0)
>arch= "MyFile.geo"//null
>call WriteEnsightGeometryBin ( arch, irank+1, nnos, nel, 3, 4, 
>.                              ien(1,1), xyz(1,1) )
>
>!----------------------------------------------------
>
>And I should advise your that not always it works fine ;-)
>
>Regards
>
>Renato N. Elias
>===============================================
>PhD student - http://www.nacad.ufrj.br/~rnelias
>High Performance Computing Center
>Federal University of Rio de Janeiro
>Rio de Janeiro, Brazil
>+55(21) 2562-8080 
>
>-----Mensagem original-----
>De: Stéphane Montésino [mailto:Stephane.Montesino at hmg.inpg.fr] 
>Enviada em: sexta-feira, 10 de fevereiro de 2006 13:05
>Para: Renato N. Elias
>Assunto: [Paraview] Writing unformatted Fortran data
>
>Hi Renato,
>Openning file in Binary form is only possible with Microsoft Develloppers
>Studio.
>When I wanted to run my routine on IBM SP4, I had to change the form to
>UNFORMATTED because the key word BINARY is not accepted..
>But now I can't read my data with paraview.
>
>Does anyone has a solution to write UNFORMATTED fortran data that can be
>read with Paraview ????
>
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>ParaView mailing list
>ParaView at paraview.org
>http://www.paraview.org/mailman/listinfo/paraview
>  
>

-- 
===================================================================
 Benjamin Réveillé               

 Institut Français du Pétrole       Tel  : +33 1 47 52 62 68
 Section R1022R  /  Bureau L207     Fax  : +33 1 47 52 70 68
 1 & 4, avenue de Bois-Preau
 92852 RUEIL-MALMAISON  FRANCE      http://www.ifp.fr

 mail : benjamin.reveille at ifp.fr
===================================================================



__________________________

Ce message (et toutes ses pièces jointes éventuelles) est confidentiel et établi à l'intention exclusive de ses destinataires. Toute utilisation de ce message non conforme à sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L'IFP décline toute responsabilité au titre de ce message.

This message and any attachments (the message) are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. IFP should not be liable for this message.

Visitez notre site Web / Visit our web site : http://www.ifp.fr
__________________________






More information about the ParaView mailing list