40 use,
intrinsic :: iso_c_binding
67 type, bind(c) :: kim_numbering_type
68 integer(c_int) :: numbering_id
69 end type kim_numbering_type
76 type(kim_numbering_type),
protected,
save, &
77 bind(c, name=
"KIM_NUMBERING_zeroBased") &
85 type(kim_numbering_type),
protected,
save, &
86 bind(c, name=
"KIM_NUMBERING_oneBased") &
95 module procedure kim_numbering_known
96 end interface kim_known
103 interface operator (.eq.)
104 module procedure kim_numbering_equal
105 end interface operator (.eq.)
112 interface operator (.ne.)
113 module procedure kim_numbering_not_equal
114 end interface operator (.ne.)
122 interface kim_from_string
123 module procedure kim_numbering_from_string
124 end interface kim_from_string
131 interface kim_to_string
132 module procedure kim_numbering_to_string
133 end interface kim_to_string
141 logical recursive function kim_numbering_known(numbering)
144 integer(c_int) recursive function known(numbering) &
145 bind(c, name=
"KIM_Numbering_Known")
146 use,
intrinsic :: iso_c_binding
147 import kim_numbering_type
149 type(kim_numbering_type),
intent(in),
value :: numbering
152 type(kim_numbering_type),
intent(in) :: numbering
154 kim_numbering_known = (known(numbering) /= 0)
155 end function kim_numbering_known
162 logical recursive function kim_numbering_equal(lhs, rhs)
164 type(kim_numbering_type),
intent(in) :: lhs
165 type(kim_numbering_type),
intent(in) :: rhs
167 kim_numbering_equal &
168 = (lhs%numbering_id .eq. rhs%numbering_id)
169 end function kim_numbering_equal
176 logical recursive function kim_numbering_not_equal(lhs, rhs)
178 type(kim_numbering_type),
intent(in) :: lhs
179 type(kim_numbering_type),
intent(in) :: rhs
181 kim_numbering_not_equal = .not. (lhs .eq. rhs)
182 end function kim_numbering_not_equal
190 recursive subroutine kim_numbering_from_string(string, numbering)
193 type(kim_numbering_type)
recursive function from_string(string) &
194 bind(c, name=
"KIM_Numbering_FromString")
195 use,
intrinsic :: iso_c_binding
196 import kim_numbering_type
198 character(c_char),
intent(in) :: string(*)
199 end function from_string
201 character(len=*, kind=c_char),
intent(in) :: string
202 type(kim_numbering_type),
intent(out) :: numbering
204 numbering = from_string(trim(string)//c_null_char)
205 end subroutine kim_numbering_from_string
212 recursive subroutine kim_numbering_to_string(numbering, string)
213 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
216 type(c_ptr)
recursive function get_string(numbering) &
217 bind(c, name=
"KIM_Numbering_ToString")
218 use,
intrinsic :: iso_c_binding
219 import kim_numbering_type
221 type(kim_numbering_type),
intent(in),
value :: numbering
222 end function get_string
224 type(kim_numbering_type),
intent(in) :: numbering
225 character(len=*, kind=c_char),
intent(out) :: string
229 p = get_string(numbering)
230 call kim_convert_c_char_ptr_to_string(p, string)
231 end subroutine kim_numbering_to_string
242 recursive subroutine get_number_of_numberings(number_of_numberings) &
243 bind(c, name=
"KIM_NUMBERING_GetNumberOfNumberings")
244 use,
intrinsic :: iso_c_binding
246 integer(c_int),
intent(out) :: number_of_numberings
247 end subroutine get_number_of_numberings
249 integer(c_int),
intent(out) :: number_of_numberings
251 call get_number_of_numberings(number_of_numberings)
262 integer(c_int) recursive function get_numbering(index, numbering) &
263 bind(c, name=
"KIM_NUMBERING_GetNumbering")
264 use,
intrinsic :: iso_c_binding
265 import kim_numbering_type
267 integer(c_int),
intent(in),
value :: index
268 type(kim_numbering_type),
intent(out) :: numbering
269 end function get_numbering
271 integer(c_int),
intent(in) :: index
272 type(kim_numbering_type),
intent(out) :: numbering
273 integer(c_int),
intent(out) :: ierr
275 ierr = get_numbering(index-1, numbering)
type(kim_numbering_type), save, public, protected kim_numbering_one_based
An Extensible Enumeration for the Numbering's supported by the KIM API.
type(kim_numbering_type), save, public, protected kim_numbering_zero_based
recursive subroutine, public kim_get_number_of_numberings(number_of_numberings)
Get the number of standard Numbering's defined by the KIM API.
recursive subroutine, public kim_get_numbering(index, numbering, ierr)
Get the identity of each defined standard Numbering.