Adds a eulerian object to the eulerian set.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(eulerian_set), | intent(inout) | :: | this |
An Eulerian Set |
||
| character(len=*), | intent(in) | :: | name |
Name of variable |
||
| integer, | intent(in) | :: | stag |
Staggering |
||
| class(eulerian_obj_base), | intent(inout), | target | :: | obj |
Eulerian obj to link and Initialize |
impure subroutine eulerian_set_Add(this,name,stag,obj) !> Adds a eulerian object to the eulerian set. implicit none class(eulerian_set), intent(inout) :: this !! An Eulerian Set character(len=*), intent(in) :: name !! Name of variable integer, intent(in) :: stag !! Staggering class(eulerian_obj_base), intent(inout), & target :: obj !! Eulerian obj to link and Initialize ! Work bariables type(eulerian_ptr), allocatable :: tmp_array(:) ! Initialize Eulerian object call obj%Initialize(name, this%block,this%parallel,stag) ! First resize array to accomodate a new element if (.not.allocated(this%field)) then allocate(this%field(1)) else ! Allocate temporary array allocate(tmp_array(size(this%field)+1)) ! Store old values tmp_array(1:size(this%field)) = this%field(:) ! Move the allocation from the ! temporary array to the final one call move_alloc(tmp_array,this%field) end if ! Link step this%field(size(this%field))%p => obj ! Add to hash table call this%tbl%Put(key=this%tbl%HashString(name),val=size(this%field)) return end subroutine eulerian_set_Add