The main documentation of the Dump_GMV DV and MV Vector Procedures contains additional explanation of this code listing.
define([DUMP_GMV_VARIABLE_ROUTINE],[
subroutine Dump_GMV_$1_Vector (Variable, Mesh, unit, status)
! Input variables.
type($1_Vector_type), intent(in) :: Variable ! Variable to be output.
type(Multi_Mesh_type), intent(in) :: Mesh ! Mesh to be output.
type(integer), intent(in) :: unit ! GMV output unit.
! Output variable.
type(Status_type), intent(out), optional :: status ! Exit status.
! Internal variables.
type(integer) :: GMV_Locus_Number ! GMV Locus: 0-Cells, 1-Nodes, 2-Faces.
type(integer) :: location ! Location of the space character.
type(character,name_length) :: Variable_Name ! Name of the GMV variable.
type(real,1) :: Variable_PE ! BNV of the variable on each PE.
type(real,1) :: Variable_Total ! BNV of the total variable on the IO_PE.
type(Status_type) :: consolidated_status ! Consolidated Status.
type(Status_type), dimension(4) :: dump_status ! Status vector.
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Verify requirements.
VERIFY(Valid_State(Mesh),5) ! Mesh is valid.
VERIFY(Valid_State(Variable),5) ! Variable is valid.
! Allocations and initializations.
call Initialize (dump_status)
call Initialize (consolidated_status)
! Get Variable Name and process to replace spaces with underscores.
Variable_Name = Name(Variable)
location = SCAN(TRIM(Variable_Name), " ")
do while (location /= 0)
Variable_Name(location:location) = "_"
location = SCAN(TRIM(Variable_Name), " ")
end do
! Toggle on Variable Locus to initialize temporaries.
select case (Locus(Variable))
case ("Cells")
GMV_Locus_Number = 0
call Initialize (Variable_PE, NCells_PE(Mesh), dump_status(1))
call Initialize (Variable_Total, NCells_Total(Mesh), dump_status(2))
case ("Nodes")
GMV_Locus_Number = 1
call Initialize (Variable_PE, NNodes_PE(Mesh), dump_status(1))
call Initialize (Variable_Total, NNodes_Total(Mesh), dump_status(2))
case ("Faces")
GMV_Locus_Number = 2
call Initialize (Variable_PE, NFaces_PE(Mesh), dump_status(1))
call Initialize (Variable_Total, NFaces_Total(Mesh), dump_status(2))
VERIFY(.false.,1) ! Face-based variables cannot be output to GMV until
! the mesh is defined by faces instead of cells.
case default
VERIFY(.false.,1) ! GMV variable output is only available for
! mesh-based variables with a Locus of Cells,
! Nodes or Faces.
end select
! Move data to the IO_PE and output.
Variable_PE = Variable
call Assemble (Variable_Total, Variable_PE)
if (this_is_IO_PE) then
! GMV limit is 32 characters.
write (unit,100) TRIM(Variable_Name(:32)), GMV_Locus_Number
write (unit,101) Variable_Total
end if
! Clean up temporary vectors.
call Finalize (Variable_PE, dump_status(3))
call Finalize (Variable_Total, dump_status(4))
! Consolidate and handle status.
consolidated_status = dump_status
if (PRESENT(status)) then
WARN_IF(Error(consolidated_status), 5)
status = consolidated_status
else
VERIFY(Normal(consolidated_status), 5)
end if
call Finalize (consolidated_status)
call Finalize (dump_status)
! Format statements.
100 format (a,5(:,i11))
101 format ((1pg15.8,4(:,1pg16.8)))
! Verify guarantees - none.
return
end subroutine Dump_GMV_$1_Vector
])
fortext([Type], [Mathematic Distributed],[
DUMP_GMV_VARIABLE_ROUTINE(Type)
])