region_obj_Add Subroutine

private pure subroutine region_obj_Add(this, name, type, extents)

Adds a new variable to region.

Type Bound

region_obj

Arguments

Type IntentOptional Attributes Name
class(region_obj), intent(inout) :: this

A boundary region object

character(len=*), intent(in) :: name

Region name

integer, intent(in) :: type

Type of boundary condition

type(extent_obj), intent(in) :: extents

Region extents


Calls

proc~~region_obj_add~~CallsGraph proc~region_obj_add region_obj%region_obj_Add proc~hashtbl_obj_hashstring hashtbl_obj%hashtbl_obj_HashString proc~region_obj_add->proc~hashtbl_obj_hashstring proc~hashtbl_obj_put hashtbl_obj%hashtbl_obj_Put proc~region_obj_add->proc~hashtbl_obj_put proc~region_obj_expand region_obj%region_obj_Expand proc~region_obj_add->proc~region_obj_expand proc~sllist_obj_put sllist_obj%sllist_obj_Put proc~hashtbl_obj_put->proc~sllist_obj_put proc~sllist_obj_put->proc~sllist_obj_put

Called by

proc~~region_obj_add~~CalledByGraph proc~region_obj_add region_obj%region_obj_Add proc~bc_set_setbc bc_set%bc_set_SetBC proc~bc_set_setbc->proc~region_obj_add proc~cdifs_obj_preparesolverbcs cdifs_obj_PrepareSolverBCS proc~cdifs_obj_preparesolverbcs->proc~bc_set_setbc proc~grans_obj_preparesolverbcs grans_obj_PrepareSolverBCS proc~grans_obj_preparesolverbcs->proc~bc_set_setbc proc~cdifs_obj_preparesolver cdifs_obj_PrepareSolver proc~cdifs_obj_preparesolver->proc~cdifs_obj_preparesolverbcs proc~grans_obj_preparesolver grans_obj_PrepareSolver proc~grans_obj_preparesolver->proc~grans_obj_preparesolverbcs interface~cdifs_obj_preparesolver cdifs_obj%cdifs_obj_PrepareSolver interface~cdifs_obj_preparesolver->proc~cdifs_obj_preparesolver interface~grans_obj_preparesolver grans_obj%grans_obj_PrepareSolver interface~grans_obj_preparesolver->proc~grans_obj_preparesolver

Source Code

    pure subroutine region_obj_Add(this,name,type,extents)
      !> Adds a new variable to region.
      class(region_obj), intent(inout) :: this                                 !! A boundary region object
      character(len=*),  intent(in)    :: name                                 !! Region name
      integer,           intent(in)    :: type                                 !! Type of boundary condition
      type(extent_obj),  intent(in)    :: extents                              !! Region extents

      ! First resize arrays to accomodate a new element
      call this%Expand()

      ! Add to hash table
      call this%tbl%Put(key=this%tbl%HashString(name),val=this%count)

      ! Store the new BC
      this%BC(this%count)%name = name
      this%BC(this%count)%type = type

      select case(type)
        case (BC_DIRICHLET, BC_NEUMANN)
          ! Allocate val
          associate(lo => extents%lo, hi => extents%hi)
            allocate(this%BC(this%count)%val(lo(1):hi(1),lo(2):hi(2),lo(3):hi(3)))
            this%BC(this%count)%val = 0.0_wp
          end associate
        case default
          ! Do not allocate
      end select

      return
    end subroutine region_obj_Add