Do some standard setup/checking
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(abstract_config_type), | intent(inout) | :: | self | |||
character(len=*), | intent(in), | optional | :: | name | ||
logical, | intent(in), | optional | :: | requires_index | ||
integer, | intent(in), | optional | :: | index |
subroutine setup_generic(self, name, requires_index, index)
implicit none
class(abstract_config_type), intent(inout) :: self
character(len = *), intent(in), optional :: name
logical, intent(in), optional :: requires_index
integer, intent(in), optional :: index
if(present(name)) then
self%name = name
else
!Set the default name if not passed
self%name = self%get_default_name()
end if
if(present(requires_index)) then
self%requires_index = requires_index
else
!Set the default requires index if not passed
self%requires_index = self%get_default_requires_index()
end if
if(present(index)) then
self%index = index
else
!Set a default index number if required and not set
if(self%get_requires_index()) self%index = 1
end if
self%initialised = .true.
end subroutine setup_generic