Add new elements to point containers is now more general

This commit is contained in:
Jorge Gonzalez 2026-02-20 11:03:11 +01:00
commit 70f6db0883
12 changed files with 109 additions and 108 deletions

View file

@ -18,6 +18,37 @@ submodule(moduleMesh) elements
END SUBROUTINE resetOutput
subroutine meshNodePointerAdd(self, node)
implicit none
class(meshNodePointer), allocatable, intent(inout):: self(:)
integer, intent(in):: node
integer:: n
logical:: inArray
type(meshNodePointer):: nodeToAdd
nodeToAdd%obj => mesh%nodes(node)%obj
inArray = .false.
! I cannot use the procedure 'any' for this
do n = 1 , size(self)
IF (self(n) == nodeToAdd) THEN
! Node already in array
inArray = .true.
exit
end if
end do
if (.not. inArray) then
! If not, add element to array of nodes
self = [self, nodeToAdd]
end if
end subroutine meshNodePointerAdd
function meshNodePointer_equal_type_type(self, other) result(isEqual)
implicit none
@ -49,6 +80,37 @@ submodule(moduleMesh) elements
end function meshEdgePointer_equal_type_type
subroutine meshEdgePointer_add(self, edge)
implicit none
class(meshEdgePointer), allocatable, intent(inout):: self(:)
integer, intent(in):: edge
integer:: n
logical:: inArray
type(meshEdgePointer):: edgeToAdd
edgeToAdd%obj => mesh%edges(edge)%obj
inArray = .false.
! I cannot use the procedure 'any' for this
do n = 1 , size(self)
IF (self(n) == edgeToAdd) THEN
! Node already in array
inArray = .true.
exit
end if
end do
if (.not. inArray) then
! If not, add element to array of nodes
self = [self, edgeToAdd]
end if
end subroutine meshEdgePointer_add
function meshEdgePointer_equal_type_int(self, other) result(isEqual)
implicit none