source: LMDZ4/branches/LMDZ4-dev/libf/phylmd/buffer_mod.F90 @ 1267

Last change on this file since 1267 was 1001, checked in by Laurent Fairhead, 16 years ago
  • Modifs sur le parallelisme: masquage dans la physique
  • Inclusion strato
  • mise en coherence etat0
  • le mode offline fonctionne maintenant en parallele,
  • les fichiers de la dynamiques sont correctement sortis et peuvent etre reconstruit avec rebuild
  • la version parallele de la dynamique peut s'executer sans MPI (sur 1 proc)
  • L'OPENMP fonctionne maintenant sans la parallelisation MPI.

YM
LF

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1MODULE buffer_mod
2
3PRIVATE
4  REAL,PARAMETER :: grow_factor=1.5
5
6  INTEGER, POINTER, SAVE :: buffer_i(:)
7  INTEGER,SAVE :: size_buffer_i = 0
8!$OMP THREADPRIVATE(buffer_i,size_buffer_i)
9
10  REAL,POINTER,SAVE      :: buffer_r(:)
11  INTEGER,SAVE :: size_buffer_r = 0
12!$OMP THREADPRIVATE(buffer_r,size_buffer_r)
13 
14  LOGICAL,POINTER,SAVE   :: buffer_l(:)
15  INTEGER,SAVE :: size_buffer_l = 0
16!$OMP THREADPRIVATE(buffer_l,size_buffer_l)
17
18  CHARACTER,POINTER,SAVE :: buffer_c(:)
19  INTEGER,SAVE :: size_buffer_c = 0
20!$OMP THREADPRIVATE(buffer_c,size_buffer_c)
21
22INTERFACE get_buffer
23  MODULE PROCEDURE get_buffer_i, get_buffer_r, get_buffer_l, get_buffer_c
24END INTERFACE
25 
26PUBLIC :: get_buffer
27
28CONTAINS
29
30  SUBROUTINE get_buffer_i(buff,buff_size)
31  IMPLICIT NONE
32    INTEGER,POINTER    :: buff(:)
33    INTEGER,INTENT(IN) :: buff_size
34
35    IF (buff_size>size_buffer_i) THEN
36      DEALLOCATE(buffer_i)
37      size_buffer_i=MAX(2,INT(size_buffer_i*grow_factor))
38      ALLOCATE(buffer_i(size_buffer_i))
39    ENDIF
40   
41    buff=>buffer_i
42  END SUBROUTINE get_buffer_i
43
44  SUBROUTINE get_buffer_r(buff,buff_size)
45  IMPLICIT NONE
46    REAL,POINTER       :: buff(:)
47    INTEGER,INTENT(IN) :: buff_size
48
49    IF (buff_size>size_buffer_r) THEN
50      DEALLOCATE(buffer_r)
51      size_buffer_r=MAX(2,INT(size_buffer_r*grow_factor))
52      ALLOCATE(buffer_r(size_buffer_r))
53    ENDIF
54   
55    buff=>buffer_r
56  END SUBROUTINE get_buffer_r
57
58  SUBROUTINE get_buffer_l(buff,buff_size)
59  IMPLICIT NONE
60    LOGICAL,POINTER    :: buff(:)
61    INTEGER,INTENT(IN) :: buff_size
62
63    IF (buff_size>size_buffer_l) THEN
64      DEALLOCATE(buffer_l)
65      size_buffer_l=MAX(2,INT(size_buffer_l*grow_factor))
66      ALLOCATE(buffer_l(size_buffer_l))
67    ENDIF
68   
69    buff=>buffer_l
70  END SUBROUTINE get_buffer_l
71 
72  SUBROUTINE get_buffer_c(buff,buff_size)
73  IMPLICIT NONE
74    CHARACTER,POINTER  :: buff(:)
75    INTEGER,INTENT(IN) :: buff_size
76
77    IF (buff_size>size_buffer_c) THEN
78      DEALLOCATE(buffer_c)
79      size_buffer_c=MAX(2,INT(size_buffer_c*grow_factor))
80      ALLOCATE(buffer_c(size_buffer_c))
81    ENDIF
82   
83    buff=>buffer_c
84  END SUBROUTINE get_buffer_c
85 
86END MODULE buffer_mod
Note: See TracBrowser for help on using the repository browser.