tem_prop_countelems Subroutine

public subroutine tem_prop_countelems(me, elempropertybits, comm)

Subroutine to (re-)count the global number of elements the property.

All elements with the given property are counted across all elements and the nElems setting is updated accordingly.

Arguments

Type IntentOptional Attributes Name
type(tem_prophead_type), intent(inout) :: me

Property to count and set the number of elements for.

integer(kind=long_k), intent(in) :: elempropertybits(:)

Propertybits of all elements.

integer, intent(in) :: comm

MPI communicator within which the mesh is distributed.


Source Code

  subroutine tem_prop_countelems(me, elempropertybits, comm)
    ! -------------------------------------------------------------------- !
    !> Property to count and set the number of elements for.
    type(tem_prophead_type), intent(inout) :: me

    !> Propertybits of all elements.
    integer(kind=long_k), intent(in) :: elempropertybits(:)

    !> MPI communicator within which the mesh is distributed.
    integer, intent(in) :: comm
    ! -------------------------------------------------------------------- !
    integer(kind=long_k) :: localElems
    integer :: iError
    ! -------------------------------------------------------------------- !

    localElems = count(btest(elempropertybits, me%BitPos))

    ! MPI_ALLREDUCE(SENDBUF, RECVBUF, COUNT, DATATYPE, OP, COMM, IERROR)
    call MPI_Allreduce( localElems, me%nElems, 1, MPI_INTEGER8, MPI_SUM, &
      &                 comm, iError                                     )

  end subroutine tem_prop_countelems