gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
groupOfElements.cpp
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 #include "groupOfElements.h"
7 #include "GModel.h"
8 #include "GEntity.h"
9 
11 {
12  elementFilterTrivial filter;
13  addElementary(gf, filter);
14 }
15 
17 {
18  elementFilterTrivial filter;
19  addElementary(gr, filter);
20 }
21 
22 groupOfElements::groupOfElements(std::vector<MElement *> &elems)
23 {
24  elementFilterTrivial filter;
25  for(auto it = elems.begin(); it != elems.end();
26  it++) {
27  MElement *e = *it;
28  if(filter(e)) {
29  insert(e);
30  }
31  }
32 }
33 
35 {
36  for(std::size_t j = 0; j < ge->getNumMeshElements(); j++) {
37  MElement *e = ge->getMeshElement(j);
38  if(filter(e)) {
39  insert(e);
40  }
41  }
42 }
43 
44 void groupOfElements::addPhysical(int dim, int physical,
45  const elementFilter &filter)
46 {
47  std::map<int, std::vector<GEntity *> > groups[4];
49  std::vector<GEntity *> &ent = groups[dim][physical];
50  for(std::size_t i = 0; i < ent.size(); i++) {
51  addElementary(ent[i], filter);
52  }
53 }
GFace
Definition: GFace.h:33
GEntity.h
groupOfElements::addPhysical
virtual void addPhysical(int dim, int physical)
Definition: groupOfElements.h:43
GEntity
Definition: GEntity.h:31
GModel::getPhysicalGroups
void getPhysicalGroups(std::map< int, std::vector< GEntity * > > groups[4]) const
Definition: GModel.cpp:837
GEntity::getNumMeshElements
virtual std::size_t getNumMeshElements() const
Definition: GEntity.h:348
MElement
Definition: MElement.h:30
elementFilter
Definition: groupOfElements.h:13
GRegion
Definition: GRegion.h:28
elementFilterTrivial
Definition: groupOfElements.h:19
GEntity::getMeshElement
virtual MElement * getMeshElement(std::size_t index) const
Definition: GEntity.h:363
groupOfElements::insert
void insert(MElement *e)
Definition: groupOfElements.h:72
groupOfElements::groupOfElements
groupOfElements()
Definition: groupOfElements.h:35
GModel.h
groupOfElements::addElementary
virtual void addElementary(GEntity *ge, const elementFilter &f)
Definition: groupOfElements.cpp:34
groupOfElements.h
GModel::current
static GModel * current(int index=-1)
Definition: GModel.cpp:136