MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / indexFromValue

Function indexFromValue

Src/Base/AMReX_MultiFab.cpp:982–1008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

980namespace {
981
982IntVect
983indexFromValue (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

Callers 2

minIndexMethod · 0.70
maxIndexMethod · 0.70

Calls 3

NProcsSubFunction · 0.85
MyProcSubFunction · 0.85
CommunicatorSubFunction · 0.85

Tested by

no test coverage detected