#ifndef Map_H #define Map_H /* Last edited on 2007-01-31 14:20:52 by stolfi */ /* Explicit representation of the topology of a 3D map. */ #define Map_H_copyright \ "Copyright © 2001 Universidade Estadual de Campinas (UNICAMP)" #define _GNU_SOURCE #include #include #include #include #include #include #include /* ENUMERATION */ typedef struct Topology_t /* [!!! Should be {TopologyRec_t} !!!] */ { Place_vec_t node; Place_vec_t edge; Place_vec_t wall; Place_vec_t cell; Wedge_vec_t wedge; /* one place for each wedge */ /* [!!! RENAMED: top.out -> top.node; top.node[i] -> PNode(top->node[i]); !!!] */ /* [!!! RENAMED: top.region -> top.cell; top.cell[i] -> PCell(top->cell[i]); !!!] */ /* Place_vec_t out; */ /* one place for each node where: Org(out[v]) == node[v] */ /* Place_vec_t region; */ /* one place for each cell where: Org(region[r]) == cell[r] */ /* These fields are used by {JStri.h}: [???] */ /* uint der; */ /* Edge Ring Degree */ /* uint bdr; */ /* Where (0) indicates without boundary */ /* (1) indicates with boundary */ /* and (2) indicates that cells are octahedra */ } Topology_t; /* Explicit tables of elements of a 3D map. A {Topology_t} structure {t} describes a 3D map {N}, consisting zero or more connected components of the maps represented by the facet-edge structure. The structure is basically four tables {t.elem[d]}, for {d} in {0..3} that provide direct access to all {d}-dimensional elements of {N}. For data structure {t} to be valid, each data field {p.data[d]} of every place {p} on {N} must contain a pointer to the appropriate {d}-dimensional element record --- a {NodeRec_t}, {EdgeRec_t}, {WallRec_t}, or {CellRec_t}, respectively, for {d == 0,1,2,3}. There must be a distinct and unique element record for each map element. Moreover, the {num} fields of all {d}-element records of {N} must contain sequential integers from 0 to {n-1}, in any order; where {n} is the number of such elements in the map {N}. Finally, for each {d} in {0..3} and each {i} in {0..n-1}, the entry {p = t.elem[d].el[i]} must be a place on the {d}-element with number {i}; that is, one must have {p.data[d]->num == i}. Each component of {N} may come from {M} or {M*} indifferently. However, if a component {K} of {M} is included in {N}, its dual {K*} must not be. */ Topology_t MakeTopology(Place_vec_t pv); /* This procedure computes the explicit topology of that part of the primal map that can be reached from places {pv.el[0..pv.nel]}. All starting places must be on the primal map. The map may have a non-empty border. */ void FreeMapData(Topology_t *t); /* This procedure reclaims all the storage associated with the topology {t}, including the element data records and the tables {t->elem[0..3].el}. */ typedef struct TopoDict_t { uint_vec_t OldNodeNum; uint_vec_t OldEdgeNum; uint_vec_t OldWallNum; uint_vec_t OldCellNum; } TopoDict_t; /* CELL TOPOLOGY */ typedef struct CellTopology_t { Place_vec_t vRef; /* One Place_t out of each node. */ Place_vec_t eRef; /* One Place_t on each edge. */ Place_vec_t fRef; /* One Place_t on the boundary of each wall. */ } CellTopology_t; /* A data structure that lists all elements on the boundary of a cell {c} of the map. [!!! This should be just a {Topology_t} for the submap that comprises the cell's star !!!]. */ CellTopology_t *MakeCellTopology(Place_t p); /* Returns the elements of the boundary of the cell Pneg(Dual(a))==Org(a). Note that `PWedge(a)->@{edge->?}' is an @{edge->?} of the dual map. */ bool_t TriviallyIsomorphic(Topology_t *ta, Topology_t *tb); /* True iff {ta} and {tb} are topologically isomorphic, with the trivial isomorphism (that is, if elements with same index have the same topological relationship in both). */ #define Map_H_author \ "C Interface created by J. Stolfi in jan/2007.\n" \ "Partly based on Modula-3 interfaces by L.A.P.Lozada (1999)\n"\ "and R.M.Rosi (1994)." #endif