Millepede-II  V04-00-00_preview
 All Classes Files Functions Variables Enumerator Pages
mille.f90
Go to the documentation of this file.
1 
2 ! Code converted using TO_F90 by Alan Miller
3 ! Date: 2012-03-03 Time: 17:00:12
4 
7 
10 
13 
16 
64 
65 SUBROUTINE mille(nlc,derlc,ngl,dergl,label,rmeas,sigma) ! add data
66  IMPLICIT NONE
67  INTEGER :: i
68  INTEGER :: icount
69  INTEGER :: isp
70  INTEGER :: nr
71  INTEGER :: nsp
72  ! -----------------------------------------------------------------
73 
74  INTEGER, INTENT(IN) :: nlc
75  REAL, INTENT(IN) :: derlc(nlc)
76  INTEGER, INTENT(IN) :: ngl
77  REAL, INTENT(IN) :: dergl(ngl)
78  INTEGER, INTENT(IN) :: label(ngl)
79  REAL, INTENT(IN) :: rmeas
80  REAL, INTENT(IN) :: sigma
81  INTEGER, PARAMETER :: lun=51
82  INTEGER, PARAMETER :: ndim=10000
83  REAL :: glder(ndim) ! real data record array
84  INTEGER :: inder(ndim) ! integer data record array
85  ! -----------------------------------------------------------------
86 
87  SAVE
88  DATA nr/0/ ! initial record length
89  DATA icount/0/
90  ! ...
91  IF(sigma <= 0.0) return ! error zero - no measurement
92  IF(nr == 0) THEN
93  nr=1
94  glder(1)=0.0
95  inder(1)=0 ! error counter
96  isp=0
97  END IF
98  IF(nr+nlc+ngl+2 > ndim) THEN
99  icount=icount+1
100  IF(icount <= 10) THEN
101  WRITE(*,*) 'Mille warning: data can not be stored'
102  IF(icount == 10) THEN
103  WRITE(*,*) 'Mille warning: no further printout'
104  END IF
105  END IF
106  inder(1)=inder(1)+1 ! count errors
107  return ! record dimension too small
108  END IF
109  nr=nr+1
110  glder(nr)=rmeas ! measured value
111  inder(nr)=0
112  DO i=1,nlc ! local derivatives
113  IF(derlc(i) /= 0.0) THEN
114  nr=nr+1
115  glder(nr)=derlc(i) ! derivative of local parameter
116  inder(nr)=i ! index of local parameter
117  END IF
118  END DO
119 
120  nr=nr+1
121  glder(nr)=sigma ! error of measured value
122  inder(nr)=0
123  DO i=1,ngl ! global derivatives
124  IF(dergl(i) /= 0.0.AND.label(i) > 0) THEN
125  nr=nr+1
126  glder(nr)=dergl(i) ! derivative of global parameter
127  inder(nr)=label(i) ! index of global parameter
128  END IF
129  END DO
130  return
131 
132  entry millsp(nsp,dergl,label)
133  ! add NSP special words (floating-point and integer)
134 
135  ! 0.0 0
136  ! -float(NSP) 0 ! indicates special data
137  ! following NSP floating and NSP integer data
138 
139  IF(nsp <= 0.OR.isp /= 0) return
140  isp=nr
141  IF(nr == 0) THEN
142  nr=1
143  glder(1)=0.0
144  inder(1)=0 ! error counter
145  END IF
146  IF(nr+nsp+2 > ndim) THEN
147  inder(1)=inder(1)+1 ! count errors
148  return ! record dimension too small
149  END IF
150  nr=nr+1 ! zero pair
151  glder(nr)=0.0
152  inder(nr)=0
153  nr=nr+1 ! nsp and zero
154  glder(nr)=-float(nsp)
155  inder(nr)=0
156  DO i=1,nsp
157  nr=nr+1
158  glder(nr)=dergl(i) ! floating-point
159  inder(nr)=label(i) ! integer
160  END DO
161  return
162 
163  entry kille ! stop record
164  nr=0 ! reset
165  return
166 
167  entry endle ! end-of-record
168  IF(nr > 1) THEN
169  WRITE(lun) nr+nr,(glder(i),i=1,nr),(inder(i),i=1,nr)
170  END IF
171  nr=0 ! reset
172  return
173 END SUBROUTINE mille