39 use,
intrinsic :: iso_c_binding
63 type, bind(c) :: kim_numbering_type
64 integer(c_int) :: numbering_id
65 end type kim_numbering_type
72 type(kim_numbering_type),
protected,
save, &
73 bind(c, name=
"KIM_NUMBERING_zeroBased") &
81 type(kim_numbering_type),
protected,
save, &
82 bind(c, name=
"KIM_NUMBERING_oneBased") &
91 module procedure kim_numbering_known
92 end interface kim_known
99 interface operator(.eq.)
100 module procedure kim_numbering_equal
101 end interface operator(.eq.)
108 interface operator(.ne.)
109 module procedure kim_numbering_not_equal
110 end interface operator(.ne.)
118 interface kim_from_string
119 module procedure kim_numbering_from_string
120 end interface kim_from_string
127 interface kim_to_string
128 module procedure kim_numbering_to_string
129 end interface kim_to_string
137 logical recursive function kim_numbering_known(numbering)
140 integer(c_int) recursive function known(numbering) &
141 bind(c, name=
"KIM_Numbering_Known")
142 use,
intrinsic :: iso_c_binding
143 import kim_numbering_type
145 type(kim_numbering_type),
intent(in),
value :: numbering
148 type(kim_numbering_type),
intent(in) :: numbering
150 kim_numbering_known = (known(numbering) /= 0)
151 end function kim_numbering_known
158 logical recursive function kim_numbering_equal(lhs, rhs)
160 type(kim_numbering_type),
intent(in) :: lhs
161 type(kim_numbering_type),
intent(in) :: rhs
163 kim_numbering_equal = (lhs%numbering_id == rhs%numbering_id)
164 end function kim_numbering_equal
171 logical recursive function kim_numbering_not_equal(lhs, rhs)
173 type(kim_numbering_type),
intent(in) :: lhs
174 type(kim_numbering_type),
intent(in) :: rhs
176 kim_numbering_not_equal = .not. (lhs == rhs)
177 end function kim_numbering_not_equal
185 recursive subroutine kim_numbering_from_string(string, numbering)
188 type(kim_numbering_type)
recursive function from_string(string) &
189 bind(c, name=
"KIM_Numbering_FromString")
190 use,
intrinsic :: iso_c_binding
191 import kim_numbering_type
193 character(c_char),
intent(in) :: string(*)
194 end function from_string
196 character(len=*, kind=c_char),
intent(in) :: string
197 type(kim_numbering_type),
intent(out) :: numbering
199 numbering = from_string(trim(string)//c_null_char)
200 end subroutine kim_numbering_from_string
207 recursive subroutine kim_numbering_to_string(numbering, string)
208 use kim_convert_string_module
, only: kim_convert_c_char_ptr_to_string
211 type(c_ptr)
recursive function get_string(numbering) &
212 bind(c, name=
"KIM_Numbering_ToString")
213 use,
intrinsic :: iso_c_binding
214 import kim_numbering_type
216 type(kim_numbering_type),
intent(in),
value :: numbering
217 end function get_string
219 type(kim_numbering_type),
intent(in) :: numbering
220 character(len=*, kind=c_char),
intent(out) :: string
224 p = get_string(numbering)
225 call kim_convert_c_char_ptr_to_string(p, string)
226 end subroutine kim_numbering_to_string
237 recursive subroutine get_number_of_numberings(number_of_numberings) &
238 bind(c, name=
"KIM_NUMBERING_GetNumberOfNumberings")
239 use,
intrinsic :: iso_c_binding
241 integer(c_int),
intent(out) :: number_of_numberings
242 end subroutine get_number_of_numberings
244 integer(c_int),
intent(out) :: number_of_numberings
246 call get_number_of_numberings(number_of_numberings)
257 integer(c_int) recursive function get_numbering(index, numbering) &
258 bind(c, name=
"KIM_NUMBERING_GetNumbering")
259 use,
intrinsic :: iso_c_binding
260 import kim_numbering_type
262 integer(c_int),
intent(in),
value :: index
263 type(kim_numbering_type),
intent(out) :: numbering
264 end function get_numbering
266 integer(c_int),
intent(in) :: index
267 type(kim_numbering_type),
intent(out) :: numbering
268 integer(c_int),
intent(out) :: ierr
270 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.