TABLE OF CONTENTS


ABINIT/m_MapHyb [ Modules ]

[ Top ] [ Modules ]

NAME

  m_MapHyb

FUNCTION

  map template integer/double

COPYRIGHT

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

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

28 #include "defs.h"
29 MODULE m_MapHyb
30 USE m_Global
31 IMPLICIT NONE

ABINIT/m_MapHyb/MapHyb_assign [ Functions ]

[ Top ] [ Functions ]

NAME

  MapHyb_assign

FUNCTION

  assign this=map

COPYRIGHT

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

INPUTS

  this=this
  this=Map

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

303 SUBROUTINE MapHyb_assign(this, map)
304 
305 !Arguments ------------------------------------
306 
307 !This section has been created automatically by the script Abilint (TD).
308 !Do not modify the following lines by hand.
309 #undef ABI_FUNC
310 #define ABI_FUNC 'MapHyb_assign'
311 !End of the abilint section
312 
313   TYPE(MapHyb), INTENT(INOUT) :: this
314   TYPE(MapHyb), INTENT(IN   ) :: map
315 !Local variables ------------------------------
316   INTEGER                     :: tail
317 
318   tail = map%tail
319   CALL MapHyb_setSize(this, tail)
320   this%listINT(1:tail)  = map%listINT(1:tail)
321   this%listDBLE(1:tail) = map%listDBLE(1:tail)
322 
323 END SUBROUTINE MapHyb_assign

ABINIT/m_MapHyb/MapHyb_clear [ Functions ]

[ Top ] [ Functions ]

NAME

  MapHyb_clear

FUNCTION

  Clear the this

COPYRIGHT

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

INPUTS

  this=Map

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

544 SUBROUTINE MapHyb_clear(this)
545 
546 !Arguments ------------------------------------
547 
548 !This section has been created automatically by the script Abilint (TD).
549 !Do not modify the following lines by hand.
550 #undef ABI_FUNC
551 #define ABI_FUNC 'MapHyb_clear'
552 !End of the abilint section
553 
554   TYPE(MapHyb), INTENT(INOUT) :: this
555   this%tail = 0 
556 END SUBROUTINE MapHyb_clear

ABINIT/m_MapHyb/MapHyb_destroy [ Functions ]

[ Top ] [ Functions ]

NAME

  MapHyb_destroy

FUNCTION

  destroy and deallocate the this

COPYRIGHT

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

INPUTS

  this=Map

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

589 SUBROUTINE MapHyb_destroy(this)
590 
591 !Arguments ------------------------------------
592 
593 !This section has been created automatically by the script Abilint (TD).
594 !Do not modify the following lines by hand.
595 #undef ABI_FUNC
596 #define ABI_FUNC 'MapHyb_destroy'
597 !End of the abilint section
598 
599   TYPE(MapHyb), INTENT(INOUT) :: this
600 
601   FREEIF(this%listINT)
602   FREEIF(this%listDBLE)
603 
604   this%tail     = 0
605   this%size     = 0
606 END SUBROUTINE MapHyb_destroy

ABINIT/m_MapHyb/MapHyb_enlarge [ Functions ]

[ Top ] [ Functions ]

NAME

  MapHyb_enlarge

FUNCTION

  enlarge memory space

COPYRIGHT

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

INPUTS

  this=Map
  size=new memory size

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

226 SUBROUTINE MapHyb_enlarge(this, size)
227 
228 !Arguments ------------------------------------
229 
230 !This section has been created automatically by the script Abilint (TD).
231 !Do not modify the following lines by hand.
232 #undef ABI_FUNC
233 #define ABI_FUNC 'MapHyb_enlarge'
234 !End of the abilint section
235 
236   TYPE(MapHyb)     , INTENT(INOUT)       :: this
237   INTEGER, OPTIONAL, INTENT(IN   )       :: size
238 !Local variables ------------------------------
239   INTEGER                                :: width
240   INTEGER                                :: tail
241   INTEGER                                :: size_val
242   INTEGER         , ALLOCATABLE, DIMENSION(:) :: listINT_temp 
243   DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:) :: listDBLE_temp 
244 
245   IF ( ALLOCATED(this%listINT) ) THEN
246     FREEIF(listINT_temp)
247     width = this%size
248     tail  = this%tail
249     size_val = width
250     IF ( PRESENT(size) ) size_val = size 
251     ! listINT enlarge
252     MALLOC(listINT_temp,(1:tail))
253     listINT_temp(1:tail) = this%listINT(1:tail)
254     FREE(this%listINT)
255     this%size = width + size_val
256     MALLOC(this%listINT,(1:this%size))
257     this%listINT(1:tail) = listINT_temp(1:tail)
258     FREE(listINT_temp)
259     ! listDBLE enlarge
260     MALLOC(listDBLE_temp,(1:tail))
261     listDBLE_temp(1:tail) = this%listDBLE(1:tail)
262     FREE(this%listDBLE)
263     MALLOC(this%listDBLE,(1:this%size))
264     this%listDBLE(1:tail) = listDBLE_temp(1:tail)
265     FREE(listDBLE_temp)
266   ELSE
267     CALL MapHyb_init(this, Global_SIZE)
268   END IF
269 END SUBROUTINE MapHyb_enlarge

ABINIT/m_MapHyb/MapHyb_init [ Functions ]

[ Top ] [ Functions ]

NAME

  MapHyb_init

FUNCTION

  initialize

COPYRIGHT

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

INPUTS

  this=Map
  size=memory size for initialization

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

112 SUBROUTINE MapHyb_init(this, size)
113 
114 !Arguments ------------------------------------
115 
116 !This section has been created automatically by the script Abilint (TD).
117 !Do not modify the following lines by hand.
118 #undef ABI_FUNC
119 #define ABI_FUNC 'MapHyb_init'
120 !End of the abilint section
121 
122   TYPE(MapHyb)     , INTENT(INOUT) :: this
123   INTEGER, OPTIONAL, INTENT(IN   ) :: size
124 !Local variables ------------------------------
125   INTEGER                          :: size_val
126 
127   size_val = Global_SIZE
128   IF ( PRESENT(size) ) size_val = size
129   this%size = size_val
130   FREEIF(this%listINT)
131   MALLOC(this%listINT,(1:size_val))
132   FREEIF(this%listDBLE)
133   MALLOC(this%listDBLE,(1:size_val))
134   this%tail     = 0
135 END SUBROUTINE MapHyb_init

ABINIT/m_MapHyb/MapHyb_print [ Functions ]

[ Top ] [ Functions ]

NAME

  MapHyb_print

FUNCTION

  print the this

COPYRIGHT

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

INPUTS

  this=Map
  ostream=file stream

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

489 SUBROUTINE MapHyb_print(this,ostream)
490 
491 !Arguments ------------------------------------
492 
493 !This section has been created automatically by the script Abilint (TD).
494 !Do not modify the following lines by hand.
495 #undef ABI_FUNC
496 #define ABI_FUNC 'MapHyb_print'
497 !End of the abilint section
498 
499   TYPE(MapHyb)     , INTENT(IN) :: this
500   INTEGER, OPTIONAL, INTENT(IN) :: ostream
501 !Local variables ------------------------------
502   INTEGER                       :: ostream_val
503   INTEGER                       :: it
504 
505   ostream_val = 6
506   IF ( PRESENT(ostream) ) ostream_val = ostream
507   WRITE(ostream_val,'(A,2x,A5,2x,A5)') "#","Index", "Value"
508   DO it = 1, this%tail
509     WRITE(ostream_val,'(3x,I5,2x,ES22.14)') this%listINT(it), this%listDBLE(it) 
510   END DO
511 END SUBROUTINE MapHyb_print

ABINIT/m_MapHyb/MapHyb_quickSort [ Functions ]

[ Top ] [ Functions ]

NAME

  MapHyb_quickSort

FUNCTION

  sort the this with respect to the integer array
  with the quickSort algo

COPYRIGHT

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

INPUTS

  this=Map
  begin=first element to consider
  end=last element to consider

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

406 RECURSIVE SUBROUTINE MapHyb_quickSort(this, begin, end)
407 
408 !Arguments ------------------------------------
409 
410 !This section has been created automatically by the script Abilint (TD).
411 !Do not modify the following lines by hand.
412 #undef ABI_FUNC
413 #define ABI_FUNC 'MapHyb_quickSort'
414 !End of the abilint section
415 
416   TYPE(MapHyb), INTENT(INOUT) :: this
417   INTEGER     , INTENT(IN   ) :: begin
418   INTEGER     , INTENT(IN   ) :: end
419 !Local variables ------------------------------
420   INTEGER                     :: it1
421   INTEGER                     :: it2
422   INTEGER                     :: pivot
423   INTEGER                     :: Iswap
424   DOUBLE PRECISION            :: Dswap
425 
426   pivot = this%listINT((end-begin)/2 + begin) ! not the betterchoice.... FIXME
427   it1 = begin
428   it2 = end
429   DO WHILE (it1 .LE. it2)
430     DO WHILE ( this%listINT(it1) .LT. pivot )
431       it1 = it1 + 1
432     END DO
433     DO WHILE ( this%listINT(it2) .GT. pivot )
434       it2 = it2 - 1
435     END DO
436     IF ( it1 .LE. it2) THEN
437       Iswap = this%listINT(it1)
438       Dswap = this%listDBLE(it1)
439       this%listINT(it1)  = this%listINT(it2)
440       this%listDBLE(it1) = this%listDBLE(it2)
441       this%listINT(it2)  = Iswap
442       this%listDBLE(it2) = Dswap
443       it1 = it1 + 1
444       it2 = it2 - 1
445     END IF
446   END DO
447   IF ( begin < it2 ) THEN
448     CALL MapHyb_quickSort(this,begin,it2)
449   END IF
450   !!it2= it1+1
451   IF ( it1 < end ) THEN
452     CALL MapHyb_quickSort(this,it1,end)
453   END IF
454 
455 END SUBROUTINE MapHyb_quickSort

ABINIT/m_MapHyb/MapHyb_setSize [ Functions ]

[ Top ] [ Functions ]

NAME

  MapHyb_setSize

FUNCTION

  impose size of the this

COPYRIGHT

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

INPUTS

  this=Map
  new_tail=new size

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

169 SUBROUTINE MapHyb_setSize(this,new_tail)
170 
171 !Arguments ------------------------------------
172 
173 !This section has been created automatically by the script Abilint (TD).
174 !Do not modify the following lines by hand.
175 #undef ABI_FUNC
176 #define ABI_FUNC 'MapHyb_setSize'
177 !End of the abilint section
178 
179   TYPE(MapHyb), INTENT(INOUT) :: this
180   INTEGER     , INTENT(IN   ) :: new_tail
181 !Local variables ------------------------------
182   INTEGER                     :: size
183 
184   IF ( .NOT. ALLOCATED(this%listINT) ) THEN
185     CALL MapHyb_init(this)
186   END IF
187   size = this%size
188   IF( new_tail .GT. size ) THEN
189     CALL MapHyb_enlarge(this, MAX(new_tail-size,Global_SIZE))
190   END IF
191   this%tail = new_tail
192 END SUBROUTINE MapHyb_setSize  

ABINIT/m_MapHyb/MapHyb_sort [ Functions ]

[ Top ] [ Functions ]

NAME

  MapHyb_sort

FUNCTION

  sort the this with respect to the integer array

COPYRIGHT

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

INPUTS

  this=Map

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

356 SUBROUTINE MapHyb_sort(this)
357 
358 !Arguments ------------------------------------
359 
360 !This section has been created automatically by the script Abilint (TD).
361 !Do not modify the following lines by hand.
362 #undef ABI_FUNC
363 #define ABI_FUNC 'MapHyb_sort'
364 !End of the abilint section
365 
366   TYPE(MapHyb), INTENT(INOUT) :: this
367  
368   IF ( this%tail .EQ. 1 ) RETURN
369   CALL MapHyb_quickSort(this, 1, this%tail)
370 END SUBROUTINE MapHyb_sort

m_MapHyb/MapHyb [ Types ]

[ Top ] [ m_MapHyb ] [ Types ]

NAME

  MapHyb

FUNCTION

  This structured datatype contains the necessary data

COPYRIGHT

  Copyright (C) 2013-2018 ABINIT group (J. Bieder)
  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

52 TYPE, PUBLIC :: MapHyb
53   INTEGER _PRIVATE :: size
54   INTEGER          :: tail
55   INTEGER         , ALLOCATABLE, DIMENSION(:) :: listINT
56   DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:) :: listDBLE
57 END TYPE MapHyb