[Paraview] Re: Plot3D
Berk Geveci
berk.geveci at kitware.com
Wed May 2 11:07:27 EDT 2007
As an alternative, you can change the Byte Order flag in ParaView to
Little Endian... The flags I used to read the file were:
Binary, MultiGrid, Has Byte Count, Byte Order: Little Endian
-berk
On 5/2/07, Evgeniy Shapiro <shellinux at gmail.com> wrote:
> Paul, thanks a bunch!
>
> convert='big_endian' does the job.
>
> I post complete description to avoid such question in future.
>
> The followinjg code generates a plot3D file which is read by 2.6.0
> without problems with the following options:
> Binary
> Multiblock
> Fortran byte order
>
> compiler: ifort 9.1 20061101
>
> ==========================
> Fortran code example:
>
>
>
> program write_example
> implicit none
>
> real x(21,21,21),y(21,21,21),z(21,21,21)
> real vars(21,21,21,5), r, alpha
> integer ni,nj,nk,i,j,k,l
>
> ! create gridpoints for a simple example:
> ni=21
> nj=21
> nk=21
> do k=1,nk
> do j=1,nj
> do i=1,ni
> x(i,j,k)=real(i-ni/2,kind=4)/ni*2.
> y(i,j,k)=real(j-nj/2,kind=4)/nj*2.
> z(i,j,k)=real(k-1,kind=4)/nk*10.
> r=exp(-sqrt(x(i,j,k)**2+y(i,j,k)**2))*z(i,j,k)/10.
> alpha=atan(y(i,j,k)/(x(i,j,k)+1.e-6))
> vars(i,j,k,1)=1.
> vars(i,j,k,2)=r*sin(alpha)
> vars(i,j,k,3)=-r*cos(alpha)
> vars(i,j,k,4)=0.01
> vars(i,j,k,5)=1.
> enddo
> enddo
> enddo
> OPEN(1,FILE="grid.xyz", form="unformatted", status="replace",
> & convert='big_endian')
> ! write blocks
> write(1) 1
> ! write size
> write(1) ni,nj,nk
> ! write grid
> write(1) (((x(I,J,K),I=1,ni),J=1,nj),K=1,nk),
> & (((y(I,J,K),I=1,ni),J=1,nj),K=1,nk),
> & (((z(I,J,K),I=1,ni),J=1,nj),K=1,nk)
> close(1)
> OPEN(1,FILE="grid.q", form="unformatted", status="replace",
> & convert='big_endian')
> ! write blocks
> write(1) 1
> ! write size
> write(1) ni,nj,nk
> ! mach, alpha, re, time - bogus
> write(1) 0.1,0.0,1000.,0.
> ! write coordinates
> write(1) (((( vars(i,j,k,l), i = 1, ni),
> & j = 1, nj), k = 1, nk), l = 1, 5 )
> close(1)
> stop
> end program write_example
>
> ==============================
>
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>
--
Berk Geveci
Kitware Inc.
28 Corporate Drive
Clifton Park, NY, 12065
More information about the ParaView
mailing list