gencost_pointer3d(k) = 0
gencost_pointer3d(k)=gencost_k3d
& gencost_pointer3d(k)
kk=gencost_pointer3d(k)
& gencost_pointer3d, gencost_smooth2Ddiffnbt,
integer gencost_pointer3d(NGENCOST)
if (gencost_pointer3d(k).GT.NGENCOST3D) then