move enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; to Comm class

This commit is contained in:
Axel Kohlmeyer 2018-05-10 00:43:13 -04:00
parent 3682bc47c2
commit 71e1867dd2
16 changed files with 35 additions and 61 deletions

View File

@ -39,7 +39,6 @@ using namespace MathConst;
enum{ATOM,MOLECULE};
enum{ONE,RANGE,POLY};
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
#define EPSILON 0.001
#define SMALL 1.0e-10
@ -609,7 +608,7 @@ void FixPour::pre_exchange()
newcoord[1] >= sublo[1] && newcoord[1] < subhi[1] &&
newcoord[2] >= sublo[2] && newcoord[2] < subhi[2]) flag = 1;
else if (dimension == 3 && newcoord[2] >= domain->boxhi[2]) {
if (comm->layout != LAYOUT_TILED) {
if (comm->layout != Comm::LAYOUT_TILED) {
if (comm->myloc[2] == comm->procgrid[2]-1 &&
newcoord[0] >= sublo[0] && newcoord[0] < subhi[0] &&
newcoord[1] >= sublo[1] && newcoord[1] < subhi[1]) flag = 1;
@ -619,7 +618,7 @@ void FixPour::pre_exchange()
newcoord[1] >= sublo[1] && newcoord[1] < subhi[1]) flag = 1;
}
} else if (dimension == 2 && newcoord[1] >= domain->boxhi[1]) {
if (comm->layout != LAYOUT_TILED) {
if (comm->layout != Comm::LAYOUT_TILED) {
if (comm->myloc[1] == comm->procgrid[1]-1 &&
newcoord[0] >= sublo[0] && newcoord[0] < subhi[0]) flag = 1;
} else {

View File

@ -39,8 +39,6 @@ using namespace LAMMPS_NS;
#define DELTA_PROCS 16
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
/* ---------------------------------------------------------------------- */
CommTiledKokkos::CommTiledKokkos(LAMMPS *lmp) : CommTiled(lmp)

View File

@ -37,7 +37,6 @@ using namespace FixConst;
using namespace MathConst;
enum{ATOM,MOLECULE};
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
enum{DIST_UNIFORM,DIST_GAUSSIAN};
#define EPSILON 1.0e6
@ -506,7 +505,7 @@ void FixDeposit::pre_exchange()
newcoord[1] >= sublo[1] && newcoord[1] < subhi[1] &&
newcoord[2] >= sublo[2] && newcoord[2] < subhi[2]) flag = 1;
else if (dimension == 3 && newcoord[2] >= domain->boxhi[2]) {
if (comm->layout != LAYOUT_TILED) {
if (comm->layout != Comm::LAYOUT_TILED) {
if (comm->myloc[2] == comm->procgrid[2]-1 &&
newcoord[0] >= sublo[0] && newcoord[0] < subhi[0] &&
newcoord[1] >= sublo[1] && newcoord[1] < subhi[1]) flag = 1;
@ -516,7 +515,7 @@ void FixDeposit::pre_exchange()
newcoord[1] >= sublo[1] && newcoord[1] < subhi[1]) flag = 1;
}
} else if (dimension == 2 && newcoord[1] >= domain->boxhi[1]) {
if (comm->layout != LAYOUT_TILED) {
if (comm->layout != Comm::LAYOUT_TILED) {
if (comm->myloc[1] == comm->procgrid[1]-1 &&
newcoord[0] >= sublo[0] && newcoord[0] < subhi[0]) flag = 1;
} else {

View File

@ -29,8 +29,6 @@
using namespace LAMMPS_NS;
using namespace FixConst;
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
#define BIG 1.0e30
#define EPSILON 1.0e-6
@ -417,7 +415,7 @@ void FixAppendAtoms::pre_exchange()
if (spatflag==1) if (get_spatial()==0) return;
int addflag = 0;
if (comm->layout != LAYOUT_TILED) {
if (comm->layout != Comm::LAYOUT_TILED) {
if (comm->myloc[2] == comm->procgrid[2]-1) addflag = 1;
} else {
if (comm->mysplit[2][1] == 1.0) addflag = 1;

View File

@ -40,10 +40,6 @@ using namespace Eigen;
using namespace std;
#define DELTA 16384
#define EPSILON 1.0e-6
enum {
LAYOUT_UNIFORM, LAYOUT_NONUNIFORM, LAYOUT_TILED
};
// several files
/* ---------------------------------------------------------------------- */
@ -151,7 +147,7 @@ void FixSMDWallSurface::setup(int vflag) {
subhi[2] = domain->subhi_lamda[2];
}
if (comm->layout != LAYOUT_TILED) {
if (comm->layout != Comm::LAYOUT_TILED) {
if (domain->xperiodic) {
if (comm->myloc[0] == 0)
sublo[0] -= epsilon[0];

View File

@ -51,8 +51,6 @@ using namespace MathConst;
#define DELTA_MEMSTR 1024
#define EPSILON 1.0e-6
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
/* ---------------------------------------------------------------------- */
Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
@ -866,7 +864,7 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
sublo[2] = domain->sublo_lamda[2]; subhi[2] = domain->subhi_lamda[2];
}
if (comm->layout != LAYOUT_TILED) {
if (comm->layout != Comm::LAYOUT_TILED) {
if (domain->xperiodic) {
if (comm->myloc[0] == 0) sublo[0] -= epsilon[0];
if (comm->myloc[0] == comm->procgrid[0]-1) subhi[0] += epsilon[0];

View File

@ -48,8 +48,6 @@ using namespace LAMMPS_NS;
enum{XYZ,SHIFT,BISECTION};
enum{NONE,UNIFORM,USER};
enum{X,Y,Z};
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
/* ---------------------------------------------------------------------- */
Balance::Balance(LAMMPS *lmp) : Pointers(lmp)
@ -281,7 +279,7 @@ void Balance::command(int narg, char **arg)
// no load-balance if imbalance doesn't exceed threshold
// unless switching from tiled to non tiled layout, then force rebalance
if (comm->layout == LAYOUT_TILED && style != BISECTION) {
if (comm->layout == Comm::LAYOUT_TILED && style != BISECTION) {
} else if (imbinit < thresh) return;
// debug output of initial state
@ -296,16 +294,16 @@ void Balance::command(int narg, char **arg)
// style XYZ = explicit setting of cutting planes of logical 3d grid
if (style == XYZ) {
if (comm->layout == LAYOUT_UNIFORM) {
if (comm->layout == Comm::LAYOUT_UNIFORM) {
if (xflag == USER || yflag == USER || zflag == USER)
comm->layout = LAYOUT_NONUNIFORM;
} else if (comm->layout == LAYOUT_NONUNIFORM) {
comm->layout = Comm::LAYOUT_NONUNIFORM;
} else if (comm->layout == Comm::LAYOUT_NONUNIFORM) {
if (xflag == UNIFORM && yflag == UNIFORM && zflag == UNIFORM)
comm->layout = LAYOUT_UNIFORM;
} else if (comm->layout == LAYOUT_TILED) {
comm->layout = Comm::LAYOUT_UNIFORM;
} else if (comm->layout == Comm::LAYOUT_TILED) {
if (xflag == UNIFORM && yflag == UNIFORM && zflag == UNIFORM)
comm->layout = LAYOUT_UNIFORM;
else comm->layout = LAYOUT_NONUNIFORM;
comm->layout = Comm::LAYOUT_UNIFORM;
else comm->layout = Comm::LAYOUT_NONUNIFORM;
}
if (xflag == UNIFORM) {
@ -333,7 +331,7 @@ void Balance::command(int narg, char **arg)
// style SHIFT = adjust cutting planes of logical 3d grid
if (style == SHIFT) {
comm->layout = LAYOUT_NONUNIFORM;
comm->layout = Comm::LAYOUT_NONUNIFORM;
shift_setup_static(bstr);
niter = shift();
}
@ -341,7 +339,7 @@ void Balance::command(int narg, char **arg)
// style BISECTION = recursive coordinate bisectioning
if (style == BISECTION) {
comm->layout = LAYOUT_TILED;
comm->layout = Comm::LAYOUT_TILED;
bisection(1);
}
@ -745,7 +743,7 @@ void Balance::shift_setup_static(char *str)
// if current layout is TILED, set initial uniform splits in Comm
// this gives starting point to subsequent shift balancing
if (comm->layout == LAYOUT_TILED) {
if (comm->layout == Comm::LAYOUT_TILED) {
int *procgrid = comm->procgrid;
double *xsplit = comm->xsplit;
double *ysplit = comm->ysplit;

View File

@ -42,7 +42,6 @@ using namespace LAMMPS_NS;
enum{ONELEVEL,TWOLEVEL,NUMA,CUSTOM};
enum{CART,CARTREORDER,XYZ};
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
/* ---------------------------------------------------------------------- */
@ -605,7 +604,7 @@ int Comm::coord2proc(double *x, int &igx, int &igy, int &igz)
triclinic = domain->triclinic;
if (layout == LAYOUT_UNIFORM) {
if (layout == Comm::LAYOUT_UNIFORM) {
if (triclinic == 0) {
igx = static_cast<int> (procgrid[0] * (x[0]-boxlo[0]) / prd[0]);
igy = static_cast<int> (procgrid[1] * (x[1]-boxlo[1]) / prd[1]);
@ -616,7 +615,7 @@ int Comm::coord2proc(double *x, int &igx, int &igy, int &igz)
igz = static_cast<int> (procgrid[2] * x[2]);
}
} else if (layout == LAYOUT_NONUNIFORM) {
} else if (layout == Comm::LAYOUT_NONUNIFORM) {
if (triclinic == 0) {
igx = binary((x[0]-boxlo[0])/prd[0],procgrid[0],xsplit);
igy = binary((x[1]-boxlo[1])/prd[1],procgrid[1],ysplit);

View File

@ -24,6 +24,7 @@ class Comm : protected Pointers {
int layout; // LAYOUT_UNIFORM = equal-sized bricks
// LAYOUT_NONUNIFORM = logical bricks, but diff sizes via LB
// LAYOUT_TILED = general tiling, due to RCB LB
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED};
int mode; // 0 = single cutoff, 1 = multi-type cutoff
enum{SINGLE,MULTI};

View File

@ -46,8 +46,6 @@ using namespace LAMMPS_NS;
#define BUFEXTRA 1000
#define BIG 1.0e20
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
/* ---------------------------------------------------------------------- */
CommBrick::CommBrick(LAMMPS *lmp) :
@ -60,7 +58,7 @@ CommBrick::CommBrick(LAMMPS *lmp) :
sendlist(NULL), maxsendlist(NULL), buf_send(NULL), buf_recv(NULL)
{
style = 0;
layout = LAYOUT_UNIFORM;
layout = Comm::LAYOUT_UNIFORM;
pbc_flag = NULL;
init_buffers();
}
@ -92,7 +90,7 @@ CommBrick::~CommBrick()
CommBrick::CommBrick(LAMMPS *lmp, Comm *oldcomm) : Comm(*oldcomm)
{
if (oldcomm->layout == LAYOUT_TILED)
if (oldcomm->layout == Comm::LAYOUT_TILED)
error->all(FLERR,"Cannot change to comm_style brick from tiled layout");
style = 0;
@ -239,7 +237,7 @@ void CommBrick::setup()
int *periodicity = domain->periodicity;
int left,right;
if (layout == LAYOUT_UNIFORM) {
if (layout == Comm::LAYOUT_UNIFORM) {
maxneed[0] = static_cast<int> (cutghost[0] * procgrid[0] / prd[0]) + 1;
maxneed[1] = static_cast<int> (cutghost[1] * procgrid[1] / prd[1]) + 1;
maxneed[2] = static_cast<int> (cutghost[2] * procgrid[2] / prd[2]) + 1;

View File

@ -38,14 +38,12 @@ using namespace LAMMPS_NS;
#define DELTA_PROCS 16
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
/* ---------------------------------------------------------------------- */
CommTiled::CommTiled(LAMMPS *lmp) : Comm(lmp)
{
style = 1;
layout = LAYOUT_UNIFORM;
layout = Comm::LAYOUT_UNIFORM;
pbc_flag = NULL;
init_buffers();
}
@ -140,7 +138,7 @@ void CommTiled::setup()
// set function pointers
if (layout != LAYOUT_TILED) {
if (layout != Comm::LAYOUT_TILED) {
box_drop = &CommTiled::box_drop_brick;
box_other = &CommTiled::box_other_brick;
box_touch = &CommTiled::box_touch_brick;
@ -154,7 +152,7 @@ void CommTiled::setup()
// if RCB decomp exists and just changed, gather needed global RCB info
if (layout == LAYOUT_TILED) coord2proc_setup();
if (layout == Comm::LAYOUT_TILED) coord2proc_setup();
// set cutoff for comm forward and comm reverse
// check that cutoff < any periodic box length
@ -1806,7 +1804,7 @@ void CommTiled::coord2proc_setup()
int CommTiled::coord2proc(double *x, int &igx, int &igy, int &igz)
{
if (layout != LAYOUT_TILED) return Comm::coord2proc(x,igx,igy,igz);
if (layout != Comm::LAYOUT_TILED) return Comm::coord2proc(x,igx,igy,igz);
return point_drop_tiled_recurse(x,0,nprocs-1);
}

View File

@ -44,7 +44,6 @@ using namespace MathConst;
enum{BOX,REGION,SINGLE,RANDOM};
enum{ATOM,MOLECULE};
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
/* ---------------------------------------------------------------------- */
@ -314,7 +313,7 @@ void CreateAtoms::command(int narg, char **arg)
}
if (style == BOX || style == REGION) {
if (comm->layout != LAYOUT_TILED) {
if (comm->layout != Comm::LAYOUT_TILED) {
if (domain->xperiodic) {
if (comm->myloc[0] == 0) sublo[0] -= epsilon[0];
if (comm->myloc[0] == comm->procgrid[0]-1) subhi[0] -= 2.0*epsilon[0];

View File

@ -44,8 +44,6 @@
using namespace LAMMPS_NS;
using namespace MathConst;
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
#define BIG 1.0e20
#define SMALL 1.0e-4
#define DELTAREGION 4
@ -274,7 +272,7 @@ void Domain::set_global_box()
void Domain::set_lamda_box()
{
if (comm->layout != LAYOUT_TILED) {
if (comm->layout != Comm::LAYOUT_TILED) {
int *myloc = comm->myloc;
double *xsplit = comm->xsplit;
double *ysplit = comm->ysplit;
@ -311,7 +309,7 @@ void Domain::set_local_box()
{
if (triclinic) return;
if (comm->layout != LAYOUT_TILED) {
if (comm->layout != Comm::LAYOUT_TILED) {
int *myloc = comm->myloc;
int *procgrid = comm->procgrid;
double *xsplit = comm->xsplit;

View File

@ -33,7 +33,6 @@ using namespace LAMMPS_NS;
using namespace FixConst;
enum{SHIFT,BISECTION};
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
/* ---------------------------------------------------------------------- */
@ -264,10 +263,10 @@ void FixBalance::rebalance()
int *sendproc;
if (lbstyle == SHIFT) {
itercount = balance->shift();
comm->layout = LAYOUT_NONUNIFORM;
comm->layout = Comm::LAYOUT_NONUNIFORM;
} else if (lbstyle == BISECTION) {
sendproc = balance->bisection();
comm->layout = LAYOUT_TILED;
comm->layout = Comm::LAYOUT_TILED;
}
// output of new decomposition

View File

@ -34,8 +34,6 @@ static int compare_standalone(const void *, const void *);
static int compare_standalone(const int, const int, void *);
#endif
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
#define BUFFACTOR 1.5
#define BUFMIN 1000
#define BUFEXTRA 1000
@ -222,7 +220,7 @@ int Irregular::migrate_check()
// migrate required if comm layout is tiled
// cannot use myloc[] logic below
if (comm->layout == LAYOUT_TILED) return 1;
if (comm->layout == Comm::LAYOUT_TILED) return 1;
// subbox bounds for orthogonal or triclinic box

View File

@ -30,8 +30,6 @@ using namespace LAMMPS_NS;
#define LB_FACTOR 1.1
#define EPSILON 1.0e-6
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
/* ---------------------------------------------------------------------- */
Replicate::Replicate(LAMMPS *lmp) : Pointers(lmp) {}
@ -267,7 +265,7 @@ void Replicate::command(int narg, char **arg)
sublo[2] = domain->sublo_lamda[2]; subhi[2] = domain->subhi_lamda[2];
}
if (comm->layout != LAYOUT_TILED) {
if (comm->layout != Comm::LAYOUT_TILED) {
if (domain->xperiodic) {
if (comm->myloc[0] == 0) sublo[0] -= epsilon[0];
if (comm->myloc[0] == comm->procgrid[0]-1) subhi[0] += epsilon[0];