Skip to content

Commit 84c79ce

Browse files
Doxygen marked source files (#600)
Add doxygen marked source
1 parent b19156f commit 84c79ce

24 files changed

+2667
-1055
lines changed

model/src/w3metamd.F90

Lines changed: 113 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
!> @file
2+
!> @brief Dynamic storage for meta data attribute/value pairs.
3+
!> @author Chris Bunney @date 16-Dec-2020
4+
!/ ------------------------------------------------------------------- /
5+
!/
6+
!> @brief Dynamic storage for meta data attribute/value pairs.
7+
!>
8+
!> @details Provides types for handling "meta data" (attribute/value pairs)
9+
!> and a linked list construct for dynamic storage.
10+
!>
11+
!> ### Change log
12+
!> Date | Ver | Comments
13+
!> ------------|------|---------
14+
!> 16-Dec-2020 | 7.12 | Creation
15+
!>
16+
!> @author Chris Bunney @date 16-Dec-2020
17+
!>
118
!/ ------------------------------------------------------------------- /
219
MODULE W3METAMD
320
!/
@@ -17,39 +34,45 @@ MODULE W3METAMD
1734
! and a linked list construct for dynamic storage.
1835
!/ ------------------------------------------------------------------- /
1936

20-
! Values to represent "unset" data:
37+
!> Value to represent "unset" character variable
2138
CHARACTER(LEN=*), PARAMETER :: UNSETC = "unset"
39+
!> Value to represent "unset" real variable
2240
REAL, PARAMETER :: UNSETR = HUGE(1.0)
2341

24-
! Type for storing a user defined metadata pair:
42+
!> Type for storing a user defined metadata pair as linked list element
2543
TYPE META_PAIR_T
26-
CHARACTER(LEN=64) :: ATTNAME = UNSETC
27-
CHARACTER(LEN=120) :: ATTVAL = UNSETC
28-
CHARACTER :: TYPE = 'c' ! c,i,f/r
29-
TYPE(META_PAIR_T), POINTER :: NEXT
44+
CHARACTER(LEN=64) :: ATTNAME = UNSETC !< Attribute name
45+
CHARACTER(LEN=120) :: ATTVAL = UNSETC !< Attribute value
46+
CHARACTER :: TYPE = 'c' !< Attribute type (c,i,f/r)
47+
TYPE(META_PAIR_T), POINTER :: NEXT !< Pointer to next node
3048
END TYPE META_PAIR_T
3149

50+
!> Linked list of meta data pairs
3251
TYPE META_LIST_T
3352
TYPE (META_PAIR_T), POINTER :: HEAD => NULL(), TAIL => NULL()
34-
INTEGER :: N = 0
53+
INTEGER :: N = 0 !< Num elements in list
3554
END TYPE META_LIST_T
3655

37-
! Interface to facilitate adding real/int/character values to list
56+
!> Interface to facilitate adding real/int/character values to list
3857
INTERFACE META_LIST_APPEND
39-
MODULE PROCEDURE META_LIST_APPEND_M
40-
MODULE PROCEDURE META_LIST_APPEND_R
41-
MODULE PROCEDURE META_LIST_APPEND_I
42-
MODULE PROCEDURE META_LIST_APPEND_C
58+
MODULE PROCEDURE META_LIST_APPEND_M !< Append a META_PAIR_T
59+
MODULE PROCEDURE META_LIST_APPEND_R !< Append a REAL value
60+
MODULE PROCEDURE META_LIST_APPEND_I !< Append an INTEGER value
61+
MODULE PROCEDURE META_LIST_APPEND_C !< Append a CHARACTER value
4362
END INTERFACE META_LIST_APPEND
4463

45-
4664
CONTAINS
4765

4866

4967
!/ ------------------------------------------------------------------- /
50-
SUBROUTINE DEL_META_LIST(LIST)
51-
! Deletes all entries in list
68+
!> @brief Deletes all entries in list.
69+
!>
70+
!> @param[in,out] LIST The list to clear.
71+
!>
72+
!> @author Chris Bunney
5273
!/ ------------------------------------------------------------------- /
74+
SUBROUTINE DEL_META_LIST(LIST)
75+
5376
IMPLICIT NONE
5477

5578
TYPE(META_LIST_T), INTENT(INOUT) :: LIST
@@ -76,9 +99,21 @@ END SUBROUTINE DEL_META_LIST
7699

77100

78101
!/ ------------------------------------------------------------------- /
79-
FUNCTION COPY_META_LIST(LIST) RESULT(COPY)
80-
! Create a deep copy of a meta data list
102+
!> @brief Create a deep copy of a meta data list
103+
!>
104+
!> @details A "deep copy" ensures that a copy is made of the underlying
105+
!> linked list, rather than a simply copy of the pointers to the
106+
!> existing list.
107+
!>
108+
!> @param[in] LIST The list to copy
109+
!>
110+
!> @returns A new META_LIST_T
111+
!>
112+
!> @author Chris Bunney
113+
!>
81114
!/ ------------------------------------------------------------------- /
115+
FUNCTION COPY_META_LIST(LIST) RESULT(COPY)
116+
82117
IMPLICIT NONE
83118

84119
TYPE(META_LIST_T), INTENT(IN) :: LIST
@@ -105,9 +140,14 @@ END FUNCTION COPY_META_LIST
105140

106141

107142
!/ ------------------------------------------------------------------- /
108-
SUBROUTINE PRINT_META_LIST(LIST)
109-
! Prints meta pairs in list to screen
143+
!> @brief Prints meta pairs in list to screen
144+
!>
145+
!> @param[in] LIST Linked list of meta data to print
146+
!>
147+
!> @author Chris Bunney
110148
!/ ------------------------------------------------------------------- /
149+
SUBROUTINE PRINT_META_LIST(LIST)
150+
111151
IMPLICIT NONE
112152

113153
TYPE(META_LIST_T), INTENT(IN) :: LIST
@@ -133,9 +173,15 @@ END SUBROUTINE PRINT_META_LIST
133173

134174

135175
!/ ------------------------------------------------------------------- /
136-
SUBROUTINE META_LIST_APPEND_M(LIST, META)
137-
! Append META_PAIR_T object to list
176+
!> @brief Append META_PAIR_T object to list
177+
!>
178+
!> @param[in,out] LIST The list to append to
179+
!> @param[in] META The META_PAIR_T object to append.
180+
!>
181+
!> @author Chris Bunney
138182
!/ ------------------------------------------------------------------- /
183+
SUBROUTINE META_LIST_APPEND_M(LIST, META)
184+
139185
IMPLICIT NONE
140186

141187
TYPE(META_LIST_T), INTENT(INOUT) :: LIST
@@ -168,9 +214,16 @@ END SUBROUTINE META_LIST_APPEND_M
168214

169215

170216
!/ ------------------------------------------------------------------- /
171-
SUBROUTINE META_LIST_APPEND_R(LIST, ATTNAME, RVAL)
172-
! Append real value meta pair to list
217+
!> @brief Append REAL value attribute to list
218+
!>
219+
!> @param[in,out] LIST The list to append to
220+
!> @param[in] ATTNAME The attribute name
221+
!> @param[in] RVAL The attribute value (REAL)
222+
!>
223+
!> @author Chris Bunney
173224
!/ ------------------------------------------------------------------- /
225+
SUBROUTINE META_LIST_APPEND_R(LIST, ATTNAME, RVAL)
226+
174227
IMPLICIT NONE
175228

176229
TYPE(META_LIST_T), INTENT(INOUT) :: LIST
@@ -190,9 +243,16 @@ END SUBROUTINE META_LIST_APPEND_R
190243

191244

192245
!/ ------------------------------------------------------------------- /
193-
SUBROUTINE META_LIST_APPEND_I(LIST, ATTNAME, IVAL)
194-
! Append integer value meta pair to list
246+
!> @brief Append INTEGER value attribute to list
247+
!>
248+
!> @param[in,out] LIST The list to append to
249+
!> @param[in] ATTNAME The attribute name
250+
!> @param[in] IVAL The attribute value (INTEGER)
251+
!>
252+
!> @author Chris Bunney
195253
!/ ------------------------------------------------------------------- /
254+
SUBROUTINE META_LIST_APPEND_I(LIST, ATTNAME, IVAL)
255+
196256
IMPLICIT NONE
197257

198258
TYPE(META_LIST_T), INTENT(INOUT) :: LIST
@@ -212,9 +272,16 @@ END SUBROUTINE META_LIST_APPEND_I
212272

213273

214274
!/ ------------------------------------------------------------------- /
215-
SUBROUTINE META_LIST_APPEND_C(LIST, ATTNAME, SVAL)
216-
! Append character value meta pair to list
275+
!> @brief Append CHARACTER string value attribute to list
276+
!>
277+
!> @param[in,out] LIST The list to append to
278+
!> @param[in] ATTNAME The attribute name
279+
!> @param[in] SVAL The attribute value (CHARACTER string)
280+
!>
281+
!> @author Chris Bunney
217282
!/ ------------------------------------------------------------------- /
283+
SUBROUTINE META_LIST_APPEND_C(LIST, ATTNAME, SVAL)
284+
218285
IMPLICIT NONE
219286

220287
TYPE(META_LIST_T), INTENT(INOUT) :: LIST
@@ -231,13 +298,18 @@ SUBROUTINE META_LIST_APPEND_C(LIST, ATTNAME, SVAL)
231298

232299
END SUBROUTINE META_LIST_APPEND_C
233300

234-
! Append pair to list
235-
236301

237302
!/ ------------------------------------------------------------------- /
238-
SUBROUTINE META_LIST_FIND_ATTR(LIST, ATTN, META, ERR)
239-
! Find (first) entry in list with matching attname
303+
!> @brief Find (first) entry in list with matching attname
304+
!>
305+
!> @param[in] LIST List to search
306+
!> @param[in] ATTN Attribute name to search for
307+
!> @param[out] META Meta data type to store matched result in
308+
!> @param[out] ERR Error status (0=Found, 1=Empty list, 2=Not found)
309+
!>
310+
!> @author Chris Bunney
240311
!/ ------------------------------------------------------------------- /
312+
SUBROUTINE META_LIST_FIND_ATTR(LIST, ATTN, META, ERR)
241313
IMPLICIT NONE
242314

243315
TYPE(META_LIST_T), INTENT(IN) :: LIST
@@ -269,9 +341,17 @@ END SUBROUTINE META_LIST_FIND_ATTR
269341

270342

271343
!/ ------------------------------------------------------------------- /
272-
FUNCTION META_LIST_HAS_ATTR(LIST, ATTN) RESULT(FOUND)
273-
! Tests whether list contains an entry with specified attname
344+
!> @brief Tests whether list contains an entry with specified attname
345+
!>
346+
!> @param[in] LIST The list to search
347+
!> @param[in] ATTN Attribute name to search for
348+
!>
349+
!> @returns LOGICAL: True if match found, False otherwise.
350+
!>
351+
!> @author Chris Bunney
274352
!/ ------------------------------------------------------------------- /
353+
FUNCTION META_LIST_HAS_ATTR(LIST, ATTN) RESULT(FOUND)
354+
275355
IMPLICIT NONE
276356

277357
TYPE(META_LIST_T), INTENT(IN) :: LIST

0 commit comments

Comments
 (0)