Skip to content

Commit

Permalink
Add neko_type_error
Browse files Browse the repository at this point in the history
  • Loading branch information
timofeymukha committed Dec 16, 2024
1 parent c5d24f6 commit 15eb08f
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/common/utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module utils
public :: neko_error, neko_warning, nonlinear_index, filename_chsuffix, &
filename_suffix, filename_suffix_pos, filename_tslash_pos, &
linear_index, split_string, NEKO_FNAME_LEN, index_is_on_facet, &
concat_string_array, extract_fld_file_index
concat_string_array, extract_fld_file_index, neko_type_error


contains
Expand Down Expand Up @@ -240,6 +240,27 @@ subroutine neko_error_msg(error_msg)
error stop
end subroutine neko_error_msg

!> Reports an error allocating a type for a particular base pointer class.
!! @details Should be used in factories.
!! @param base_type The base type of the object, which the factory tried to
!! construct.
!! @param wrong_type The type that was attempted to construct.
!! @param known_types A list of the types that are known.
subroutine neko_type_error(base_type, wrong_type, known_types)
character(len=*) :: base_type
character(len=*) :: wrong_type
character(len=*) :: known_types(:)
integer :: i

write(error_unit, *) '*** ERROR WHEN SELECTING TYPE ***'
write(error_unit, *) 'Type ', wrong_type, ' does not exist for ', base_type
write(error_unit, *) 'Valid types are:'
do i = 1, size(known_types)
write(error_unit, *) " ", known_types(i)
end do
error stop
end subroutine neko_type_error

!> Reports a warning to standard output
subroutine neko_warning(warning_msg)
character(len=*) :: warning_msg
Expand Down

0 comments on commit 15eb08f

Please sign in to comment.