File: writeIFrIT.f

package info (click to toggle)
ifrit 3.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 22,568 kB
  • ctags: 10,223
  • sloc: cpp: 99,601; ansic: 203; fortran: 129; makefile: 61
file content (153 lines) | stat: -rwxr-xr-x 5,240 bytes parent folder | download | duplicates (7)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
C
C  Write to text uniform scalars data file
C
      subroutine WriteIFrITUniformScalarsTxtFile(n1,n2,n3,var1,var2,var3,
     .     filename)
      integer n1, n2, n3  ! Size of the computational mesh in 3 directions
      real*4 var1(n1,n2,n3)
      real*4 var2(n1,n2,n3) ! Three scalar variables
      real*4 var3(n1,n2,n3)  
      character*(*) filename  ! Name of the file
      open(unit=1, file=filename)
      write(1,*) n1, n2, n3
      do k=1,n3
         do j=1,n2
            do i=1,n1
               write(1,*) var1(i,j,k), var2(i,j,k), var3(i,j,k)
            enddo
         enddo
      enddo
      close(1)
      return
      end
C
C  Write to binary uniform scalars data file
C
      subroutine WriteIFrITUniformScalarsBinFile(n1,n2,n3,var1,var2,var3,
     .     filename)
      integer n1, n2, n3  ! Size of the computational mesh in 3 directions
      real*4 var1(n1,n2,n3)
      real*4 var2(n1,n2,n3) ! Three scalar variables
      real*4 var3(n1,n2,n3)  
      character*(*) filename  ! Name of the file
      open(unit=1, file=filename, form='unformatted')
      write(1) n1, n2, n3
      write(1) (((var1(i,j,k),i=1,n1),j=1,n2),k=1,n3)
      write(1) (((var2(i,j,k),i=1,n1),j=1,n2),k=1,n3)
      write(1) (((var3(i,j,k),i=1,n1),j=1,n2),k=1,n3)
      close(1)
      return
      end
C
C  Write to text uniform vectors data file
C
      subroutine WriteIFrITUniformVectorsTxtFile(n1,n2,n3,vect,filename)
      integer n1, n2, n3  ! Size of the computational mesh in 3 directions
      real*4 vect(3,n1,n2,n3)  ! Vector field
      character*(*) filename  ! Name of the file
      open(unit=1, file=filename)
      write(1,*) n1, n2, n3
      do k=1,n3
         do j=1,n2
            do i=1,n1
               write(1,*) vect(1,i,j,k), vect(2,i,j,k), vect(3,i,j,k)
            enddo
         enddo
      enddo
      close(1)
      return
      end
C
C  Write to binary uniform vectors data file
C
      subroutine WriteIFrITUniformVectorsBinFile(n1,n2,n3,vect,filename)
      integer n1, n2, n3  ! Size of the computational mesh in 3 directions
      real*4 vect(3,n1,n2,n3)  ! Vector field
      character*(*) filename  ! Name of the file
      open(unit=1, file=filename, form='unformatted')
      write(1) n1, n2, n3
      write(1) (((vect(1,i,j,k),i=1,n1),j=1,n2),k=1,n3)
      write(1) (((vect(2,i,j,k),i=1,n1),j=1,n2),k=1,n3)
      write(1) (((vect(3,i,j,k),i=1,n1),j=1,n2),k=1,n3)
      close(1)
      return
      end
C
C  Write to text uniform tensors data file
C
      subroutine WriteIFrITUniformTensorsTxtFile(n1,n2,n3,tens,filename)
      integer n1, n2, n3  ! Size of the computational mesh in 3 directions
      real*4 tens(6,n1,n2,n3)  ! Tensor field
      character*(*) filename  ! Name of the file
      open(unit=1, file=filename)
      write(1,*) n1, n2, n3
      do k=1,n3
         do j=1,n2
            do i=1,n1
               write(1,*) tens(1,i,j,k), tens(2,i,j,k), tens(3,i,j,k),
     .              tens(4,i,j,k), tens(5,i,j,k), tens(6,i,j,k)
            enddo
         enddo
      enddo
      close(1)
      return
      end
C
C  Write to binary uniform tensors data file
C
      subroutine WriteIFrITUniformTensorsBinFile(n1,n2,n3,tens,filename)
      integer n1, n2, n3  ! Size of the computational mesh in 3 directions
      real*4 tens(6,n1,n2,n3)  ! Tensor field
      character*(*) filename  ! Name of the file
      open(unit=1, file=filename, form='unformatted')
      write(1) n1, n2, n3
      write(1) (((tens(1,i,j,k),i=1,n1),j=1,n2),k=1,n3)
      write(1) (((tens(2,i,j,k),i=1,n1),j=1,n2),k=1,n3)
      write(1) (((tens(3,i,j,k),i=1,n1),j=1,n2),k=1,n3)
      write(1) (((tens(4,i,j,k),i=1,n1),j=1,n2),k=1,n3)
      write(1) (((tens(5,i,j,k),i=1,n1),j=1,n2),k=1,n3)
      write(1) (((tens(6,i,j,k),i=1,n1),j=1,n2),k=1,n3)
      close(1)
      return
      end
C
C  Write to text basic particles data file
C
      subroutine WriteIFrITBasicParticlesTxtFile(n,xl,yl,zl,xh,yh,zh,
     .     x,y,z,attr1,attr2,attr3,filename)
      integer n  ! Number of particles
      real*4 xl, yl, zl, xh, yh, zh  ! Bounding box 
      real*4 x(n), y(n), z(n)  ! Particle positions (can be real*8)
      real*4 attr1(n), attr2(n), attr3(n)  ! Particle attributes
      character*(*) filename  ! Name of the file
      open(unit=1, file=filename)
      write(1,*) n
      write(1,*) xl, yl, zl, xh, yh, zh
      do i=1,n
         write(1,*) x(i), y(i), z(i), attr1(i), attr2(i), attr3(i)
      enddo
      close(1)
      return
      end
C
C  Write to binary basic particles data file
C
      subroutine WriteIFrITBasicParticlesBinFile(n,xl,yl,zl,xh,yh,zh,
     .     x,y,z,attr1,attr2,attr3,filename)
      integer n  ! Number of particles
      real*4 xl, yl, zl, xh, yh, zh  ! Bounding box
      real*4 x(n), y(n), z(n)  ! Particle positions (can be real*8)
      real*4 attr1(n), attr2(n), attr3(n)  ! Particle attributes
      character*(*) filename  ! Name of the file
      open(unit=1, file=filename, form='unformatted')
      write(1) n
      write(1) xl, yl, zl, xh, yh, zh
      write(1) (x(i),i=1,n)
      write(1) (y(i),i=1,n)
      write(1) (z(i),i=1,n)
      write(1) (attr1(i),i=1,n)
      write(1) (attr2(i),i=1,n)
      write(1) (attr3(i),i=1,n)
      close(1)
      return
      end