c ====================================================================== c usage: partdemo0 c c Demonstrates use of 'gft_out_part_xyz' to output particle data c in 'sdf' form for subsequent visualizaton with 'DV'. c c Specifically, this program generates particles randomly c distributed on the surface of a unit-radius sphere, centred c at (0,0,0) then outputs x, y and z coordinates to c 'partdemo0.sdf', which will then contain particle data defined c at a single time, t = 0. c c In addition to 'gft_out_part_xyz', defined in the 'bbhutil' c library, this program references the external routines 'i4arg', c 'srand' and 'drand48', which are defined in the 'p410f' library. c ====================================================================== program partdemo0 implicit none character*9 cdnm parameter ( cdnm = 'partdemo0' ) real*8 drand48 integer iargc, i4arg integer np integer npmax parameter ( npmax = 10 000 000 ) real*8 x(npmax), y(npmax), z(npmax) real*8 t, xj, yj, zj, nrm integer j if( iargc() .ne. 1 ) go to 900 np = i4arg(1,-1) if( np .eq. -1 ) go to 900 if( np .lt. 1 .or. np .gt. npmax ) then write(0,*) 'cdnm: np=', np write(0,*) 'cdnm: Exceeds range 1 to ', npmax go to 900 end if call srand(np) do j = 1 , np xj = (2.0d0 * drand48() - 1.0d0) yj = (2.0d0 * drand48() - 1.0d0) zj = (2.0d0 * drand48() - 1.0d0) nrm = 1.0d0 / sqrt(xj**2 + yj**2 + zj**2) x(j) = nrm * xj y(j) = nrm * yj z(j) = nrm * zj end do t = 0.0d0 call gft_out_part_xyz('partdemo0',t,x,y,z,np) stop 900 continue write(0,*) 'usage: '//cdnm//' ' stop end