GetNodeToElements
Inheritence
This method is inherited from the AbstractMesh class.
GetNodeToNodes
Retrieves the global node numbers that are connected to a specified node or nodes.
Interface 1
MODULE PURE FUNCTION getNodeToNodes(obj, globalNode, IncludeSelf) &
& RESULT(ans)
CLASS(Mesh_), INTENT(IN) :: obj
INTEGER(I4B), INTENT(IN) :: globalNode
LOGICAL(LGT), INTENT(IN) :: IncludeSelf
INTEGER(I4B), ALLOCATABLE :: ans(:)
END FUNCTION getNodeToNodes
Interface 2
MODULE PURE FUNCTION getNodeToNodes(obj, globalNode, IncludeSelf) &
& RESULT(ans)
CLASS(Mesh_), INTENT(IN) :: obj
INTEGER(I4B), INTENT(IN) :: globalNode( : )
LOGICAL(LGT), INTENT(IN) :: IncludeSelf
INTEGER(I4B), ALLOCATABLE :: ans(:)
END FUNCTION getNodeToNodes
Arguments
obj
(AbstractMesh_, input): The mesh object.globalNode
(INTEGER, input): The global (or local) node number(s).includeSelf
(LOGICAL, input): If true, the specified node(s) will be included in the result.islocal
(LOGICAL, optional, input): If present and true,globalNode
is treated as local node number(s). Default is false.
Returns
ans
(INTEGER array): A 1D array containing the global node numbers connected to the specified node(s).
Description
This function returns the global node numbers that are connected to the specified node or nodes through element connectivity.
In Version 1, a single node is specified, and all nodes connected to that node are returned.
In Version 2, multiple nodes are specified, and all nodes connected to any of those nodes are returned (without duplicates).
If a node is not present in the mesh, the returned array will have zero size.
Example
! Find all nodes connected to node 25, including node 25 itself
INTEGER(I4B), ALLOCATABLE :: connectedNodes(:)
connectedNodes = mesh%GetNodeToNodes(25, includeSelf=.TRUE.)
! Find all nodes connected to nodes 10, 11, and 12, excluding these nodes
INTEGER(I4B) :: nodes(3) = [10, 11, 12]
connectedNodes = mesh%GetNodeToNodes(nodes, includeSelf=.FALSE.)
Examples
Example 1
PROGRAM main
USE easifemBase
USE easifemClasses
IMPLICIT NONE
TYPE( FEMesh_ ) :: obj
TYPE( HDF5File_ ) :: meshfile
CHARACTER(*), PARAMETER :: filename="../../Mesh/examples/meshdata/small_mesh.h5"
CALL e%SetQuietMode(.TRUE.)
CALL meshfile%Initiate( FileName=filename, MODE="READ" )
!Open the mesh file
CALL meshfile%Open()
CALL obj%SetShowTime(.true.)
!Initiate an instance of `Mesh_`
CALL obj%Initiate(hdf5=meshfile, group="/surfaceEntities_1" )
! Initiate dynamic data structure
CALL obj%InitiateNodeToElements()
!Display the content of mesh.
CALL obj%DisplayMeshInfo(filename)
! Display the mesh data
block
INTEGER( I4B ), ALlOCATABLE :: ans(:), exact_ans(:)
INTEGER( I4B ), PARAMETER :: globalNode = 10
ans = obj%GetNodeToElements(globalNode)
ans = sort(ans)
exact_ans = [14, 15, 22, 23, 24, 25]
CALL OK(ALL(exact_ans .eq. ans), "GetNodeToElements: " )
end block
block
INTEGER( I4B ), ALlOCATABLE :: ans(:), exact_ans(:)
INTEGER( I4B ), PARAMETER :: globalNode = 5
ans = obj%GetNodeToElements(globalNode)
ans = sort(ans)
exact_ans = [15, 17, 24]
CALL OK(ALL(exact_ans .eq. ans), "GetNodeToElements: " )
end block
block
INTEGER( I4B ), ALlOCATABLE :: ans(:), exact_ans(:)
INTEGER( I4B ), PARAMETER :: globalNode = 5
ans = obj%GetNodeToElements(globalNode, islocal=.true.)
ans = sort(ans)
exact_ans = [15, 17, 24]
CALL OK(ALL(exact_ans .eq. ans), "GetNodeToElements: " )
end block
CALL obj%Deallocate()
CALL meshfile%Deallocate()
END PROGRAM main