V3FIT
line_segment.f
Go to the documentation of this file.
1 !*******************************************************************************
4 !
5 ! Note separating the Doxygen comment block here so detailed decription is
6 ! found in the Module not the file.
7 !
11 !*******************************************************************************
12 
13  MODULE line_segment
14  USE stel_kinds
15  USE stel_constants
16 
17 !*******************************************************************************
18 ! INTERFACE BLOCKS
19 !*******************************************************************************
22 
23  CONTAINS
24 
25 !*******************************************************************************
26 ! UTILITY SUBROUTINES
27 !*******************************************************************************
28 !-------------------------------------------------------------------------------
39 !-------------------------------------------------------------------------------
40  SUBROUTINE line_seg(x, y, xx, yy, n)
41 
42  IMPLICIT NONE
43 
44 ! Declare Arguments
45  REAL (rprec), INTENT(in) :: x
46  REAL (rprec), INTENT(out) :: y
47  REAL (rprec), DIMENSION(:), INTENT(in) :: xx
48  REAL (rprec), DIMENSION(:), INTENT(in) :: yy
49  INTEGER, INTENT(in) :: n
50 
51 ! local variables
52  INTEGER :: ilow, ihigh
53 
54 ! Start of executable code
55 ! Check for valid line segments.
56  IF (n .le. 1) THEN
57  stop "Line sigments require at least two points"
58  ELSE IF (xx(1) .ge. xx(2)) THEN
59  stop "Line sigments must be specified in increasing order of x"
60  END IF
61 
62 ! If x is outside of array, linearly interprolate from the last two points.
63  IF (x .lt. xx(1)) THEN
64  ilow = 1; ihigh = 2
65  ELSE IF (x .gt. xx(n)) THEN
66  ilow = n - 1; ihigh = n
67  ELSE
68  CALL get_indices(x, xx, 1, n, ilow, ihigh)
69  END IF
70 
71  y = y_value(x, yy, xx, ilow, ihigh)
72 
73  END SUBROUTINE
74 
75 !-------------------------------------------------------------------------------
86 !-------------------------------------------------------------------------------
87  SUBROUTINE line_seg_int(x, y, xx, yy, n)
88 
89  IMPLICIT NONE
90 
91 ! Declare Arguments
92  REAL (rprec), INTENT(in) :: x
93  REAL (rprec), INTENT(out) :: y
94  REAL (rprec), DIMENSION(:), INTENT(in) :: xx
95  REAL (rprec), DIMENSION(:), INTENT(in) :: yy
96  INTEGER, INTENT(in) :: n
97 
98 ! local variables
99  INTEGER :: ilow, ihigh
100  INTEGER :: i0low, i0high
101  INTEGER :: i
102 
103 ! Start of executable code
104 ! Check for valid line segments.
105  IF (n .le. 1) THEN
106  stop "Line sigments require at least two points"
107  ELSE IF (xx(1) .ge. xx(2)) THEN
108  stop "Line sigments must be specified in increasing order of x"
109  END IF
110 
111 ! If x is outside of array, linearly interprolate from the last two points.
112  IF (x .lt. xx(1)) THEN
113  ilow = 1; ihigh = 2
114  ELSE IF (x .gt. xx(n)) THEN
115  ilow = n - 1; ihigh = n
116  ELSE
117  CALL get_indices(x, xx, 1, n, ilow, ihigh)
118  END IF
119 
120 ! Determine where zero is.
121  IF (zero .lt. xx(1)) THEN
122  i0low = 1; i0high = 2
123  ELSE IF (zero .gt. xx(n)) THEN
124  i0low = n - 1; i0high = n
125  ELSE
126  CALL get_indices(zero, xx, 1, n, i0low, i0high)
127  END IF
128 
129 ! If 0 and x have the same low and high indices, then the integrate directly
130 ! from 0 to x. Other wise Integrate from:
131 ! 0 to xx(i0high); xx(i0high) to xx(ilow); xx(ilow) to x
132  IF (ilow .eq. i0low) THEN
133  y = y_value_int(zero, x, yy, xx, ilow, ihigh)
134  ELSE
135  y = y_value_int(zero, xx(i0high), yy, xx, i0low, i0high)
136  DO i = i0high, ilow - 1
137  y = y + y_value_int(xx(i), xx(i+1), yy, xx, i, i+1)
138  END DO
139  y = y + y_value_int(xx(ilow), x, yy, xx, ilow, ihigh)
140  END IF
141 
142  END SUBROUTINE
143 
144 !*******************************************************************************
145 ! PRIVATE
146 !*******************************************************************************
147 !-------------------------------------------------------------------------------
162 !-------------------------------------------------------------------------------
163  PURE RECURSIVE &
164  &SUBROUTINE get_indices(x, xx, lBound, uBound, ilow, ihigh)
165 
166  IMPLICIT NONE
167 
168 ! Declare Arguments
169  REAL(rprec), INTENT(in) :: x
170  REAL(rprec), DIMENSION(:), INTENT(in) :: xx
171  INTEGER, INTENT(in) :: lbound
172  INTEGER, INTENT(in) :: ubound
173  INTEGER, INTENT(out) :: ilow
174  INTEGER, INTENT(out) :: ihigh
175 
176 ! local variables
177  INTEGER :: hbound ! Half way index of the xx array.
178 
179 ! Start of executable code
180 ! Perform a tree search to find the interval that x falls between. This
181 ! algorthim works by dividing the array into two sub arrays then determining if
182 ! x is in the lower or upper array. Then the algortrim recurses on the sub array
183 ! until the size of the array equals 2. This assumes that the array xx is
184 ! correctly sorted.
185  IF (ubound - lbound .eq. 1) THEN
186  ilow = lbound; ihigh = ubound
187  RETURN
188  END IF
189 
190  hbound = (ubound + lbound)/2
191  IF (x .ge. xx(lbound) .and. x .lt. xx(hbound)) THEN
192  CALL get_indices(x, xx, lbound, hbound, ilow, ihigh)
193  ELSE
194  CALL get_indices(x, xx, hbound, ubound, ilow, ihigh)
195  END IF
196  END SUBROUTINE
197 
198 !-------------------------------------------------------------------------------
209 !-------------------------------------------------------------------------------
210  PURE FUNCTION slope(yy, xx, ilow, ihigh)
211 
212  IMPLICIT NONE
213 
214 ! Declare Arguments
215  REAL(rprec) :: slope
216  REAL(rprec), DIMENSION(:), INTENT(in) :: xx
217  REAL(rprec), DIMENSION(:), INTENT(in) :: yy
218  INTEGER, INTENT(in) :: ilow
219  INTEGER, INTENT(in) :: ihigh
220 
221 ! Start of executable code
222  slope = (yy(ihigh) - yy(ilow))/(xx(ihigh) - xx(ilow))
223 
224  END FUNCTION
225 
226 !-------------------------------------------------------------------------------
237 !-------------------------------------------------------------------------------
238  PURE FUNCTION offset(yy, xx, ilow, ihigh)
239 
240  IMPLICIT NONE
241 
242 ! Declare Arguments
243  REAL(rprec) :: offset
244  REAL(rprec), DIMENSION(:), INTENT(in) :: xx
245  REAL(rprec), DIMENSION(:), INTENT(in) :: yy
246  INTEGER, INTENT(in) :: ilow
247  INTEGER, INTENT(in) :: ihigh
248 
249 ! Start of executable code
250  offset = (xx(ihigh)*yy(ilow) - xx(ilow)*yy(ihigh)) &
251  & / (xx(ihigh) - xx(ilow))
252 
253  END FUNCTION
254 
255 !-------------------------------------------------------------------------------
268 !-------------------------------------------------------------------------------
269  PURE FUNCTION y_value(x, yy, xx, ilow, ihigh)
270 
271  IMPLICIT NONE
272 
273 ! Declare Arguments
274  REAL(rprec) :: y_value
275  REAL(rprec), INTENT(in) :: x
276  REAL(rprec), DIMENSION(:), INTENT(in) :: xx
277  REAL(rprec), DIMENSION(:), INTENT(in) :: yy
278  INTEGER, INTENT(in) :: ilow
279  INTEGER, INTENT(in) :: ihigh
280 
281 ! Start of executable code
282  IF (xx(ilow) .eq. xx(ihigh)) THEN
283  y_value = yy(ihigh)
284  ELSE
285  y_value = slope(yy, xx, ilow, ihigh)*x &
286  & + offset(yy, xx, ilow, ihigh)
287  END IF
288 
289  END FUNCTION
290 
291 !-------------------------------------------------------------------------------
305 !-------------------------------------------------------------------------------
306  PURE FUNCTION y_value_int(x0, x1, yy, xx, ilow, ihigh)
307 
308  IMPLICIT NONE
309 
310 ! Declare Arguments
311  REAL(rprec) :: y_value_int
312  REAL(rprec), INTENT(in) :: x0
313  REAL(rprec), INTENT(in) :: x1
314  REAL(rprec), DIMENSION(:), INTENT(in) :: xx
315  REAL(rprec), DIMENSION(:), INTENT(in) :: yy
316  INTEGER, INTENT(in) :: ilow
317  INTEGER, INTENT(in) :: ihigh
318 
319 ! Start of executable code
320  IF (xx(ilow) .eq. xx(ihigh)) THEN
321  y_value_int = 0.0
322  ELSE
323  y_value_int = slope(yy, xx, ilow, ihigh) &
324  & / 2.0*(x1**2.0 - x0**2.0) &
325  & + offset(yy, xx, ilow, ihigh)*(x1 - x0)
326  END IF
327 
328  END FUNCTION
329 
330 !*******************************************************************************
331 ! UNIT TESTS
332 !*******************************************************************************
333 !*******************************************************************************
334 ! Main test function
335 !*******************************************************************************
336 !-------------------------------------------------------------------------------
342 !-------------------------------------------------------------------------------
343  FUNCTION line_seg_test()
344 
345  IMPLICIT NONE
346 
347 ! Declare Arguments
348  LOGICAL :: line_seg_test
349 
350 ! local variables
351  REAL(rprec) :: result
352 
353 ! Start of executable code
354 ! Test slope function. yy(0.0,1.0) and xx(0.0,1.0) should have a slope of 1.0
355  result = slope((/ 0.0d+0, 1.0d+0 /), &
356  & (/ 0.0d+0, 1.0d+0 /), &
357  & 1, 2)
358  line_seg_test = check(1.0d+0, result, 1, "slope()")
359  IF (.not.line_seg_test) RETURN
360 ! Test slope function. yy(1.0,0.0) and xx(0.0,1.0) should have a slope of -1.0
361  result = slope((/ 1.0d+0, 0.0d+0 /), &
362  & (/ 0.0d+0, 1.0d+0 /), &
363  & 1, 2)
364  line_seg_test = check(-1.0d+0, result, 2, "slope()")
365  IF (.not.line_seg_test) RETURN
366 ! Test slope function. yy(1.0,1.0) and xx(0.0,1.0) should have a slope of 0.0
367  result = slope((/ 1.0d+0, 1.0d+0 /), &
368  & (/ 0.0d+0, 1.0d+0 /), &
369  & 1, 2)
370  line_seg_test = check(0.0d+0, result, 3, "slope()")
371  IF (.not.line_seg_test) RETURN
372 
373 ! Test slope function. yy(0.0,1.0) and xx(1.0,2.0) should have a slope of 1.0
374  result = slope((/ 0.0d+0, 1.0d+0 /), &
375  & (/ 1.0d+0, 2.0d+0 /), &
376  & 1, 2)
377  line_seg_test = check(1.0d+0, result, 4, "slope()")
378 
379 ! Test offset function. yy(0.0,1.0) and xx(0.0,1.0) should have an offset of 0.0
380  result = offset((/ 0.0d+0, 1.0d+0 /), &
381  & (/ 0.0d+0, 1.0d+0 /), &
382  & 1, 2)
383  line_seg_test = check(0.0d+0, result, 1, "offset()")
384  IF (.not.line_seg_test) RETURN
385 ! Test offset function. yy(1.0,0.0) and xx(0.0,1.0) should have an offset of 1.0
386  result = offset((/ 1.0d+0, 0.0d+0 /), &
387  & (/ 0.0d+0, 1.0d+0 /), &
388  & 1, 2)
389  line_seg_test = check(1.0d+0, result, 2, "offset()")
390  IF (.not.line_seg_test) RETURN
391 ! Test offset function. yy(2.0,1.0) and xx(1.0,2.0) should have an offset of 3.0
392  result = offset((/ 2.0d+0, 1.0d+0 /), &
393  & (/ 1.0d+0, 2.0d+0 /), &
394  & 1, 2)
395  line_seg_test = check(3.0d+0, result, 3, "offset()")
396  IF (.not.line_seg_test) RETURN
397 
398 ! Test y_value function. yy(0.0,2.0) and xx(0.0,2.0) should have a value of 1.0
399 ! at x = 1.0
400  result = y_value(1.0d+0, &
401  & (/ 0.0d+0, 2.0d+0 /), &
402  & (/ 0.0d+0, 2.0d+0 /), &
403  & 1, 2)
404  line_seg_test = check(1.0d+0, result, 1, "y_value()")
405  IF (.not.line_seg_test) RETURN
406 ! Test y_value function. yy(1.0,2.0) and xx(1.0,2.0) should have a value of 0.0
407 ! at x = 0.0
408  result = y_value(0.0d+0, &
409  & (/ 1.0d+0, 2.0d+0 /), &
410  & (/ 1.0d+0, 2.0d+0 /), &
411  & 1, 2)
412  line_seg_test = check(0.0d+0, result, 2, "y_value()")
413  IF (.not.line_seg_test) RETURN
414 ! Test y_value function. yy(0.0,1.0) and xx(0.0,1.0) should have a value of 3.0
415 ! at x = 3.0
416  result = y_value(3.0d+0, &
417  & (/ 0.0d+0, 1.0d+0 /), &
418  & (/ 0.0d+0, 1.0d+0 /), &
419  & 1, 2)
420  line_seg_test = check(3.0d+0, result, 3, "y_value()")
421  IF (.not.line_seg_test) RETURN
422 
423 ! Test y_value_int function. yy(1.0,1.0) and xx(0.0,1.0) should have a value of
424 ! 1.0 at x1 = 1.0 to x0 = 0.0
425  result = y_value_int(0.0d+0, 1.0d+0, &
426  & (/ 1.0d+0, 1.0d+0 /), &
427  & (/ 0.0d+0, 1.0d+0 /), &
428  & 1, 2)
429  line_seg_test = check(1.0d+0, result, 1, "y_value_int()")
430  IF (.not.line_seg_test) RETURN
431 
432 ! Test y_value_int function. yy(1.0,1.0) and xx(1.0,2.0) should have a value of
433 ! 1.0 at x1 = 1.0 to x0 = 0.0
434  result = y_value_int(0.0d+0, 1.0d+0, &
435  & (/ 1.0d+0, 1.0d+0 /), &
436  & (/ 1.0d+0, 2.0d+0 /), &
437  & 1, 2)
438  line_seg_test = check(1.0d+0, result, 2, "y_value_int()")
439  IF (.not.line_seg_test) RETURN
440 ! Test y_value_int function. yy(1.0,1.0) and xx(0.0,1.0) should have a value of
441 ! 1.0 at x1 = 2.0 to x0 = 1.0
442  result = y_value_int(1.0d+0, 2.0d+0, &
443  & (/ 1.0d+0, 1.0d+0 /), &
444  & (/ 0.0d+0, 1.0d+0 /), &
445  & 1, 2)
446  line_seg_test = check(1.0d+0, result, 3, "y_value_int()")
447  IF (.not.line_seg_test) RETURN
448 ! Test y_value_int function. yy(0.0,1.0) and xx(0.0,1.0) should have a value of
449 ! 0.5 at x1 = 1.0 to x0 = 0.0
450  result = y_value_int(0.0d+0, 1.0d+0, &
451  & (/ 0.0d+0, 1.0d+0 /), &
452  & (/ 0.0d+0, 1.0d+0 /), &
453  & 1, 2)
454  line_seg_test = check(0.5d+0, result, 4, "y_value_int()")
455  IF (.not.line_seg_test) RETURN
456 ! Test y_value_int function. yy(1.0,2.0) and xx(0.0,1.0) should have a value of
457 ! 1.5 at x1 = 1.0 to x0 = 0.0
458  result = y_value_int(0.0d+0, 1.0d+0, &
459  & (/ 1.0d+0, 2.0d+0 /), &
460  & (/ 0.0d+0, 1.0d+0 /), &
461  & 1, 2)
462  line_seg_test = check(1.5d+0, result, 5, "y_value_int()")
463  IF (.not.line_seg_test) RETURN
464 ! Test y_value_int function. yy(1.0,2.0) and xx(1.0,2.0) should have a value of
465 ! 0.5 at x1 = 1.0 to x0 = 0.0
466  result = y_value_int(0.0d+0, 1.0d+0, &
467  & (/ 1.0d+0, 2.0d+0 /), &
468  & (/ 1.0d+0, 2.0d+0 /), &
469  & 1, 2)
470  line_seg_test = check(0.5d+0, result, 6, "y_value_int()")
471  IF (.not.line_seg_test) RETURN
472 ! Test y_value_int function. yy(0.0,1.0) and xx(0.0,1.0) should have a value of
473 ! 1.5 at x1 = 2.0 to x0 = 1.0
474  result = y_value_int(1.0d+0, 2.0d+0, &
475  & (/ 1.0d+0, 2.0d+0 /), &
476  & (/ 1.0d+0, 2.0d+0 /), &
477  & 1, 2)
478  line_seg_test = check(1.5d+0, result, 7, "y_value_int()")
479  IF (.not.line_seg_test) RETURN
480 
481 ! Test line_seg function. yy(1.0,1.0,0.0,0.0) and xx(0.0,1.0,2.0,3.0) should
482 ! have a value of 1.0 at x = 0.5
483  CALL line_seg(0.5d+0, result, &
484  & (/ 0.0d+0, 1.0d+0, 2.0d+0, 3.0d+0 /), &
485  & (/ 1.0d+0, 1.0d+0, 0.0d+0, 0.0d+0 /), &
486  & 4)
487  line_seg_test = check(1.0d+0, result, 1, "line_seg()")
488  IF (.not.line_seg_test) RETURN
489 ! Test line_seg function. yy(1.0,1.0,0.0,0.0) and xx(0.0,1.0,2.0,3.0) should
490 ! have a value of 0.0 at x = 2.5
491  CALL line_seg(2.5d+0, result, &
492  & (/ 0.0d+0, 1.0d+0, 2.0d+0, 3.0d+0 /), &
493  & (/ 1.0d+0, 1.0d+0, 0.0d+0, 0.0d+0 /), &
494  & 4)
495  line_seg_test = check(0.0d+0, result, 2, "line_seg()")
496  IF (.not.line_seg_test) RETURN
497 ! Test line_seg function. yy(1.0,1.0,0.0,0.0) and xx(0.0,1.0,2.0,3.0) should
498 ! have a value of 0.5 at x = 1.5
499  CALL line_seg(1.5d+0, result, &
500  & (/ 0.0d+0, 1.0d+0, 2.0d+0, 3.0d+0 /), &
501  & (/ 1.0d+0, 1.0d+0, 0.0d+0, 0.0d+0 /), &
502  & 4)
503  line_seg_test = check(0.5d+0, result, 3, "line_seg()")
504  IF (.not.line_seg_test) RETURN
505 ! Test line_seg function. yy(1.0,1.0,0.0,0.0) and xx(1.0,2.0,3.0,4.0) should
506 ! have a value of 1.0 at x = 0.0
507  CALL line_seg(0.0d+0, result, &
508  & (/ 1.0d+0, 2.0d+0, 3.0d+0, 4.0d+0 /), &
509  & (/ 1.0d+0, 1.0d+0, 0.0d+0, 0.0d+0 /), &
510  & 4)
511  line_seg_test = check(1.0d+0, result, 4, "line_seg()")
512  IF (.not.line_seg_test) RETURN
513 ! Test line_seg function. yy(1.0,1.0,0.0,0.0) and xx(0.0,1.0,2.0,3.0) should
514 ! have a value of 0.0 at x = 4.0
515  CALL line_seg(4.0d+0, result, &
516  & (/ 0.0d+0, 1.0d+0, 2.0d+0, 3.0d+0 /), &
517  & (/ 1.0d+0, 1.0d+0, 0.0d+0, 0.0d+0 /), &
518  & 4)
519  line_seg_test = check(0.0d+0, result, 5, "line_seg()")
520  IF (.not.line_seg_test) RETURN
521 
522 ! Test line_seg_int function. yy(1.0,1.0,0.0,0.0) and xx(0.0,1.0,2.0,3.0) should
523 ! have a value of 0.5 at x = 0.5
524  CALL line_seg_int(0.5d+0, result, &
525  & (/ 0.0d+0, 1.0d+0, 2.0d+0, 3.0d+0 /), &
526  & (/ 1.0d+0, 1.0d+0, 0.0d+0, 0.0d+0 /), &
527  & 4)
528  line_seg_test = check(0.5d+0, result, 1, "line_seg_int()")
529  IF (.not.line_seg_test) RETURN
530 ! Test line_seg_int function. yy(1.0,1.0,0.0,0.0) and xx(0.0,1.0,2.0,3.0) should
531 ! have a value of 1.375 at x = 1.5
532  CALL line_seg_int(1.5d+0, result, &
533  & (/ 0.0d+0, 1.0d+0, 2.0d+0, 3.0d+0 /), &
534  & (/ 1.0d+0, 1.0d+0, 0.0d+0, 0.0d+0 /), &
535  & 4)
536  line_seg_test = check(1.375d+0, result, 2, "line_seg_int()")
537  IF (.not.line_seg_test) RETURN
538 ! Test line_seg_int function. yy(1.0,1.0,0.0,0.0) and xx(0.0,1.0,2.0,3.0) should
539 ! have a value of 1.5 at x = 2.5
540  CALL line_seg_int(2.5d+0, result, &
541  & (/ 0.0d+0, 1.0d+0, 2.0d+0, 3.0d+0 /), &
542  & (/ 1.0d+0, 1.0d+0, 0.0d+0, 0.0d+0 /), &
543  & 4)
544  line_seg_test = check(1.5d+0, result, 3, "line_seg_int()")
545  IF (.not.line_seg_test) RETURN
546 ! Test line_seg_int function. yy(1.0,1.0,0.0,0.0) and xx(1.0,2.0,3.0,4.0) should
547 ! have a value of 0.5 at x = 0.5
548  CALL line_seg_int(0.5d+0, result, &
549  & (/ 1.0d+0, 2.0d+0, 3.0d+0, 4.0d+0 /), &
550  & (/ 1.0d+0, 1.0d+0, 0.0d+0, 0.0d+0 /), &
551  & 4)
552  line_seg_test = check(0.5d+0, result, 4, "line_seg_int()")
553  IF (.not.line_seg_test) RETURN
554 ! Test line_seg_int function. yy(1.0,0.0,0.0,1.0) and xx(0.0,1.0,2.0,3.0) should
555 ! have a value of 2.5 at x = 4.0
556  CALL line_seg_int(4.0d+0, result, &
557  & (/ 0.0d+0, 1.0d+0, 2.0d+0, 3.0d+0 /), &
558  & (/ 1.0d+0, 0.0d+0, 0.0d+0, 1.0d+0 /), &
559  & 4)
560  line_seg_test = check(2.5d+0, result, 5, "line_seg_int()")
561  IF (.not.line_seg_test) RETURN
562 ! Test line_seg_int function. yy(1.0,0.0,0.0,1.0) and xx(1.0,2.0,3.0,4.0) should
563 ! have a value of 4.0 at x = 5.0
564  CALL line_seg_int(5.0d+0, result, &
565  & (/ 1.0d+0, 2.0d+0, 3.0d+0, 4.0d+0 /), &
566  & (/ 1.0d+0, 0.0d+0, 0.0d+0, 1.0d+0 /), &
567  & 4)
568  line_seg_test = check(4.0d+0, result, 6, "line_seg_int()")
569  IF (.not.line_seg_test) RETURN
570 
571  END FUNCTION
572 
573 !*******************************************************************************
574 ! CHECK FUNCTIONS
575 !*******************************************************************************
576 !-------------------------------------------------------------------------------
587 !-------------------------------------------------------------------------------
588  FUNCTION check(expected, received, testNum, name)
589 
590  IMPLICIT NONE
591 
592 ! Declare Arguments
593  LOGICAL :: check
594  REAL(rprec), INTENT(in) :: expected
595  REAL(rprec), INTENT(in) :: received
596  INTEGER, INTENT(in) :: testnum
597  CHARACTER (LEN=*), INTENT(in) :: name
598 
599 ! Start of executable code
600  check = expected .eq. received
601  IF (.not.check) THEN
602  WRITE(*,*) "line_segment_mod.f: ", name, " test", testnum, &
603  & "failed."
604  WRITE(*,*) "Expected", expected, "Received", received
605  END IF
606 
607  END FUNCTION
608 
609  END MODULE line_segment
line_segment::y_value_int
pure real(rprec) function, private y_value_int(x0, x1, yy, xx, ilow, ihigh)
Integrate the line.
Definition: line_segment.f:307
line_segment::offset
pure real(rprec) function, private offset(yy, xx, ilow, ihigh)
Find the y intercept of the line.
Definition: line_segment.f:239
line_segment::slope
pure real(rprec) function, private slope(yy, xx, ilow, ihigh)
Find the slope of the line.
Definition: line_segment.f:211
line_segment::check
logical function, private check(expected, received, testNum, name)
Check a real value.
Definition: line_segment.f:589
line_segment::line_seg_test
logical function, public line_seg_test()
Line segment unit test function.
Definition: line_segment.f:344
line_segment
Module is part of the LIBSTELL. This module contains code to create a profile constructed of line sig...
Definition: line_segment.f:13
line_segment::line_seg
subroutine, public line_seg(x, y, xx, yy, n)
Interpolate a point on a line.
Definition: line_segment.f:41
line_segment::line_seg_int
subroutine, public line_seg_int(x, y, xx, yy, n)
Integrate to a point on a line.
Definition: line_segment.f:88
line_segment::y_value
pure real(rprec) function, private y_value(x, yy, xx, ilow, ihigh)
Evaluate the line.
Definition: line_segment.f:270
line_segment::get_indices
pure recursive subroutine, private get_indices(x, xx, lBound, uBound, ilow, ihigh)
Find the bounding indicies of the array.
Definition: line_segment.f:165