1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
program polarisation
integer :: taille,m
double precision, dimension (:,:), allocatable :: a,b
double precision, dimension (:,:), allocatable :: p
character(99) :: inputfile1, inputfile2,outputfile
!---------------------------------------------------------------------------------------------------------------------------------------
type *,'inputfile 1 :'
read (*,'(a30)') inputfile1
OPEN (UNIT =1,FILE =inputfile1,form='formatted',status="old",action='read')
taille=0
do
read (1,'(i2)', end=100) m
taille=taille+1
enddo
100 continue
print *,taille
allocate(a(3,taille))
allocate(b(3,taille))
allocate(p(2,taille))
rewind 1
read (1,'(f10.4,2e12.8)') a
type *,'inputfile 2 :'
read (*,'(a30)') inputfile2
OPEN (UNIT =2,FILE =inputfile2,form='formatted',status="old",action='read')
read (2,'(f10.4,2e12.8)') b
print *,'a(1:3,1) =',a(1:3,1)
print *,'b(1:3,1) =',b(1:3,1)
print *,'a(1:3,10) =',a(1:3,10)
print *,'b(1:3,10) =',b(1:3,10)
p(1,:)=a(1,:)
p(2,:)=sqrt( a(3,:)**2 + b(3,:)**2 )
print *,'p(1:2,1) =',p(1:2,1)
print *,'p(1:2,10) =',p(1:2,10)
type *,'outputfile :'
read (*,'(a30)') outputfile
OPEN (UNIT =3,FILE =outputfile,form='formatted',status="new",action="write")
write (3,'(f10.4,3x,f10.7)') p
end program polarisation |
Partager