! CALL l2g_vertex(msh%verts,verts,msh%desc_v)
! CALL l2g_cell(msh%cells,cells,msh%desc_c)
! CALL l2g_conn(msh%v2c,v2c,msh%desc_v,msh%desc_c)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mesh), | intent(in) | :: | msh | |||
real(kind=psb_dpk_), | intent(out), | dimension(:,:), allocatable | :: | points | ||
integer, | intent(out), | dimension(:), allocatable | :: | cell_ids | ||
integer, | intent(out), | dimension(:), allocatable | :: | v2cconn | ||
integer, | intent(out), | dimension(:), allocatable | :: | icverts | ||
integer, | intent(out), | dimension(:), allocatable | :: | iproc |
SUBROUTINE write_vtk_mesh(msh, points, cell_ids, v2cconn, icverts, iproc)
USE class_psblas
USE class_cell
USE class_connectivity
USE class_face
USE class_iterating
USE class_mesh
USE class_output
USE class_vertex
USE tools_output_basics
IMPLICIT NONE
!
TYPE(mesh), INTENT(IN) :: msh
INTEGER, DIMENSION(:), ALLOCATABLE, INTENT(OUT) :: cell_ids
INTEGER, DIMENSION(:), ALLOCATABLE, INTENT(OUT) :: v2cconn
INTEGER, DIMENSION(:), ALLOCATABLE, INTENT(OUT) :: icverts
INTEGER, DIMENSION(:), ALLOCATABLE, INTENT(OUT) :: iproc
REAL(psb_dpk_), DIMENSION(:,:), ALLOCATABLE, INTENT(OUT) :: points
!
INTEGER :: info, err_act
INTEGER :: icontxt, mypnum
INTEGER :: i, ic, ig, ncells, ngc, ngroups
INTEGER, POINTER :: ic2g(:) => NULL()
INTEGER, ALLOCATABLE :: igroup(:)
INTEGER, ALLOCATABLE :: i_loc(:)
TYPE(cell), ALLOCATABLE :: cells(:)
! TYPE(face), ALLOCATABLE :: faces(:)
TYPE(vertex), ALLOCATABLE :: verts(:)
TYPE(connectivity) :: v2c!, f2c, v2f
! Sets error handling for PSBLAS-2 routines
CALL psb_erractionsave(err_act)
mypnum = mypnum_()
icontxt = icontxt_()
! Global number of cells
ncells = psb_cd_get_global_cols(msh%desc_c)
CALL psb_geall(i_loc,msh%desc_c,info)
CALL psb_check_error(info,'write_mesh','psb_geall',icontxt)
ALLOCATE(igroup(ncells),iproc(ncells),stat=info)
IF(info /= 0) THEN
WRITE(*,100)
CALL abort_psblas
END IF
! Gathers MESH components on P0
!!! CALL l2g_vertex(msh%verts,verts,msh%desc_v)
! CALL l2g_face(msh%faces,faces,msh%desc_f,msh%desc_c)
!!! CALL l2g_cell(msh%cells,cells,msh%desc_c)
! CALL l2g_conn(msh%v2f,v2f,msh%desc_v,msh%desc_f)
!!! CALL l2g_conn(msh%v2c,v2c,msh%desc_v,msh%desc_c)
! CALL l2g_conn(msh%f2c,f2c,msh%desc_f,msh%desc_c)
verts = msh%verts
cells = msh%cells
v2c = msh%v2c
! Gathers processor IDs
i_loc(:) = mypnum
CALL psb_gather(iproc,i_loc,msh%desc_c,info,root=0)
CALL psb_check_error(info,'write_mesh','psb_gather',icontxt)
! Gathers group IDs
i_loc(:) = 0
ngroups = msh%c2g%nel_()
DO ig = 1, ngroups
CALL msh%c2g%get_ith_conn(ic2g,ig)
ngc = SIZE(ic2g) ! number of group cells
DO i = 1, ngc
ic = ic2g(i)
i_loc(ic) = ig
END DO
END DO
CALL psb_gather(igroup,i_loc,msh%desc_c,info,root=0)
CALL psb_check_error(info,'write_mesh','psb_gather',icontxt)
CALL wr_vtk_mesh(msh%ncd, verts, cells, v2c, points, cell_ids, v2cconn, icverts)
! Frees Memory
NULLIFY(ic2g)
DEALLOCATE(igroup)
CALL psb_gefree(i_loc,msh%desc_c,info)
CALL psb_check_error(info,'write_mesh','psb_gefree',icontxt)
! CALL free_conn(f2c)
CALL free_conn(v2c)
! CALL free_conn(v2f)
IF(ALLOCATED(cells)) CALL free_cell(cells)
! IF(ALLOCATED(faces)) CALL free_face(faces)
IF(ALLOCATED(verts)) CALL free_vertex(verts)
! ----- Normal termination -----
CALL psb_erractionrestore(err_act)
100 FORMAT(' ERROR! Memory allocation failure in WRITE_MESH')
!200 FORMAT(' ERROR! Unsupported output format in WRITE_MESH')
END SUBROUTINE write_vtk_mesh