1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
// Gmsh - Copyright (C) 1997-2020 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
//
// Contributor(s):
// Boris Sedji
//
#ifndef FILTERS_H
#define FILTERS_H
#include "dofManager.h"
#include "GModel.h"
#include "groupOfElements.h"
#include "gmshLevelset.h"
template <class scalar> class simpleFunction;
class FilterNodeEnriched {
private:
std::set<int> *_tagEnrichedVertex;
std::set<int> *_enrichComp;
public:
FilterNodeEnriched(std::set<int> *TagEnrichedVertex,
std::set<int> *EnrichComp)
{
_tagEnrichedVertex = TagEnrichedVertex;
_enrichComp = EnrichComp;
}
virtual ~FilterNodeEnriched() {}
virtual bool operator()(Dof &key) const
{
std::set<int>::iterator it1;
std::set<int>::iterator it2;
int i1, i2;
Dof::getTwoIntsFromType(key.getType(), i1, i2);
it2 = _enrichComp->find(i1);
it1 = _tagEnrichedVertex->find(key.getEntity());
if((it1 != _tagEnrichedVertex->end()) && (it2 != _enrichComp->end()))
return true;
else
return false;
}
// std::vector<int> * getEnrichComp(){return _enrichComp;}
// void SetEnrichedVertex(MElement *elep, std::vector<int> &
// EnrichedVertex,int &nbdofs)
// {
// EnrichedVertex.clear();
// nbdofs = 0;
// for (int i=0 ;i<elep->getNumVertices();i++)
// {
// std::set<int>::iterator it;
// it = _tagEnrichedVertex->find(elep->getVertex(i)->getNum());
// if (it!=_tagEnrichedVertex->end())
// {
// EnrichedVertex.push_back(i);
// nbdofs = nbdofs + 1*_enrichComp->size(); // enriched dof
// }
// }
// }
};
class FilterElementsCutByLevelSet {
private:
std::set<int> _tagEnrichedVertex;
std::pair<int, int> _levelSetEntity;
std::set<int> *_enrichComp;
public:
FilterElementsCutByLevelSet(std::pair<int, int> LevelSetEntity,
std::set<int> *EnrichComp)
{
_enrichComp = EnrichComp;
_levelSetEntity = LevelSetEntity;
// groupOfElements to get all the elements associate with the level set --
// (work with *current GModel)
groupOfElements *LevelSetElements =
new groupOfElements(_levelSetEntity.first, _levelSetEntity.second);
// tag enriched vertex determination
std::set<MElement *>::const_iterator it = LevelSetElements->begin();
for(; it != LevelSetElements->end(); it++) {
MElement *e = *it;
if(e->getParent()) { // if element got parents
for(std::size_t k = 0; k < e->getParent()->getNumVertices();
++k) { // for all vertices in the element parent
_tagEnrichedVertex.insert(e->getParent()->getVertex(k)->getNum());
}
}
}
}
virtual ~FilterElementsCutByLevelSet() {}
virtual bool operator()(Dof &key) const
{
std::set<int>::const_iterator it1;
std::set<int>::const_iterator it2;
int i1, i2;
Dof::getTwoIntsFromType(key.getType(), i1, i2);
it2 = _enrichComp->find(i1);
it1 = _tagEnrichedVertex.find(key.getEntity());
if((it1 != _tagEnrichedVertex.end()) && (it2 != _enrichComp->end())) {
return true;
}
else
return false;
}
};
#endif
|