I.1.13 Get_Coordinates_Cells_Multi_Mesh Procedure

The main documentation of the Get_Coordinates_Cells_Multi_Mesh Procedure contains additional explanation of this code listing.

  subroutine Get_Coordinates_Cells_MMesh (Coordinates_Cells, Mesh)

    ! Input variable.

    type(Multi_Mesh_type), intent(inout) :: Mesh   ! Mesh object.

    ! Input/Output variable.

    type(real,2) :: Coordinates_Cells ! Coordinates_Cells BNV.

    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ! Verify requirements.
  
    VERIFY(Valid_State(Mesh),5)                       ! Mesh is valid.
    ! Coordinates_Cells is valid.
    VERIFY(Valid_State(Coordinates_Cells),5)  
    ! Coordinates_Cells has correct dimensions.
    VERIFY(SIZE(Coordinates_Cells,1) == Mesh%NDimensions,5)
    VERIFY(SIZE(Coordinates_Cells,2) == Mesh%NCells_PE,5)

    ! Initializations.

    if (.not.Initialized(Mesh%Coordinates_Cells_DV)) then
      call Initialize (Mesh%Coordinates_Cells_DV, Mesh%Cell_Structure, 2, &
                       dim1=Mesh%NDimensions)
    end if
    if (.not.Initialized(Mesh%Coordinates_Nodes_of_Cells_CA)) then
      call Initialize (Mesh%Coordinates_Nodes_of_Cells_CA, &
                       Mesh%Nodes_of_Cells_Index, 2, &
                       dim1=Mesh%NDimensions)
    end if

    ! Gather node coordinates to cells.

    Mesh%Coordinates_Nodes_of_Cells_CA = Mesh%Coordinates_Nodes_DV

    ! Calculate cell center coordinates (= average of the node coordinates).

    call Combine_with_Average (Mesh%Coordinates_Cells_DV, &
                               Mesh%Coordinates_Nodes_of_Cells_CA)
    Coordinates_Cells = Mesh%Coordinates_Cells_DV
  
    ! Verify guarantees.

    VERIFY(Valid_State(Mesh),5)                ! Mesh is valid.
    ! Coordinates_Cells is valid.
    VERIFY(Valid_State(Coordinates_Cells),5) 
  
    return
  end subroutine Get_Coordinates_Cells_MMesh



Michael L. Hall