Register a boundary condition function with the given bcid and bcname. If the bcid is already registered, the function pointer is updated. The elements and sides arrays are not allocated here; call PopulateBoundaries after scanning the mesh.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(BoundaryConditionList), | intent(inout) | :: | list | |||
| integer, | intent(in) | :: | bcid | |||
| character, | intent(in) | :: | bcname | |||
| procedure(SELF_bcMethod), | intent(in), | pointer | :: | bcfunc |
subroutine RegisterbcMethod(list,bcid,bcname,bcfunc)
!! Register a boundary condition function with the given bcid and bcname.
!! If the bcid is already registered, the function pointer is updated.
!! The elements and sides arrays are not allocated here; call
!! PopulateBoundaries after scanning the mesh.
class(BoundaryConditionList),intent(inout) :: list
integer,intent(in) :: bcid
character(*),intent(in) :: bcname
procedure(SELF_bcMethod),pointer,intent(in) :: bcfunc
! Local
type(BoundaryCondition),pointer :: bc
! Check if bcid is registered
bc => list%GetBCForID(bcid)
if(associated(bc)) then
print*,"Boundary condition with ID ",bcid," is already registered."
print*,"Assigning new function to existing BC"
bc%bcMethod => bcfunc
else
allocate(bc)
bc%bcid = bcid
bc%bcname = trim(bcname)
bc%bcMethod => bcfunc
bc%nBoundaries = 0
nullify(bc%next)
nullify(bc%prev)
! Insert at the tail
if(.not. associated(list%head)) then
! First entry
list%head => bc
list%tail => bc
else
! Append to tail
bc%prev => list%tail
list%tail%next => bc
list%tail => bc
endif
list%nbc = list%nbc+1
list%current => bc
endif
endsubroutine RegisterbcMethod