InitiateFaceConnectivity
This method is inherited from the AbstractMesh class.
InitiateFaceConnectivity
The InitiateFaceConnectivity
method initializes the face connectivity data for elements in an AbstractMesh_
object.
Face connectivity is a critical part of mesh representation that defines how faces are shared between elements.
Interface
INTERFACE
MODULE SUBROUTINE obj_InitiateFaceConnectivity(obj)
CLASS(AbstractMesh_), INTENT(INOUT) :: obj
!! mesh data
END SUBROUTINE obj_InitiateFaceConnectivity
END INTERFACE
Description
This method initializes the face connectivity information for all elements in the mesh. It assigns global face numbers to each face of every element and determines the orientation of each face. The implementation is dimension-dependent:
- For 2D meshes: Establishes connectivity between line segments (edges as faces)
- For 3D meshes: Establishes connectivity between triangular or quadrilateral faces
The method:
- Checks if face connectivity is already initialized
- Creates a binary tree data structure for efficient face lookup
- For each active element in the mesh:
- Gets the face topology information from the reference element
- Allocates memory for global face numbers and face orientation data
- For each face of the element:
- Extracts the global node numbers of the face
- Sorts the nodes to create a unique identifier for the face
- Assigns a global face number
- Determines the orientation of the face
- Sets the
isFaceConnectivityInitiated
flag toTRUE
Implementation Details
2D Case
In 2D, faces are represented by edges (2 nodes). The implementation:
- Extracts the 2 nodes of each edge
- Sorts the nodes to create a canonical representation
- Determines if the edge is reversed compared to the canonical order
- Assigns a global face number
3D Case
In 3D, faces can be triangles or quadrilaterals. The implementation:
- Determines the face type (triangle or quadrilateral)
- Uses specialized methods to obtain the canonical (sorted) representation
- Computes a 3-component orientation vector
- Assigns a global face number
Usage
This method is typically called internally when face connectivity information is needed for mesh operations. It can be used like:
TYPE(YourMeshType_) :: mesh
! Initialize mesh
CALL mesh%InitiateFaceConnectivity()
Notes
- This method sets the
isFaceConnectivityInitiated
flag to prevent duplicate initialization - For 3D meshes, face orientation is represented by a 3-component vector
- For 2D meshes, face orientation is a single value (1 or -1)
- The total number of faces in the mesh (
obj%tFaces
) is updated during processing
Would you like more information about any specific aspect of this method?
Example 1
In this example we show the usage of InitiateFaceConnectivity
method.
!> author: Vikas Sharma, Ph. D.
! date: 2025-06-03
! summary: This example demonstrates the use of the `InitiateFaceConnectivity` method in the `FEMesh_` class to set up face connectivity for a 3D mesh.
PROGRAM main
USE FEMesh_Class
USE HDF5File_Class
USE GlobalData
USE Display_Method
USE ExceptionHandler_Class, only: e
IMPLICIT NONE
TYPE( FEMesh_ ) :: obj
TYPE( HDF5File_ ) :: meshfile
CHARACTER(*), PARAMETER :: filename="./meshdata/small_tri3_mesh.h5"
CHARACTER(*), PARAMETER :: testname="InitiateFaceConnectivity_test_1"
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 `FEMesh_`
CALL obj%Initiate(hdf5=meshfile, dim=2)
!Initiate an edge connectivity
CALL obj%InitiateFaceConnectivity()
!Display the content of mesh.
CALL obj%DisplayMeshInfo(filename)
CALL obj%DisplayElementData("ElementData:")
CALL obj%Deallocate()
CALL meshfile%Deallocate()
CALL Display("End of test: " //testname)
END PROGRAM main
Example 2
In this example we show the usage of InitiateFaceConnectivity
method. We test its accuracy also.
PROGRAM main
USE easifemBase
USE easifemClasses
IMPLICIT NONE
TYPE( Mesh_ ) :: obj
TYPE( HDF5File_ ) :: meshfile
CHARACTER(*), PARAMETER :: filename="./meshdata/small_mesh_3d.h5"
INTEGER(I4B) :: iel, globalFaceCon(4, 4)
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="/volumeEntities_1" )
!Initiate an edge connectivity
CALL obj%InitiateFaceConnectivity()
!Display the content of mesh.
CALL obj%DisplayMeshInfo(filename)
CALL obj%DisplayElementData("ElementData:")
DO iel = 1, obj%GetTotalElements()
CALL ElemData_GetGlobalFaceCon(obj%elementData(iel), globalFaceCon )
END DO
CALL obj%Deallocate()
CALL meshfile%Deallocate()
END PROGRAM main