D.4.9 Data_Index Class Unit Test Program

This lightly commented program performs a unit test on the Data_Index Class.

program Unit_Test
  use Caesar_Intrinsics_Module
  use Caesar_Base_Structure_Class
  use Caesar_Data_Index_Class
  use Caesar_Communication_Class
  implicit none

  type(Communication_type) :: Comm
  type(Base_Structure_type) :: Cell_Structure, Node_Structure
  type(Data_Index_type) :: Nodes_of_Cells_Index
  type(integer) :: NDimensions
  type(logical) :: detailed_output

  ! Initializations.

  call Initialize (Comm)
  call Output (Comm)
  detailed_output = NPEs < 16

  ! Loop over 1-D, 2-D and 3-D.

  do NDimensions = 1, 3

    if (this_is_IO_PE) write (6,'(/,a,i1)') 'Number of Dimensions = ', &
                                            NDimensions

    ! Set up the Shell Partition Structures.

    call Initialize_Shell_Partition (NDimensions, Cell_Structure, &
                                     Node_Structure, Nodes_of_Cells_Index, &
                                     detailed_output)

    ! Output Index info.
  
    call Output (Nodes_of_Cells_Index, &
      MAX(1, Length_Total(Cell_Structure)/10), &
      MIN(Length_Total(Cell_Structure), Length_Total(Cell_Structure)/10+50), &
      Output_OPE=detailed_output)
  
    ! Check state of data index.
  
    VERIFY(Valid_State(Nodes_of_Cells_Index),0)
  
    ! Finalize NDimensions-dependent data structures.

    call Finalize (Nodes_of_Cells_Index)
    call Finalize (Node_Structure)
    call Finalize (Cell_Structure)

  end do
  if (this_is_IO_PE) write (6,*)

  ! Finalize communications.

  call Finalize (Comm)

end



Michael L. Hall