1+ ! ***********************************************************************
2+ ! * Apache License 2.0
3+ ! *
4+ ! * This file is part of the GFDL Flexible Modeling System (FMS).
5+ ! *
6+ ! * Licensed under the Apache License, Version 2.0 (the "License");
7+ ! * you may not use this file except in compliance with the License.
8+ ! * You may obtain a copy of the License at
9+ ! *
10+ ! * http://www.apache.org/licenses/LICENSE-2.0
11+ ! *
12+ ! * FMS is distributed in the hope that it will be useful, but WITHOUT
13+ ! * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied;
14+ ! * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15+ ! * PARTICULAR PURPOSE. See the License for the specific language
16+ ! * governing permissions and limitations under the License.
17+ ! ***********************************************************************
118module metadata_transfer_mod
219 use platform_mod
320#ifdef use_libMPI
@@ -107,7 +124,6 @@ subroutine fms_metadata_transfer_init(this, dtype)
107124 displacements(3 ) = displacements(2 ) + sizeof(' ' )* ATTR_NAME_MAX_LENGTH ! get_attribute_name() start address
108125 displacements(4 ) = displacements(3 ) + sizeof(' ' )* ATTR_NAME_MAX_LENGTH ! attribute_value start address
109126
110- print * , " calculated displacements: " , displacements
111127 select case (dtype)
112128 case (real8_type)
113129 types = (/ MPI_INTEGER, MPI_INTEGER, MPI_CHARACTER, MPI_CHARACTER, MPI_DOUBLE/ )
@@ -142,7 +158,7 @@ end subroutine fms_metadata_transfer_init
142158
143159 ! > Broadcast the entire metadata object to all PEs in the current pelist
144160 subroutine fms_metadata_broadcast (this )
145- class(metadata_class), intent (inout ) :: this
161+ class(metadata_class), intent (inout ) :: this ! < object that inherits metadata_class
146162 integer :: ierror, curr_comm_id
147163 integer , allocatable :: broadcasting_pes(:)
148164 if (this% mpi_type_id .eq. - 1 ) then
@@ -178,7 +194,7 @@ end subroutine fms_metadata_broadcast
178194
179195 ! > Broadcast an array of metadata objects to all PEs in the current pelist
180196 subroutine fms_metadata_broadcast_all (metadata_objs )
181- class(metadata_class), intent (inout ) :: metadata_objs(:)
197+ class(metadata_class), intent (inout ) :: metadata_objs(:) ! < list of metadata objects
182198 integer :: i
183199
184200 do i= 1 , size (metadata_objs)
@@ -200,7 +216,7 @@ function get_attribute_r8_value(this) result(val)
200216 ! > Setter for real 8 attribute_value
201217 subroutine set_attribute_r8_value (this , val )
202218 class(metadata_r8 _type), intent (inout ) :: this
203- real (r8 _kind), intent (in ) :: val(:)
219+ real (r8 _kind), intent (in ) :: val(:) ! < 8 byte real value to set attribute value to
204220 if (size (val) .gt. ATTR_VALUE_MAX_LENGTH) then
205221 call mpp_error(FATAL, &
206222 " metadata_transfer_mod: attribute value array exceeds max length of " // string (ATTR_NAME_MAX_LENGTH))
@@ -219,7 +235,7 @@ function get_attribute_r4_value(this) result(val)
219235 ! > Setter for real 4 attribute_value
220236 subroutine set_attribute_r4_value (this , val )
221237 class(metadata_r4 _type), intent (inout ) :: this
222- real (r4 _kind), intent (in ) :: val(:)
238+ real (r4 _kind), intent (in ) :: val(:) ! < 4 byte real attribute to set
223239 if (size (val) .gt. ATTR_VALUE_MAX_LENGTH) then
224240 call mpp_error(FATAL, &
225241 " metadata_transfer_mod: attribute value array exceeds max length of " // string (ATTR_NAME_MAX_LENGTH))
@@ -238,7 +254,7 @@ function get_attribute_i8_value(this) result(val)
238254 ! > Setter for integer(kind=8) attribute_value
239255 subroutine set_attribute_i8_value (this , val )
240256 class(metadata_i8_type), intent (inout ) :: this
241- integer (i8_kind), intent (in ) :: val(:)
257+ integer (i8_kind), intent (in ) :: val(:) ! < 8 byte int attribute to set
242258 if (size (val) .gt. ATTR_VALUE_MAX_LENGTH) then
243259 call mpp_error(FATAL, &
244260 " metadata_transfer_mod: attribute value array exceeds max length of " // string (ATTR_NAME_MAX_LENGTH))
@@ -257,7 +273,7 @@ function get_attribute_i4_value(this) result(val)
257273 ! > Setter for integer(kind=4) attribute_value
258274 subroutine set_attribute_i4_value (this , val )
259275 class(metadata_i4_type), intent (inout ) :: this
260- integer (i4_kind), intent (in ) :: val(:)
276+ integer (i4_kind), intent (in ) :: val(:) ! < 4 byte integer to set attribute value to
261277 if (size (val) .gt. ATTR_VALUE_MAX_LENGTH) then
262278 call mpp_error(FATAL, &
263279 " metadata_transfer_mod: attribute value array exceeds max length of " // string (ATTR_NAME_MAX_LENGTH))
@@ -276,7 +292,7 @@ function get_attribute_str_value(this) result(val)
276292 ! > Setter for string attribute_value
277293 subroutine set_attribute_str_value (this , val )
278294 class(metadata_str_type), intent (inout ) :: this
279- character (len=* ), intent (in ) :: val
295+ character (len=* ), intent (in ) :: val ! < character string to set attribute value to
280296 if (len (val) .gt. ATTR_VALUE_MAX_LENGTH) then
281297 call mpp_error(FATAL, &
282298 " metadata_transfer_mod: attribute value array exceeds max length of " // string (ATTR_NAME_MAX_LENGTH))
@@ -288,14 +304,13 @@ subroutine set_attribute_str_value(this, val)
288304 ! > Getter for attribute_name (for all metadata types)
289305 function get_attribute_name (this ) result(val)
290306 class(metadata_class), intent (inout ) :: this
291- character (len= ATTR_NAME_MAX_LENGTH) :: val
292- val = trim (this% attribute_name)
307+ character (len= ATTR_NAME_MAX_LENGTH) :: val val = trim (this% attribute_name)
293308 end function
294309
295310 ! > Setter for attribute_name (for all metadata types)
296311 subroutine set_attribute_name (this , val )
297312 class(metadata_class), intent (inout ) :: this
298- character (len=* ), intent (in ) :: val
313+ character (len=* ), intent (in ) :: val ! < character string to set attribute name to
299314 if (len (val) .gt. ATTR_NAME_MAX_LENGTH) then
300315 call mpp_error(FATAL, &
301316 " metadata_transfer_mod: attribute name exceeds max length of " // string (ATTR_VALUE_MAX_LENGTH))
0 commit comments