29 #include "../base/base_uses.f90"
35 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'tmc_tree_references'
49 TYPE(global_tree_type),
POINTER :: gt_elem
51 CHARACTER(LEN=*),
PARAMETER :: routinen =
'add_to_references'
54 TYPE(gt_elem_list_type),
POINTER :: tmp_pt_list_elem
56 NULLIFY (tmp_pt_list_elem)
58 cpassert(
ASSOCIATED(gt_elem))
61 CALL timeset(routinen, handle)
64 ALLOCATE (tmp_pt_list_elem)
65 tmp_pt_list_elem%gt_elem => gt_elem
66 IF (
ASSOCIATED(gt_elem%conf(gt_elem%mv_conf)%elem%gt_nodes_references))
THEN
67 tmp_pt_list_elem%next => gt_elem%conf(gt_elem%mv_conf)%elem%gt_nodes_references
69 tmp_pt_list_elem%next => null()
71 gt_elem%conf(gt_elem%mv_conf)%elem%gt_nodes_references => tmp_pt_list_elem
75 IF (gt_elem%swaped)
THEN
77 ALLOCATE (tmp_pt_list_elem)
78 tmp_pt_list_elem%gt_elem => gt_elem
79 IF (
ASSOCIATED(gt_elem%conf(gt_elem%mv_conf + 1)%elem%gt_nodes_references))
THEN
80 tmp_pt_list_elem%next => gt_elem%conf(gt_elem%mv_conf + 1)%elem%gt_nodes_references
82 tmp_pt_list_elem%next => null()
84 gt_elem%conf(gt_elem%mv_conf + 1)%elem%gt_nodes_references => tmp_pt_list_elem
98 TYPE(global_tree_type),
POINTER :: gt_ptr
99 TYPE(tmc_env_type),
POINTER :: tmc_env
101 CHARACTER(LEN=*),
PARAMETER :: routinen =
'remove_gt_references'
105 cpassert(
ASSOCIATED(gt_ptr))
106 cpassert(
ASSOCIATED(tmc_env))
109 CALL timeset(routinen, handle)
112 elem=gt_ptr%conf(gt_ptr%mv_conf)%elem, tmc_env=tmc_env)
115 IF (gt_ptr%swaped)
THEN
117 elem=gt_ptr%conf(gt_ptr%mv_conf + 1)%elem, tmc_env=tmc_env)
120 CALL timestop(handle)
130 TYPE(tree_type),
POINTER :: ptr
132 CHARACTER(LEN=*),
PARAMETER :: routinen =
'remove_subtree_element_of_all_references'
134 CHARACTER(len=2000) :: list_of_nr
136 TYPE(gt_elem_list_type),
POINTER :: tmp_gt_list_ptr
138 NULLIFY (tmp_gt_list_ptr)
140 cpassert(
ASSOCIATED(ptr))
143 CALL timeset(routinen, handle)
145 pt_node_ref_loop:
DO WHILE (
ASSOCIATED(ptr%gt_nodes_references))
146 tmp_gt_list_ptr => ptr%gt_nodes_references
147 cpassert(
ASSOCIATED(tmp_gt_list_ptr%gt_elem))
148 CALL cp_abort(__location__, &
149 "found reference of global tree node "// &
150 cp_to_string(tmp_gt_list_ptr%gt_elem%nr)// &
151 ", while removing sub tree node "// &
152 cp_to_string(ptr%sub_tree_nr)//cp_to_string(ptr%nr))
154 IF (
ASSOCIATED(tmp_gt_list_ptr%gt_elem%conf(tmp_gt_list_ptr%gt_elem%mv_conf)%elem))
THEN
155 IF (
ASSOCIATED(ptr, tmp_gt_list_ptr%gt_elem%conf(tmp_gt_list_ptr%gt_elem%mv_conf)%elem))
THEN
156 tmp_gt_list_ptr%gt_elem%conf(tmp_gt_list_ptr%gt_elem%mv_conf)%elem => null()
158 ELSE IF (
ASSOCIATED(ptr, tmp_gt_list_ptr%gt_elem%conf(tmp_gt_list_ptr%gt_elem%mv_conf + 1)%elem))
THEN
159 tmp_gt_list_ptr%gt_elem%conf(tmp_gt_list_ptr%gt_elem%mv_conf + 1)%elem => null()
162 DO i = 1,
SIZE(tmp_gt_list_ptr%gt_elem%conf)
163 WRITE (list_of_nr, *) trim(adjustl(list_of_nr)), tmp_gt_list_ptr%gt_elem%conf(i)%elem%sub_tree_nr, &
164 tmp_gt_list_ptr%gt_elem%conf(i)%elem%nr,
" | "
166 CALL cp_warn(__location__, &
168 cp_to_string(ptr%sub_tree_nr)// &
169 "element "//cp_to_string(ptr%nr)// &
170 "global tree element"//cp_to_string(tmp_gt_list_ptr%gt_elem%nr)// &
171 "swaped"//cp_to_string(tmp_gt_list_ptr%gt_elem%swaped)// &
172 "moved elem"//cp_to_string(tmp_gt_list_ptr%gt_elem%mv_conf)// &
173 "with the related subtree, elements: "// &
174 trim(adjustl(list_of_nr)))
177 CALL cp_warn(__location__, &
178 "for subtree "//cp_to_string(ptr%sub_tree_nr)// &
179 "element "//cp_to_string(ptr%nr)// &
180 " is not related to global tree node "//cp_to_string(tmp_gt_list_ptr%gt_elem%nr)// &
183 ptr%gt_nodes_references => ptr%gt_nodes_references%next
184 DEALLOCATE (tmp_gt_list_ptr)
185 END DO pt_node_ref_loop
188 CALL timestop(handle)
190 cpassert(.NOT.
ASSOCIATED(ptr%gt_nodes_references))
202 TYPE(global_tree_type),
POINTER :: gt_ptr
203 TYPE(tree_type),
POINTER :: elem
204 TYPE(tmc_env_type),
POINTER :: tmc_env
206 CHARACTER(LEN=*),
PARAMETER :: routinen =
'search_and_remove_reference_in_list'
209 TYPE(gt_elem_list_type),
POINTER :: tmp_gt_list_last_ptr, tmp_gt_list_ptr
211 NULLIFY (tmp_gt_list_ptr, tmp_gt_list_last_ptr)
214 IF (.NOT.
ASSOCIATED(elem))
RETURN
215 IF (.NOT.
ASSOCIATED(gt_ptr))
RETURN
217 cpassert(
ASSOCIATED(tmc_env))
220 CALL timeset(routinen, handle)
223 tmp_gt_list_ptr => elem%gt_nodes_references
224 tmp_gt_list_last_ptr => elem%gt_nodes_references
227 DO WHILE (
ASSOCIATED(tmp_gt_list_ptr))
229 IF (
ASSOCIATED(tmp_gt_list_ptr%gt_elem, gt_ptr))
THEN
231 IF (
ASSOCIATED(tmp_gt_list_ptr, elem%gt_nodes_references))
THEN
233 IF (.NOT.
ASSOCIATED(tmp_gt_list_ptr%next))
THEN
236 elem%gt_nodes_references => null()
237 tmp_gt_list_last_ptr => null()
241 elem%gt_nodes_references => tmp_gt_list_ptr%next
242 tmp_gt_list_last_ptr => elem%gt_nodes_references
247 tmp_gt_list_last_ptr%next => tmp_gt_list_ptr%next
251 DEALLOCATE (tmp_gt_list_ptr)
253 tmp_gt_list_ptr => tmp_gt_list_last_ptr
256 tmp_gt_list_last_ptr => tmp_gt_list_ptr
258 IF (
ASSOCIATED(tmp_gt_list_ptr)) tmp_gt_list_ptr => tmp_gt_list_ptr%next
261 CALL timestop(handle)
various routines to log and control the output. The idea is that decisions about where to log should ...
to decrease the used memory size, just actual needed tree elements should be stored in memory,...
subroutine, public add_to_canceling_list(elem, tmc_env)
add a certain element to the cancelation list
subroutine, public search_and_remove_reference_in_list(gt_ptr, elem, tmc_env)
removes the global tree references of this actual global tree element from all related sub tree eleme...
subroutine, public add_to_references(gt_elem)
adds global tree reference to the modified sub tree element(s)
subroutine, public remove_subtree_element_of_all_references(ptr)
removes the pointers to a certain subtree element from every related global tree element
subroutine, public remove_gt_references(gt_ptr, tmc_env)
removes the global tree references of this actual global tree element from all related sub tree eleme...
module handles definition of the tree nodes for the global and the subtrees binary tree parent elemen...
module handles definition of the tree nodes for the global and the subtrees binary tree parent elemen...