36 use,
intrinsic :: iso_c_binding
60 type, bind(c) :: kim_numbering_type
61 integer(c_int) :: numbering_id
62 end type kim_numbering_type
69 type(kim_numbering_type),
protected,
save, &
70 bind(c, name=
"KIM_NUMBERING_zeroBased") &
78 type(kim_numbering_type),
protected,
save, &
79 bind(c, name=
"KIM_NUMBERING_oneBased") &
88 module procedure kim_numbering_known
89 end interface kim_known
96 interface operator(.eq.)
97 module procedure kim_numbering_equal
98 end interface operator(.eq.)
105 interface operator(.ne.)
106 module procedure kim_numbering_not_equal
107 end interface operator(.ne.)
115 interface kim_from_string
116 module procedure kim_numbering_from_string
117 end interface kim_from_string
124 interface kim_to_string
125 module procedure kim_numbering_to_string
126 end interface kim_to_string
134 logical recursive function kim_numbering_known(numbering)
137 integer(c_int) recursive function known(numbering) &
138 bind(c, name=
"KIM_Numbering_Known")
139 use,
intrinsic :: iso_c_binding
140 import kim_numbering_type
142 type(kim_numbering_type),
intent(in),
value :: numbering
145 type(kim_numbering_type),
intent(in) :: numbering
147 kim_numbering_known = (known(numbering) /= 0)
148 end function kim_numbering_known
155 logical recursive function kim_numbering_equal(lhs, rhs)
157 type(kim_numbering_type),
intent(in) :: lhs
158 type(kim_numbering_type),
intent(in) :: rhs
160 kim_numbering_equal = (lhs%numbering_id == rhs%numbering_id)
161 end function kim_numbering_equal
168 logical recursive function kim_numbering_not_equal(lhs, rhs)
170 type(kim_numbering_type),
intent(in) :: lhs
171 type(kim_numbering_type),
intent(in) :: rhs
173 kim_numbering_not_equal = .not. (lhs == rhs)
174 end function kim_numbering_not_equal
182 recursive subroutine kim_numbering_from_string(string, numbering)
185 type(kim_numbering_type)
recursive function from_string(string) &
186 bind(c, name=
"KIM_Numbering_FromString")
187 use,
intrinsic :: iso_c_binding
188 import kim_numbering_type
190 character(c_char),
intent(in) :: string(*)
191 end function from_string
193 character(len=*, kind=c_char),
intent(in) :: string
194 type(kim_numbering_type),
intent(out) :: numbering
196 numbering = from_string(trim(string)//c_null_char)
197 end subroutine kim_numbering_from_string
204 recursive subroutine kim_numbering_to_string(numbering, string)
205 use kim_convert_string_module
, only: kim_convert_c_char_ptr_to_string
208 type(c_ptr)
recursive function get_string(numbering) &
209 bind(c, name=
"KIM_Numbering_ToString")
210 use,
intrinsic :: iso_c_binding
211 import kim_numbering_type
213 type(kim_numbering_type),
intent(in),
value :: numbering
214 end function get_string
216 type(kim_numbering_type),
intent(in) :: numbering
217 character(len=*, kind=c_char),
intent(out) :: string
221 p = get_string(numbering)
222 call kim_convert_c_char_ptr_to_string(p, string)
223 end subroutine kim_numbering_to_string
234 recursive subroutine get_number_of_numberings(number_of_numberings) &
235 bind(c, name=
"KIM_NUMBERING_GetNumberOfNumberings")
236 use,
intrinsic :: iso_c_binding
238 integer(c_int),
intent(out) :: number_of_numberings
239 end subroutine get_number_of_numberings
241 integer(c_int),
intent(out) :: number_of_numberings
243 call get_number_of_numberings(number_of_numberings)
254 integer(c_int) recursive function get_numbering(index, numbering) &
255 bind(c, name=
"KIM_NUMBERING_GetNumbering")
256 use,
intrinsic :: iso_c_binding
257 import kim_numbering_type
259 integer(c_int),
intent(in),
value :: index
260 type(kim_numbering_type),
intent(out) :: numbering
261 end function get_numbering
263 integer(c_int),
intent(in) :: index
264 type(kim_numbering_type),
intent(out) :: numbering
265 integer(c_int),
intent(out) :: ierr
267 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.