Loading...
Searching...
No Matches
dc_calendar_types.f90
Go to the documentation of this file.
1!= 暦と日時に関する構造データ型と定数
2!= Derived types and parameters of calendar and date
3!
4! Authors:: Yasuhiro MORIKAWA
5! Version:: $Id: dc_calendar_types.f90,v 1.2 2009-10-17 14:08:59 morikawa Exp $
6! Tag Name:: $Name: $
7! Copyright:: Copyright (C) GFD Dennou Club, 2009-. All rights reserved.
8! License:: See COPYRIGHT[link:../../COPYRIGHT]
9
11 != 暦と日時に関する構造データ型と定数
12 != Derived types and parameters of calendar and date
13 !
14 ! <b>Note that Japanese and English are described in parallel.</b>
15 !
16 ! dc_calendar に関連する構造体や定数を提供します.
17 !
18 ! Derived types and parameters for "dc_calendar" are provided.
19 !
20 !== Derived types List
21 !
22 ! DC_CAL :: 暦情報
23 ! DC_CAL_DATE :: 日時情報
24 ! ------------ ::
25 ! DC_CAL :: Calendar
26 ! DC_CAL_DATE :: Date
27 !
28 !== Parameters for calender
29 !
30 ! CAL_USER_DEFINED :: 1 年の月数, 1 月の日数, 1 日の時間数, 1 時間の分数,
31 ! 1 分の秒数が任意である暦.
32 ! CAL_GREGORIAN :: グレゴリオ暦
33 ! CAL_JULIAN :: ユリウス暦
34 ! CAL_NOLEAP :: 閏年無しの暦
35 ! CAL_360DAY :: 1ヶ月が 30 日の暦
36 ! CAL_CYCLIC :: ある月の日数を
37 ! 「30.6 × 月数 − 前月までの総日数」
38 ! の小数点以下切捨とする暦
39 ! ------------ ::
40 ! CAL_USER_DEFINED :: A calendar in which number of months of a year,
41 ! days of a month, hours of a day, minutes of a hour,
42 ! seconds of a minute are arbitrary.
43 ! CAL_GREGORIAN :: Gregorian calendar.
44 ! CAL_JULIAN :: Julian calendar.
45 ! CAL_NOLEAP :: A calendar without leap year.
46 ! CAL_360DAY :: A calendar in which number of days of a month is 30.
47 ! CAL_CYCLIC :: A calendar in which number of days of a year is
48 ! "30.6 x (number of months) - (total days until last month)"
49 ! (truncate fractional part).
50 !
51 !== Characters list for unit
52 !
53 ! 日時の単位として認識される文字列のリストです.
54 !
55 ! List of strings recognized as units of date.
56 !
57 ! UNIT_SEC :: 秒の単位
58 ! UNIT_MIN :: 分の単位
59 ! UNIT_HOUR :: 時間の単位
60 ! UNIT_DAY :: 日の単位
61 ! UNIT_MONTH :: 月の単位
62 ! UNIT_YEAR :: 年の単位
63 ! ------------ ::
64 ! UNIT_SEC :: Units of second
65 ! UNIT_MIN :: Units of minute
66 ! UNIT_HOUR :: Units of hour
67 ! UNIT_DAY :: Units of day
68 ! UNIT_MONTH :: Units of month
69 ! UNIT_YEAR :: Units of year
70 !
71 !== Symbols for unit
72 !
73 ! dc_calendar から提供される手続で使用される,
74 ! 日時の単位を示す整数です.
75 !
76 ! Integers that indicate units of date.
77 ! They are used in procedures provied from "dc_calendar".
78 !
79 ! UNIT_SYMBOL_SEC :: 秒の単位
80 ! UNIT_SYMBOL_MIN :: 分の単位
81 ! UNIT_SYMBOL_HOUR :: 時間の単位
82 ! UNIT_SYMBOL_DAY :: 日の単位
83 ! UNIT_SYMBOL_MONTH :: 月の単位
84 ! UNIT_SYMBOL_YEAR :: 年の単位
85 ! UNIT_SYMBOL_ERR :: 無効な単位
86 ! ------------ ::
87 ! UNIT_SYMBOL_SEC :: Units of second
88 ! UNIT_SYMBOL_MIN :: Units of minute
89 ! UNIT_SYMBOL_HOUR :: Units of hour
90 ! UNIT_SYMBOL_DAY :: Units of day
91 ! UNIT_SYMBOL_MONTH :: Units of month
92 ! UNIT_SYMBOL_YEAR :: Units of year
93 ! UNIT_SYMBOL_ERR :: Invalid unit
94 !
95
96 use dc_types, only: dp, token
97 implicit none
98
99 private
100 public:: dc_cal, dc_cal_date
103 public:: unit_sec, unit_min, unit_hour, &
108
109 integer, parameter:: cal_user_defined = 1
110 ! 利用者が任意で指定する暦.
111 ! User defined calendar.
112 !
113 integer, parameter:: cal_cyclic = 2 ! 1 ヵ月を 30.6 日 (CYCLIC_MDAYS)
114 ! とする暦.
115 !
116 ! All months are 30.6 day.
117 !
118 integer, parameter:: cal_noleap = 3 ! 1 年 365 日 (閏年無し) の暦.
119 !
120 ! Gregorian calendar without
121 ! leap years, i.e., all years
122 ! are 365 days long.
123 !
124 integer, parameter:: cal_julian = 4 ! ユリウス暦.
125 ! Julian calendar.
126 !
127 integer, parameter:: cal_gregorian = 5 ! グレゴリオ暦.
128 ! Gregorian calendar.
129 !
130 integer, parameter:: cal_360day = 6 ! 1 年 360 日 (1 月 30 日) の暦.
131 !
132 ! All years are 360 days
133 ! divided into 30 day months.
134
136 !
137 ! 暦を表現する構造体.
138 !
139 ! この構造体の要素を直接を参照および変更してはならない.
140 ! この構造体を扱う上では必ず dc_calendar_generic より提供される
141 ! 手続きを用いること.
142 !
143 ! A derived type that expresses calendar.
144 !
145 ! Do not refer and modify elements of this derived type.
146 ! Use procedures provied by "dc_calendar_generic" necessarily
147 ! for handling this derived type.
148 !
149 logical:: initialized = .false.
150 ! 初期設定フラグ.
151 ! Initialization flag
152 integer:: month_in_year
153 ! 1 年の月数.
154 ! Months in a year.
155 integer, pointer:: day_in_month(:) => null()
156 ! 1 ヶ月の日数.
157 ! Days in months.
158 integer:: hour_in_day
159 ! 1 日の時間数.
160 ! Hours in a day.
161 integer:: min_in_hour
162 ! 1 時間の分数.
163 ! Minutes in a hour.
164 real(dp):: sec_in_min
165 ! 1 分の秒数.
166 ! Seconds in a minute.
167 integer:: cal_type
168 ! 暦の種別.
169 ! Kind of calendar.
170 end type dc_cal
171
173 !
174 ! 日時を表現する構造体
175 !
176 ! この構造体の要素を直接を参照および変更してはならない.
177 ! この構造体を扱う上では必ず dc_calendar_generic より提供される
178 ! 手続きを用いること.
179 !
180 ! A derived type that expresses date.
181 !
182 ! Do not refer and modify elements of this derived type.
183 ! Use procedures provied by "dc_calendar_generic" necessarily
184 ! for handling this derived type.
185 !
186 logical:: initialized = .false.
187 ! 初期設定フラグ.
188 ! Initialization flag
189 integer:: year ! 年. Year.
190 integer:: month ! 月. Month.
191 integer:: day ! 日. Day.
192 integer:: hour ! 時. Hour.
193 integer:: min ! 分. Minute.
194 real(dp):: sec ! 秒. Sec.
195 character(TOKEN):: zone ! UTC からの時差. Time-zone.
196 end type dc_cal_date
197
198 ! 日時の単位として認識される文字列
199 ! Strings recognized as units of date and time
200 !
201 character(*), parameter, dimension(8) :: unit_sec = (/ &
202 & 'seconds', 'second ', 'secs. ', 'secs ', &
203 & 'sec. ', 'sec ', 's. ', 's '/) ! 秒の単位を示す文字列
204
205 character(*), parameter, dimension(4) :: unit_min = (/ &
206 & 'minutes', 'minute ', 'min. ', 'min '/) ! 分の単位を示す文字列
207 character(*), parameter, dimension(8) :: unit_hour = (/ &
208 & 'hours', 'hour ', 'hrs. ', 'hrs ', &
209 & 'hr. ', 'hr ', 'h. ', 'h '/) ! 時の単位を示す文字列
210 character(*), parameter, dimension(4) :: unit_day = (/ &
211 & 'days', 'day ', 'd. ', 'd '/) ! 日の単位を示す文字列
212 character(*), parameter, dimension(6) :: unit_month = (/ &
213 & 'months', 'month ', 'mon. ', &
214 & 'mon ', 'mo. ', 'mo '/) ! 月の単位を示す文字列
215 character(*), parameter, dimension(4) :: unit_year = (/ &
216 & 'years', 'year ', 'yr. ', 'yr '/) ! 年の単位を示す文字列
217
218
219 ! 日時の単位のシンボル
220 ! Synbols of units of date and time
221 !
222 integer, parameter:: unit_symbol_err = -1 ! 無効な単位を示すシンボル
223 integer, parameter:: unit_symbol_sec = 2 ! 秒の単位を示すシンボル
224 integer, parameter:: unit_symbol_min = 3 ! 分の単位を示すシンボル
225 integer, parameter:: unit_symbol_hour = 4 ! 時間の単位を示すシンボル
226 integer, parameter:: unit_symbol_day = 5 ! 日の単位を示すシンボル
227 integer, parameter:: unit_symbol_month = 6 ! 月の単位を示すシンボル
228 integer, parameter:: unit_symbol_year = 7 ! 年の単位を示すシンボル
229
230end module dc_calendar_types
integer, parameter, public cal_user_defined
integer, parameter, public cal_julian
character(*), dimension(6), parameter, public unit_month
integer, parameter, public unit_symbol_sec
character(*), dimension(4), parameter, public unit_year
character(*), dimension(8), parameter, public unit_hour
integer, parameter, public cal_gregorian
character(*), dimension(8), parameter, public unit_sec
integer, parameter, public unit_symbol_month
integer, parameter, public unit_symbol_year
integer, parameter, public unit_symbol_hour
integer, parameter, public unit_symbol_day
integer, parameter, public unit_symbol_min
character(*), dimension(4), parameter, public unit_day
character(*), dimension(4), parameter, public unit_min
integer, parameter, public unit_symbol_err
integer, parameter, public cal_360day
integer, parameter, public cal_noleap
integer, parameter, public cal_cyclic
種別型パラメタを提供します。
Definition dc_types.f90:49
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
Definition dc_types.f90:109
integer, parameter, public dp
倍精度実数型変数
Definition dc_types.f90:83