Add node-based surface parsing

This commit is contained in:
shenw
2026-06-24 18:20:17 +08:00
parent e17c04736b
commit aff82622f0
9 changed files with 182 additions and 22 deletions
+9 -3
View File
@@ -28,23 +28,29 @@ subroutine start_nset(set_index, item_pos, set_name_value)
elset_count(set_index) = 0
end subroutine start_elset
subroutine start_surface(surface_index, item_pos, surface_name_value)
subroutine start_surface(surface_index, item_pos, surface_name_value, &
surface_type_value)
integer, intent(in) :: surface_index
integer, intent(in) :: item_pos
character(len=*), intent(in) :: surface_name_value
character(len=*), intent(in) :: surface_type_value
surface_name(surface_index) = surface_name_value
if (allocated(surface_type)) surface_type(surface_index) = surface_type_value
surface_start(surface_index) = item_pos + 1
surface_count(surface_index) = 0
end subroutine start_surface
subroutine reset_surface(surface_index, item_pos, surface_name_value)
subroutine reset_surface(surface_index, item_pos, surface_name_value, &
surface_type_value)
integer, intent(in) :: surface_index
integer, intent(in) :: item_pos
character(len=*), intent(in) :: surface_name_value
character(len=*), intent(in) :: surface_type_value
integer :: pos
call start_surface(surface_index, item_pos, surface_name_value)
call start_surface(surface_index, item_pos, surface_name_value, &
surface_type_value)
if (.not. allocated(surface_owner)) return
do pos = 1, n_surface_item
if (surface_owner(pos) .eq. surface_index) surface_owner(pos) = 0
+13 -4
View File
@@ -874,8 +874,9 @@ contains
return
end if
call get_keyword_value(line, 'TYPE', type_value)
if (len_trim(type_value) .gt. 0 .and. trim(type_value) .ne. 'ELEMENT') then
call error_set(FEM_ERR_INPUT, 'only *SURFACE TYPE=ELEMENT is supported', ierr)
if (len_trim(type_value) .eq. 0) type_value = 'ELEMENT'
if (trim(type_value) .ne. 'ELEMENT' .and. trim(type_value) .ne. 'NODE') then
call error_set(FEM_ERR_INPUT, 'only *SURFACE TYPE=ELEMENT/NODE is supported', ierr)
return
end if
call get_keyword_value(line, 'OP', op_value)
@@ -887,11 +888,19 @@ contains
existing_surface = database_find_surface(name_value)
if (existing_surface .ne. 0) then
current_surface = existing_surface
if (trim(op_value) .eq. 'NEW') call reset_surface(current_surface, surface_pos, name_value)
if (trim(op_value) .eq. 'NEW') then
call reset_surface(current_surface, surface_pos, name_value, type_value)
else if (allocated(surface_type)) then
if (trim(surface_type(current_surface)) .ne. trim(type_value)) then
call error_set(FEM_ERR_INPUT, &
'*SURFACE OP=ADD cannot change surface TYPE', ierr)
return
end if
end if
else
used_surface_count = used_surface_count + 1
current_surface = used_surface_count
call start_surface(current_surface, surface_pos, name_value)
call start_surface(current_surface, surface_pos, name_value, type_value)
end if
ierr = FEM_SUCCESS
end subroutine fill_surface_keyword