gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
partitionEdge.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #ifndef PARTITION_EDGE_H
7 #define PARTITION_EDGE_H
8 
9 #include "GModel.h"
10 #include "discreteEdge.h"
11 
12 class partitionEdge : public discreteEdge {
13 private:
14  std::vector<int> _partitions;
16 
17 public:
19  const std::vector<int> &partitions)
20  : discreteEdge(model, num, _v0, _v1), _partitions(partitions),
21  _parentEntity(nullptr)
22  {
23  }
24  partitionEdge(GModel *model, int num, const std::vector<int> &partitions)
25  : discreteEdge(model, num), _partitions(partitions), _parentEntity(nullptr)
26  {
27  }
28  partitionEdge(GModel *model, const std::vector<int> &partitions)
29  : discreteEdge(model), _partitions(partitions), _parentEntity(nullptr)
30  {
31  }
32  virtual ~partitionEdge() {}
33  virtual GeomType geomType() const { return PartitionCurve; }
34  virtual bool haveParametrization() { return false; }
35  virtual void setParentEntity(GEntity *e) { _parentEntity = e; }
36  virtual GEntity *getParentEntity() { return _parentEntity; }
37  virtual void setPartitions(std::vector<int> &partitions)
38  {
39  _partitions = partitions;
40  }
41  virtual const std::vector<int> &getPartitions() const { return _partitions; }
42  virtual int getPartition(std::size_t index) const
43  {
44  return _partitions[index];
45  }
46  virtual std::size_t numPartitions() const { return _partitions.size(); }
47 };
48 
50  : public std::binary_function<partitionEdge *, partitionEdge *, bool> {
51  bool operator()(const partitionEdge *e1, const partitionEdge *e2) const
52  {
53  if(e1->numPartitions() < e2->numPartitions()) return true;
54  if(e1->numPartitions() > e2->numPartitions()) return false;
55  for(std::size_t i = 0; i < e1->numPartitions(); i++) {
56  if(e1->getPartition(i) < e2->getPartition(i)) return true;
57  if(e1->getPartition(i) > e2->getPartition(i)) return false;
58  }
59  return false;
60  }
61 };
62 
63 #endif
partitionEdge
Definition: partitionEdge.h:12
partitionEdge::getPartition
virtual int getPartition(std::size_t index) const
Definition: partitionEdge.h:42
GEntity::model
GModel * model() const
Definition: GEntity.h:277
discreteEdge
Definition: discreteEdge.h:12
partitionEdge::getParentEntity
virtual GEntity * getParentEntity()
Definition: partitionEdge.h:36
partitionEdge::partitionEdge
partitionEdge(GModel *model, int num, GVertex *_v0, GVertex *_v1, const std::vector< int > &partitions)
Definition: partitionEdge.h:18
GEntity
Definition: GEntity.h:31
GEntity::PartitionCurve
@ PartitionCurve
Definition: GEntity.h:122
partitionEdge::partitionEdge
partitionEdge(GModel *model, const std::vector< int > &partitions)
Definition: partitionEdge.h:28
GVertex
Definition: GVertex.h:23
partitionEdge::_parentEntity
GEntity * _parentEntity
Definition: partitionEdge.h:15
GModel
Definition: GModel.h:44
partitionEdge::haveParametrization
virtual bool haveParametrization()
Definition: partitionEdge.h:34
partitionEdgePtrLessThan
Definition: partitionEdge.h:50
partitionEdge::getPartitions
virtual const std::vector< int > & getPartitions() const
Definition: partitionEdge.h:41
GEntity::GeomType
GeomType
Definition: GEntity.h:88
partitionEdge::setParentEntity
virtual void setParentEntity(GEntity *e)
Definition: partitionEdge.h:35
partitionEdge::geomType
virtual GeomType geomType() const
Definition: partitionEdge.h:33
partitionEdge::numPartitions
virtual std::size_t numPartitions() const
Definition: partitionEdge.h:46
partitionEdge::setPartitions
virtual void setPartitions(std::vector< int > &partitions)
Definition: partitionEdge.h:37
discreteEdge.h
partitionEdge::~partitionEdge
virtual ~partitionEdge()
Definition: partitionEdge.h:32
GEdge::_v0
GVertex * _v0
Definition: GEdge.h:35
GEdge::_v1
GVertex * _v1
Definition: GEdge.h:35
partitionEdge::partitionEdge
partitionEdge(GModel *model, int num, const std::vector< int > &partitions)
Definition: partitionEdge.h:24
GModel.h
partitionEdgePtrLessThan::operator()
bool operator()(const partitionEdge *e1, const partitionEdge *e2) const
Definition: partitionEdge.h:51
partitionEdge::_partitions
std::vector< int > _partitions
Definition: partitionEdge.h:14