How to access ghost nodes?
Answer: Following Fortran code illustrates how to see which nodes in the mesh are ghost nodes.
subroutine query_ghosts( mesh ) type( atlas_Mesh ), intent(in) :: mesh type( atlas_mesh_Nodes ) :: nodes type( atlas_Field ) :: field_ghost integer, pointer :: ghost(:) integer :: nb_ghost, ghost_begin, jnode nodes = mesh%nodes() field_ghost = nodes%ghost() call field_ghost%data( ghost ) nb_ghost = 0 ghost_begin = nodes%size() do jnode = 1, nodes%size() if( ghost(jnode) ) then nb_ghost = nb_ghost + 1 ghost_begin = min( ghost_begin, jnode ) endif enddo end subroutine
In early atlas versions, ghost nodes were located in between owned nodes. In later versions the default behaviour is that all ghost nodes are located at the end. This means that using above snippet, all ghost nodes start from "ghost_begin" to "nodes%size()"
We will try to make it easier in subsequent atlas versions.