write_vtk_mesh Subroutine

subroutine write_vtk_mesh(msh, points, cell_ids, v2cconn, icverts, iproc)

Uses

  • proc~~write_vtk_mesh~~UsesGraph proc~write_vtk_mesh write_vtk_mesh module~class_cell class_cell proc~write_vtk_mesh->module~class_cell module~class_connectivity class_connectivity proc~write_vtk_mesh->module~class_connectivity module~class_psblas class_psblas proc~write_vtk_mesh->module~class_psblas module~class_iterating class_iterating proc~write_vtk_mesh->module~class_iterating module~class_mesh class_mesh proc~write_vtk_mesh->module~class_mesh module~class_vertex class_vertex proc~write_vtk_mesh->module~class_vertex module~class_output class_output proc~write_vtk_mesh->module~class_output module~class_face class_face proc~write_vtk_mesh->module~class_face module~tools_output_basics tools_output_basics proc~write_vtk_mesh->module~tools_output_basics module~class_cell->module~class_psblas module~class_connectivity->module~class_psblas module~class_stopwatch class_stopwatch module~class_psblas->module~class_stopwatch module~tools_psblas tools_psblas module~class_psblas->module~tools_psblas module~class_iterating->module~class_psblas module~class_mesh->module~class_cell module~class_mesh->module~class_connectivity module~class_mesh->module~class_psblas module~class_mesh->module~class_vertex module~class_mesh->module~class_face module~class_keytable class_keytable module~class_mesh->module~class_keytable module~class_vector class_vector module~class_mesh->module~class_vector module~class_surface class_surface module~class_mesh->module~class_surface module~class_least_squares class_least_squares module~class_mesh->module~class_least_squares psb_base_mod psb_base_mod module~class_mesh->psb_base_mod module~grid_interface grid_interface module~class_mesh->module~grid_interface module~class_vertex->module~class_psblas module~class_vertex->module~class_vector module~class_output->module~class_psblas module~class_output->module~class_mesh module~class_vector_field class_vector_field module~class_output->module~class_vector_field module~class_scalar_field class_scalar_field module~class_output->module~class_scalar_field module~class_face->module~class_psblas module~tools_output_basics->module~class_connectivity module~tools_output_basics->psb_base_mod module~class_stopwatch->module~tools_psblas module~class_stopwatch->psb_base_mod module~tools_psblas->psb_base_mod psb_krylov_mod psb_krylov_mod module~tools_psblas->psb_krylov_mod psb_prec_mod psb_prec_mod module~tools_psblas->psb_prec_mod module~class_vector_field->module~class_psblas module~class_vector_field->module~class_mesh module~class_vector_field->module~class_vector module~class_field class_field module~class_vector_field->module~class_field module~class_bc class_bc module~class_vector_field->module~class_bc module~class_dimensions class_dimensions module~class_vector_field->module~class_dimensions module~class_material class_material module~class_vector_field->module~class_material module~class_vector->module~class_psblas module~class_surface->module~class_connectivity module~class_cylinder class_cylinder module~class_surface->module~class_cylinder module~class_plane class_plane module~class_surface->module~class_plane module~class_least_squares->module~class_connectivity module~class_least_squares->module~class_psblas module~class_scalar_field->module~class_psblas module~class_scalar_field->module~class_mesh module~class_scalar_field->module~class_field module~class_scalar_field->module~class_bc module~class_scalar_field->module~class_dimensions module~class_scalar_field->module~class_material module~units_interface units_interface module~grid_interface->module~units_interface module~object_interface object_interface module~grid_interface->module~object_interface module~class_cylinder->module~class_psblas module~class_cylinder->module~class_vertex module~class_cylinder->module~class_vector module~class_field->module~class_psblas module~class_field->module~class_mesh module~class_field->module~grid_interface module~class_field->module~class_bc module~class_field->module~class_dimensions module~class_field->module~class_material module~class_bc->module~class_psblas module~class_motion class_motion module~class_bc->module~class_motion module~class_bc_math class_bc_math module~class_bc->module~class_bc_math module~class_bc_wall class_bc_wall module~class_bc->module~class_bc_wall module~class_dimensions->module~class_psblas module~class_material->module~class_psblas matlib matlib module~class_material->matlib module~units_interface->module~object_interface module~class_plane->module~class_psblas module~class_plane->module~class_vector module~class_motion->module~class_psblas module~class_motion->module~class_vector module~class_bc_math->module~class_psblas module~class_bc_wall->module~class_psblas module~class_bc_wall->module~class_mesh module~class_bc_wall->module~class_vector module~class_bc_wall->module~class_dimensions module~class_bc_wall->module~class_material module~class_bc_wall->module~class_bc_math

! 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)

Arguments

Type IntentOptional AttributesName
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

Calls

proc~~write_vtk_mesh~~CallsGraph proc~write_vtk_mesh write_vtk_mesh psb_gather psb_gather proc~write_vtk_mesh->psb_gather interface~abort_psblas abort_psblas proc~write_vtk_mesh->interface~abort_psblas psb_erractionsave psb_erractionsave proc~write_vtk_mesh->psb_erractionsave interface~icontxt_ icontxt_ proc~write_vtk_mesh->interface~icontxt_ psb_check_error psb_check_error proc~write_vtk_mesh->psb_check_error psb_geall psb_geall proc~write_vtk_mesh->psb_geall proc~wr_vtk_mesh wr_vtk_mesh proc~write_vtk_mesh->proc~wr_vtk_mesh psb_gefree psb_gefree proc~write_vtk_mesh->psb_gefree interface~free_conn free_conn proc~write_vtk_mesh->interface~free_conn interface~mypnum_ mypnum_ proc~write_vtk_mesh->interface~mypnum_ psb_cd_get_global_cols psb_cd_get_global_cols proc~write_vtk_mesh->psb_cd_get_global_cols psb_erractionrestore psb_erractionrestore proc~write_vtk_mesh->psb_erractionrestore proc~abort_psblas abort_psblas interface~abort_psblas->proc~abort_psblas proc~icontxt_ icontxt_ interface~icontxt_->proc~icontxt_ proc~wr_vtk_mesh->interface~abort_psblas proc~free_conn free_conn interface~free_conn->proc~free_conn proc~mypnum_ mypnum_ interface~mypnum_->proc~mypnum_ proc~free_conn->interface~abort_psblas psb_abort psb_abort proc~abort_psblas->psb_abort

Called by

proc~~write_vtk_mesh~~CalledByGraph proc~write_vtk_mesh write_vtk_mesh proc~write_vtk_morfeus write_vtk_morfeus proc~write_vtk_morfeus->proc~write_vtk_mesh interface~write_vtk_morfeus write_vtk_morfeus interface~write_vtk_morfeus->proc~write_vtk_morfeus

Contents

Source Code


Source Code

    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