Make domdec a proper module
[alexxy/gromacs.git] / src / gromacs / domdec / domdec_network.h
index 570080076496123ba6da625bca917f6a9bcb6d97..efadf4327f7586108293867fd52244485b606562 100644 (file)
  * the research papers on the package. Check out http://www.gromacs.org.
  */
 
-#ifndef _domdec_network_h
-#define _domdec_network_h
+/*! \libinternal \file
+ *
+ * \brief This file declares functions for (mostly) the domdec module
+ * to use MPI functionality
+ *
+ * \todo Wrap the raw dd_bcast in md.cpp into a higher-level function
+ * in the domdec module, then this file can be module-internal.
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \inlibraryapi
+ * \ingroup module_domdec
+ */
+#ifndef GMX_DOMDEC_DOMDEC_NETWORK_H
+#define GMX_DOMDEC_DOMDEC_NETWORK_H
 
 #include "gromacs/legacyheaders/typedefs.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+/* \brief */
 enum {
     dddirForward, dddirBackward
 };
 
-/* Move integers in the comm. region one cell along the domain decomposition
- * in the dimension indexed by ddimind
- * forward (direction=dddirFoward) or backward (direction=dddirBackward).
+/*! \brief Move integers in the communication region one cell along
+ * the domain decomposition
+ *
+ * Moves in the dimension indexed by ddimind, either forward
+ * (direction=dddirFoward) or backward (direction=dddirBackward).
  */
 void
 dd_sendrecv_int(const gmx_domdec_t *dd,
@@ -56,9 +67,10 @@ dd_sendrecv_int(const gmx_domdec_t *dd,
                 int *buf_s, int n_s,
                 int *buf_r, int n_r);
 
-/* Move reals in the comm. region one cell along the domain decomposition
- * in the dimension indexed by ddimind
- * forward (direction=dddirFoward) or backward (direction=dddirBackward).
+/*! \brief Move reals in the comm. region one cell along the domain decomposition
+ *
+ * Moves in the dimension indexed by ddimind, either forward
+ * (direction=dddirFoward) or backward (direction=dddirBackward).
  */
 void
 dd_sendrecv_real(const gmx_domdec_t *dd,
@@ -66,9 +78,10 @@ dd_sendrecv_real(const gmx_domdec_t *dd,
                  real *buf_s, int n_s,
                  real *buf_r, int n_r);
 
-/* Move revc's in the comm. region one cell along the domain decomposition
- * in dimension indexed by ddimind
- * forward (direction=dddirFoward) or backward (direction=dddirBackward).
+/*! \brief Move revc's in the comm. region one cell along the domain decomposition
+ *
+ * Moves in dimension indexed by ddimind, either forward
+ * (direction=dddirFoward) or backward (direction=dddirBackward).
  */
 void
 dd_sendrecv_rvec(const gmx_domdec_t *dd,
@@ -77,9 +90,10 @@ dd_sendrecv_rvec(const gmx_domdec_t *dd,
                  rvec *buf_r, int n_r);
 
 
-/* Move revc's in the comm. region one cell along the domain decomposition
- * in dimension indexed by ddimind
- * simultaneously in the forward and backward directions.
+/*! \brief Move revc's in the comm. region one cell along the domain decomposition
+ *
+ * Moves in dimension indexed by ddimind, simultaneously in the forward
+ * and backward directions.
  */
 void
 dd_sendrecv2_rvec(const gmx_domdec_t *dd,
@@ -96,33 +110,40 @@ dd_sendrecv2_rvec(const gmx_domdec_t *dd,
  * The DD master node is the master for these operations.
  */
 
+/*! \brief Broadcasts \p nbytes from \p data on \p DDMASTERRANK to all PP ranks */
 void
 dd_bcast(gmx_domdec_t *dd, int nbytes, void *data);
 
-/* Copies src to dest on the master node and then broadcasts */
+/*! \brief Copies \p nbytes from \p src to \p dest on \p DDMASTERRANK
+ * and then broadcasts to \p dest on all PP ranks */
 void
 dd_bcastc(gmx_domdec_t *dd, int nbytes, void *src, void *dest);
 
+/*! \brief Scatters \p nbytes from \p src on \p DDMASTERRANK to all PP ranks, received in \p dest */
 void
 dd_scatter(gmx_domdec_t *dd, int nbytes, void *src, void *dest);
 
+/*! \brief Gathers \p nbytes from \p src on all PP ranks, received in \p dest on \p DDMASTERRANK */
 void
 dd_gather(gmx_domdec_t *dd, int nbytes, void *src, void *dest);
 
-/* If rcount==0, rbuf is allowed to be NULL */
+/*! \brief Scatters \p scounts bytes from \p src on \p DDMASTERRANK to all PP ranks, receiving \p rcount bytes in \p dest.
+ *
+ * See man MPI_Scatterv for details of how to construct scounts and disps.
+ * If rcount==0, rbuf is allowed to be NULL */
 void
 dd_scatterv(gmx_domdec_t *dd,
             int *scounts, int *disps, void *sbuf,
             int rcount, void *rbuf);
 
-/* If scount==0, sbuf is allowed to be NULL */
+/*! \brief Gathers \p rcount bytes from \p src on all PP ranks, received in \p scounts bytes in \p dest on \p DDMASTERRANK.
+ *
+ * See man MPI_Gatherv for details of how to construct scounts and disps.
+ *
+ * If scount==0, sbuf is allowed to be NULL */
 void
 dd_gatherv(gmx_domdec_t *dd,
            int scount, void *sbuf,
            int *rcounts, int *disps, void *rbuf);
 
-#ifdef __cplusplus
-}
 #endif
-
-#endif  /* _domdec_network_h */