| 1 |
/** |
| 2 |
* @file |
| 3 |
* @brief makes @ref maze with @ref mkMaze for routing orthogonal edges |
| 4 |
*/ |
| 5 |
|
| 6 |
/************************************************************************* |
| 7 |
* Copyright (c) 2011 AT&T Intellectual Property |
| 8 |
* All rights reserved. This program and the accompanying materials |
| 9 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 10 |
* which accompanies this distribution, and is available at |
| 11 |
* https://www.eclipse.org/legal/epl-v10.html |
| 12 |
* |
| 13 |
* Contributors: Details at https://graphviz.org |
| 14 |
*************************************************************************/ |
| 15 |
|
| 16 |
#pragma once |
| 17 |
|
| 18 |
#include <ortho/sgraph.h> |
| 19 |
#include <stddef.h> |
| 20 |
|
| 21 |
enum {M_RIGHT=0, M_TOP, M_LEFT, M_BOTTOM}; |
| 22 |
|
| 23 |
#define MZ_ISNODE 1 |
| 24 |
#define MZ_VSCAN 2 |
| 25 |
#define MZ_HSCAN 4 |
| 26 |
#define MZ_SMALLV 8 |
| 27 |
#define MZ_SMALLH 16 |
| 28 |
|
| 29 |
/// @brief cell corresponds to node |
| 30 |
#define IsNode(cp) (cp->flags & MZ_ISNODE) |
| 31 |
/// @brief cell already inserted in vertical channel |
| 32 |
#define IsVScan(cp) (cp->flags & MZ_VSCAN) |
| 33 |
/// @brief cell already inserted in horizontal channel |
| 34 |
#define IsHScan(cp) (cp->flags & MZ_HSCAN) |
| 35 |
/// @brief cell has small height corresponding to a small height node |
| 36 |
#define IsSmallV(cp) (cp->flags & MZ_SMALLV) |
| 37 |
/// @brief cell has small width corresponding to a small width node |
| 38 |
#define IsSmallH(cp) (cp->flags & MZ_SMALLH) |
| 39 |
|
| 40 |
/// @brief result of partitioning available space, part of @ref maze |
| 41 |
|
| 42 |
typedef struct cell { |
| 43 |
int flags; |
| 44 |
int nedges; |
| 45 |
sedge* edges[6]; /**< @brief up to six links (@ref sedge) between |
| 46 |
four @ref sides (@ref snode) of the cell |
| 47 |
1. ┘ left — top |
| 48 |
2. └ top — right |
| 49 |
3. ┐ left — bottom |
| 50 |
4. ┌ bottom — right |
| 51 |
5. │ top — bottom |
| 52 |
6. ─ left — right |
| 53 |
*/ |
| 54 |
size_t nsides; |
| 55 |
snode** sides; ///< @brief up to four sides: @ref M_RIGHT, @ref M_TOP, @ref M_LEFT, @ref M_BOTTOM |
| 56 |
boxf bb; |
| 57 |
} cell; |
| 58 |
|
| 59 |
/** |
| 60 |
* @struct maze |
| 61 |
* @brief available channels for orthogonal edges around nodes of @ref graph_t |
| 62 |
* |
| 63 |
* A maze is the result of partitioning free space around a graph's nodes by @ref mkMaze. |
| 64 |
*/ |
| 65 |
|
| 66 |
typedef struct { |
| 67 |
size_t ncells; |
| 68 |
size_t ngcells; |
| 69 |
cell* cells; ///< @brief cells not corresponding to graph nodes |
| 70 |
cell* gcells; ///< @brief cells corresponding to graph nodes |
| 71 |
sgraph* sg; ///< @brief search graph |
| 72 |
Dt_t* hchans; ///< @brief set of horizontal @ref channel "channels", created by @ref extractHChans. |
| 73 |
Dt_t* vchans; ///< @brief set of vertical @ref channel "channels", created by @ref extractVChans |
| 74 |
} maze; |
| 75 |
|
| 76 |
extern maze* mkMaze(graph_t*); |
| 77 |
extern void freeMaze (maze*); |
| 78 |
void updateWts (sgraph* g, cell* cp, sedge* ep); |
| 79 |
#ifdef DEBUG |
| 80 |
extern int odb_flags; |
| 81 |
#define ODB_MAZE 1 |
| 82 |
#define ODB_SGRAPH 2 |
| 83 |
#define ODB_ROUTE 4 |
| 84 |
#define ODB_CHANG 8 |
| 85 |
#define ODB_IGRAPH 16 |
| 86 |
#endif |