Skip to content

Commit

Permalink
Optimization for the conservative interpolation code in 2d
Browse files Browse the repository at this point in the history
  • Loading branch information
jrper committed Oct 27, 2016
1 parent 3b70218 commit c68550e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions femtools/Conservative_interpolation.F90
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ subroutine galerkin_projection_inner_loop(ele_B, little_mass_matrix, detJ, local
end if
else
intersection = intersect_elements(old_position, ele_A, pos_B, supermesh_shape)
if (.not. has_references(intersection)) then
llnode => llnode%next
cycle
end if
end if

#ifdef DUMP_SUPERMESH_INTERSECTIONS
Expand Down Expand Up @@ -1055,6 +1059,11 @@ subroutine grandy_projection_scalars(old_fields, old_position, new_fields, new_p
end do

intersection = intersect_elements(old_position, ele_A, pos_B, supermesh_shape)
if (.not. has_references(intersection)) then
llnode => llnode%next
cycle
end if

do ele_C=1,ele_count(intersection)
vol_C = simplex_volume(intersection, ele_C)
do field=1,field_cnt
Expand Down
10 changes: 10 additions & 0 deletions femtools/Intersection_finder.F90
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,11 @@ subroutine verify_map(mesh_field_a, mesh_field_b, map_ab, map_ab_reference)
node => map_ab(i)%firstnode
do while(associated(node))
intersection = intersect_elements(mesh_field_a, i, ele_val(mesh_field_b, node%value), shape)
if (.not. has_references(intersection)) then
node => node%next
cycle
end if

do j = 1, ele_count(intersection)
allocate(detwei(shape%ngi))
call transform_to_physical(intersection, j, detwei = detwei)
Expand All @@ -715,6 +720,11 @@ subroutine verify_map(mesh_field_a, mesh_field_b, map_ab, map_ab_reference)
node => map_ab_reference(i)%firstnode
do while(associated(node))
intersection = intersect_elements(mesh_field_a, i, ele_val(mesh_field_b, node%value), shape)
if (.not. has_references(intersection)) then
node => node%next
cycle
end if

do j = 1, ele_count(intersection)
allocate(detwei(shape%ngi))
call transform_to_physical(intersection, j, detwei = detwei)
Expand Down
5 changes: 5 additions & 0 deletions femtools/Supermesh.F90
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ function intersect_elements(positions_A, ele_A, posB, shape) result(intersection
call cintersector_set_input(ele_val(positions_A, ele_A), posB, dim, loc)
call cintersector_drive
call cintersector_query(nonods, totele)

if (totele==0) then
return
end if

call allocate(intersection_mesh, nonods, totele, shape, "IntersectionMesh")
intersection_mesh%continuity = -1
call allocate(intersection, dim, intersection_mesh, "IntersectionCoordinates")
Expand Down

0 comments on commit c68550e

Please sign in to comment.