source: CIVL/examples/mpi-omp/AMG2013/struct_mv/struct_communication.h@ 7d77e64

main test-branch
Last change on this file since 7d77e64 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 8.4 KB
Line 
1/*BHEADER**********************************************************************
2 * Copyright (c) 2008, Lawrence Livermore National Security, LLC.
3 * Produced at the Lawrence Livermore National Laboratory.
4 * This file is part of HYPRE. See file COPYRIGHT for details.
5 *
6 * HYPRE is free software; you can redistribute it and/or modify it under the
7 * terms of the GNU Lesser General Public License (as published by the Free
8 * Software Foundation) version 2.1 dated February 1999.
9 *
10 * $Revision: 2.4 $
11 ***********************************************************************EHEADER*/
12
13
14
15#ifndef hypre_COMMUNICATION_HEADER
16#define hypre_COMMUNICATION_HEADER
17
18/*--------------------------------------------------------------------------
19 * hypre_CommInfo:
20 *--------------------------------------------------------------------------*/
21
22typedef struct hypre_CommInfo_struct
23{
24 hypre_BoxArrayArray *send_boxes;
25 hypre_BoxArrayArray *recv_boxes;
26 hypre_Index send_stride;
27 hypre_Index recv_stride;
28 int **send_processes;
29 int **recv_processes;
30 int **send_rboxnums;
31 int **recv_rboxnums; /* required for "inverse" communication */
32 hypre_BoxArrayArray *send_rboxes;
33
34} hypre_CommInfo;
35
36/*--------------------------------------------------------------------------
37 * hypre_CommEntryType:
38 *--------------------------------------------------------------------------*/
39
40typedef struct hypre_CommEntryType_struct
41{
42 int offset; /* offset for the data */
43 int dim; /* dimension of the communication */
44 int length_array[4];
45 int stride_array[4];
46
47} hypre_CommEntryType;
48
49/*--------------------------------------------------------------------------
50 * hypre_CommType:
51 *--------------------------------------------------------------------------*/
52
53typedef struct hypre_CommType_struct
54{
55 int proc;
56 int bufsize; /* message buffer size (in doubles) */
57 int num_entries;
58 hypre_CommEntryType *entries;
59
60 int *loc_boxnums; /* entry local box numbers */
61 int *rem_boxnums; /* entry remote box numbers */
62 hypre_Box *loc_boxes; /* entry local boxes */
63 hypre_Box *rem_boxes; /* entry remote boxes */
64
65} hypre_CommType;
66
67/*--------------------------------------------------------------------------
68 * hypre_CommPkg:
69 * Structure containing information for doing communications
70 *--------------------------------------------------------------------------*/
71
72typedef struct hypre_CommPkg_struct
73{
74 MPI_Comm comm;
75
76 int first_send; /* is this the first send? */
77 int first_recv; /* is this the first recv? */
78
79 int num_values;
80 hypre_Index send_stride;
81 hypre_Index recv_stride;
82 int send_bufsize; /* total send buffer size (in doubles) */
83 int recv_bufsize; /* total recv buffer size (in doubles) */
84
85 int num_sends;
86 int num_recvs;
87 hypre_CommType *send_types;
88 hypre_CommType *recv_types;
89
90 hypre_CommType *copy_from_type;
91 hypre_CommType *copy_to_type;
92
93 int *recv_data_offsets; /* offsets into recv data (by box) */
94 hypre_BoxArray *recv_data_space; /* recv data dimensions (by box) */
95
96} hypre_CommPkg;
97
98/*--------------------------------------------------------------------------
99 * CommHandle:
100 *--------------------------------------------------------------------------*/
101
102typedef struct hypre_CommHandle_struct
103{
104 hypre_CommPkg *comm_pkg;
105 double *send_data;
106 double *recv_data;
107
108 int num_requests;
109 MPI_Request *requests;
110 MPI_Status *status;
111
112 double **send_buffers;
113 double **recv_buffers;
114
115} hypre_CommHandle;
116
117/*--------------------------------------------------------------------------
118 * Accessor macros: hypre_CommInto
119 *--------------------------------------------------------------------------*/
120
121#define hypre_CommInfoSendBoxes(info) (info -> send_boxes)
122#define hypre_CommInfoRecvBoxes(info) (info -> recv_boxes)
123#define hypre_CommInfoSendStride(info) (info -> send_stride)
124#define hypre_CommInfoRecvStride(info) (info -> recv_stride)
125#define hypre_CommInfoSendProcesses(info) (info -> send_processes)
126#define hypre_CommInfoRecvProcesses(info) (info -> recv_processes)
127#define hypre_CommInfoSendRBoxnums(info) (info -> send_rboxnums)
128#define hypre_CommInfoRecvRBoxnums(info) (info -> recv_rboxnums)
129#define hypre_CommInfoSendRBoxes(info) (info -> send_rboxes)
130
131/*--------------------------------------------------------------------------
132 * Accessor macros: hypre_CommEntryType
133 *--------------------------------------------------------------------------*/
134
135#define hypre_CommEntryTypeOffset(entry) (entry -> offset)
136#define hypre_CommEntryTypeDim(entry) (entry -> dim)
137#define hypre_CommEntryTypeLengthArray(entry) (entry -> length_array)
138#define hypre_CommEntryTypeStrideArray(entry) (entry -> stride_array)
139
140/*--------------------------------------------------------------------------
141 * Accessor macros: hypre_CommType
142 *--------------------------------------------------------------------------*/
143
144#define hypre_CommTypeProc(type) (type -> proc)
145#define hypre_CommTypeBufsize(type) (type -> bufsize)
146#define hypre_CommTypeNumEntries(type) (type -> num_entries)
147#define hypre_CommTypeEntries(type) (type -> entries)
148#define hypre_CommTypeEntry(type, i) &(type -> entries[i])
149#define hypre_CommTypeLocBoxnums(type) (type -> loc_boxnums)
150#define hypre_CommTypeLocBoxnum(type, i) (type -> loc_boxnums[i])
151#define hypre_CommTypeRemBoxnums(type) (type -> rem_boxnums)
152#define hypre_CommTypeRemBoxnum(type, i) (type -> rem_boxnums[i])
153#define hypre_CommTypeLocBoxes(type) (type -> loc_boxes)
154#define hypre_CommTypeLocBox(type, i) &(type -> loc_boxes[i])
155#define hypre_CommTypeRemBoxes(type) (type -> rem_boxes)
156#define hypre_CommTypeRemBox(type, i) &(type -> rem_boxes[i])
157
158/*--------------------------------------------------------------------------
159 * Accessor macros: hypre_CommPkg
160 *--------------------------------------------------------------------------*/
161
162#define hypre_CommPkgComm(comm_pkg) (comm_pkg -> comm)
163
164#define hypre_CommPkgFirstSend(comm_pkg) (comm_pkg -> first_send)
165#define hypre_CommPkgFirstRecv(comm_pkg) (comm_pkg -> first_recv)
166
167#define hypre_CommPkgNumValues(comm_pkg) (comm_pkg -> num_values)
168#define hypre_CommPkgSendStride(comm_pkg) (comm_pkg -> send_stride)
169#define hypre_CommPkgRecvStride(comm_pkg) (comm_pkg -> recv_stride)
170#define hypre_CommPkgSendBufsize(comm_pkg) (comm_pkg -> send_bufsize)
171#define hypre_CommPkgRecvBufsize(comm_pkg) (comm_pkg -> recv_bufsize)
172
173#define hypre_CommPkgNumSends(comm_pkg) (comm_pkg -> num_sends)
174#define hypre_CommPkgNumRecvs(comm_pkg) (comm_pkg -> num_recvs)
175#define hypre_CommPkgSendTypes(comm_pkg) (comm_pkg -> send_types)
176#define hypre_CommPkgSendType(comm_pkg, i) &(comm_pkg -> send_types[i])
177#define hypre_CommPkgRecvTypes(comm_pkg) (comm_pkg -> recv_types)
178#define hypre_CommPkgRecvType(comm_pkg, i) &(comm_pkg -> recv_types[i])
179
180#define hypre_CommPkgCopyFromType(comm_pkg) (comm_pkg -> copy_from_type)
181#define hypre_CommPkgCopyToType(comm_pkg) (comm_pkg -> copy_to_type)
182
183#define hypre_CommPkgRecvDataOffsets(comm_pkg) (comm_pkg -> recv_data_offsets)
184#define hypre_CommPkgRecvDataSpace(comm_pkg) (comm_pkg -> recv_data_space)
185
186/*--------------------------------------------------------------------------
187 * Accessor macros: hypre_CommHandle
188 *--------------------------------------------------------------------------*/
189
190#define hypre_CommHandleCommPkg(comm_handle) (comm_handle -> comm_pkg)
191#define hypre_CommHandleSendData(comm_handle) (comm_handle -> send_data)
192#define hypre_CommHandleRecvData(comm_handle) (comm_handle -> recv_data)
193#define hypre_CommHandleNumRequests(comm_handle) (comm_handle -> num_requests)
194#define hypre_CommHandleRequests(comm_handle) (comm_handle -> requests)
195#define hypre_CommHandleStatus(comm_handle) (comm_handle -> status)
196#define hypre_CommHandleSendBuffers(comm_handle) (comm_handle -> send_buffers)
197#define hypre_CommHandleRecvBuffers(comm_handle) (comm_handle -> recv_buffers)
198
199#endif
Note: See TracBrowser for help on using the repository browser.