gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
filters.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 // Contributor(s):
7 // Boris Sedji
8 //
9 
10 #ifndef FILTERS_H
11 #define FILTERS_H
12 
13 #include "dofManager.h"
14 #include "GModel.h"
15 #include "groupOfElements.h"
16 #include "gmshLevelset.h"
17 template <class scalar> class simpleFunction;
18 
20 private:
21  std::set<int> *_tagEnrichedVertex;
22  std::set<int> *_enrichComp;
23 
24 public:
25  FilterNodeEnriched(std::set<int> *TagEnrichedVertex,
26  std::set<int> *EnrichComp)
27  {
28  _tagEnrichedVertex = TagEnrichedVertex;
29  _enrichComp = EnrichComp;
30  }
31  virtual ~FilterNodeEnriched() {}
32 
33  virtual bool operator()(Dof &key) const
34  {
35  std::set<int>::iterator it1;
36  std::set<int>::iterator it2;
37  int i1, i2;
38  Dof::getTwoIntsFromType(key.getType(), i1, i2);
39  it2 = _enrichComp->find(i1);
40  it1 = _tagEnrichedVertex->find(key.getEntity());
41  if((it1 != _tagEnrichedVertex->end()) && (it2 != _enrichComp->end()))
42  return true;
43  else
44  return false;
45  }
46  // std::vector<int> * getEnrichComp(){return _enrichComp;}
47 
48  // void SetEnrichedVertex(MElement *elep, std::vector<int> &
49  // EnrichedVertex,int &nbdofs)
50  // {
51  // EnrichedVertex.clear();
52  // nbdofs = 0;
53  // for (int i=0 ;i<elep->getNumVertices();i++)
54  // {
55  // std::set<int>::iterator it;
56  // it = _tagEnrichedVertex->find(elep->getVertex(i)->getNum());
57  // if (it!=_tagEnrichedVertex->end())
58  // {
59  // EnrichedVertex.push_back(i);
60  // nbdofs = nbdofs + 1*_enrichComp->size(); // enriched dof
61  // }
62  // }
63  // }
64 };
65 
67 private:
68  std::set<int> _tagEnrichedVertex;
69  std::pair<int, int> _levelSetEntity;
70  std::set<int> *_enrichComp;
71 
72 public:
73  FilterElementsCutByLevelSet(std::pair<int, int> LevelSetEntity,
74  std::set<int> *EnrichComp)
75  {
76  _enrichComp = EnrichComp;
77  _levelSetEntity = LevelSetEntity;
78  // groupOfElements to get all the elements associate with the level set --
79  // (work with *current GModel)
80  groupOfElements *LevelSetElements =
82  // tag enriched vertex determination
83  auto it = LevelSetElements->begin();
84  for(; it != LevelSetElements->end(); it++) {
85  MElement *e = *it;
86  if(e->getParent()) { // if element got parents
87  for(std::size_t k = 0; k < e->getParent()->getNumVertices();
88  ++k) { // for all vertices in the element parent
89  _tagEnrichedVertex.insert(e->getParent()->getVertex(k)->getNum());
90  }
91  }
92  }
93  }
95  virtual bool operator()(Dof &key) const
96  {
97  std::set<int>::const_iterator it1;
98  std::set<int>::const_iterator it2;
99  int i1, i2;
100  Dof::getTwoIntsFromType(key.getType(), i1, i2);
101  it2 = _enrichComp->find(i1);
102  it1 = _tagEnrichedVertex.find(key.getEntity());
103  if((it1 != _tagEnrichedVertex.end()) && (it2 != _enrichComp->end())) {
104  return true;
105  }
106  else
107  return false;
108  }
109 };
110 
111 #endif
FilterNodeEnriched::_enrichComp
std::set< int > * _enrichComp
Definition: filters.h:22
FilterElementsCutByLevelSet::_levelSetEntity
std::pair< int, int > _levelSetEntity
Definition: filters.h:69
groupOfElements::end
elementContainer::const_iterator end() const
Definition: groupOfElements.h:56
FilterNodeEnriched::~FilterNodeEnriched
virtual ~FilterNodeEnriched()
Definition: filters.h:31
Dof::getTwoIntsFromType
static void getTwoIntsFromType(int t, int &i1, int &i2)
Definition: dofManager.h:32
MElement::getParent
virtual MElement * getParent() const
Definition: MElement.h:231
MVertex::getNum
std::size_t getNum() const
Definition: MVertex.h:86
groupOfElements
Definition: groupOfElements.h:24
FilterNodeEnriched
Definition: filters.h:19
MElement::getVertex
virtual const MVertex * getVertex(int num) const =0
FilterElementsCutByLevelSet::_enrichComp
std::set< int > * _enrichComp
Definition: filters.h:70
simpleFunction
Definition: GModel.h:30
Dof::getType
int getType() const
Definition: dofManager.h:27
Dof
Definition: dofManager.h:19
FilterElementsCutByLevelSet::_tagEnrichedVertex
std::set< int > _tagEnrichedVertex
Definition: filters.h:68
MElement
Definition: MElement.h:30
dofManager.h
Dof::getEntity
long int getEntity() const
Definition: dofManager.h:26
groupOfElements::begin
elementContainer::const_iterator begin() const
Definition: groupOfElements.h:55
FilterNodeEnriched::FilterNodeEnriched
FilterNodeEnriched(std::set< int > *TagEnrichedVertex, std::set< int > *EnrichComp)
Definition: filters.h:25
FilterElementsCutByLevelSet::~FilterElementsCutByLevelSet
virtual ~FilterElementsCutByLevelSet()
Definition: filters.h:94
GModel.h
ElementType::getNumVertices
int getNumVertices(int type)
Definition: ElementType.cpp:456
FilterElementsCutByLevelSet::FilterElementsCutByLevelSet
FilterElementsCutByLevelSet(std::pair< int, int > LevelSetEntity, std::set< int > *EnrichComp)
Definition: filters.h:73
FilterNodeEnriched::_tagEnrichedVertex
std::set< int > * _tagEnrichedVertex
Definition: filters.h:21
FilterNodeEnriched::operator()
virtual bool operator()(Dof &key) const
Definition: filters.h:33
groupOfElements.h
FilterElementsCutByLevelSet::operator()
virtual bool operator()(Dof &key) const
Definition: filters.h:95
gmshLevelset.h
FilterElementsCutByLevelSet
Definition: filters.h:66