This commit is contained in:
Martin Diehl 2019-06-15 20:42:16 +02:00
parent 2c4f1eb173
commit e30478127d
2 changed files with 40 additions and 40 deletions

View File

@ -179,7 +179,7 @@ recursive subroutine math_sort(a, istart, iend, sortDim)
e = ubound(a,2) e = ubound(a,2)
endif endif
if(present(sortDim)) then if(present(sortDim)) then
d = sortDim d = sortDim
else else
d = 1 d = 1

View File

@ -497,7 +497,7 @@ subroutine mesh_marc_map_elements(tableStyle,nameElemSet,mapElemSet,nElems,fileF
mesh_mapFEtoCPelem(2,cpElem) = cpElem mesh_mapFEtoCPelem(2,cpElem) = cpElem
enddo enddo
call math_sort(mesh_mapFEtoCPelem,1,size(mesh_mapFEtoCPelem,2)) call math_sort(mesh_mapFEtoCPelem)
end subroutine mesh_marc_map_elements end subroutine mesh_marc_map_elements
@ -532,7 +532,7 @@ subroutine mesh_marc_map_nodes(nNodes,fileUnit)
endif endif
enddo enddo
620 call math_sort(mesh_mapFEtoCPnode,1,size(mesh_mapFEtoCPnode,2)) 620 call math_sort(mesh_mapFEtoCPnode)
end subroutine mesh_marc_map_nodes end subroutine mesh_marc_map_nodes
@ -1262,43 +1262,43 @@ end subroutine mesh_build_ipAreas
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
integer function mesh_FEasCP(what,myID) integer function mesh_FEasCP(what,myID)
character(len=*), intent(in) :: what character(len=*), intent(in) :: what
integer, intent(in) :: myID integer, intent(in) :: myID
integer, dimension(:,:), pointer :: lookupMap integer, dimension(:,:), pointer :: lookupMap
integer :: lower,upper,center integer :: lower,upper,center
mesh_FEasCP = 0 mesh_FEasCP = 0
select case(IO_lc(what(1:4))) select case(IO_lc(what(1:4)))
case('elem') case('elem')
lookupMap => mesh_mapFEtoCPelem lookupMap => mesh_mapFEtoCPelem
case('node') case('node')
lookupMap => mesh_mapFEtoCPnode lookupMap => mesh_mapFEtoCPnode
case default case default
return return
endselect endselect
lower = 1 lower = 1
upper = int(size(lookupMap,2),pInt) upper = int(size(lookupMap,2),pInt)
if (lookupMap(1,lower) == myID) then ! check at bounds QUESTION is it valid to extend bounds by 1 and just do binary search w/o init check at bounds? if (lookupMap(1,lower) == myID) then ! check at bounds QUESTION is it valid to extend bounds by 1 and just do binary search w/o init check at bounds?
mesh_FEasCP = lookupMap(2,lower) mesh_FEasCP = lookupMap(2,lower)
return return
elseif (lookupMap(1,upper) == myID) then elseif (lookupMap(1,upper) == myID) then
mesh_FEasCP = lookupMap(2,upper) mesh_FEasCP = lookupMap(2,upper)
return return
endif endif
binarySearch: do while (upper-lower > 1) binarySearch: do while (upper-lower > 1)
center = (lower+upper)/2 center = (lower+upper)/2
if (lookupMap(1,center) < myID) then if (lookupMap(1,center) < myID) then
lower = center lower = center
elseif (lookupMap(1,center) > myID) then elseif (lookupMap(1,center) > myID) then
upper = center upper = center
else else
mesh_FEasCP = lookupMap(2,center) mesh_FEasCP = lookupMap(2,center)
exit exit
endif endif
enddo binarySearch enddo binarySearch
end function mesh_FEasCP end function mesh_FEasCP