| 980 | namespace { |
| 981 | |
| 982 | IntVect |
| 983 | indexFromValue (MultiFab const& mf, int comp, int nghost, Real value, MPI_Op mmloc) |
| 984 | { |
| 985 | IntVect loc = indexFromValue(mf, comp, IntVect{nghost}, value); |
| 986 | |
| 987 | #ifdef BL_USE_MPI |
| 988 | const int NProcs = ParallelContext::NProcsSub(); |
| 989 | if (NProcs > 1) |
| 990 | { |
| 991 | struct { |
| 992 | Real mm; |
| 993 | int rank; |
| 994 | } in, out; |
| 995 | in.mm = value; |
| 996 | in.rank = ParallelContext::MyProcSub(); |
| 997 | MPI_Datatype datatype = (sizeof(Real) == sizeof(double)) |
| 998 | ? MPI_DOUBLE_INT : MPI_FLOAT_INT; |
| 999 | MPI_Comm comm = ParallelContext::CommunicatorSub(); |
| 1000 | MPI_Allreduce(&in, &out, 1, datatype, mmloc, comm); |
| 1001 | MPI_Bcast(&(loc[0]), AMREX_SPACEDIM, MPI_INT, out.rank, comm); |
| 1002 | } |
| 1003 | #else |
| 1004 | amrex::ignore_unused(mmloc); |
| 1005 | #endif |
| 1006 | |
| 1007 | return loc; |
| 1008 | } |
| 1009 | |
| 1010 | } |
| 1011 |
no test coverage detected