62
63
transform_cvsurf_to_physical, transform_cvsurf_facet_to_physical, &
63
64
transform_superconvergent_to_physical, transform_horizontal_to_physical, &
64
65
compute_jacobian, compute_inverse_jacobian, element_volume,&
65
cache_transform_elements, deallocate_transform_cache
66
cache_transform_elements, deallocate_transform_cache, &
67
prepopulate_transform_cache
67
69
integer, parameter :: cyc3(1:5)=(/ 1, 2, 3, 1, 2 /)
168
170
end function retrieve_cached_transform_det
172
function prepopulate_transform_cache(X) result(cache_valid)
173
!!< Prepopulate the caches for transform_to_physical and
174
!!< transform_face_to_physical
176
!!< If you're going to call transform_to_physical on a coordinate
177
!!< field inside a threaded region, you need to call this on the
178
!!< same field before entering the region.
179
type(vector_field), intent(in) :: X
180
logical :: cache_valid
181
logical :: face_cache_valid
183
face_cache_valid=.true.
184
! Although the caches are thread safe, the code that assembles the
185
! caches is not so we want a simple way to construct them if
186
! appropriate before entering a threaded region.
187
if (X%refcount%id /= position_id) then
189
if (X%name/="Coordinate") then
190
!!< If Someone is not calling this on the main Coordinate field
191
!!< then we're screwed anyway.
194
else if (eventcount(EVENT_MESH_MOVEMENT) /= last_mesh_movement) then
198
if (X%refcount%id /= face_position_id) then
199
face_cache_valid=.false.
200
else if (eventcount(EVENT_MESH_MOVEMENT) /= face_last_mesh_movement) then
201
face_cache_valid = .false.
204
if (.not.cache_valid) then
205
call construct_cache(X)
209
if (.not.face_cache_valid) then
210
call construct_face_cache(X)
211
face_cache_valid=.true.
214
cache_valid = cache_valid .and. face_cache_valid
216
end function prepopulate_transform_cache
171
218
subroutine construct_cache(X)
172
219
!!< The cache is invalid so make a new one.
180
227
! ewrite(1,*) "Reconstructing element geometry cache."
229
call abort_if_in_parallel_region
182
231
position_id=X%refcount%id
183
232
last_mesh_movement=eventcount(EVENT_MESH_MOVEMENT)
306
355
! ewrite(1,*) "Reconstructing element geometry cache."
357
call abort_if_in_parallel_region
308
359
face_position_id=X%refcount%id
309
360
face_last_mesh_movement=eventcount(EVENT_MESH_MOVEMENT)