1 /* ----------------------------------------------------------------------
2    SPARTA - Stochastic PArallel Rarefied-gas Time-accurate Analyzer
3    http://sparta.sandia.gov
4    Steve Plimpton, sjplimp@sandia.gov, Michael Gallis, magalli@sandia.gov
5    Sandia National Laboratories
6 
7    Copyright (2014) Sandia Corporation.  Under the terms of Contract
8    DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
9    certain rights in this software.  This software is distributed under
10    the GNU General Public License.
11 
12    See the README file in the top-level SPARTA directory.
13 ------------------------------------------------------------------------- */
14 
15 #ifndef SPARTA_COMM_H
16 #define SPARTA_COMM_H
17 
18 #include "pointers.h"
19 
20 namespace SPARTA_NS {
21 
22 class Comm : protected Pointers {
23  public:
24   int me,nprocs;                    // proc info
25   bigint ncomm;                     // dummy statistic for now
26 
27   int commsortflag;                 // 1 to force sort in all irregular comms
28                                     //   useful for debugging to insure
29                                     //   reproducible ordering of recv datums
30   int commpartstyle;                // 1 for neighbor, 0 for all
31                                     //   changes how irregular comm for
32                                     //   particles is performed
33 
34   Comm(class SPARTA *);
35   ~Comm();
init()36   void init() {}
37   void reset_neighbors();
38   int migrate_particles(int, int *);
39   virtual void migrate_cells(int);
40   int send_cells_adapt(int, int *, char *, char **);
41   int irregular_uniform_neighs(int, int *, char *, int, char **);
42   int irregular_uniform(int, int *, char *, int, char **);
43   void ring(int, int, void *, int, void (*)(int, char *, void *),
44             void *, int, void *);
45   int rendezvous(int, int, char *, int, int, int *,
46                  int (*)(int, char *, int &, int *&, char *&, void *),
47                  int, char *&, int, void *, int statflag=0);
48 
49  protected:
50   class Irregular *iparticle,*igrid,*iuniform;
51   char *sbuf,*rbuf;
52   int maxsendbuf,maxrecvbuf;
53   int *pproc,*gproc,*gsize;
54   int maxpproc,maxgproc;
55   bigint rvous_bytes;
56 
57   int neighflag;                    // 1 if nearest-neighbor particle comm
58   int nneigh;                       // # of procs I own ghost cells of
59   int *neighlist;                   // list of ghost procs
60 
61   int copymode;                 // 1 if copy of class (prevents deallocation of
62                                 // base class when child copy is destroyed)
63 
64   void migrate_cells_less_memory(int);  // small memory version of migrate_cells
65   int rendezvous_irregular(int, char *, int, int, int *,
66                            int (*)(int, char *, int &, int *&, char *&, void *),
67                            int, char *&, int, void *, int);
68   int rendezvous_all2all(int, char *, int, int, int *,
69                          int (*)(int, char *, int &, int *&, char *&, void *),
70                          int, char *&, int, void *, int);
71   void rendezvous_stats(int, int, int, int, int, int);
72 };
73 
74 }
75 
76 #endif
77 
78 /* ERROR/WARNING messages:
79 
80 E: Migrate cells send buffer exceeds 2 GB
81 
82 MPI does not support a communication buffer that exceeds a 4-byte
83 integer in size.
84 
85 */
86