Skip to main content

IsElementPresent

Inheritence

This method is inherited from the AbstractMesh class.

IsElementPresent

The IsElementPresent method checks if a specific element number exists in the mesh.

Interface

INTERFACE
MODULE FUNCTION isElementPresent(obj, globalElement, islocal) &
RESULT(ans)
CLASS(AbstractMesh_), INTENT(IN) :: obj
INTEGER(I4B), INTENT(IN) :: globalElement
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: islocal
LOGICAL(LGT) :: ans
END FUNCTION isElementPresent
END INTERFACE

Syntax

RESULT = mesh%IsElementPresent(globalElement, [islocal])

Parameters

ParameterTypeIntentDescription
objCLASS(AbstractMesh_)INThe mesh object
globalElementINTEGER(I4B)INGlobal or local element number to check
islocalLOGICAL(LGT)IN (optional)If true, globalElement is treated as a local element number

Return Value

TypeDescription
LOGICAL(LGT)True if the element is present in the mesh

Description

IsElementPresent determines whether a specified element number exists in the mesh. It returns a logical value indicating whether the element is present.

Implementation Details

The method checks:

  • If the element is being treated as local, it verifies it's within the valid range of local elements
  • If the element is global, it checks if it's within the valid range of global elements and has a valid local mapping

Example Usage

TYPE(Mesh_) :: mesh
INTEGER(I4B) :: elemNum
LOGICAL(LGT) :: isPresent

! Initialize mesh, elemNum...

! Check if an element exists
isPresent = mesh%IsElementPresent(elemNum)

IF (isPresent) THEN
PRINT *, "Element", elemNum, "exists in the mesh"
ELSE
PRINT *, "Element", elemNum, "does not exist in the mesh"
END IF