proxy.h 2.57 KB
Newer Older
1
2
3
/*******************************************************************************
 * This file is part of SWIFT.
 * Coypright (c) 2013 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
4
 *
5
6
7
8
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
9
 *
10
11
12
13
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
14
 *
15
16
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 *
18
 ******************************************************************************/
19
20
#ifndef SWIFT_PROXY_H
#define SWIFT_PROXY_H
21

22
23
24
/* Includes. */
#include "part.h"

25
/* Some constants. */
26
27
#define proxy_buffgrow 1.5
#define proxy_buffinit 100
28
29

/* Proxy tag arithmetic. */
30
31
32
33
34
#define proxy_tag_shift 8
#define proxy_tag_count 0
#define proxy_tag_parts 1
#define proxy_tag_xparts 2
#define proxy_tag_cells 3
35
36
37
38

/* Data structure for the proxy. */
struct proxy {

39
40
41
42
43
44
45
  /* ID of the node this proxy represents. */
  int mynodeID, nodeID;

  /* Incomming cells. */
  struct cell **cells_in;
  struct pcell *pcells_in;
  int nr_cells_in, size_cells_in, size_pcells_in;
46

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  /* Outgoing cells. */
  struct cell **cells_out;
  struct pcell *pcells_out;
  int nr_cells_out, size_cells_out, size_pcells_out;

  /* The parts and xparts buffers for input and output. */
  struct part *parts_in, *parts_out;
  struct xpart *xparts_in, *xparts_out;
  int size_parts_in, size_parts_out;
  int nr_parts_in, nr_parts_out;

/* MPI request handles. */
#ifdef WITH_MPI
  MPI_Request req_parts_count_out, req_parts_count_in;
  MPI_Request req_parts_out, req_parts_in;
  MPI_Request req_xparts_out, req_xparts_in;
  MPI_Request req_cells_count_out, req_cells_count_in;
  MPI_Request req_cells_out, req_cells_in;
#endif
};
67
68

/* Function prototypes. */
69
70
71
72
73
74
75
76
77
78
79
void proxy_init(struct proxy *p, int mynodeID, int nodeID);
void proxy_parts_load(struct proxy *p, struct part *parts, struct xpart *xparts,
                      int N);
void proxy_parts_exch1(struct proxy *p);
void proxy_parts_exch2(struct proxy *p);
void proxy_addcell_in(struct proxy *p, struct cell *c);
void proxy_addcell_out(struct proxy *p, struct cell *c);
void proxy_cells_exch1(struct proxy *p);
void proxy_cells_exch2(struct proxy *p);

#endif /* SWIFT_PROXY_H */