NCEPLIBS-g2 4.0.0
Loading...
Searching...
No Matches
drstemplates.F90
Go to the documentation of this file.
1
4
34 implicit none
35
36 integer, parameter :: maxlen = 200
37 integer, parameter :: maxtemp = 9
38 integer :: j
39
42 integer :: template_num
43 integer :: mapdrslen
44 integer, dimension(MAXLEN) :: mapdrs
45 logical :: needext
46 end type drstemplate
47
48 type(drstemplate), dimension(MAXTEMP) :: templates
49
50 data templates(1)%template_num /0/
51 data templates(1)%mapdrslen /5/
52 data templates(1)%needext /.false./
53 data (templates(1)%mapdrs(j), j = 1, 5) &
54 /4,-2,-2,1,1/
55
56 data templates(2)%template_num /2/
57 data templates(2)%mapdrslen /16/
58 data templates(2)%needext /.false./
59 data (templates(2)%mapdrs(j), j = 1, 16) &
60 /4, -2, -2, 1, 1, 1, 1, 4, 4, 4, 1, 1, 4, 1, 4, 1/
61
62 data templates(3)%template_num /3/
63 data templates(3)%mapdrslen /18/
64 data templates(3)%needext /.false./
65 data (templates(3)%mapdrs(j), j = 1, 18) &
66 /4, -2, -2, 1, 1, 1, 1, 4, 4, 4, 1, 1, 4, 1, 4, 1, 1, 1/
67
68 data templates(4)%template_num /50/
69 data templates(4)%mapdrslen /5/
70 data templates(4)%needext /.false./
71 data (templates(4)%mapdrs(j), j = 1, 5) &
72 /4, -2, -2, 1, 4/
73
74 data templates(5)%template_num /51/
75 data templates(5)%mapdrslen /10/
76 data templates(5)%needext /.false./
77 data (templates(5)%mapdrs(j), j = 1, 10) &
78 /4, -2, -2, 1, -4, 2, 2, 2, 4, 1/
79
80 data templates(6)%template_num /40000/
81 data templates(6)%mapdrslen /7/
82 data templates(6)%needext /.false./
83 data (templates(6)%mapdrs(j), j = 1, 7) &
84 /4, -2, -2, 1, 1, 1, 1/
85
86 data templates(7)%template_num /40010/
87 data templates(7)%mapdrslen /5/
88 data templates(7)%needext /.false./
89 data (templates(7)%mapdrs(j), j = 1, 5) &
90 /4, -2, -2, 1, 1/
91
92 data templates(8)%template_num /40/
93 data templates(8)%mapdrslen /7/
94 data templates(8)%needext /.false./
95 data (templates(8)%mapdrs(j), j = 1, 7) &
96 /4, -2, -2, 1, 1, 1, 1/
97
98 data templates(9)%template_num /41/
99 data templates(9)%mapdrslen /5/
100 data templates(9)%needext /.false./
101 data (templates(9)%mapdrs(j), j = 1, 5) &
102 /4, -2, -2, 1, 1/
103
104 ! data templates(5)%template_num /1/ !< Simple Packing - Matrix
105 ! data templates(5)%mapdrslen /15/
106 ! data templates(5)%needext /.true./
107 ! data (templates(5)%mapdrs(j),j=1,15) &
108 ! /4,-2,-2,1,1,1,4,2,2,1,1,1,1,1,1/
109
110contains
111
121 integer function getdrsindex(number)
122 implicit none
123
124 integer, intent(in) :: number
125 integer :: j
126
127 getdrsindex = -1
128
129 do j = 1, maxtemp
130 if (number .eq. templates(j)%template_num) then
131 getdrsindex = j
132 return
133 endif
134 enddo
135 end function getdrsindex
136
156 subroutine getdrstemplate(number, nummap, map, needext, iret)
157 implicit none
158
159 integer, intent(in) :: number
160 integer, intent(out) :: nummap, map(*), iret
161 logical, intent(out) :: needext
162 integer :: index
163
164 iret = 0
165
166 index = getdrsindex(number)
167
168 if (index .ne. -1) then
169 nummap = templates(index)%mapdrslen
170 needext = templates(index)%needext
171 map(1 : nummap) = templates(index)%mapdrs(1 : nummap)
172 else
173 nummap = 0
174 needext = .false.
175 print *, 'getdrstemplate: DRS Template ', number, &
176 ' not defined.'
177 iret = 1
178 endif
179 end subroutine getdrstemplate
180
201 subroutine extdrstemplate(number, list, nummap, map)
202 implicit none
203
204 integer, intent(in) :: number, list(*)
205 integer, intent(out) :: nummap, map(*)
206 integer :: index, N, i
207
208 index = getdrsindex(number)
209 if (index .eq. -1) return
210
211 ! No implemented DRS templates need extensions.
212 if (.not. templates(index)%needext) return
213
214 nummap = templates(index)%mapdrslen
215 map(1 : nummap) = templates(index)%mapdrs(1 : nummap)
216
217 if (number .eq. 1) then
218 n = list(11) + list(13)
219 do i = 1, n
220 map(nummap + i)=4
221 enddo
222 nummap = nummap + n
223 endif
224 end subroutine extdrstemplate
225end module drstemplates
Handles Data Representation Templates used in Section 5.
subroutine getdrstemplate(number, nummap, map, needext, iret)
Return DRS template information for a specified Data Representation Template.
subroutine extdrstemplate(number, list, nummap, map)
Generate the remaining octet map for a given Data Representation Template, if required.
integer j
loop iterator
integer, parameter maxtemp
maximum number of entries in the template
integer, parameter maxlen
maximum number of octets in mapdrs
integer function getdrsindex(number)
Return the index of specified Data Representation Template in array templates.
type(drstemplate), dimension(maxtemp) templates
template in type of drstemplate
This type holds information about a DRS template.