Skip to main content

GetElemNum

This method returns the element numbers stored inside the mesh selection instance.

Interface

The following interface returns element number if isSelectionByElemNum is true.

INTERFACE
MODULE FUNCTION meshSelect_getElemNum1(obj, dim) RESULT(Ans)
CLASS(MeshSelection_), INTENT(IN) :: obj
INTEGER(I4B), INTENT(IN) :: dim
INTEGER(I4B), ALLOCATABLE :: ans(:)
END FUNCTION meshSelect_getElemNum1
END INTERFACE

The following interface returns element number when

  • IsSelectionByElemNum is true
  • or when IsSelectionByMeshID is true

TODO

  • IsSelectionByNodeNum
  • IsSelectionByBox
INTERFACE
MODULE FUNCTION meshSelect_getElemNum2(obj, dim, domain) RESULT(Ans)
CLASS(MeshSelection_), INTENT(IN) :: obj
INTEGER(I4B), INTENT(IN) :: dim
CLASS(Domain_), INTENT(IN) :: domain
INTEGER(I4B), ALLOCATABLE :: ans(:)
END FUNCTION meshSelect_getElemNum2
END INTERFACE

The following interface returns element of all dimensions.

INTERFACE
MODULE FUNCTION meshSelect_getElemNum3(obj) RESULT(Ans)
CLASS(MeshSelection_), INTENT(IN) :: obj
INTEGER(I4B), ALLOCATABLE :: ans(:)
END FUNCTION meshSelect_getElemNum3
END INTERFACE
INTERFACE
MODULE FUNCTION meshSelect_getElemNum4(obj, domain) RESULT(Ans)
CLASS(MeshSelection_), INTENT(IN) :: obj
CLASS(Domain_), INTENT(IN) :: domain
INTEGER(I4B), ALLOCATABLE :: ans(:)
END FUNCTION meshSelect_getElemNum4
END INTERFACE

Example 1

Click here to see the example

This example demonstrates the usage of getElemNum() method.

PROGRAM main
USE easifemBase
USE easifemClasses
IMPLICIT NONE
TYPE( MeshSelection_ ) :: obj
TYPE(Domain_) :: dom
TYPE(HDF5File_) :: meshfile
TYPE(IntVector_) :: intvec

CALL meshfile%Initiate("./mesh.h5", mode="READ")
CALL meshfile%Open()

CALL dom%Initiate(meshfile, '')

CALL obj%Initiate( isSelectionByMeshID=.TRUE. )

CALL obj%Add( dim=2, meshID=[1])

CALL obj%Set()

intvec = obj%getElemNum(domain=dom, dim=2)
CALL Display(intvec, "getElemNum =", orient='row')

CALL obj%Deallocate()
CALL obj%Add(dim=1, meshID=[1,2])
CALL obj%Set()
intvec = obj%getElemNum(domain=dom, dim=1)
CALL Display(intvec, "getElemNum =", orient='row')

intvec = obj%getElemNum(domain=dom)
CALL Display(intvec, "getElemNum =", orient='row')

CALL obj%Deallocate()
END PROGRAM main