public static MPI_Op GetPredefinedOperation()

in MPI/Operation.cs [491:538]


        public static MPI_Op GetPredefinedOperation(ReductionOperation<T> op)
        {
            // Predefined reduction operations with no representation in C#
            //   MPI_LXOR: There is no equivalent operator in C# or C++
            //   MPI_MAXLOC: We don't permit the data type used in reduction to differ
            //               from the type used in reduction.
            //   MPI_MINLOC: We don't permit the data type used in reduction to differ
            //               from the type used in reduction.

            // Min/max
            if (Kind == DatatypeKind.CInteger
                || Kind == DatatypeKind.FortranInteger
                || Kind == DatatypeKind.FloatingPoint)
            {
                if (op == min) return Unsafe.MPI_MIN;
                if (op == max) return Unsafe.MPI_MAX;
            }

            // Product/sum
            if (Kind == DatatypeKind.CInteger
                || Kind == DatatypeKind.FortranInteger
                || Kind == DatatypeKind.FloatingPoint
                || Kind == DatatypeKind.Complex)
            {
                if (op == add) return Unsafe.MPI_SUM;
                if (op == multiply) return Unsafe.MPI_PROD;
            }

            // Logical and/or/xor
            if (Kind == DatatypeKind.CInteger
                || Kind == DatatypeKind.Logical)
            {
                if (op == logicalAnd) return Unsafe.MPI_LAND;
                if (op == logicalOr) return Unsafe.MPI_LOR;
            }

            // Bitwise and/or/xor
            if (Kind == DatatypeKind.CInteger
                || Kind == DatatypeKind.FortranInteger
                || Kind == DatatypeKind.Byte)
            {
                if (op == bitwiseAnd) return Unsafe.MPI_BAND;
                if (op == bitwiseOr) return Unsafe.MPI_BOR;
                if (op == exclusiveOr) return Unsafe.MPI_BXOR;
            }

            return Unsafe.MPI_OP_NULL;
        }