Gcc 受约束实现数据的读取例程

Gcc 受约束实现数据的读取例程,gcc,fortran,Gcc,Fortran,有人能简要描述一下MPA站点上的阅读程序或给出命令吗? 我现在不知道在我的Fedora 17 32位上如何处理这些Fortran文件,gcc版本为4.7.2 20120921(Red Hat 4.7.2-2)。 例如,ReadGalCat.F: program ReadGalCat integer*4 ngals integer*4, dimension(:), allocatable :: IdGal,InGroup,MassGroup,Code real*4, dimension(

有人能简要描述一下MPA站点上的阅读程序或给出命令吗? 我现在不知道在我的Fedora 17 32位上如何处理这些Fortran文件,gcc版本为4.7.2 20120921(Red Hat 4.7.2-2)。 例如,
ReadGalCat.F

program ReadGalCat



integer*4 ngals

integer*4, dimension(:), allocatable :: IdGal,InGroup,MassGroup,Code

real*4, dimension(:), allocatable :: PosX,PosY,PosZ,VelX,VelY,VelZ
real*4, dimension(:), allocatable :: LumTotB,LumTotV,LumTotI,LumTotK,&
     &LumBulB,LumBulV,LumBulI,LumBulK


real*4, dimension(:), allocatable :: CGas,Stellar,Bulge,SFR,ZLast,VirmLast,Vc


character*100 base
character*100 ext
character*100 fname

implicit none


!base='/mybase/'
!ext='myext.halos'

base='/gpfs/mpa/hmathis/WebSiteCR/LCDM/'
ext='cat_cutLum.gals'


fname=base(1:len_trim(base))//ext

print *,'Reading : ',fname



open(1,file=fname,form='unformatted',status='old')

read(1) ngals
print*,'ngals : ',ngals



allocate(IdGal(ngals),InGroup(ngals),MassGroup(ngals),Code(ngals))
allocate(PosX(ngals),PosY(ngals),PosZ(ngals),VelX(ngals),VelY(ngals),VelZ(ngals))
allocate(LumTotB(ngals),LumTotV(ngals),LumTotI(ngals),LumTotK(ngals),&
     &LumBulB(ngals),LumBulV(ngals),LumBulI(ngals),LumBulK(ngals))
allocate(CGas(ngals),Stellar(ngals),Bulge(ngals),SFR(ngals),ZLast(ngals),VirmLast(ngals),Vc(ngals))




read(1) IdGal ! the index of the particle the galaxy is associated with
read(1) InGroup ! the index (i.e. the rank in the halo cat file) of the halo hosting the galaxy          
read(1) MassGroup ! the number of particles of that halo (found by the groupfinder)
read(1) Code ! 0 for central galaxy, 1 for satellite galaxy



read(1) PosX ! comoving position of particle attached to the galaxy SGX in kpc/h (origin = Milky Way)
read(1) PosY ! --- SGY in kpc/h (origin = Milky Way)
read(1) PosZ ! --- SGZ in kpc/h (origin = Milky Way)
read(1) VelX ! peculiar velocity of the particle attached to the galaxy in km/s
read(1) VelY ! ---
read(1) VelZ ! ---


read(1) LumTotB ! total B band luminosity in Lsol
read(1) LumTotV ! total V band luminosity in Lsol
read(1) LumTotI ! total I band luminosity in Lsol
read(1) LumTotK ! total K band luminosity in Lsol
read(1) LumBulB ! bulge B band luminosity in Lsol
read(1) LumBulV ! bulge V band luminosity in Lsol
read(1) LumBulI ! bulge I band luminosity in Lsol
read(1) LumBulK ! bulge K band luminosity in Lsol

read(1) CGas ! mass of cold gas in Msol/h
read(1) Stellar ! total stellar mass in Msol/h
read(1) Bulge ! bulge stellar mass in Msol/h
read(1) SFR ! total (starburst+quiescent) SFR during last redshift interval in Msol/h/year

read(1) ZLast ! redshift when the galaxy was last a central galaxy
read(1) VirmLast ! virial mass of the halo when the galaxy was last a central galaxy
read(1) Vc ! disk circular velocity in km/s


close(1)


print*, 'Read ...'


print* ,'min,max PosX : ',minval(PosX),maxval(PosX)
print* ,'min,max PosY : ',minval(PosY),maxval(PosY)
print* ,'min,max PosZ : ',minval(PosZ),maxval(PosZ)


print* ,'min,max VelX : ',minval(VelX),maxval(VelX)
print* ,'min,max VelY : ',minval(VelY),maxval(VelY)
print* ,'min,max VelZ : ',minval(VelZ),maxval(VelZ)

print* ,'min,max IdGal : ',minval(IdGal),maxval(IdGal)
print* ,'min,max Code : ',minval(Code),maxval(Code)
print* ,'min,max InGroup : ',minval(InGroup),maxval(InGroup)
print* ,'min,max MassGroup : ',minval(MassGroup),maxval(MassGroup)


print* ,'min,max LumTotB : ',minval(LumTotB),maxval(LumTotB)
print* ,'min,max LumTotV : ',minval(LumTotV),maxval(LumTotV)
print* ,'min,max LumTotI : ',minval(LumTotI),maxval(LumTotI)
print* ,'min,max LumTotK : ',minval(LumTotK),maxval(LumTotK)

print* ,'min,max LumBulB : ',minval(LumBulB),maxval(LumBulB)
print* ,'min,max LumBulV : ',minval(LumBulV),maxval(LumBulV)
print* ,'min,max LumBulI : ',minval(LumBulI),maxval(LumBulI)
print* ,'min,max LumBulK : ',minval(LumBulK),maxval(LumBulK)

print* ,'min,max ColdG : ',minval(CGas),maxval(CGas)
print* ,'min,max Stellar : ',minval(Stellar),maxval(Stellar)
print* ,'min,max Bulge : ',minval(Bulge),maxval(Bulge)
print* ,'min,max SFR : ',minval(SFR),maxval(SFR)

print* ,'min,max ZLast : ',minval(ZLast),maxval(ZLast)
print* ,'min,max Virm : ',minval(VirmLast),maxval(VirmLast)
print* ,'min,max Vc : ',minval(Vc),maxval(Vc)


stop

end

作为Fortran代码,您可以使用Fortran编译器(如gfortran)进行编译。然后运行可执行文件。此示例将数据汇总到终端。因此,您可能会使用阅读部分作为示例,将其包含在您自己的代码中。您必须更改目录“base”。如果您不想使用Fortran,请使用文档和本示例来指导您用另一种语言编写阅读器。对于这种方法,您可能希望运行此示例以获得用于检查代码的比较结果。请阅读有关使用编译器以及系统路径含义的任何教程。谢谢,如何更改目录“base”?这是否意味着脚本指向a或目录?我尝试编译,但得到以下结果:klauslang@Fedq7ReadGalCat]$gfortran ReadGalCat.f90 ReadGalCat.f90:23.13:隐式无1 ReadGalCat.f90:21.19:字符*100 fname 2 Fehler:Anweisung隐式无bei(1)不允许使用Anweisung数据删除bei(2)福尔根[klauslang@Fedq7你知道这是什么意思吗?