Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2 of the GNU General Public License as 00007 published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU General Public License along 00021 with this program; if not, write the Free Software Foundation, Inc., 59 00022 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00023 00024 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00025 Mountain View, CA 94043, or: 00026 00027 http://www.sgi.com 00028 00029 For further information regarding this notice, see: 00030 00031 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00032 00033 */ 00034 00035 00036 #ifndef MFMC_DEFS_H_INCLUDED 00037 #define MFMC_DEFS_H_INCLUDED "mfmc_defs.h" 00038 00039 #include "mfmc.h" 00040 00041 typedef struct mfmc_arc MFMC_ARC; 00042 typedef struct mfmc_node MFMC_NODE; 00043 typedef struct mfmc_layer MFMC_LAYER; 00044 00045 typedef enum { 00046 SOURCE, 00047 USER_SOURCE, 00048 TRANSSHIPMENT, /* the default */ 00049 USER_SINK, 00050 SINK 00051 } NODE_TYPE; 00052 00053 /* Possible TODO: Separate the MFMC_HANDLE structure into two 00054 * structures with different lifetimes. The primary handle structure 00055 * will live throughout, but there will be a secondary structure that 00056 * lives only during initialization and contains temporary information 00057 * required to set the problem up. After initialization, the secondary 00058 * structure can be freed. Also, maybe add an optional statistics 00059 * structure. 00060 */ 00061 00062 struct mfmc_handle { 00063 MEM_POOL *mem_pool; /* where to get memory from */ 00064 BOOL trace; /* whether to spit out tracing info */ 00065 INT32 n; /* number of nodes in the problem we 00066 * solve 00067 */ 00068 INT32 m; /* number of forward arcs in the 00069 * problem we solve 00070 */ 00071 MFMC_NODE *the_source; /* the source in the problem we solve */ 00072 MFMC_NODE *the_sink; /* the sink in the problem we solve */ 00073 MFMC_NODE *nodes; /* array of nodes in our problem */ 00074 MFMC_ARC *arcs; /* array of arcs in our problem */ 00075 INT64 *acap; /* original arc capacities */ 00076 INT64 max_cap; /* maximum capacity magnitude in input */ 00077 INT64 flow_value; /* objective function value */ 00078 00079 /* fields for algorithm overhead outside the problem description */ 00080 MFMC_NODE **queue; /* queue of nodes for (backward) BFS */ 00081 MFMC_LAYER *layers; /* structure of distance-estimate 00082 * levels for node selection 00083 */ 00084 00085 /* -------------- fields for performance statistics -------------- */ 00086 MFMC_STATS stats; /* block of statistics counts */ 00087 00088 /* --------------- fields below are only for setup --------------- */ 00089 00090 INT32 user_n; /* number of nodes the user gives us */ 00091 INT32 user_m; /* number of arcs the user gives us */ 00092 INT32 n_sources; /* number of sources promised */ 00093 INT32 n_sources_set; /* number of sources set by the user */ 00094 INT32 n_sinks; /* number of sinks promised */ 00095 INT32 n_sinks_set; /* number of sinks set by the user */ 00096 INT32 *arc_tail; /* temporary for use in arc ordering */ 00097 INT32 *arc_first; /* temporary for use in arc ordering */ 00098 MFMC_ARC *arc_current; /* temporary for use in arc ordering */ 00099 INT32 pos_current; /* temporary for use in arc ordering */ 00100 }; 00101 00102 struct mfmc_arc 00103 { 00104 INT64 r_cap; /* residual capacity */ 00105 MFMC_NODE *head; /* head */ 00106 MFMC_ARC *reverse; /* opposite arc */ 00107 MFMC_ARC *next; /* next arc with the same tail; 00108 * TODO: is this field needed? 00109 */ 00110 }; 00111 00112 struct mfmc_node 00113 { 00114 MFMC_ARC *first; /* first outgoing arc */ 00115 MFMC_ARC *current; /* current incident arc */ 00116 INT64 excess; /* excess of the node */ 00117 INT32 rank; /* distance from the sink */ 00118 MFMC_NODE *nl_next; /* next node in layer-list */ 00119 MFMC_NODE *nl_prev; /* previous node in layer-list */ 00120 00121 /* -------------- fields below are only for setup ------------- */ 00122 NODE_TYPE node_type; 00123 }; 00124 00125 struct mfmc_layer 00126 { 00127 MFMC_NODE *push_first; /* 1st node with positive excess */ 00128 MFMC_NODE *trans_first; /* 1st node with zero excess */ 00129 }; 00130 00131 BOOL MFMC_Find_max_flow_min_cut(INT32, /* n */ 00132 MFMC_NODE *, /* nodes */ 00133 MFMC_ARC *, /* arcs */ 00134 INT64 *, /* original capacities */ 00135 MFMC_NODE *, /* the source */ 00136 MFMC_NODE *, /* the sink */ 00137 MFMC_NODE **, /* BFS queue */ 00138 MFMC_LAYER *, /* distance levels */ 00139 INT64, /* flow upper bound */ 00140 MFMC_STATS *, /* statistics block */ 00141 INT64 *); /* flow value */ 00142 #endif