build_cell_faces Subroutine

private subroutine build_cell_faces(m)

Builds the cell-to-face mapping by inverting the face owner/neighbor data.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(inout) :: m

Source Code

   subroutine build_cell_faces(m)
      type(mesh_t), intent(inout) :: m

      integer :: f, c

      allocate(m%ncell_faces(m%ncells))
      allocate(m%cell_faces(max_cell_faces, m%ncells))
      m%ncell_faces = 0
      m%cell_faces = 0

      do f = 1, m%nfaces
         c = m%faces(f)%owner
         call append_cell_face(m, c, f)

         c = m%faces(f)%neighbor
         if (c > 0) call append_cell_face(m, c, f)
      end do

      do c = 1, m%ncells
         if (m%ncell_faces(c) /= max_cell_faces) then
            call fatal_error('mesh_io', 'each v1 cuboid cell must have exactly six faces')
         end if
      end do
   end subroutine build_cell_faces