TABLE OF CONTENTS


ABINIT/m_clib [ Modules ]

[ Top ] [ Modules ]

NAME

 m_clib

FUNCTION

COPYRIGHT

 Copyright (C) 2009-2018 ABINIT group (MG)
 This file is distributed under the terms of the
 GNU General Public License, see ~abinit/COPYING
 or http://www.gnu.org/copyleft/gpl.txt .

SOURCE

 16 #if defined HAVE_CONFIG_H
 17 #include "config.h"
 18 #endif
 19 
 20 #include "abi_common.h"
 21 
 22 MODULE m_clib
 23 
 24 #ifdef HAVE_FC_ISO_C_BINDING
 25 #define USE_MODULE 
 26 #else
 27 #define USE_MODULE use m_iso_c_binding
 28 #endif
 29 
 30  use iso_c_binding
 31 
 32  implicit none
 33 
 34  private 
 35 
 36  integer, parameter :: dp=kind(1.0d0)
 37  integer, parameter :: dpc=kind((1.0_dp,1.0_dp))  ! Complex should not be used presently
 38 
 39  type,public :: Mallinfo_t
 40    integer(C_LONG) :: arena 
 41    integer(C_LONG) :: hblkhd 
 42    integer(C_LONG) :: usmblks 
 43    integer(C_LONG) :: fsmblks 
 44    integer(C_LONG) :: uordblks 
 45    integer(C_LONG) :: fordblks
 46  end type Mallinfo_t
 47 
 48  public :: clib_rename
 49 
 50 !FIXME the interfaces below have been commented out since abilint
 51 ! crashes during the analysis of the file (maybe due to the macro USE_MODULE!)      
 52 ! JB : No, it is because interface must have a name in abilint
 53 
 54 ! ===================================================
 55 ! ==== Fortran-bindings declared in intrinsics.c ====
 56 ! ===================================================
 57 ! interface 
 58 !   subroutine clib_fflush()
 59 !     import 
 60 !     implicit none
 61 !   end subroutine clib_fflush
 62 ! end interface
 63 !
 64 ! interface 
 65 !   subroutine clib_getenv(ierr,fname)
 66 !     import
 67 !     implicit none
 68 !     integer(C_INT),intent(out) :: ierr
 69 !     character(len=*),intent(in) :: fname
 70 !   end subroutine clib_getenv
 71 ! end interface
 72 !
 73 !! ===================================================
 74 !! ==== Fortran-bindings declared in fsi_posix.c ====
 75 !! ===================================================
 76 ! interface 
 77 !   subroutine clib_mkdir(ierr,fname)
 78 !     import
 79 !     implicit none
 80 !     integer(C_INT),intent(out) :: ierr
 81 !     character(len=*),intent(in) :: fname
 82 !   end subroutine clib_mkdir
 83 ! end interface
 84 !
 85 ! interface 
 86 !   subroutine clib_chdir(ierr,fname)
 87 !     import
 88 !     implicit none
 89 !     integer(C_INT),intent(out) :: ierr
 90 !     character(len=*),intent(in) :: fname
 91 !   end subroutine clib_chdir
 92 ! end interface
 93 !
 94 interface c_rename
 95     integer(c_int) function rename(oldname,newname) bind(C,name='rename')
 96       use iso_c_binding
 97       implicit none
 98       character(kind=c_char),intent(in) :: oldname(*)
 99       character(kind=c_char),intent(in) :: newname(*)
100     end function rename
101  end interface c_rename
102 !
103 ! interface 
104 !   subroutine clib_remove(ierr,fname)
105 !     import 
106 !     implicit none
107 !     integer(C_INT),intent(out) :: ierr
108 !     character(len=*),intent(in) :: fname
109 !   end subroutine clib_remove
110 ! end interface
111 !
112 ! interface 
113 !   subroutine clib_getcwd(ierr,fname)
114 !     import 
115 !     implicit none
116 !     integer(C_INT),intent(out) :: ierr
117 !     character(len=*),intent(in) :: fname
118 !   end subroutine clib_getcwd
119 ! end interface
120 !
121 ! interface 
122 !   subroutine clib_gethname(ierr,fname)
123 !     import
124 !     implicit none
125 !     integer(C_INT),intent(out) :: ierr
126 !     character(len=*),intent(in) :: fname
127 !   end subroutine clib_gethname
128 ! end interface
129 !
130 !! =====================================================
131 !! ==== Fortran-bindings declared in progress_bar.c ====
132 !! =====================================================
133 ! interface
134 !   subroutine clib_progress_bar(actual, max)
135 !     import
136 !     implicit none
137 !     integer(C_INT),intent(in) :: actual
138 !     integer(C_INT),intent(in) :: max
139 !   end subroutine clib_progress_bar
140 ! end interface
141 !
142 !! =================================================
143 !! ==== Fortran-bindings declared in mallinfo.c ====
144 !! =================================================
145 ! interface
146 !   subroutine clib_mallinfo(arena, hblkhd, usmblks, fsmblks, uordblks, fordblks)
147 !     import
148 !     implicit none
149 !     integer(C_LONG),intent(out) :: arena,hblkhd,usmblks,fsmblks,uordblks,fordblks
150 !   end subroutine clib_mallinfo
151 ! end interface
152 !
153 !
154 !! ==================================================
155 !! ==== Fortran-bindings declared in gnu_tools.c ====
156 !! ==================================================
157 !
158 ! interface
159 !   subroutine clib_mtrace(ierr)
160 !     import
161 !     implicit none
162 !     integer(C_INT),intent(out) :: ierr
163 !   end subroutine clib_mtrace
164 ! end interface
165 !
166 ! interface
167 !   subroutine clib_muntrace(ierr)
168 !     import
169 !     implicit none
170 !     integer(C_INT),intent(out) :: ierr
171 !   end subroutine clib_muntrace
172 ! end interface
173 !
174 ! interface
175 !   subroutine clib_mcheck(ierr)
176 !     import
177 !     implicit none
178 !     integer(C_INT),intent(out) :: ierr
179 !   end subroutine clib_mcheck
180 ! end interface
181 
182 ! ==========================================
183 ! ==== Fortran-bindings for file_lock.c ====
184 ! ==========================================
185 
186  !interface
187  !  function lock_file(path) bind(C)
188  !    import
189  !    implicit none
190  !    character(kind=c_char),intent(in) :: path(*)
191  !    integer(c_int) :: lock_file
192  !  end function lock_file
193  !end interface
194 
195  !interface
196  !  function unlock_fd(fd) bind(C)
197  !    import
198  !    implicit none
199  !    integer(c_int),value,intent(in) :: fd
200  !    integer(c_int) unlock_fd
201  !  end function unlock_fd
202  !end interface
203 
204 
205 CONTAINS  !===========================================================

m_clib/clib_print_mallinfo [ Functions ]

[ Top ] [ m_clib ] [ Functions ]

NAME

 clib_print_mallinfo

FUNCTION

INPUTS

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

CHILDREN

SOURCE

276 subroutine clib_print_mallinfo(Minfo,unt)
277 
278 !Arguments ------------------------------------
279 
280 !This section has been created automatically by the script Abilint (TD).
281 !Do not modify the following lines by hand.
282 #undef ABI_FUNC
283 #define ABI_FUNC 'clib_print_mallinfo'
284 !End of the abilint section
285 
286  integer,intent(in) :: unt
287  type(Mallinfo_t),intent(in) :: Minfo
288 ! *********************************************************************
289 
290  write(unt,*)' Total space in arena            : ',Minfo%arena
291  write(unt,*)' Space in holding block headers  : ',Minfo%hblkhd
292  write(unt,*)' Space in small blocks in use    : ',Minfo%usmblks
293  write(unt,*)' Space in free small blocks      : ',Minfo%fsmblks
294  write(unt,*)' Space in ordinary blocks in use : ',Minfo%uordblks
295  write(unt,*)' Space in free ordinary blocks   : ',Minfo%fordblks
296  write(unt,*)' End memory statistics '
297 
298 end subroutine clib_print_mallinfo

m_clib/clib_rename [ Functions ]

[ Top ] [ m_clib ] [ Functions ]

NAME

  clib_rename

FUNCTION

  Rename a file with a new name
  It uses the C rename function from stdlib

INPUTS

OUTPUT

PARENTS

      isfile

CHILDREN

SOURCE

375 subroutine clib_rename(old_fname, new_fname, ierr)
376 
377 !Arguments ------------------------------------
378 
379 !This section has been created automatically by the script Abilint (TD).
380 !Do not modify the following lines by hand.
381 #undef ABI_FUNC
382 #define ABI_FUNC 'clib_rename'
383 !End of the abilint section
384 
385  character(len=*),intent(in) :: old_fname, new_fname
386  integer, optional, intent(out) :: ierr
387  integer :: ier
388 
389 !Local variables-------------------------------
390 
391 ! *********************************************************************
392 
393  ier = rename(trim(old_fname)//c_null_char, trim(new_fname)//c_null_char)
394  if ( present(ierr) ) ierr = ier
395 
396 end subroutine clib_rename

m_clib/clib_show_fc_alignment [ Functions ]

[ Top ] [ m_clib ] [ Functions ]

NAME

 clib_show_fc_alignment

FUNCTION

INPUTS

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

CHILDREN

SOURCE

324 subroutine clib_show_fc_alignment(unt)
325 
326 
327 !This section has been created automatically by the script Abilint (TD).
328 !Do not modify the following lines by hand.
329 #undef ABI_FUNC
330 #define ABI_FUNC 'clib_show_fc_alignment'
331 !End of the abilint section
332 
333  implicit none
334 
335 !Arguments ------------------------------------
336  integer,intent(in) :: unt
337 
338 !Local variables-------------------------------
339  integer,parameter :: sz=1024
340  integer :: algn
341 !arrays
342  real(dp),allocatable :: arr(:)
343 
344 ! *************************************************************************
345 
346  !allocate(arr(sz))
347  call clib_alignment_of(arr, 16, algn)
348  write(unt,*)" dp_arr: p % 16 = ",algn
349  call clib_alignment_of(arr, 64, algn)
350  write(unt,*)" dp_arr: p % 64 = ",algn
351  !deallocate(arr)
352 
353 end subroutine clib_show_fc_alignment

m_clib/fmallinfo [ Functions ]

[ Top ] [ m_clib ] [ Functions ]

NAME

   fmallinfo

FUNCTION

INPUTS

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

CHILDREN

SOURCE

228 subroutine fmallinfo(Minfo)
229 
230 !Arguments ------------------------------------
231 
232 !This section has been created automatically by the script Abilint (TD).
233 !Do not modify the following lines by hand.
234 #undef ABI_FUNC
235 #define ABI_FUNC 'fmallinfo'
236 !End of the abilint section
237 
238  type(Mallinfo_t),intent(out) :: Minfo
239 
240 !Local variables-------------------------------
241  integer(C_LONG) :: arena,hblkhd,usmblks,fsmblks,uordblks,fordblks
242 ! *********************************************************************
243 
244   call clib_mallinfo(arena,hblkhd,usmblks,fsmblks,uordblks,fordblks) 
245 
246   Minfo%arena    = arena
247   Minfo%hblkhd   = hblkhd
248   Minfo%usmblks  = usmblks
249   Minfo%fsmblks  = fsmblks
250   Minfo%uordblks = uordblks
251   Minfo%fordblks = fordblks
252 
253 end subroutine fmallinfo