19 if(
c1->getNum() != 0)
return (
c1->getNum() < c2->
getNum());
25 for(
int i = 0; i <
c1->getNumSortedVertices(); i++) {
35 const std::vector<MVertex *> &v2)
37 if(v1.size() != v2.size())
return false;
38 for(std::size_t i = 0; i < v1.size(); i++)
39 if(v1[i]->getNum() != v2[i]->getNum())
return false;
54 for(std::size_t i = 0; i <
element->getNumPrimaryVertices(); i++)
55 cell->
_v.push_back(
element->getVertex(i));
81 for(std::size_t i = 0; i <
element->getNumPrimaryVertices(); i++)
101 std::map<MVertex *, int, MVertexPtrLessThan> si;
103 bool noinsert =
false;
104 for(std::size_t i = 0; i <
_v.size(); i++)
105 noinsert = (!si.insert(std::make_pair(
_v[i], i)).second || noinsert);
107 if(noinsert ==
true) {
108 Msg::Warning(
"The input mesh has degenerate elements, ignored");
112 for(
auto it = si.begin(); it != si.end(); it++)
_si.push_back(it->second);
126 case 1: vertices.push_back(
_v[i]);
return;
130 for(
int j = 0; j < 2; j++)
134 for(
int j = 0; j < 2; j++)
142 for(
int j = 0; j < 3; j++)
147 for(
int j = 0; j < 3; j++)
150 for(
int j = 0; j < 4; j++)
155 for(
int j = 0; j < 3; j++)
158 for(
int j = 0; j < 4; j++)
162 for(
int j = 0; j < 4; j++)
215 std::vector<MVertex *> v;
488 for(std::size_t i = 0; i <
_v.size(); i++) {
491 auto it = std::find(v.begin(), v.end(), vertex);
500 for(
auto cit =
_cells.begin(); cit !=
_cells.end(); cit++) {
501 if(cit->first->hasVertex(vertex))
return true;
509 printf(
" Vertices:");
529 std::vector<Cell *> toRemove;
532 if(it->second.get() == 0) toRemove.push_back(it->first);
534 for(std::size_t i = 0; i < toRemove.size(); i++)
_cbd.erase(toRemove[i]);
538 if(it->second.get() == 0) toRemove.push_back(it->first);
540 for(std::size_t i = 0; i < toRemove.size(); i++)
_bd.erase(toRemove[i]);
545 auto it =
_bd.find(cell);
546 if(it !=
_bd.end()) {
547 int newOrientation = it->second.get() + orientation;
548 it->second.set(newOrientation);
549 if(newOrientation == 0) {
550 it->first->removeCoboundaryCell(
this,
false);
551 if(it->second.geto() == 0) {
_bd.erase(it); }
556 _bd.insert(std::make_pair(cell,
BdInfo(orientation)));
562 auto it =
_cbd.find(cell);
563 if(it !=
_cbd.end()) {
564 int newOrientation = it->second.get() + orientation;
565 it->second.set(newOrientation);
566 if(newOrientation == 0) {
567 it->first->removeBoundaryCell(
this,
false);
568 if(it->second.geto() == 0) {
_cbd.erase(it); }
573 _cbd.insert(std::make_pair(cell,
BdInfo(orientation)));
579 auto it =
_bd.find(cell);
580 if(it !=
_bd.end()) {
582 if(other) it->first->removeCoboundaryCell(
this,
false);
583 if(it->second.geto() == 0)
_bd.erase(it);
589 auto it =
_cbd.find(cell);
590 if(it !=
_cbd.end()) {
592 if(other) it->first->removeBoundaryCell(
this,
false);
593 if(it->second.geto() == 0)
_cbd.erase(it);
600 auto it =
_bd.find(cell);
601 if(it !=
_bd.end() && it->second.get() != 0)
return true;
605 auto it =
_bd.find(cell);
606 if(it !=
_bd.end() && it->second.geto() != 0)
return true;
614 auto it =
_cbd.find(cell);
615 if(it !=
_cbd.end() && it->second.get() != 0)
return true;
619 auto it =
_cbd.find(cell);
620 if(it !=
_cbd.end() && it->second.geto() != 0)
return true;
627 auto it =
_bd.begin();
629 while(it->second.get() == 0 && it !=
_bd.end()) it++;
631 while(it->second.geto() == 0 && it !=
_bd.end()) it++;
639 auto it =
_cbd.begin();
641 while(it->second.get() == 0 && it !=
_cbd.end()) it++;
643 while(it->second.geto() == 0 && it !=
_cbd.end()) it++;
652 for(
auto bit =
_bd.begin(); bit !=
_bd.end(); bit++) {
653 if(!orig && bit->second.get() != 0)
655 else if(orig && bit->second.geto() != 0)
664 for(
auto bit =
_cbd.begin(); bit !=
_cbd.end(); bit++) {
665 if(!orig && bit->second.get() != 0)
667 else if(orig && bit->second.geto() != 0)
678 Cell *cell = it->first;
679 if(!orig && it->second.get() != 0) boundary[cell] = it->second.get();
680 if(orig && it->second.geto() != 0) boundary[cell] = it->second.geto();
685 std::map<Cell *, short int, CellPtrLessThan> &coboundary,
bool orig)
689 Cell *cell = it->first;
690 if(!orig && it->second.get() != 0) coboundary[cell] = it->second.get();
691 if(orig && it->second.geto() != 0) coboundary[cell] = it->second.geto();
698 printf(
"Boundary cell orientation: %d ", it->second.get());
699 Cell *cell2 = it->first;
703 printf(
"Cell boundary is empty. \n");
710 printf(
"Coboundary cell orientation: %d, ", it->second.get());
711 Cell *cell2 = it->first;
714 printf(
"Cell coboundary is empty. \n");
735 std::map<Cell *, int, CellPtrLessThan> c2Cells;
737 for(
auto cit = c2Cells.begin(); cit != c2Cells.end(); cit++) {
738 if(!orMatch) (*cit).second = -1 * (*cit).second;
743 for(
auto it =
c1->firstBoundary(); it !=
c1->lastBoundary(); it++) {
744 Cell *cell = it->first;
745 int ori = it->second.get();
746 if(ori == 0)
continue;
751 Cell *cell = it->first;
752 if(!orMatch) it->second.set(-1 * it->second.get());
753 int ori = it->second.get();
754 if(ori == 0)
continue;
762 for(
auto it =
c1->firstCoboundary(); it !=
c1->lastCoboundary(); it++) {
763 Cell *cell = it->first;
764 int ori = it->second.get();
765 if(ori == 0)
continue;
770 Cell *cell = it->first;
771 if(!orMatch) it->second.set(-1 * it->second.get());
772 int ori = it->second.get();
773 if(ori == 0)
continue;
775 if(!co && !
c1->hasCoboundary(cell)) {
786 _domain = cells.at(0)->getDomain();
791 for(std::size_t i = 0; i < cells.size(); i++) {
792 Cell *
c = cells.at(i);