找回密码
 注册
Simdroid-非首页
查看: 84|回复: 1

[命令/FISH] 高手指点:关于p-y命令流的解释

[复制链接]
发表于 2010-7-26 21:27:20 | 显示全部楼层 |阅读模式 来自 浙江杭州
;  Calculate P-Y Curves at equidistant locations(等距离位置) along pile
;
;  set linked lists of equidistant nodes(设置等距离节点连接表)
;
def set_list
  ver_head = null
  i_pnt = i_head;指向接触面表中第一个接触面的地址
  loop while i_pnt # null
    node_pnt = i_node_head(i_pnt);接触面的第一个地址
    loop while node_pnt # null
      z_pos = in_pos(node_pnt,3);node_pnt的z坐标
      ver_pnt = ver_head
      section
        if ver_head = null then
          new = get_mem(5)
          mem(new) = ver_head
          ver_head = new
          mem(new+2) = z_pos
          mem(new+4) = gp_near(0,0,z_pos)
          hnew = get_mem(2)
          mem(hnew+1) = node_pnt
          mem(new+1) = hnew
          mem(hnew)  = null
          exit section
        end_if
        loop while ver_pnt # null
          ver_pnt_n = mem(ver_pnt)
          if abs(mem(ver_pnt+2)-z_pos)<0.1 then
            hnew = get_mem(2)
            mem(hnew+1) = node_pnt
            mem(hnew) = mem(ver_pnt+1)
            mem(ver_pnt+1) = hnew
            exit section
          end_if
          if ver_pnt_n = null then
            new = get_mem(5)
            mem(new) = null
            mem(ver_pnt) = new
            mem(new+2) = z_pos
            mem(new+4) = gp_near(0,0,z_pos)
            hnew = get_mem(2)
            mem(hnew+1) = node_pnt
            mem(new+1) = hnew
            mem(hnew)  = null
            exit section
          end_if
          ver_pnt = ver_pnt_n
        end_loop
      end_section
      node_pnt = in_next(node_pnt)
    end_loop
    i_pnt = i_next(i_pnt)
  end_loop
;
; --- calculate length corresponding to each segment
;
  ver_pnt = ver_head
  z_up = mem(ver_pnt+2)
  loop while ver_pnt # null
    ver_pnt_n = mem(ver_pnt)
    if ver_pnt_n # null then
      z_down = mem(ver_pnt_n+2)
    else
      z_down = mem(ver_pnt+2)
    end_if
    mem(ver_pnt+3) = 0.5*(z_up-z_down)
    z_up = mem(ver_pnt+2)
    ver_pnt = ver_pnt_n
  end_loop
end
set_list
;
; calculate average pressure during simulation
;
def gen_curve
  while_stepping
  if step-100*int(step/100)=0 then
  tot_reac = 0.
  vcount = 0
  ver_pnt = ver_head
  loop while ver_pnt # null
    vcount = vcount+1
    hor_pnt = mem(ver_pnt+1)
    hor_for = 0.
    hcount = 0
    loop while hor_pnt # null
      node_pnt = mem(hor_pnt+1)
      hcount   = hcount+1
      area     = 2.0 * in_area(node_pnt)
      hor_nor  = in_nstr(node_pnt)     
      hor_she  = in_sstr(node_pnt,1)   
;
; --- find orientation of the normal ---
;
      t_zone  = in_ztarget(node_pnt)   
      t_face  = in_ftarget(node_pnt)     
      t_gp1   = z_facegp(t_zone,t_face,1)
      t_gp2   = z_facegp(t_zone,t_face,2)
      t_gp3   = z_facegp(t_zone,t_face,3)
;
      dx1     = gp_xpos(t_gp2)-gp_xpos(t_gp1)
      dy1     = gp_ypos(t_gp2)-gp_ypos(t_gp1)
      dz1     = gp_zpos(t_gp2)-gp_zpos(t_gp1)
;
      dx2     = gp_xpos(t_gp3)-gp_xpos(t_gp1)
      dy2     = gp_ypos(t_gp3)-gp_ypos(t_gp1)
      dz2     = gp_zpos(t_gp3)-gp_zpos(t_gp1)
;
      dxn     = dy1*dz2-dz1*dy2
      dyn     = dz1*dx2-dx1*dz2
      dzn     = dx1*dy2-dy1*dx2
      dn      = sqrt(dxn*dxn+dyn*dyn+dzn*dzn)
      dxn     = dxn/dn
;
      hor_nor = hor_nor*dxn
      hor_for = hor_for+(hor_nor+hor_she)*area
      hor_pnt = mem(hor_pnt)
    end_loop
    gp_pile = mem(ver_pnt+4)
    hor_dis = gp_xdisp(gp_pile)
    tot_reac = tot_reac+hor_for
    table(vcount,hor_dis) = hor_for/mem(ver_pnt+3)
    ver_pnt = mem(ver_pnt)
  end_loop
  end_if
end
关于pointer在fish的运用,我已经学习了很久,但是一直没有怎么进步,终于鼓起勇气,把这段程序放上来,希望高手能帮我解释一下这段程序,非常感谢。
发表于 2010-8-14 00:48:35 | 显示全部楼层 来自 英国
Simdroid开发平台
这段程序,也在看~嵌套的太多了,需要慢慢梳理~
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Simapps系列直播

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-9-25 16:30 , Processed in 0.048134 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表