3. 3角形メッシュでの等高色分布図



ソースプログラム(Fortran 90,自動倍精度利用)
!***************************************************** ! 2D Graphic Sample No. 3 * ! Color Distribution for Trianglar Mesh * !***************************************************** program gsample3 implicit none integer, parameter :: npd = 300, nsd = 500 real x(npd),y(npd),f(npd) integer ndx(3,nsd) real sh(3),sl(3),ss(3) real xmin,xmax,ymin,ymax,dy integer ndiv(2),np,ns,i,ni,nj call fr_ginit call fr_opencanvas(1,'gsample3',101) xmin = -3 xmax = 3 ymin = -2 ymax = 2 ni = 10 nj = 10 dy = (ymax-ymin)/nj np = 0 ns = 0 call genmesh(xmin,0.0,ymin,ymax,ni,nj,x,y,ndx,np,ns) call genmesh(0.0,xmax,ymin,-dy,ni,nj/2-1,x,y,ndx,np,ns) call genmesh(0.6,xmax,0.0,ymax,ni,nj,x,y,ndx,np,ns) do i = 1, np f(i)=-exp(-5.0*((x(i)-1.8)**2+(y(i)-1.1)**2))+exp(-0.7*((x(i)+1.3)**2+(y(i)+.5)**2)) enddo sh(1) = 130 sh(2) = 340 sh(3) = 340 sl(1) = 0.5 sl(2) = 0.5 sl(3) = 0.0 ss(1) = 1 ss(2) = 1 ss(3) = 1 ndiv(1) = 64 ndiv(2) = 64 call fr_hlsset(sh,sl,ss,ndiv,2) call fr_view2d(80,50,560,430) call fr_aspect2d(1.0,1.0,0) call fr_frame2d(xmin,xmax,ymin,ymax,1) call fr_tricontour(x,y,f,np,ndx,ns,20,-2,7) call fr_colorbar(200,60,200,20,2) call fr_gend end program gsample3 subroutine genmesh(x1,x2,y1,y2,ni,nj,x,y,node,ip,is) implicit none real x(*),y(*),x1,x2,y1,y2,dx,dy integer node(3,*),ni,nj,ip,is,i,j,ns,np,np0 dx = (x2-x1)/ni dy = (y2-y1)/nj np = ip do j = 0, nj do i = 0, ni np = np + 1 x(np) = x1 + i*dx y(np) = y1 + j*dy enddo enddo ns = is np0 = ip do j = 0, nj-1 do i = 0, ni-1 ns = ns + 1 np0 = np0 + 1 node(1,ns) = np0 node(2,ns) = np0 + ni + 1 node(3,ns) = np0 + ni + 2 ns = ns + 1 node(1,ns) = np0 node(2,ns) = np0 + 1 node(3,ns) = np0 + ni + 2 enddo np0 = np0 + 1 enddo ip = np is = ns end subroutine genmesh


Copyright (C) Toshihiro Taguchi, Setsunan University, 2000-2012 All rights reserved.