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