gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
partitionFace.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_FACE_H
7 #define PARTITION_FACE_H
8 
9 #include "GModel.h"
10 #include "discreteFace.h"
11 
12 class partitionFace : public discreteFace {
13 private:
14  std::vector<int> _partitions;
16 
17 public:
18  partitionFace(GModel *model, int num, const std::vector<int> &partitions)
19  : discreteFace(model, num), _partitions(partitions), _parentEntity(nullptr)
20  {
21  }
23  : discreteFace(model, num), _partitions(), _parentEntity(nullptr)
24  {
25  }
26  partitionFace(GModel *model, const std::vector<int> &partitions)
27  : discreteFace(model), _partitions(partitions), _parentEntity(nullptr)
28  {
29  }
30  virtual ~partitionFace() {}
31  virtual GeomType geomType() const { return PartitionSurface; }
32  virtual bool haveParametrization() { return false; }
33  virtual void setParentEntity(GEntity *f) { _parentEntity = f; }
34  virtual GEntity *getParentEntity() { return _parentEntity; }
35  virtual void setPartitions(std::vector<int> &partitions)
36  {
37  _partitions = partitions;
38  }
39  virtual const std::vector<int> &getPartitions() const { return _partitions; }
40  virtual int getPartition(std::size_t index) const
41  {
42  return _partitions[index];
43  }
44  virtual std::size_t numPartitions() const { return _partitions.size(); }
45 };
46 
48  : public std::binary_function<partitionFace *, partitionFace *, bool> {
49  bool operator()(const partitionFace *e1, const partitionFace *e2) const
50  {
51  if(e1->numPartitions() < e2->numPartitions()) return true;
52  if(e1->numPartitions() > e2->numPartitions()) return false;
53  for(std::size_t i = 0; i < e1->numPartitions(); i++) {
54  if(e1->getPartition(i) < e2->getPartition(i)) return true;
55  if(e1->getPartition(i) > e2->getPartition(i)) return false;
56  }
57  return false;
58  }
59 };
60 
61 #endif
partitionFace::partitionFace
partitionFace(GModel *model, int num)
Definition: partitionFace.h:22
GEntity::model
GModel * model() const
Definition: GEntity.h:277
partitionFacePtrLessThan::operator()
bool operator()(const partitionFace *e1, const partitionFace *e2) const
Definition: partitionFace.h:49
LegendrePolynomials::f
void f(int n, double u, double *val)
Definition: orthogonalBasis.cpp:77
partitionFace::partitionFace
partitionFace(GModel *model, int num, const std::vector< int > &partitions)
Definition: partitionFace.h:18
partitionFace
Definition: partitionFace.h:12
partitionFace::geomType
virtual GeomType geomType() const
Definition: partitionFace.h:31
partitionFace::_parentEntity
GEntity * _parentEntity
Definition: partitionFace.h:15
partitionFace::getPartitions
virtual const std::vector< int > & getPartitions() const
Definition: partitionFace.h:39
partitionFace::getPartition
virtual int getPartition(std::size_t index) const
Definition: partitionFace.h:40
GEntity
Definition: GEntity.h:31
partitionFacePtrLessThan
Definition: partitionFace.h:48
partitionFace::haveParametrization
virtual bool haveParametrization()
Definition: partitionFace.h:32
GModel
Definition: GModel.h:44
partitionFace::setPartitions
virtual void setPartitions(std::vector< int > &partitions)
Definition: partitionFace.h:35
discreteFace.h
GEntity::GeomType
GeomType
Definition: GEntity.h:88
partitionFace::partitionFace
partitionFace(GModel *model, const std::vector< int > &partitions)
Definition: partitionFace.h:26
GEntity::PartitionSurface
@ PartitionSurface
Definition: GEntity.h:123
partitionFace::~partitionFace
virtual ~partitionFace()
Definition: partitionFace.h:30
partitionFace::_partitions
std::vector< int > _partitions
Definition: partitionFace.h:14
partitionFace::setParentEntity
virtual void setParentEntity(GEntity *f)
Definition: partitionFace.h:33
GModel.h
partitionFace::getParentEntity
virtual GEntity * getParentEntity()
Definition: partitionFace.h:34
partitionFace::numPartitions
virtual std::size_t numPartitions() const
Definition: partitionFace.h:44
discreteFace
Definition: discreteFace.h:18