The main documentation of the Get_Coordinates_Faces_of_Cells_Multi_Mesh Procedure contains additional explanation of this code listing.
subroutine Get_Coordinates_FoC_MMesh (Coordinates_Faces_of_Cells, Mesh)
! Input variable.
type(Multi_Mesh_type), intent(inout) :: Mesh ! Mesh object.
! Input/Output variable.
! Coordinates_Faces_of_Cells BNV.
type(real,3) :: Coordinates_Faces_of_Cells
! Internal variables.
! BNV of coordinates of nodes of cells.
type(real,3) :: Coordinates_Nodes_of_Cells
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Verify requirements.
VERIFY(Valid_State(Mesh),5) ! Mesh is valid.
! Coordinates_Faces_of_Cells is valid.
VERIFY(Valid_State(Coordinates_Faces_of_Cells),5)
! Coordinates_Faces_of_Cells has correct dimensions.
VERIFY(SIZE(Coordinates_Faces_of_Cells,1) == Mesh%NDimensions,5)
VERIFY(SIZE(Coordinates_Faces_of_Cells,2) == Mesh%NCells_PE,5)
! Following is not true for polys.
VERIFY(SIZE(Coordinates_Faces_of_Cells,3) == Mesh%Faces_per_Cell,5)
! Get Coordinates of the Nodes.
call Initialize (Coordinates_Nodes_of_Cells, Mesh%NDimensions, &
Mesh%NCells_PE, Mesh%Nodes_per_Cell)
call Get_Coordinates_Nodes_of_Cells (Coordinates_Nodes_of_Cells, Mesh)
! Set the coordinates for each face.
! Note: probably should generalize this to an
! Average_Nodes_to_Faces procedure later.
Coordinates_Faces_of_Cells = zero
if (Mesh%Shape == "Segmented") then
Coordinates_Faces_of_Cells(:,:,:) = Coordinates_Nodes_of_Cells(:,:,:)
else if (Mesh%Shape == "Quadrilateral") then
Coordinates_Faces_of_Cells(:,:,1) = &
half*(Coordinates_Nodes_of_Cells(:,:,1) + &
Coordinates_Nodes_of_Cells(:,:,3))
Coordinates_Faces_of_Cells(:,:,2) = &
half*(Coordinates_Nodes_of_Cells(:,:,2) + &
Coordinates_Nodes_of_Cells(:,:,4))
Coordinates_Faces_of_Cells(:,:,3) = &
half*(Coordinates_Nodes_of_Cells(:,:,1) + &
Coordinates_Nodes_of_Cells(:,:,2))
Coordinates_Faces_of_Cells(:,:,4) = &
half*(Coordinates_Nodes_of_Cells(:,:,3) + &
Coordinates_Nodes_of_Cells(:,:,4))
else if (Mesh%Shape == "Hexahedral") then
Coordinates_Faces_of_Cells(:,:,1) = &
fourth*(Coordinates_Nodes_of_Cells(:,:,1) + &
Coordinates_Nodes_of_Cells(:,:,3) + &
Coordinates_Nodes_of_Cells(:,:,5) + &
Coordinates_Nodes_of_Cells(:,:,7))
Coordinates_Faces_of_Cells(:,:,2) = &
fourth*(Coordinates_Nodes_of_Cells(:,:,2) + &
Coordinates_Nodes_of_Cells(:,:,4) + &
Coordinates_Nodes_of_Cells(:,:,6) + &
Coordinates_Nodes_of_Cells(:,:,8))
Coordinates_Faces_of_Cells(:,:,3) = &
fourth*(Coordinates_Nodes_of_Cells(:,:,1) + &
Coordinates_Nodes_of_Cells(:,:,2) + &
Coordinates_Nodes_of_Cells(:,:,5) + &
Coordinates_Nodes_of_Cells(:,:,6))
Coordinates_Faces_of_Cells(:,:,4) = &
fourth*(Coordinates_Nodes_of_Cells(:,:,3) + &
Coordinates_Nodes_of_Cells(:,:,4) + &
Coordinates_Nodes_of_Cells(:,:,7) + &
Coordinates_Nodes_of_Cells(:,:,8))
Coordinates_Faces_of_Cells(:,:,5) = &
fourth*(Coordinates_Nodes_of_Cells(:,:,1) + &
Coordinates_Nodes_of_Cells(:,:,2) + &
Coordinates_Nodes_of_Cells(:,:,3) + &
Coordinates_Nodes_of_Cells(:,:,4))
Coordinates_Faces_of_Cells(:,:,6) = &
fourth*(Coordinates_Nodes_of_Cells(:,:,5) + &
Coordinates_Nodes_of_Cells(:,:,6) + &
Coordinates_Nodes_of_Cells(:,:,7) + &
Coordinates_Nodes_of_Cells(:,:,8))
else
! Coding for other mesh types not implemented yet.
VERIFY(.false.,1)
end if
! Finalize temporaries.
call Finalize (Coordinates_Nodes_of_Cells)
! Verify guarantees.
VERIFY(Valid_State(Mesh),5) ! Mesh is valid.
! Coordinates_Faces_of_Cells is valid.
VERIFY(Valid_State(Coordinates_Faces_of_Cells),5)
return
end subroutine Get_Coordinates_FoC_MMesh