Convert domdec code to C++
authorMark Abraham <mark.j.abraham@gmail.com>
Thu, 4 Sep 2014 20:21:35 +0000 (22:21 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 11 Sep 2014 12:18:07 +0000 (14:18 +0200)
commitfdbd674832f07e7388761a004321edd1089e8d39
treed1d2151489ba6124279ea76ec67774b953feb26a
parent2c8e4fac688f51c7b779c13a542f4700a221715d
Convert domdec code to C++

Used std:: versions of at least some calls to min, max, sqrt and pow,
eliminated unused variables, used a named floating-point constant,
used a static_cast to make clear that we intend to truncate to integer
in one place, made some iteration variables local to their block,
protected some uses of fplog and fshift.

Eliminated some redundant #ifdef GMX_MPI, changed the range of others
to declare variables only where used.

Converted some neighbour-search constants to be static const real,
rather than macros, with the side effect of not having to deal
with overloaded std::sqrt for constants.

Introduced one work-around (duplicating the code of add_ifunc) for
dealing with the way that nral is a complicated function of
ftype. Static analysis was not being consistent in the way it was
choosing code paths with possible values of nral in different
functions. Co-locating two loops over nral resolves the issue.

Added assertions that help static analysis understand that settles are
kinds of constraints and that sane things happen elsewhere, so that
code paths that look like they might be called when only
inter-charge-group settles exist are actually well formed.

Added yet more assertions to reassure the analyzer that we handle
memory allocation with charge-group linking correctly.

Clarified a PBC-related variable name.

Change-Id: I5d1cf06c866098d183d7fe5aa023a292ca3d109b
src/gromacs/legacyheaders/nsgrid.h
src/gromacs/mdlib/domdec.cpp [moved from src/gromacs/mdlib/domdec.c with 97% similarity]
src/gromacs/mdlib/domdec_box.cpp [moved from src/gromacs/mdlib/domdec_box.c with 100% similarity]
src/gromacs/mdlib/domdec_con.cpp [moved from src/gromacs/mdlib/domdec_con.c with 97% similarity]
src/gromacs/mdlib/domdec_network.cpp [moved from src/gromacs/mdlib/domdec_network.c with 100% similarity]
src/gromacs/mdlib/domdec_setup.cpp [moved from src/gromacs/mdlib/domdec_setup.c with 98% similarity]
src/gromacs/mdlib/domdec_top.cpp [moved from src/gromacs/mdlib/domdec_top.c with 97% similarity]