1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 /*! \file dlmgr.h
4  * \ingroup gm
5  */
6 /****************************************************************************/
7 /*                                                                          */
8 /* File:      dlmgr.h                                                       */
9 /*                                                                          */
10 /* Purpose:   defines for dynamic linked list management                    */
11 /*                                                                          */
12 /* Author:    Stefan Lang                                                   */
13 /*            Institut fuer Computeranwendungen III                         */
14 /*            Universitaet Stuttgart                                        */
15 /*            Pfaffenwaldring 27                                            */
16 /*            70550 Stuttgart                                               */
17 /*            email: ug@ica3.uni-stuttgart.de                               */
18 /*                                                                          */
19 /* History:   960915 sl  start of dynamic list management                   */
20 /*                                                                          */
21 /* Remarks:                                                                 */
22 /*            Management of dynamic linked lists, which consist of          */
23 /*            several parts. An object can be mapped to a part of the list  */
24 /*            by its priority using PRIO2LISTPART().                        */
25 /*            The formulation on object basis allows for management of      */
26 /*            elements, nodes, vectors and vertices.                        */
27 /*            A list has the form:                                          */
28 /*                p0first-p0last->p1first-p1last->...->pnfirst..pnlast      */
29 /*            where each part p0,p1,..,pn is limited by two pointers,       */
30 /*            pxfirst and pxlast, x=0..n. The part numbers are ordered      */
31 /*            increasingly and connected in a manner that one can run       */
32 /*            through the whole list in increasing order (SUCC) but only    */
33 /*            through one listpart in decreasing order (PRED).              */
34 /*            Linking/Unlinking of objects in a list part is done in a      */
35 /*            way that preserves these conventions.                         */
36 /*                                                                          */
37 /****************************************************************************/
38 
39 
40 #ifndef __DLMGR_H__
41 
42 #include "gm.h"
43 #include <dune/uggrid/low/debug.h>
44 #include <dune/uggrid/low/misc.h>
45 #include <dune/uggrid/low/namespace.h>
46 
47 #ifdef ModelP
48 #include <dune/uggrid/parallel/dddif/parallel.h>
49 #endif
50 
51 
52 START_UGDIM_NAMESPACE
53 
54 #ifdef ModelP
55 
56 #define FIRSTPART_OF_LIST               0
57 #define LASTPART_OF_LIST(OTYPE) ((CAT(OTYPE,_LISTPARTS)) -1)
58 
59 /* define DDD_HDR macros */
60 #define HDRELEMENT      PARHDRE
61 #define HDRNODE         PARHDR
62 #define HDRVERTEX       PARHDRV
63 #define HDRVECTOR       PARHDR
64 #define HDR(OTYPE)      CAT(HDR,OTYPE)
65 
66 /* define macros for formatted output */
67 #define ELEMENTFMT      EID_
68 #define NODEFMT         ID_
69 #define VERTEXFMT       VID_
70 #define VECTORFMT       VINDEX_
71 #define FORMAT(t)       CAT(t,FMT)
72 
73 #endif
74 
75 /* define Object COUNTER macros */
76 #define COUNTELEMENT    NT
77 #define COUNTNODE               NN
78 #define COUNTVERTEX             NV
79 #define COUNTVECTOR             NVEC
80 
81 /* define Object COUNTER macros for priorities */
82 #define PRIOCOUNTELEMENT        NT_PRIO
83 #define PRIOCOUNTNODE           NN_PRIO
84 #define PRIOCOUNTVERTEX         NV_PRIO
85 #define PRIOCOUNTVECTOR         NVEC_PRIO
86 
87 /* define header prototypes */
88 #define UNLINK(OTYPE)    void CAT(GRID_UNLINK_, OTYPE ) (GRID *Grid, OTYPE *Object)
89 #define LINK(OTYPE)      void CAT(GRID_LINK_,OTYPE) (GRID *Grid, OTYPE *Object, INT Prio)
90 #define LINKX(OTYPE)     void CAT(GRID_LINKX_,OTYPE) (GRID *Grid, OTYPE *Object, INT Prio, OTYPE *After)
91 #define INIT(OTYPE)      void CAT3(GRID_INIT_,OTYPE,_LIST(GRID *Grid))
92 #define CHECK(OTYPE)     void CAT3(GRID_CHECK_,OTYPE,_LIST(GRID *Grid))
93 #ifdef ModelP
94 #define PRINT_LIST(OTYPE) void CAT(PRINT_LIST_STARTS_,OTYPE) (GRID *Grid, INT prios)
95 #endif
96 
97 LINK(ELEMENT);
98 LINKX(ELEMENT);
99 UNLINK(ELEMENT);
100 INIT(ELEMENT);
101 CHECK(ELEMENT);
102 
103 LINK(NODE);
104 LINKX(NODE);
105 UNLINK(NODE);
106 INIT(NODE);
107 CHECK(NODE);
108 
109 LINK(VERTEX);
110 LINKX(VERTEX);
111 UNLINK(VERTEX);
112 INIT(VERTEX);
113 CHECK(VERTEX);
114 
115 LINK(VECTOR);
116 LINKX(VECTOR);
117 UNLINK(VECTOR);
118 INIT(VECTOR);
119 CHECK(VECTOR);
120 
121 #ifdef ModelP
122 PRINT_LIST(ELEMENT);
123 PRINT_LIST(NODE);
124 PRINT_LIST(VERTEX);
125 PRINT_LIST(VECTOR);
126 #endif
127 
128 END_UGDIM_NAMESPACE
129 
130 #endif /* __DLMGR_H__ */
131