| 1 |
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 |
// vi: set et ts=4 sw=2 sts=2: |
| 3 |
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root |
| 4 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 |
/****************************************************************************/ |
| 6 |
/* */ |
| 7 |
/* File: join.h */ |
| 8 |
/* */ |
| 9 |
/* Purpose: header file for join environment */ |
| 10 |
/* */ |
| 11 |
/* Author: Klaus Birken */ |
| 12 |
/* Institut fuer Computeranwendungen III */ |
| 13 |
/* Universitaet Stuttgart */ |
| 14 |
/* Pfaffenwaldring 27 */ |
| 15 |
/* 70569 Stuttgart */ |
| 16 |
/* email: [email protected] */ |
| 17 |
/* phone: 0049-(0)711-685-7007 */ |
| 18 |
/* fax : 0049-(0)711-685-7000 */ |
| 19 |
/* */ |
| 20 |
/* History: 980126 kb begin */ |
| 21 |
/* */ |
| 22 |
/* Remarks: */ |
| 23 |
/* */ |
| 24 |
/****************************************************************************/ |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
/****************************************************************************/ |
| 29 |
/* */ |
| 30 |
/* auto include mechanism and other include files */ |
| 31 |
/* */ |
| 32 |
/****************************************************************************/ |
| 33 |
|
| 34 |
#ifndef __JOIN_H__ |
| 35 |
#define __JOIN_H__ |
| 36 |
|
| 37 |
#include <vector> |
| 38 |
|
| 39 |
#define DebugJoin 10 /* 0 is all, 10 is off */ |
| 40 |
|
| 41 |
|
| 42 |
#include <dune/uggrid/parallel/ddd/basic/lowcomm.h> |
| 43 |
#include <dune/uggrid/parallel/ddd/basic/oopp.h> /* for object-orientated style via preprocessor */ |
| 44 |
|
| 45 |
/****************************************************************************/ |
| 46 |
/* */ |
| 47 |
/* defines in the following order */ |
| 48 |
/* */ |
| 49 |
/* compile time constants defining static data size (i.e. arrays) */ |
| 50 |
/* other constants */ |
| 51 |
/* macros */ |
| 52 |
/* */ |
| 53 |
/****************************************************************************/ |
| 54 |
|
| 55 |
/* some macros for customizing oopp */ |
| 56 |
#define _NEWPARAMS |
| 57 |
#define _NEWPARAMS_OR_VOID void |
| 58 |
|
| 59 |
#define __INDENT(n) { int i; for(i=0; i<n; i++) fputs(" ",fp);} |
| 60 |
#define _PRINTPARAMS , int indent, FILE *fp |
| 61 |
#define _PRINTPARAMS_DEFAULT ,0,stdout |
| 62 |
#define _INDENT __INDENT(indent) |
| 63 |
#define _INDENT1 __INDENT(indent+1) |
| 64 |
#define _INDENT2 __INDENT(indent+2) |
| 65 |
#define _PRINTNEXT , indent+1, fp |
| 66 |
#define _PRINTSAME , indent, fp |
| 67 |
|
| 68 |
/* map memory allocation calls */ |
| 69 |
#define OO_Allocate std::malloc |
| 70 |
#define OO_Free std::free |
| 71 |
|
| 72 |
|
| 73 |
/* extra prefix for all join-related data structures and/or typedefs */ |
| 74 |
/*#define ClassPrefix*/ |
| 75 |
|
| 76 |
namespace DDD { |
| 77 |
namespace Join { |
| 78 |
|
| 79 |
/* overall mode of Join */ |
| 80 |
enum class JoinMode : unsigned char { |
| 81 |
JMODE_IDLE = 0, /* waiting for next DDD_JoinBegin() */ |
| 82 |
JMODE_CMDS, /* after DDD_JoinBegin(), before DDD_JoinEnd() */ |
| 83 |
JMODE_BUSY /* during DDD_JoinEnd() */ |
| 84 |
}; |
| 85 |
|
| 86 |
} /* namespace Join */ |
| 87 |
} /* namespace DDD */ |
| 88 |
|
| 89 |
/****************************************************************************/ |
| 90 |
/* */ |
| 91 |
/* data structures exported by the corresponding source file */ |
| 92 |
/* */ |
| 93 |
/****************************************************************************/ |
| 94 |
|
| 95 |
START_UGDIM_NAMESPACE |
| 96 |
|
| 97 |
using JoinMode = DDD::Join::JoinMode; |
| 98 |
|
| 99 |
/****************************************************************************/ |
| 100 |
/* JIJoin: represents JoinObj command from application */ |
| 101 |
/****************************************************************************/ |
| 102 |
|
| 103 |
#define ClassName JIJoin |
| 104 |
Class_Data_Begin |
| 105 |
DDD_HDR hdr; /* local obj for which the join is requested */ |
| 106 |
DDD_PROC dest; /* proc for joining */ |
| 107 |
DDD_GID new_gid; /* gid of object on dest which should be joined */ |
| 108 |
Class_Data_End |
| 109 |
void Method(Print) (DefThis _PRINTPARAMS); |
| 110 |
int Method(Compare) (ClassPtr, ClassPtr, const DDD::DDDContext*); |
| 111 |
|
| 112 |
#undef ClassName |
| 113 |
|
| 114 |
|
| 115 |
/* define container class */ |
| 116 |
#ifndef SetOf /* necessary for inline documentation only */ |
| 117 |
#define SetOf JIJoin |
| 118 |
#define Set_SegmSize 256 |
| 119 |
#define Set_BTreeOrder 32 |
| 120 |
#endif |
| 121 |
#include <dune/uggrid/parallel/ddd/basic/ooppcc.h> |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
/****************************************************************************/ |
| 126 |
/* JIPartner: description of phase1 message on sender side */ |
| 127 |
/****************************************************************************/ |
| 128 |
|
| 129 |
struct JIPartner |
| 130 |
{ |
| 131 |
DDD_HDR hdr; /* local obj which has been contacted by join */ |
| 132 |
DDD_PROC proc; /* proc which initiated join */ |
| 133 |
}; |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
/****************************************************************************/ |
| 138 |
/* JIAddCpl: remote command to add cpl for join-obj during phase 2 */ |
| 139 |
/****************************************************************************/ |
| 140 |
|
| 141 |
struct TEAddCpl |
| 142 |
{ |
| 143 |
DDD_GID gid; /* gid of object to add coupling */ |
| 144 |
DDD_PROC proc; /* proc of new coupling */ |
| 145 |
DDD_PRIO prio; /* prio of new coupling */ |
| 146 |
|
| 147 |
}; |
| 148 |
|
| 149 |
|
| 150 |
#define ClassName JIAddCpl |
| 151 |
Class_Data_Begin |
| 152 |
DDD_PROC dest; /* receiver of this item */ |
| 153 |
TEAddCpl te; /* table entry (for message) */ |
| 154 |
Class_Data_End |
| 155 |
void Method(Print) (DefThis _PRINTPARAMS); |
| 156 |
int Method(Compare) (ClassPtr, ClassPtr, const DDD::DDDContext*); |
| 157 |
|
| 158 |
#undef ClassName |
| 159 |
|
| 160 |
|
| 161 |
/* define container class */ |
| 162 |
#ifndef SetOf /* necessary for inline documentation only */ |
| 163 |
#define SetOf JIAddCpl |
| 164 |
#define Set_SegmSize 256 |
| 165 |
#define Set_BTreeOrder 32 |
| 166 |
#endif |
| 167 |
#include <dune/uggrid/parallel/ddd/basic/ooppcc.h> |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
/****************************************************************************/ |
| 172 |
/* JOINMSG1: description of phase1 message on sender side */ |
| 173 |
/****************************************************************************/ |
| 174 |
|
| 175 |
struct TEJoin |
| 176 |
{ |
| 177 |
DDD_GID gid; /* gid of distributed obj to join with */ |
| 178 |
DDD_PRIO prio; /* prio of new local object which is joined */ |
| 179 |
|
| 180 |
DDD_HDR hdr; /* hdr of local DDD object (only for receiver) */ |
| 181 |
}; |
| 182 |
|
| 183 |
|
| 184 |
struct JOINMSG1 |
| 185 |
{ |
| 186 |
DDD_PROC dest; /* receiver of message */ |
| 187 |
|
| 188 |
JOINMSG1 *next; |
| 189 |
|
| 190 |
JIJoinPtr *arrayJoin; |
| 191 |
int nJoins; |
| 192 |
|
| 193 |
/* lowcomm message handle */ |
| 194 |
LC_MSGHANDLE msg_h; |
| 195 |
|
| 196 |
}; |
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
/****************************************************************************/ |
| 201 |
/* JOINMSG2: description of phase2 message on sender side */ |
| 202 |
/****************************************************************************/ |
| 203 |
|
| 204 |
struct JOINMSG2 |
| 205 |
{ |
| 206 |
DDD_PROC dest; /* receiver of message */ |
| 207 |
|
| 208 |
JOINMSG2 *next; |
| 209 |
|
| 210 |
JIAddCplPtr *arrayAddCpl; |
| 211 |
int nAddCpls; |
| 212 |
|
| 213 |
/* lowcomm message handle */ |
| 214 |
LC_MSGHANDLE msg_h; |
| 215 |
}; |
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
/****************************************************************************/ |
| 220 |
/* JOINMSG3: description of phase3 message on sender side */ |
| 221 |
/****************************************************************************/ |
| 222 |
|
| 223 |
struct JOINMSG3 |
| 224 |
{ |
| 225 |
DDD_PROC dest; /* receiver of message */ |
| 226 |
|
| 227 |
JOINMSG3 *next; |
| 228 |
|
| 229 |
JIAddCplPtr *arrayAddCpl; |
| 230 |
int nAddCpls; |
| 231 |
|
| 232 |
/* lowcomm message handle */ |
| 233 |
LC_MSGHANDLE msg_h; |
| 234 |
}; |
| 235 |
|
| 236 |
/****************************************************************************/ |
| 237 |
/* */ |
| 238 |
/* function declarations */ |
| 239 |
/* */ |
| 240 |
/****************************************************************************/ |
| 241 |
|
| 242 |
|
| 243 |
/* join.c, used only by cmds.c */ |
| 244 |
/* |
| 245 |
XICopyObj **CplClosureEstimate(DDD::DDDContext& context, XICopyObjPtrArray *, int *); |
| 246 |
int PrepareObjMsgs(XICopyObjPtrArray *, XINewCpl **, int, |
| 247 |
XIOldCpl **, int, XFERMSG **, size_t *); |
| 248 |
void ExecLocalXIDelCmd(XIDelCmd **, int); |
| 249 |
void ExecLocalXISetPrio(XISetPrioPtrArray *, XIDelObj **,int, XICopyObj **,int); |
| 250 |
void ExecLocalXIDelObj(XIDelObj **, int, XICopyObj **,int); |
| 251 |
void PropagateCplInfos(XISetPrio **, int, XIDelObj **, int, |
| 252 |
TENewCpl *, int); |
| 253 |
*/ |
| 254 |
bool JoinStepMode(DDD::DDDContext& context, JoinMode); |
| 255 |
|
| 256 |
|
| 257 |
/* pack.c, used only by cmds.c */ |
| 258 |
/* |
| 259 |
void XferPackMsgs (XFERMSG *); |
| 260 |
*/ |
| 261 |
|
| 262 |
|
| 263 |
/* unpack.c, used only by cmds.c */ |
| 264 |
/* |
| 265 |
void XferUnpack (LC_MSGHANDLE *, int, DDD_HDR *, int, |
| 266 |
XISetPrioPtrArray *, XIDelObj **, int, |
| 267 |
XICopyObjPtrArray *, XICopyObj **, int); |
| 268 |
*/ |
| 269 |
|
| 270 |
|
| 271 |
/* ctrl.c */ |
| 272 |
/* |
| 273 |
void XferDisplayMsg (DDD::DDDContext& context, char *comment, LC_MSGHANDLE); |
| 274 |
*/ |
| 275 |
|
| 276 |
END_UGDIM_NAMESPACE |
| 277 |
|
| 278 |
#endif |