1 | MODULE mod_grid_group |
---|
2 | USE mod_grid |
---|
3 | USE mod_xmlio_parameters |
---|
4 | |
---|
5 | IMPLICIT NONE |
---|
6 | |
---|
7 | TYPE grid_group |
---|
8 | CHARACTER(LEN=str_len) :: id |
---|
9 | LOGICAL :: has_id |
---|
10 | TYPE(vector_grid_group), POINTER :: groups |
---|
11 | TYPE(vector_grid),POINTER :: grids |
---|
12 | TYPE(grid), POINTER :: default_attribut |
---|
13 | END TYPE grid_group |
---|
14 | |
---|
15 | INCLUDE "vector_grid_group_def.inc" |
---|
16 | |
---|
17 | TYPE(vector_grid_group),POINTER,SAVE :: grid_group_Ids |
---|
18 | TYPE(sorted_list),POINTER,SAVE,PRIVATE :: Ids |
---|
19 | |
---|
20 | INTERFACE grid_group__set_attribut |
---|
21 | MODULE PROCEDURE grid_group__set_attribut_id,grid_group__set_attribut_pt |
---|
22 | END INTERFACE |
---|
23 | |
---|
24 | CONTAINS |
---|
25 | |
---|
26 | INCLUDE "vector_grid_group_contains.inc" |
---|
27 | |
---|
28 | SUBROUTINE grid_group__swap_context(saved_grid_group_Ids,saved_ids) |
---|
29 | IMPLICIT NONE |
---|
30 | TYPE(vector_grid_group),POINTER :: saved_grid_group_Ids |
---|
31 | TYPE(sorted_list),POINTER :: saved_Ids |
---|
32 | |
---|
33 | grid_group_ids=>saved_grid_group_ids |
---|
34 | ids=>saved_ids |
---|
35 | |
---|
36 | END SUBROUTINE grid_group__swap_context |
---|
37 | |
---|
38 | SUBROUTINE grid_group__init |
---|
39 | IMPLICIT NONE |
---|
40 | |
---|
41 | CALL vector_grid_group__new(grid_group_Ids) |
---|
42 | CALL sorted_list__new(Ids) |
---|
43 | |
---|
44 | END SUBROUTINE grid_group__init |
---|
45 | |
---|
46 | SUBROUTINE grid_group__get(Id,Pt_gg) |
---|
47 | USE string_function |
---|
48 | IMPLICIT NONE |
---|
49 | CHARACTER(LEN=*),INTENT(IN) :: Id |
---|
50 | TYPE(grid_group),POINTER :: Pt_gg |
---|
51 | |
---|
52 | INTEGER :: Pos |
---|
53 | LOGICAL :: success |
---|
54 | |
---|
55 | CALL sorted_list__find(Ids,hash(Id),Pos,success) |
---|
56 | IF (success) THEN |
---|
57 | Pt_gg=>grid_group_ids%at(Pos)%Pt |
---|
58 | ELSE |
---|
59 | Pt_gg=>NULL() |
---|
60 | ENDIF |
---|
61 | |
---|
62 | END SUBROUTINE grid_group__get |
---|
63 | |
---|
64 | |
---|
65 | SUBROUTINE grid_group__set_attribut_id(id,attrib,Ok) |
---|
66 | USE mod_attribut |
---|
67 | USE error_msg |
---|
68 | IMPLICIT NONE |
---|
69 | CHARACTER(LEN=*),INTENT(IN) :: id |
---|
70 | TYPE(attribut),INTENT(IN) :: attrib |
---|
71 | LOGICAL,OPTIONAL,INTENT(out) :: Ok |
---|
72 | |
---|
73 | TYPE(grid_group),POINTER :: Pt_gg |
---|
74 | INTEGER :: Pos |
---|
75 | LOGICAL :: success |
---|
76 | |
---|
77 | CALL sorted_list__find(Ids,hash(Id),Pos,success) |
---|
78 | IF (success) THEN |
---|
79 | Pt_gg=>grid_group_ids%at(Pos)%Pt |
---|
80 | CALL grid_group__set_attribut(Pt_gg,attrib) |
---|
81 | IF (PRESENT(OK)) ok=.TRUE. |
---|
82 | ELSE |
---|
83 | IF (.NOT.PRESENT(OK)) THEN |
---|
84 | WRITE(message,*) 'grid group id :',id,'is undefined' |
---|
85 | CALL error('mod_grid_group::grid_group__set_attribut') |
---|
86 | ELSE |
---|
87 | OK=.FALSE. |
---|
88 | ENDIF |
---|
89 | ENDIF |
---|
90 | |
---|
91 | END SUBROUTINE grid_group__set_attribut_id |
---|
92 | |
---|
93 | SUBROUTINE grid_group__set_attribut_pt(pt_gg,attrib) |
---|
94 | USE mod_attribut |
---|
95 | USE mod_object |
---|
96 | IMPLICIT NONE |
---|
97 | TYPE(grid_group),POINTER :: Pt_gg |
---|
98 | TYPE(attribut),INTENT(IN) :: attrib |
---|
99 | |
---|
100 | IF (attrib%object==grid_object) THEN |
---|
101 | CALL grid__set_attribut(pt_gg%default_attribut,attrib) |
---|
102 | ENDIF |
---|
103 | |
---|
104 | END SUBROUTINE grid_group__set_attribut_pt |
---|
105 | |
---|
106 | |
---|
107 | |
---|
108 | RECURSIVE SUBROUTINE grid_group__new(Pt_gg,Id) |
---|
109 | USE string_function |
---|
110 | IMPLICIT NONE |
---|
111 | TYPE(grid_group),POINTER :: Pt_gg |
---|
112 | CHARACTER(LEN=*),OPTIONAL,INTENT(IN) :: Id |
---|
113 | |
---|
114 | INTEGER :: Pos |
---|
115 | |
---|
116 | ALLOCATE(Pt_gg%groups) |
---|
117 | ALLOCATE(Pt_gg%grids) |
---|
118 | ALLOCATE(Pt_gg%default_attribut) |
---|
119 | |
---|
120 | CALL vector_grid_group__new(Pt_gg%groups) |
---|
121 | CALL vector_grid__new(Pt_gg%grids) |
---|
122 | CALL grid__new(Pt_gg%default_attribut) |
---|
123 | Pt_gg%has_id=.FALSE. |
---|
124 | |
---|
125 | IF (PRESENT(Id)) THEN |
---|
126 | Pt_gg%id=TRIM(Id) |
---|
127 | Pt_gg%has_id=.TRUE. |
---|
128 | CALL vector_grid_group__set_new(grid_group_Ids,Pt_gg,Pos) |
---|
129 | CALL sorted_list__Add(Ids,hash(id),Pos) |
---|
130 | ENDIF |
---|
131 | |
---|
132 | END SUBROUTINE grid_group__new |
---|
133 | |
---|
134 | |
---|
135 | SUBROUTINE grid_group__get_new_group(Pt_gg,Pt_gg_out,Id) |
---|
136 | IMPLICIT NONE |
---|
137 | TYPE(grid_group),POINTER :: Pt_gg |
---|
138 | TYPE(grid_group),POINTER :: Pt_gg_out |
---|
139 | CHARACTER(LEN=*),OPTIONAL :: Id |
---|
140 | |
---|
141 | CALL vector_grid_group__get_new(Pt_gg%groups,Pt_gg_out) |
---|
142 | CALL grid_group__new(Pt_gg_out) |
---|
143 | |
---|
144 | IF (PRESENT(id)) THEN |
---|
145 | CALL grid_group__new(Pt_gg_out,Id) |
---|
146 | ELSE |
---|
147 | CALL grid_group__new(Pt_gg_out) |
---|
148 | ENDIF |
---|
149 | |
---|
150 | END SUBROUTINE grid_group__get_new_group |
---|
151 | |
---|
152 | |
---|
153 | SUBROUTINE grid_group__get_new_grid(Pt_gg,Pt_g_out,Id) |
---|
154 | IMPLICIT NONE |
---|
155 | TYPE(grid_group),POINTER :: Pt_gg |
---|
156 | TYPE(grid),POINTER :: Pt_g_out |
---|
157 | CHARACTER(LEN=*),OPTIONAL :: Id |
---|
158 | |
---|
159 | CALL vector_grid__get_new(Pt_gg%grids,Pt_g_out) |
---|
160 | |
---|
161 | IF (PRESENT(id)) THEN |
---|
162 | CALL grid__new(Pt_g_out,Id) |
---|
163 | ELSE |
---|
164 | CALL grid__new(Pt_g_out) |
---|
165 | ENDIF |
---|
166 | |
---|
167 | END SUBROUTINE grid_group__get_new_grid |
---|
168 | |
---|
169 | |
---|
170 | SUBROUTINE grid_group__get_default_attrib(Pt_gg,Pt_g) |
---|
171 | IMPLICIT NONE |
---|
172 | TYPE(grid_group),POINTER :: Pt_gg |
---|
173 | TYPE(grid),POINTER :: Pt_g |
---|
174 | |
---|
175 | Pt_g=>Pt_gg%default_attribut |
---|
176 | END SUBROUTINE grid_group__get_default_attrib |
---|
177 | |
---|
178 | RECURSIVE SUBROUTINE grid_group__apply_default(Pt_gg,default) |
---|
179 | IMPLICIT NONE |
---|
180 | TYPE(grid_group),POINTER :: Pt_gg |
---|
181 | TYPE(grid),POINTER,OPTIONAL :: default |
---|
182 | |
---|
183 | INTEGER :: i |
---|
184 | |
---|
185 | IF (PRESENT(default)) THEN |
---|
186 | CALL grid__apply_default(default,Pt_gg%default_attribut,Pt_gg%default_attribut) |
---|
187 | ENDIF |
---|
188 | |
---|
189 | DO i=1,Pt_gg%groups%size |
---|
190 | CALL grid_group__apply_default(Pt_gg%groups%at(i)%pt,Pt_gg%default_attribut) |
---|
191 | ENDDO |
---|
192 | |
---|
193 | DO i=1,Pt_gg%grids%size |
---|
194 | CALL grid__apply_default(Pt_gg%default_attribut,Pt_gg%grids%at(i)%pt,Pt_gg%grids%at(i)%pt) |
---|
195 | ENDDO |
---|
196 | |
---|
197 | END SUBROUTINE grid_group__apply_default |
---|
198 | |
---|
199 | RECURSIVE SUBROUTINE grid_group__Process_domain(Pt_gg) |
---|
200 | IMPLICIT NONE |
---|
201 | TYPE(grid_group),POINTER :: Pt_gg |
---|
202 | INTEGER :: i |
---|
203 | |
---|
204 | DO i=1,pt_gg%groups%size |
---|
205 | CALL grid_group__process_domain(pt_gg%groups%at(i)%pt) |
---|
206 | ENDDO |
---|
207 | |
---|
208 | DO i=1,pt_gg%grids%size |
---|
209 | CALL grid__process_domain(pt_gg%grids%at(i)%pt) |
---|
210 | ENDDO |
---|
211 | |
---|
212 | END SUBROUTINE grid_group__Process_domain |
---|
213 | |
---|
214 | |
---|
215 | RECURSIVE SUBROUTINE grid_group__print(Pt_gg) |
---|
216 | IMPLICIT NONE |
---|
217 | TYPE(grid_group),POINTER :: Pt_gg |
---|
218 | |
---|
219 | INTEGER :: i |
---|
220 | |
---|
221 | PRINT *,"--- GRID GROUP ---" |
---|
222 | IF (pt_gg%has_id) THEN |
---|
223 | PRINT *,"id ",TRIM(pt_gg%id) |
---|
224 | ELSE |
---|
225 | PRINT *,"id undefined" |
---|
226 | ENDIF |
---|
227 | |
---|
228 | PRINT *,"grid default attribut :" |
---|
229 | CALL grid__print(Pt_gg%default_attribut) |
---|
230 | |
---|
231 | PRINT *,"owned grid groups : ",Pt_gg%groups%size |
---|
232 | DO i=1,Pt_gg%groups%size |
---|
233 | CALL grid_group__print(Pt_gg%groups%at(i)%pt) |
---|
234 | ENDDO |
---|
235 | |
---|
236 | PRINT *,"owned grid : ",Pt_gg%grids%size |
---|
237 | DO i=1,Pt_gg%grids%size |
---|
238 | CALL grid__print(Pt_gg%grids%at(i)%pt) |
---|
239 | ENDDO |
---|
240 | PRINT *,"------------" |
---|
241 | |
---|
242 | END SUBROUTINE grid_group__print |
---|
243 | |
---|
244 | END MODULE mod_grid_group |
---|