1 #ifndef IRREGULAR_H
2 #define IRREGULAR_H
3 
4 #include <mpi.h>
5 
6 class Irregular {
7  public:
8   Irregular(MPI_Comm);
9   ~Irregular();
10 
11   void pattern(int, int *);
12   int size(int);
13   int size(int *, int *, int *);
14   void exchange(char *, char *);
15 
16  private:
17   int me,nprocs;
18 
19   int patternflag;           // UNSET,SET
20   int sizestyle;             // NONE,SAME,VARYING
21 
22   int self;                  // 0 = no data to copy to self, 1 = yes
23 
24   int ndatumsend;            // # of datums to send w/ self
25   int ndatumrecv;            // # of datums to recv w/ self
26   int nbytesrecv;            // total bytes in received data w/ self
27   int nsend;                 // # of messages to send w/out self
28   int nrecv;                 // # of messages to recv w/out self
29   int nsendmax;              // # of bytes in largest send message, w/out self
30 
31   int *sendproc;             // list of procs to send to w/out self
32   int *sendcount;            // # of datums to send to each proc w/ self
33   int *sendsize;             // # of bytes to send to each proc w/ self
34   int *sendindices;          // indices of datums to send to each proc w/ self
35 
36   int nsize;                 // size of every datum in bytes (SAME)
37   int *sendsizedatum;        // bytes in each datum to send w/ self (VARYING)
38   int *sendoffset;           // byte offset to where each datum starts w/ self
39   int sendoffsetflag;        // 1 if allocated sendoffset, 0 if passed in
40 
41   int *recvproc;             // list of procs to recv from w/out self
42   int *recvcount;            // # of datums to recv from each proc w/out self
43   int *recvsize;             // # of bytes to recv from each proc w/out self
44 
45   MPI_Request *request;      // MPI requests for posted recvs
46   MPI_Status *status;        // MPI statuses for Waitall
47   MPI_Comm comm;             // MPI communicator for all communication
48 
49   class Memory *memory;
50   class Error *error;
51 
52   void exchange_same(char *, char *);
53   void exchange_varying(char *, char *);
54   void init();
55   void deallocate();
56 };
57 
58 #endif
59