FrontISTR 5.2.0
Large-scale structural analysis program with finit element method
Loading...
Searching...
No Matches
m_timepoint.f90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2! Copyright (c) 2019 FrontISTR Commons
3! This software is released under the MIT License, see LICENSE.txt
4!-------------------------------------------------------------------------------
7 use hecmw
8 implicit none
9
10 integer, parameter :: tprstep = 1
11 integer, parameter :: tprtotal = 2
12
15 character( len=80 ) :: name
16 integer :: n_points
17 integer :: range_type
18 real(kind=kreal), pointer :: points(:) => null()
19 end type
20
21contains
22
23 subroutine init_time_points(tp)
24 type(time_points), intent(inout) :: tp
25
26 tp%name = ''
27 tp%n_points = 0
28 tp%range_type = tprstep
29 end subroutine
30
31 subroutine print_time_points(tp)
32 type(time_points), intent(in) :: tp
33
34 write(*,*) 'timepoints name=',trim(tp%name)
35 write(*,*) 'n_points, range_type',tp%n_points, tp%range_type
36 write(*,*) 'points'
37 if( associated(tp%points) ) then
38 write(*,*) tp%points
39 else
40 write(*,*) ' not allocated.'
41 endif
42 end subroutine
43
44 logical function is_at_timepoints(totaltime,starttime,tp)
45 real(kind=kreal), intent(in) :: totaltime
46 real(kind=kreal), intent(in) :: starttime
47 type(time_points), intent(in) :: tp
48
49 integer :: i
50 real(kind=kreal) :: time
51
52 time = totaltime
53 if( tp%range_type == tprstep ) time = totaltime - starttime
54
55 is_at_timepoints =.false.
56 do i=1,tp%n_points
57 if( dabs(time-tp%points(i)) > 1.d-10 ) cycle
58 is_at_timepoints = .true.
59 exit
60 end do
61
62 end function
63
64 real(kind=kreal) function get_remain_to_next_timepoints(totaltime,starttime,tp)
65 real(kind=kreal), intent(in) :: totaltime
66 real(kind=kreal), intent(in) :: starttime
67 type(time_points), intent(in) :: tp
68
69 integer :: i
70 real(kind=kreal) :: time
71
72 time = totaltime
73 if( tp%range_type == tprstep ) time = totaltime - starttime
74
76 if( time < tp%points(1)-1.d-10 ) then
77 get_remain_to_next_timepoints = tp%points(1)-time
78 end if
79 do i=1,tp%n_points-1
80 if( time < tp%points(i)-1.d-10 ) cycle
81 if( time >= tp%points(i+1)-1.d-10 ) cycle
82 get_remain_to_next_timepoints = tp%points(i+1)-time
83 exit
84 end do
85
86 end function
87
88end module
Definition: hecmw.f90:6
This module manages timepoint infomation.
Definition: m_timepoint.f90:6
real(kind=kreal) function get_remain_to_next_timepoints(totaltime, starttime, tp)
Definition: m_timepoint.f90:65
integer, parameter tprstep
Definition: m_timepoint.f90:10
subroutine print_time_points(tp)
Definition: m_timepoint.f90:32
integer, parameter tprtotal
Definition: m_timepoint.f90:11
logical function is_at_timepoints(totaltime, starttime, tp)
Definition: m_timepoint.f90:45
subroutine init_time_points(tp)
Definition: m_timepoint.f90:24
Time points storage for output etc.
Definition: m_timepoint.f90:14