import_mesh Subroutine

subroutine import_mesh(msh, mesh_file)

Uses

  • proc~~import_mesh~~UsesGraph proc~import_mesh import_mesh module~tools_mesh tools_mesh proc~import_mesh->module~tools_mesh module~class_psblas class_psblas module~tools_mesh->module~class_psblas module~class_connectivity class_connectivity module~tools_mesh->module~class_connectivity module~class_stopwatch class_stopwatch module~class_psblas->module~class_stopwatch module~tools_psblas tools_psblas module~class_psblas->module~tools_psblas module~class_connectivity->module~class_psblas module~class_stopwatch->module~tools_psblas psb_base_mod psb_base_mod module~class_stopwatch->psb_base_mod psb_prec_mod psb_prec_mod module~tools_psblas->psb_prec_mod module~tools_psblas->psb_base_mod psb_krylov_mod psb_krylov_mod module~tools_psblas->psb_krylov_mod

Arguments

Type IntentOptional AttributesName
type(mesh), intent(inout) :: msh
character(len=*), intent(inout) :: mesh_file

Calls

proc~~import_mesh~~CallsGraph proc~import_mesh import_mesh interface~rd_gambit_mesh rd_gambit_mesh proc~import_mesh->interface~rd_gambit_mesh interface~abort_psblas abort_psblas proc~import_mesh->interface~abort_psblas interface~icontxt_ icontxt_ proc~import_mesh->interface~icontxt_ psb_bcast psb_bcast proc~import_mesh->psb_bcast interface~mypnum_ mypnum_ proc~import_mesh->interface~mypnum_ interface~rd_gmsh_mesh rd_gmsh_mesh proc~import_mesh->interface~rd_gmsh_mesh proc~rd_gambit_mesh rd_gambit_mesh interface~rd_gambit_mesh->proc~rd_gambit_mesh proc~abort_psblas abort_psblas interface~abort_psblas->proc~abort_psblas proc~icontxt_ icontxt_ interface~icontxt_->proc~icontxt_ proc~mypnum_ mypnum_ interface~mypnum_->proc~mypnum_ proc~rd_gmsh_mesh rd_gmsh_mesh interface~rd_gmsh_mesh->proc~rd_gmsh_mesh proc~rd_gmsh_mesh->interface~abort_psblas interface~alloc_face alloc_face proc~rd_gmsh_mesh->interface~alloc_face 6 6 proc~rd_gmsh_mesh->6 interface~alloc_vertex alloc_vertex proc~rd_gmsh_mesh->interface~alloc_vertex interface~alloc_cell alloc_cell proc~rd_gmsh_mesh->interface~alloc_cell interface~vertex_ vertex_ proc~rd_gmsh_mesh->interface~vertex_ interface~cell_ cell_ proc~rd_gmsh_mesh->interface~cell_ interface~face_ face_ proc~rd_gmsh_mesh->interface~face_ 8 8 proc~rd_gmsh_mesh->8 psb_abort psb_abort proc~abort_psblas->psb_abort proc~rd_gambit_mesh->interface~abort_psblas proc~rd_gambit_mesh->interface~alloc_face proc~rd_gambit_mesh->6 proc~rd_gambit_mesh->interface~alloc_vertex proc~rd_gambit_mesh->interface~alloc_cell proc~rd_gambit_mesh->interface~vertex_ proc~rd_gambit_mesh->interface~cell_ proc~rd_gambit_mesh->interface~face_ proc~rd_gambit_mesh->8 3 3 proc~rd_gambit_mesh->3 proc~alloc_face alloc_face interface~alloc_face->proc~alloc_face proc~alloc_vertex alloc_vertex interface~alloc_vertex->proc~alloc_vertex proc~alloc_cell alloc_cell interface~alloc_cell->proc~alloc_cell proc~cell_ cell_ interface~cell_->proc~cell_ proc~face_ face_ interface~face_->proc~face_ proc~alloc_face->interface~abort_psblas proc~alloc_cell->interface~abort_psblas proc~alloc_vertex->interface~abort_psblas interface~vector_ vector_ proc~alloc_vertex->interface~vector_ proc~vector_ vector_ interface~vector_->proc~vector_

Called by

proc~~import_mesh~~CalledByGraph proc~import_mesh import_mesh proc~create_mesh create_mesh proc~create_mesh->proc~import_mesh interface~create_mesh create_mesh interface~create_mesh->proc~create_mesh

Contents

Source Code


Source Code

    SUBROUTINE import_mesh(msh,mesh_file)
        USE tools_mesh
        IMPLICIT NONE
        !
        TYPE(mesh), INTENT(INOUT) :: msh
        CHARACTER(len=*), INTENT(INOUT) :: mesh_file
        !
        INTEGER :: i, intbuf(2)
        INTEGER :: icontxt, mypnum
        CHARACTER(len=4) :: fmt


        icontxt = icontxt_()
        mypnum  = mypnum_()

        CALL sw_msh%tic()

        ! Reads the mesh object on P0...
        IF(mypnum == 0) THEN

            ! Sets mesh format
            mesh_file = ADJUSTR(mesh_file)
            i = SCAN(mesh_file,'.',back=.TRUE.)
            IF(i == 0) THEN
                WRITE(*,100)
                WRITE(*,'(a24,a80)')'Expected to find file: ',mesh_file
                CALL abort_psblas
            END IF
            i = i + 1
            fmt = mesh_file(i:LEN(mesh_file))

            SELECT CASE (fmt)
            CASE('cgns')
#ifdef HAVE_CGNS
                CALL rd_cgns_mesh(mesh_file, msh%id, msh%nbc, msh%ncd, &
                    & msh%verts, msh%faces, msh%cells, &
                    & msh%v2f, msh%v2c, msh%f2c, msh%c2g)
#else
                ERROR STOP "MORFEUS built without CNGS support! Unable to continue."
#endif
            CASE('e')
#ifdef HAVE_EXODUS
                CALL rd_exodus_mesh(mesh_file, msh%id, msh%nbc, msh%ncd, &
                    & msh%verts, msh%faces, msh%cells, &
                    & msh%v2f, msh%v2c, msh%f2c, msh%c2g)
#else
                ERROR STOP "MORFEUS built without exodus support! Unable to continue."
#endif
            CASE('msh')
                CALL rd_gmsh_mesh(mesh_file, msh%id, msh%nbc, msh%ncd, &
                    & msh%verts, msh%faces, msh%cells, &
                    & msh%v2f, msh%v2c, msh%f2c, msh%c2g)
            CASE('neu')
                CALL rd_gambit_mesh(mesh_file, msh%id, msh%nbc, msh%ncd, &
                    & msh%verts, msh%faces, msh%cells, &
                    & msh%v2f, msh%v2c, msh%f2c, msh%c2g)
            CASE DEFAULT
                WRITE(*,200)
                CALL abort_psblas
            END SELECT

        END IF

        ! ... then bcast msh%(id,nbc,ncd)
        IF(mypnum == 0) THEN

            CALL psb_bcast(icontxt,msh%id)

            intbuf(1) = msh%nbc
            intbuf(2) = msh%ncd
            CALL psb_bcast(icontxt,intbuf)
        ELSE
            CALL psb_bcast(icontxt,msh%id)

            CALL psb_bcast(icontxt,intbuf)
            msh%nbc = intbuf(1)
            msh%ncd = intbuf(2)
        END IF

        CALL sw_msh%toc()

100     FORMAT('ERROR! Unsupported mesh filename in IMPORT_MESH')
200     FORMAT('ERROR! Unsupported mesh format in IMPORT_MESH')

    END SUBROUTINE import_mesh