17 #if defined(HAVE_FLTK)
21 #if defined(HAVE_KBIPACK)
25 #if defined(HAVE_FLTK)
26 if(FlGui::available()) FlGui::instance()->updateViews(
true,
true);
30 std::string convertInt(
int number)
32 std::stringstream stream;
38 ElemChain::_vertexCache;
40 inline void ElemChain::_sortVertexIndices()
42 std::map<MVertex *, int, MVertexPtrLessThan> si;
44 for(std::size_t i = 0; i < _v.size(); i++) si[_v[i]] = i;
46 for(
auto it = si.begin(); it != si.end(); it++) _si.push_back(it->second);
49 void findEntitiesInPhysicalGroups(
GModel *m,
50 const std::vector<int> &physicalGroups,
51 std::vector<GEntity *> &entities)
53 std::map<int, std::vector<GEntity *> > groups[4];
55 for(std::size_t i = 0; i < physicalGroups.size(); i++) {
57 for(
int j = 0; j < 4; j++) {
58 auto it = groups[j].find(physicalGroups.at(i));
59 if(it != groups[j].end()) {
61 std::vector<GEntity *> physicalGroup = it->second;
62 for(std::size_t k = 0; k < physicalGroup.size(); k++) {
63 entities.push_back(physicalGroup.at(k));
68 Msg::Error(
"Physical group %d does not exist", physicalGroups.at(i));
73 bool ElemChain::_equalVertices(
const std::vector<MVertex *> &v2)
const
75 if(_v.size() != v2.size())
return false;
76 for(std::size_t i = 0; i < _v.size(); i++)
77 if(_v[i]->getNum() != v2[i]->getNum())
return false;
89 ElemChain::ElemChain(
int dim, std::vector<MVertex *> &v) : _dim(dim), _v(v)
94 inline int ElemChain::getSortedVertex(
int i)
const
96 return _v[(int)_si[i]]->getNum();
99 int ElemChain::getTypeMSH(
int dim,
int numVertices)
105 switch(numVertices) {
111 switch(numVertices) {
122 int ElemChain::getTypeMSH()
const
127 MElement *ElemChain::createMeshElement()
const
130 std::vector<MVertex *> v(_v);
131 return factory.
create(this->getTypeMSH(), v);
134 int ElemChain::compareOrientation(
const ElemChain &c2)
const
136 std::vector<MVertex *> v2;
137 c2.getMeshVertices(v2);
140 if(this->_equalVertices(v2))
return perm;
143 if(this->_equalVertices(v2))
return perm;
145 c2.getMeshVertices(v2);
149 if(this->_equalVertices(v2))
return perm;
154 bool ElemChain::lessThan(
const ElemChain &c2)
const
156 if(this->getNumSortedVertices() != c2.getNumSortedVertices())
157 return (this->getNumSortedVertices() < c2.getNumSortedVertices());
158 for(
int i = 0; i < this->getNumSortedVertices(); i++) {
159 if(this->getSortedVertex(i) < c2.getSortedVertex(i))
161 else if(this->getSortedVertex(i) > c2.getSortedVertex(i))
167 int ElemChain::getNumBoundaries(
int dim,
int numVertices)
173 switch(numVertices) {
179 switch(numVertices) {
190 int ElemChain::getNumBoundaryElemChains()
const
195 void ElemChain::getBoundaryVertices(
int i,
int dim,
int numVertices,
196 const std::vector<MVertex *> &v,
197 std::vector<MVertex *> &vertices)
201 case 1: vertices.push_back(v[i]);
return;
203 switch(numVertices) {
205 for(
int j = 0; j < 2; j++)
209 for(
int j = 0; j < 2; j++)
215 switch(numVertices) {
217 for(
int j = 0; j < 3; j++)
222 for(
int j = 0; j < 3; j++)
225 for(
int j = 0; j < 4; j++)
230 for(
int j = 0; j < 3; j++)
233 for(
int j = 0; j < 4; j++)
237 for(
int j = 0; j < 4; j++)
246 ElemChain ElemChain::getBoundaryElemChain(
int i)
const
248 std::vector<MVertex *> vertices;
249 ElemChain::getBoundaryVertices(i, _dim, this->
getNumVertices(), _v, vertices);
250 return ElemChain(_dim - 1, vertices);
253 bool ElemChain::inEntity(
GEntity *e)
const
255 if(_vertexCache[e].empty()) {
262 if(!_vertexCache[e].count(this->getMeshVertex(i)))
return false;