400c50bf9aed18428dfda1db336122a4954a8b3a
[alexxy/gromacs.git] / include / 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
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 enum {
29     dddirForward,dddirBackward
30 };
31
32 /* Move integers in the comm. region one cell along the domain decomposition
33  * in the dimension indexed by ddimind
34  * forward (direction=dddirFoward) or backward (direction=dddirBackward).
35  */
36 void
37 dd_sendrecv_int(const gmx_domdec_t *dd,
38                 int ddimind,int direction,
39                 int *buf_s,int n_s,
40                 int *buf_r,int n_r);
41
42 /* Move reals in the comm. region one cell along the domain decomposition
43  * in the dimension indexed by ddimind
44  * forward (direction=dddirFoward) or backward (direction=dddirBackward).
45  */
46 void
47 dd_sendrecv_real(const gmx_domdec_t *dd,
48                  int ddimind,int direction,
49                  real *buf_s,int n_s,
50                  real *buf_r,int n_r);
51
52 /* Move revc's in the comm. region one cell along the domain decomposition
53  * in dimension indexed by ddimind
54  * forward (direction=dddirFoward) or backward (direction=dddirBackward).
55  */
56 void
57 dd_sendrecv_rvec(const gmx_domdec_t *dd,
58                  int ddimind,int direction,
59                  rvec *buf_s,int n_s,
60                  rvec *buf_r,int n_r);
61
62
63 /* Move revc's in the comm. region one cell along the domain decomposition
64  * in dimension indexed by ddimind
65  * simultaneously in the forward and backward directions.
66  */
67 void
68 dd_sendrecv2_rvec(const gmx_domdec_t *dd,
69                   int ddimind,
70                   rvec *buf_s_fw,int n_s_fw,
71                   rvec *buf_r_fw,int n_r_fw,
72                   rvec *buf_s_bw,int n_s_bw,
73                   rvec *buf_r_bw,int n_r_bw);
74
75
76 /* The functions below perform the same operations as the MPI functions
77  * with the same name appendices, but over the domain decomposition
78  * nodes only.
79  * The DD master node is the master for these operations.
80  */
81
82 void
83 dd_bcast(gmx_domdec_t *dd,int nbytes,void *data);
84
85 /* Copies src to dest on the master node and then broadcasts */
86 void
87 dd_bcastc(gmx_domdec_t *dd,int nbytes,void *src,void *dest);
88
89 void
90 dd_scatter(gmx_domdec_t *dd,int nbytes,void *src,void *dest);
91
92 void
93 dd_gather(gmx_domdec_t *dd,int nbytes,void *src,void *dest);
94
95 /* If rcount==0, rbuf is allowed to be NULL */
96 void
97 dd_scatterv(gmx_domdec_t *dd,
98             int *scounts,int *disps,void *sbuf,
99             int rcount,void *rbuf);
100
101 /* If scount==0, sbuf is allowed to be NULL */
102 void
103 dd_gatherv(gmx_domdec_t *dd,
104            int scount,void *sbuf,
105            int *rcounts,int *disps,void *rbuf);
106
107 #ifdef __cplusplus
108 }
109 #endif
110
111 #endif  /* _domdec_network_h */