Skip to content

Commit c68550e

Browse files
committed
Optimization for the conservative interpolation code in 2d
1 parent 3b70218 commit c68550e

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

femtools/Conservative_interpolation.F90

+9
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ subroutine galerkin_projection_inner_loop(ele_B, little_mass_matrix, detJ, local
151151
end if
152152
else
153153
intersection = intersect_elements(old_position, ele_A, pos_B, supermesh_shape)
154+
if (.not. has_references(intersection)) then
155+
llnode => llnode%next
156+
cycle
157+
end if
154158
end if
155159

156160
#ifdef DUMP_SUPERMESH_INTERSECTIONS
@@ -1055,6 +1059,11 @@ subroutine grandy_projection_scalars(old_fields, old_position, new_fields, new_p
10551059
end do
10561060

10571061
intersection = intersect_elements(old_position, ele_A, pos_B, supermesh_shape)
1062+
if (.not. has_references(intersection)) then
1063+
llnode => llnode%next
1064+
cycle
1065+
end if
1066+
10581067
do ele_C=1,ele_count(intersection)
10591068
vol_C = simplex_volume(intersection, ele_C)
10601069
do field=1,field_cnt

femtools/Intersection_finder.F90

+10
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,11 @@ subroutine verify_map(mesh_field_a, mesh_field_b, map_ab, map_ab_reference)
701701
node => map_ab(i)%firstnode
702702
do while(associated(node))
703703
intersection = intersect_elements(mesh_field_a, i, ele_val(mesh_field_b, node%value), shape)
704+
if (.not. has_references(intersection)) then
705+
node => node%next
706+
cycle
707+
end if
708+
704709
do j = 1, ele_count(intersection)
705710
allocate(detwei(shape%ngi))
706711
call transform_to_physical(intersection, j, detwei = detwei)
@@ -715,6 +720,11 @@ subroutine verify_map(mesh_field_a, mesh_field_b, map_ab, map_ab_reference)
715720
node => map_ab_reference(i)%firstnode
716721
do while(associated(node))
717722
intersection = intersect_elements(mesh_field_a, i, ele_val(mesh_field_b, node%value), shape)
723+
if (.not. has_references(intersection)) then
724+
node => node%next
725+
cycle
726+
end if
727+
718728
do j = 1, ele_count(intersection)
719729
allocate(detwei(shape%ngi))
720730
call transform_to_physical(intersection, j, detwei = detwei)

femtools/Supermesh.F90

+5
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ function intersect_elements(positions_A, ele_A, posB, shape) result(intersection
205205
call cintersector_set_input(ele_val(positions_A, ele_A), posB, dim, loc)
206206
call cintersector_drive
207207
call cintersector_query(nonods, totele)
208+
209+
if (totele==0) then
210+
return
211+
end if
212+
208213
call allocate(intersection_mesh, nonods, totele, shape, "IntersectionMesh")
209214
intersection_mesh%continuity = -1
210215
call allocate(intersection, dim, intersection_mesh, "IntersectionCoordinates")

0 commit comments

Comments
 (0)