implicit real*8 (a-h, o-z)
dimension w(3000000),x(3000000),y(3000000),z(3000000),&
&         mesh(1000000,6),narabi(10000,10000)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
read*, nset !節点数の読み込み
do i=1,nset
read*, mesh(i,5),x(i),y(i),z(i)!各節点の座標値の読み込み
end do
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
read*, nyou !エレメント数の読み込み
do i=1,nyou
read*, mesh(i,1),mesh(i,2),mesh(i,3),mesh(i,4)!各エレメントの読み込み
end do
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
print'("** salomeのdatファイルをccxのC3D4要素inp化")'
print'("**")'
print'("*NODE, NSET=Nall")'
do i=1,nset
print *,mesh(i,5),",",x(i),",",y(i),",",z(i)
end do 
print'("*ELEMENT, TYPE=C3D4, ELSET=Eall")'
do i=1,nyou
print *,i,",",mesh(i,1),",",mesh(i,3),",",mesh(i,2),",",mesh(i,4)
end do
print'("*NSET,NSET=FIX")'
print'("** ここに拘束したい節点番号とコンマを1行ずつ並べる")'
print'("** 例えば拘束節点が1と2だったら")'
print'(i6,a)',1,','
print'(i6,a)',2,','
print'("** みたいに")'
print'("*BOUNDARY")'
print'("** 以下のFIX,に続けて拘束変位1=x,2=y,3=zをコンマ区切りで")'
print'("FIX,1,3")'
print'("*MATERIAL,NAME=EL")'
print'("*ELASTIC")'
e=210000. ! ヤング率(MPa)
poi=0.3   !  ポアソン比
print*, e,',',poi
t=10.d-3 !板の厚さ(m)
print'("*SOLID SECTION, ELSET=Eall, MATERIAL=EL")'
!print*,t
!温度設定
!print'("*INITIAL CONDITIONS,TYPE=TEMPERATURE")'
!print'("Nall,273.")'
!節点ごとに厚さを変えたい時
!print'("*NSET,NSET=ATUSA")'
!do i=1,nset
!print'(i6,a)',i,','
!end do
!print'("*NODAL THICKNESS")'
!print*,'ATUSA,',t
print'("*NSET,NSET=SAIKA")'
print'("** ここに載荷したい節点番号とコンマを1行ずつ並べる")'
print'("** 例えば載荷節点が3と4だったら")'
print'(i6,a)',3,','
print'(i6,a)',4,','
print'("** みたいに")'
print'("*STEP")'
print'("*STATIC,SOLVER=SPOOLES")'
print'("*CLOAD")'
p=1.d-0 !載荷荷重(MN)
nsaika=2 !載荷節点数
print'("** 以下のSAIKAに続けて載荷方向、載荷荷重を書く")'
print'("** 例えば載荷方向が3=zで、載荷荷重がp/nsaikaなら")'
print*,'SAIKA,3,',p/nsaika
print'("*NODE PRINT,NSET=Nall")'
print'("U")'
print'("*EL PRINT,ELSET=Eall")'
print'("S")'
print'("*NODE FILE")'
print'("U")'
print'("*EL FILE,POSITION=AVERAGED AT NODES")'
print'("S")'
print'("*END STEP")'
!
!!!!!!!!!!!!!!!!!!!!!!
!
open(8,file='ble6ccx.obj')
write(8,'("3DG1")')
write(8,*) nset+1
do i=0,nset
write(8,*) x(i),y(i),z(i)
end do
!
do i=1,nyou
write(8,*) 6,mesh(i,1),mesh(i,2),mesh(i,3),mesh(i,4)&
&              ,mesh(i,5),mesh(i,6),' ','0xcccccc'
end do
!
end
