Télécharger disp3d.eso

Retour à la liste

Numérotation des lignes :

disp3d
  1. C DISP3D SOURCE PV090527 23/02/07 11:58:35 11592
  2. subroutine disp3d(s,xg,yg,zg,tri,npos)
  3.  
  4. implicit real*8 (a-h,o-z)
  5. implicit integer (i-n)
  6. c include './decl_disc_spher.h'
  7. -INC HDECSPH
  8.  
  9.  
  10. integer i,j,k,n
  11. c calcule les surfaces et les orientations des cdg de triangles qui discrétisent une surface
  12. c en repère sphérique pour 1/2 de sphere
  13.  
  14.  
  15.  
  16. c orientation des points
  17. do i=1,npos+1
  18. thet1(i)=(i-1)*ang1/npos
  19. gam1(i)=-pi/2+(i-1)*ang1/npos
  20. end do
  21.  
  22. c coordonnées des points
  23. do i=1,npos+1
  24. do j=1,npos+1
  25. x(i,j)=sin(thet1(j))*cos(gam1(i))
  26. y(i,j)=sin(thet1(j))*sin(gam1(i))
  27. z(i,j)=cos(thet1(j))
  28.  
  29. c open(unit=1,file="ptsphere.res")
  30. c if(i.eq.1) then
  31. c write(unit=1,fmt='(11g13.5)')
  32. c end if
  33. c write(unit=1,fmt='(11g13.5)') x(i,j),y(i,j),z(i,j)
  34. c splot "ptsphere.res" u 1:2:3 with pm3d at s
  35. c splot "ptsphere.res" u 1:2:3 with lines
  36. end do
  37. end do
  38.  
  39. c numérotation des triangles
  40. c n,k : triangles
  41. c l : sommet
  42. c m : coordonnée
  43. do n=1,npos
  44. do k=1,2*npos-2
  45. c print*,mod(k,2),k
  46. if(k.eq.1) then
  47. c sommet 1
  48. tri(n,k,1,1)=x(1,1)
  49. tri(n,k,1,2)=y(1,1)
  50. tri(n,k,1,3)=z(1,1)
  51. c sommet 2
  52. tri(n,k,2,1)=x(n+1,2)
  53. tri(n,k,2,2)=y(n+1,2)
  54. tri(n,k,2,3)=z(n+1,2)
  55. c sommet 3
  56. tri(n,k,3,1)=x(n,2)
  57. tri(n,k,3,2)=y(n,2)
  58. tri(n,k,3,3)=z(n,2)
  59.  
  60. else if (k.eq.2*npos-2) then
  61. c sommet 1
  62. tri(n,k,1,1)=x(n+1,npos)
  63. tri(n,k,1,2)=y(n+1,npos)
  64. tri(n,k,1,3)=z(n+1,npos)
  65. c sommet 2
  66. tri(n,k,2,1)=x(n,npos)
  67. tri(n,k,2,2)=y(n,npos)
  68. tri(n,k,2,3)=z(n,npos)
  69. c sommet 3
  70. tri(n,k,3,1)=x(npos+1,npos+1)
  71. tri(n,k,3,2)=y(npos+1,npos+1)
  72. tri(n,k,3,3)=z(npos+1,npos+1)
  73.  
  74.  
  75. else if( mod(k,2).eq.0) then
  76. c =0 si pair, 1 si impair
  77. c sommet 1
  78. tri(n,k,1,1)=x(n+1,k/2+1)
  79. tri(n,k,1,2)=y(n+1,k/2+1)
  80. tri(n,k,1,3)=z(n+1,k/2+1)
  81. c sommet 2
  82. tri(n,k,2,1)=x(n,k/2+1)
  83. tri(n,k,2,2)=y(n,k/2+1)
  84. tri(n,k,2,3)=z(n,k/2+1)
  85. c sommet 3
  86. tri(n,k,3,1)=x(n+1,k/2+2)
  87. tri(n,k,3,2)=y(n+1,k/2+2)
  88. tri(n,k,3,3)=z(n+1,k/2+2)
  89.  
  90. else if( mod(k,2).eq.1) then
  91. c =0 si pair, 1 si impair
  92. c sommet 1
  93. tri(n,k,1,1)=x(n,(k-1)/2+1)
  94. tri(n,k,1,2)=y(n,(k-1)/2+1)
  95. tri(n,k,1,3)=z(n,(k-1)/2+1)
  96. c sommet 2
  97. tri(n,k,2,1)=x(n+1,(k+1)/2+1)
  98. tri(n,k,2,2)=y(n+1,(k+1)/2+1)
  99. tri(n,k,2,3)=z(n+1,(k+1)/2+1)
  100. c sommet 3
  101. tri(n,k,3,1)=x(n,(k+1)/2+1)
  102. tri(n,k,3,2)=y(n,(k+1)/2+1)
  103. tri(n,k,3,3)=z(n,(k+1)/2+1)
  104. end if
  105. end do
  106. end do
  107.  
  108. c calcul des positions des cdg
  109.  
  110. do n=1,npos
  111. do k=1,2*npos-2
  112. xg(n,k)=(tri(n,k,1,1)+tri(n,k,2,1)+tri(n,k,3,1))/3.d0
  113. yg(n,k)=(tri(n,k,1,2)+tri(n,k,2,2)+tri(n,k,3,2))/3.d0
  114. zg(n,k)=(tri(n,k,1,3)+tri(n,k,2,3)+tri(n,k,3,3))/3.d0
  115.  
  116. c normalisation des vecteurs
  117. xg(n,k)=xg(n,k)/sqrt(xg(n,k)**2+yg(n,k)**2+zg(n,k)**2)
  118. yg(n,k)=yg(n,k)/sqrt(xg(n,k)**2+yg(n,k)**2+zg(n,k)**2)
  119. zg(n,k)=zg(n,k)/sqrt(xg(n,k)**2+yg(n,k)**2+zg(n,k)**2)
  120.  
  121. c open(unit=2,file="cdgtri.res")
  122. c write(unit=2,fmt='(11g13.5)') xg(n,k),yg(n,k),zg(n,k)
  123. c splot "cdgtri.res"
  124. c splot "cdgtri.res","ptsphere.res" lc "blue" w pm3d at s
  125. end do
  126. end do
  127.  
  128.  
  129. c calcul des surfaces
  130. do n=1,npos
  131. do k=1,2*npos-2
  132. s(n,k) = sqrt((tri(n, k, 2, 2) * tri(n, k, 1, 1) - tri(n, k, 1,1)*
  133. #tri(n, k, 3, 2) - tri(n, k, 1, 2) * tri(n, k, 2, 1) + tri(n, k, 2,
  134. # 1) * tri(n, k, 3, 2) + tri(n, k, 1, 2) * tri(n, k, 3, 1) - tri(n,
  135. # k, 3, 1) * tri(n, k, 2, 2)) ** 2 + (tri(n, k, 1, 2) * tri(n, k, 2
  136. #, 3) - tri(n, k, 1, 2) * tri(n, k, 3, 3) - tri(n, k, 1, 3) * tri(n
  137. #, k, 2, 2) + tri(n, k, 2, 2) * tri(n, k, 3, 3) + tri(n, k, 1, 3) *
  138. # tri(n, k, 3, 2) - tri(n, k, 3, 2) * tri(n, k, 2, 3)) ** 2 + (-tri
  139. #(n, k, 1, 1) * tri(n, k, 2, 3) + tri(n, k, 1, 1) * tri(n, k, 3, 3)
  140. # + tri(n, k, 1, 3) * tri(n, k, 2, 1) - tri(n, k, 2, 1) * tri(n, k,
  141. # 3, 3) - tri(n, k, 1, 3) * tri(n, k, 3, 1) + tri(n, k, 3, 1) * tri
  142. #(n, k, 2, 3)) ** 2) / 0.2D1
  143. end do
  144. end do
  145.  
  146.  
  147. c somme des surfaces
  148. sum1=sum(s)
  149. c normalisation des surfaces pour que la somme fasse 2 ang1
  150. do n=1,npos
  151. do k=1,2*npos-2
  152. s(n,k)=s(n,k)/sum1*2*ang1
  153. end do
  154. end do
  155.  
  156.  
  157. return
  158.  
  159. end
  160.  
  161.  
  162.  

© Cast3M 2003 - Tous droits réservés.
Mentions légales