newGrid Subroutine

public subroutine newGrid(this, n, name)

Arguments

Type IntentOptional Attributes Name
type(Grid), intent(inout) :: this
integer, intent(in) :: n
character(len=*), intent(in), optional :: name

Contents

Source Code


Source Code

  subroutine newGrid(this,n,name)

   type(Grid), intent(inout)  :: this
   integer, intent(in)        :: n
   character(len=*), intent(in), optional  :: name

   integer :: stat

   ! We release the previous incarnation
   ! This means that we relinquish access to the previous
   ! memory location. It will be deallocated when nobody
   ! else is using it.

   call init(this)

   if (present(name)) then
      this%data%name = trim(name)
   else
      this%data%name = "(Grid from n)"
   endif

   allocate(this%data%grid_data(n))

   call tag_new_object(this)

  end subroutine newGrid