METIS_MeshToNodal Interface

interface

Called By

interface~~metis_meshtonodal~~CalledByGraph interface~metis_meshtonodal METIS_MeshToNodal proc~fmetis_meshtonodal FMETIS_MeshToNodal proc~fmetis_meshtonodal->interface~metis_meshtonodal
Help

public function METIS_MeshToNodal(ne, nn, eptr, eind, numflag, xadj, adjncy) result(ierr) bind(C,name="METIS_MeshToNodal")

Arguments

Type IntentOptional AttributesName
integer(kind=idx_t), intent(in) :: ne

The number of elements in the mesh.

integer(kind=idx_t), intent(in) :: nn

The number of nodes in the mesh.

integer(kind=idx_t), intent(in), dimension(*):: eptr

The pair of arrays storing the mesh as described in Section 5.6 of the manual.

integer(kind=idx_t), intent(in), dimension(*):: eind

The pair of arrays storing the mesh as described in Section 5.6 of the manual.

integer(kind=idx_t), intent(in) :: numflag

Used to indicate which numbering scheme is used for eptr and eind. The possible values are:
0 - C-style numbering is assumed that starts from 0
1 - Fortran-style numbering is assumed that starts from 1

type(c_ptr), intent(out) :: xadj

These arrays store the adjacency structure of the generated dual graph. The format of the adjacency structure is described in Section 5.5 of the manual.

type(c_ptr), intent(out) :: adjncy

These arrays store the adjacency structure of the generated dual graph. The format of the adjacency structure is described in Section 5.5 of the manual.

Return Value integer(kind=idx_t)

METIS_OK - Indicates that the function returned normally.
METIS_ERROR_INPUT - Indicates an input error.
METIS_ERROR_MEMORY - Indicates that it could not allocate the required memory.
METIS_ERROR - Indicates some other type of error.

Description

This function is used to generate the nodal graph of a mesh.

Example

The code below generates the nodal graph of the following mesh: image

use iso_c_binding, only : c_ptr, c_f_pointer
use metis_interface, only: idx_t, METIS_MeshToNodal, METIS_Free
integer(kind=idx_t), parameter :: ne = 3, nn = 8, npel = 4
integer(kind=idx_t) :: ierr, eptr(ne+1), eind(ne*npel), numflag
type(c_ptr) :: xadj, adjncy
integer(kind=idx_t), dimension(:), pointer :: fxadj => null(), fadjncy => null()

numflag = 0 ! C-style numbering
eptr = [0,4,8,12]
eind = [0,1,2,3,1,4,5,2,4,6,7,5] ! note four nodes per element

ierr = METIS_MeshToNodal(ne,nn,eptr,eind,numflag,xadj,adjncy)
call c_f_pointer(xadj,fxadj,shape=[nn+1]) ! xadj is of the size nn+1
call c_f_pointer(adjncy,fadjncy,shape=[fxadj(nn+1)]) ! last value in xadj is the size of adjncy

 !... use values in fxadj and fadjncy ...

call METIS_Free(xadj)
call METIS_Free(adjncy)
end