773865abe89e4112a0daab4a1d1e25b14d9093f8
[alexxy/gromacs.git] / src / gromacs / legacyheaders / domdec_network.h
1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
2  *
3  *
4  * This file is part of Gromacs        Copyright (c) 1991-2008
5  * David van der Spoel, Erik Lindahl, Berk Hess, University of Groningen.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * To help us fund GROMACS development, we humbly ask that you cite
13  * the research papers on the package. Check out http://www.gromacs.org
14  *
15  * And Hey:
16  * Gnomes, ROck Monsters And Chili Sauce
17  */
18
19 #ifndef _domdec_network_h
20 #define _domdec_network_h
21
22 #include "typedefs.h"
23 #include "types/commrec.h"
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 enum {
30     dddirForward, dddirBackward
31 };
32
33 /* Move integers in the comm. region one cell along the domain decomposition
34  * in the dimension indexed by ddimind
35  * forward (direction=dddirFoward) or backward (direction=dddirBackward).
36  */
37 void
38 dd_sendrecv_int(const gmx_domdec_t *dd,
39                 int ddimind, int direction,
40                 int *buf_s, int n_s,
41                 int *buf_r, int n_r);
42
43 /* Move reals in the comm. region one cell along the domain decomposition
44  * in the dimension indexed by ddimind
45  * forward (direction=dddirFoward) or backward (direction=dddirBackward).
46  */
47 void
48 dd_sendrecv_real(const gmx_domdec_t *dd,
49                  int ddimind, int direction,
50                  real *buf_s, int n_s,
51                  real *buf_r, int n_r);
52
53 /* Move revc's in the comm. region one cell along the domain decomposition
54  * in dimension indexed by ddimind
55  * forward (direction=dddirFoward) or backward (direction=dddirBackward).
56  */
57 void
58 dd_sendrecv_rvec(const gmx_domdec_t *dd,
59                  int ddimind, int direction,
60                  rvec *buf_s, int n_s,
61                  rvec *buf_r, int n_r);
62
63
64 /* Move revc's in the comm. region one cell along the domain decomposition
65  * in dimension indexed by ddimind
66  * simultaneously in the forward and backward directions.
67  */
68 void
69 dd_sendrecv2_rvec(const gmx_domdec_t *dd,
70                   int ddimind,
71                   rvec *buf_s_fw, int n_s_fw,
72                   rvec *buf_r_fw, int n_r_fw,
73                   rvec *buf_s_bw, int n_s_bw,
74                   rvec *buf_r_bw, int n_r_bw);
75
76
77 /* The functions below perform the same operations as the MPI functions
78  * with the same name appendices, but over the domain decomposition
79  * nodes only.
80  * The DD master node is the master for these operations.
81  */
82
83 void
84 dd_bcast(gmx_domdec_t *dd, int nbytes, void *data);
85
86 /* Copies src to dest on the master node and then broadcasts */
87 void
88 dd_bcastc(gmx_domdec_t *dd, int nbytes, void *src, void *dest);
89
90 void
91 dd_scatter(gmx_domdec_t *dd, int nbytes, void *src, void *dest);
92
93 void
94 dd_gather(gmx_domdec_t *dd, int nbytes, void *src, void *dest);
95
96 /* If rcount==0, rbuf is allowed to be NULL */
97 void
98 dd_scatterv(gmx_domdec_t *dd,
99             int *scounts, int *disps, void *sbuf,
100             int rcount, void *rbuf);
101
102 /* If scount==0, sbuf is allowed to be NULL */
103 void
104 dd_gatherv(gmx_domdec_t *dd,
105            int scount, void *sbuf,
106            int *rcounts, int *disps, void *rbuf);
107
108 #ifdef __cplusplus
109 }
110 #endif
111
112 #endif  /* _domdec_network_h */