MineLink
 All Data Structures Functions Variables Pages
ramps.h
1 #ifndef __RAMPS_H__
2 #define __RAMPS_H__
3 
4 #include <vector>
5 #include <string>
6 #include <utility>
7 
8 #include "../../data_structures/precs/precs.h"
9 #include "../../data_structures/bm/blockmodel.h"
10 #include "../../data_structures/bm/blocksel.h"
11 
12 #include <iostream>
13 #include <cstdlib>
14 
15 /*using std::string;
16 using std::vector;
17 using std::pair;*/
18 using namespace std;
19 
20 namespace delphos{
21 
25 class RampPrecedence : public Precedence {
26 
27 public:
28 
32  static double ZTolerance;
33 
43  RampPrecedence(delphos::BlockModel& bm, const double& neighbor_distance);
44 
53  RampPrecedence(delphos::BlockModel& bm, const double& neighbor_distance, const string& ramp_attr_name);
54 
63  RampPrecedence(delphos::BlockModel& bm, const double& neighbor_distance, const string& ramp_attr_name, const string& neighbor_attr_name);
64 
72  RampPrecedence(delphos::BlockModel& bm, const double& neighbor_distance, const vector<delphos::BlockIndexType>& ramps);
73 
82  RampPrecedence(delphos::BlockModel& bm, const double& neighbor_distance, const vector<delphos::BlockIndexType>& ramps, const string& neighbor_attr_name);
83 
91  const double& NeighborDistance() const;
92 
99  const double& GetNeighborDistance() const;
100 
106  void AddRamp(const delphos::BlockIndexType& block_id);
107 
115  void AddRamp(const double& x, const double& y, const double& z);
116 
124  bool IsRamp(const delphos::BlockIndexType& block_id) const;
125 
133  bool IsRamp(const double& x, const double& y, const double& z) const;
134 
141  void RemoveRamp(const delphos::BlockIndexType& block_id);
142 
149  void RemoveRamp(const double& x, const double& y, const double& z);
150 
154  void CreateArcs();
155 
162  delphos::BlockSelection* UnreachableBlocks();
163 
169  delphos::BlockSelection* GetUnreachableBlocks();
170 
178  const string& NeighborAttribute() const;
179 
186  const string& GetNeighborAttribute() const;
187 
193  delphos::BlockIndexType BlockRamp(const BlockIndexType& block_id) const;
194 
199  delphos::BlockIndexType GetBlockRamp(const BlockIndexType& block_id) const;
200 
206  delphos::BlockSelection Leaves(const BlockIndexType& block_id);
207 
212  delphos::BlockSelection GetLeaves(const BlockIndexType& block_id);
213 
217  vector<delphos::BlockIndexType> * GetAccesses() const;
221  virtual ~RampPrecedence();
222 
223 private:
224  vector<BlockIndexType>* _ramps;
225  double _xy_dist;
226  const string _neighbor_attr;
227  BlockSelection* _unreachablebs;
228  typedef pair<pair<BlockIndexType,BlockIndexType>,double> Edge;
229  vector<Edge> * CreateNeighborEdges();
230  typedef pair<BlockIndexType,BlockIndexType> RampAssign;
231  vector<RampAssign>* _rampaccess;
232 
233 };
234 }
235 #endif
236 
Abstracts a set of blocks (subset of a blockmodel).
Definition: blocksel.h:33
static double ZTolerance
The tolerance to determine if 2 blocks are neighbours.
Definition: ramps.h:32
horizontal precedence class with utility methods.
Definition: ramps.h:25
Abstracts a container of blocks as a table with arbitrary number of attributes that can be accessed b...
Definition: blockmodel.h:62
Implements a precedence as an explicit set of arcs between blocks. Provides utility functions...
Definition: precs.h:22