500 class(TimeArraySeriesType),
intent(inout) :: this
501 integer(I4B),
intent(in) :: nvals
502 real(DP),
dimension(nvals),
intent(inout) :: values
503 real(DP),
intent(in) :: time0
504 real(DP),
intent(in) :: time1
507 real(DP) :: area, currTime, nextTime, ratio0, ratio1, t0, &
508 t01, t1, timediff,
value, value0, value1, valuediff
510 type(ListNodeType),
pointer :: precNode => null()
511 type(ListNodeType),
pointer :: currNode => null(), nextnode => null()
512 type(TimeArrayType),
pointer :: currRecord => null(), nextrecord => null()
513 class(*),
pointer :: currObj => null(), nextobj => null()
515 10
format(
'Error encountered while performing integration', &
516 ' for time-array series "', a,
'" for time interval: ', &
517 g12.5,
' to ', g12.5)
523 call this%get_latest_preceding_node(time0, precnode)
524 if (
associated(precnode))
then
526 do while (.not. ldone)
527 currobj => currnode%GetItem()
528 currrecord => castastimearraytype(currobj)
529 currtime = currrecord%taTime
530 if (currtime < time1)
then
531 if (.not.
associated(currnode%nextNode))
then
533 if (.not. this%read_next_array())
then
534 write (errmsg, 10) trim(this%Name), time0, time1
535 call store_error(errmsg)
536 call store_error_unit(this%inunit)
539 if (
associated(currnode%nextNode))
then
540 nextnode => currnode%nextNode
541 nextobj => nextnode%GetItem()
542 nextrecord => castastimearraytype(nextobj)
543 nexttime = nextrecord%taTime
546 if (currtime >= time0)
then
551 if (nexttime <= time1)
then
559 select case (this%iMethod)
563 value0 = currrecord%taArray(i)
566 values(i) = values(i) + area
571 timediff = nexttime - currtime
572 ratio0 = (t0 - currtime) / timediff
573 ratio1 = (t1 - currtime) / timediff
574 valuediff = nextrecord%taArray(i) - currrecord%taArray(i)
575 value0 = currrecord%taArray(i) + ratio0 * valuediff
576 value1 = currrecord%taArray(i) + ratio1 * valuediff
577 area = 0.5d0 * t01 * (value0 + value1)
579 values(i) = values(i) + area
583 write (errmsg, 10) trim(this%Name), time0, time1
584 call store_error(errmsg)
585 call store_error(
'(Probable programming error)', terminate=.true.)
593 if (t1 >= time1)
then
596 if (.not.
associated(currnode%nextNode))
then
598 if (.not. this%read_next_array())
then
599 write (errmsg, 10) trim(this%Name), time0, time1
600 call store_error(errmsg)
601 call this%parser%StoreErrorUnit()
604 if (
associated(currnode%nextNode))
then
605 currnode => currnode%nextNode
607 write (errmsg, 10) trim(this%Name), time0, time1
608 call store_error(errmsg)
609 call store_error(
'(Probable programming error)', terminate=.true.)
615 if (this%autoDeallocate)
then
616 if (
associated(precnode))
then
617 if (
associated(precnode%prevNode))
then
618 call this%DeallocateBackward(precnode%prevNode)