gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Def->Set change in lemon/circulation.h
0 1 0
default
1 file changed with 12 insertions and 12 deletions:
↑ Collapse diff ↑
Ignore white space 96 line context
... ...
@@ -124,159 +124,159 @@
124 124
           class _DeltaMap=typename _Graph::template NodeMap<
125 125
             typename _UCapMap::Value>,
126 126
           class _Traits=CirculationDefaultTraits<_Graph, _LCapMap,
127 127
                                                  _UCapMap, _DeltaMap> >
128 128
  class Circulation {
129 129

	
130 130
    typedef _Traits Traits;
131 131
    typedef typename Traits::Digraph Digraph;
132 132
    TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
133 133

	
134 134
    typedef typename Traits::Value Value;
135 135

	
136 136
    typedef typename Traits::LCapMap LCapMap;
137 137
    typedef typename Traits::UCapMap UCapMap;
138 138
    typedef typename Traits::DeltaMap DeltaMap;
139 139
    typedef typename Traits::FlowMap FlowMap;
140 140
    typedef typename Traits::Elevator Elevator;
141 141
    typedef typename Traits::Tolerance Tolerance;
142 142

	
143 143
    typedef typename Digraph::template NodeMap<Value> ExcessMap;
144 144

	
145 145
    const Digraph &_g;
146 146
    int _node_num;
147 147

	
148 148
    const LCapMap *_lo;
149 149
    const UCapMap *_up;
150 150
    const DeltaMap *_delta;
151 151

	
152 152
    FlowMap *_flow;
153 153
    bool _local_flow;
154 154

	
155 155
    Elevator* _level;
156 156
    bool _local_level;
157 157

	
158 158
    ExcessMap* _excess;
159 159

	
160 160
    Tolerance _tol;
161 161
    int _el;
162 162

	
163 163
  public:
164 164

	
165 165
    typedef Circulation Create;
166 166

	
167 167
    ///\name Named template parameters
168 168

	
169 169
    ///@{
170 170

	
171 171
    template <typename _FlowMap>
172
    struct DefFlowMapTraits : public Traits {
172
    struct SetFlowMapTraits : public Traits {
173 173
      typedef _FlowMap FlowMap;
174 174
      static FlowMap *createFlowMap(const Digraph&) {
175 175
        LEMON_ASSERT(false, "FlowMap is not initialized");
176 176
        return 0; // ignore warnings
177 177
      }
178 178
    };
179 179

	
180 180
    /// \brief \ref named-templ-param "Named parameter" for setting
181 181
    /// FlowMap type
182 182
    ///
183 183
    /// \ref named-templ-param "Named parameter" for setting FlowMap
184 184
    /// type
185 185
    template <typename _FlowMap>
186
    struct DefFlowMap
186
    struct SetFlowMap
187 187
      : public Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
188
                           DefFlowMapTraits<_FlowMap> > {
188
                           SetFlowMapTraits<_FlowMap> > {
189 189
      typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
190
                          DefFlowMapTraits<_FlowMap> > Create;
190
                          SetFlowMapTraits<_FlowMap> > Create;
191 191
    };
192 192

	
193 193
    template <typename _Elevator>
194
    struct DefElevatorTraits : public Traits {
194
    struct SetElevatorTraits : public Traits {
195 195
      typedef _Elevator Elevator;
196 196
      static Elevator *createElevator(const Digraph&, int) {
197 197
        LEMON_ASSERT(false, "Elevator is not initialized");
198 198
        return 0; // ignore warnings
199 199
      }
200 200
    };
201 201

	
202 202
    /// \brief \ref named-templ-param "Named parameter" for setting
203 203
    /// Elevator type
204 204
    ///
205 205
    /// \ref named-templ-param "Named parameter" for setting Elevator
206 206
    /// type
207 207
    template <typename _Elevator>
208
    struct DefElevator
208
    struct SetElevator
209 209
      : public Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
210
                           DefElevatorTraits<_Elevator> > {
210
                           SetElevatorTraits<_Elevator> > {
211 211
      typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
212
                          DefElevatorTraits<_Elevator> > Create;
212
                          SetElevatorTraits<_Elevator> > Create;
213 213
    };
214 214

	
215 215
    template <typename _Elevator>
216
    struct DefStandardElevatorTraits : public Traits {
216
    struct SetStandardElevatorTraits : public Traits {
217 217
      typedef _Elevator Elevator;
218 218
      static Elevator *createElevator(const Digraph& digraph, int max_level) {
219 219
        return new Elevator(digraph, max_level);
220 220
      }
221 221
    };
222 222

	
223 223
    /// \brief \ref named-templ-param "Named parameter" for setting
224 224
    /// Elevator type
225 225
    ///
226 226
    /// \ref named-templ-param "Named parameter" for setting Elevator
227 227
    /// type. The Elevator should be standard constructor interface, ie.
228 228
    /// the digraph and the maximum level should be passed to it.
229 229
    template <typename _Elevator>
230
    struct DefStandardElevator
230
    struct SetStandardElevator
231 231
      : public Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
232
                       DefStandardElevatorTraits<_Elevator> > {
232
                       SetStandardElevatorTraits<_Elevator> > {
233 233
      typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
234
                      DefStandardElevatorTraits<_Elevator> > Create;
234
                      SetStandardElevatorTraits<_Elevator> > Create;
235 235
    };
236 236

	
237 237
    /// @}
238 238

	
239 239
  protected:
240 240

	
241 241
    Circulation() {}
242 242

	
243 243
  public:
244 244

	
245 245
    /// The constructor of the class.
246 246

	
247 247
    /// The constructor of the class.
248 248
    /// \param g The digraph the algorithm runs on.
249 249
    /// \param lo The lower bound capacity of the arcs.
250 250
    /// \param up The upper bound capacity of the arcs.
251 251
    /// \param delta The lower bound on node excess.
252 252
    Circulation(const Digraph &g,const LCapMap &lo,
253 253
                const UCapMap &up,const DeltaMap &delta)
254 254
      : _g(g), _node_num(),
255 255
        _lo(&lo),_up(&up),_delta(&delta),_flow(0),_local_flow(false),
256 256
        _level(0), _local_level(false), _excess(0), _el() {}
257 257

	
258 258
    /// Destrcutor.
259 259
    ~Circulation() {
260 260
      destroyStructures();
261 261
    }
262 262

	
263 263
  private:
264 264

	
265 265
    void createStructures() {
266 266
      _node_num = _el = countNodes(_g);
267 267

	
268 268
      if (!_flow) {
269 269
        _flow = Traits::createFlowMap(_g);
270 270
        _local_flow = true;
271 271
      }
272 272
      if (!_level) {
273 273
        _level = Traits::createElevator(_g, _node_num);
274 274
        _local_level = true;
275 275
      }
276 276
      if (!_excess) {
277 277
        _excess = new ExcessMap(_g);
278 278
      }
279 279
    }
280 280

	
281 281
    void destroyStructures() {
282 282
      if (_local_flow) {
0 comments (0 inline)