diff --git a/Geo/CellComplex.cpp b/Geo/CellComplex.cpp index b6f025039847ac954258a87a7b8c2644cfa6cb7e..cf39f61202a9d4d05ccbd625bb3df18c05eb7a02 100644 --- a/Geo/CellComplex.cpp +++ b/Geo/CellComplex.cpp @@ -85,7 +85,6 @@ bool CellComplex::_insertCells(std::vector<MElement*>& elements, if(type == TYPE_PYR || type == TYPE_PRI || type == TYPE_POLYG || type == TYPE_POLYH) { Msg::Error("Mesh element type %d not implemented in homology solver", type); - return false; } if(type == TYPE_QUA || type == TYPE_HEX) _simplicial = false; @@ -226,26 +225,10 @@ bool CellComplex::_immunizeCells(std::vector<MElement*>& elements) CellComplex::~CellComplex() { for(int i = 0; i < 4; i++){ - if(_saveorig) { - for(citer cit = _ocells[i].begin(); cit != _ocells[i].end(); cit++){ - Cell* cell = *cit; - delete cell; - _deleteCount++; - } - for(citer cit = _cells[i].begin(); cit != _cells[i].end(); cit++){ - Cell* cell = *cit; - if(cell->isCombined()) { - delete cell; - _deleteCount++; - } - } - } - else { - for(citer cit = _cells[i].begin(); cit != _cells[i].end(); cit++){ - Cell* cell = *cit; - delete cell; - _deleteCount++; - } + for(citer cit = _cells[i].begin(); cit != _cells[i].end(); cit++){ + Cell* cell = *cit; + delete cell; + _deleteCount++; } } @@ -295,10 +278,7 @@ void CellComplex::removeCell(Cell* cell, bool other, bool del) else _numRelativeCells[dim] -= 1; } if(!erased) Msg::Debug("Tried to remove a cell from the cell complex \n"); - if(!_saveorig && (!del || !cell->isCombined())) - _removedcells.push_back(cell); - else if (!del && cell->isCombined()) - _removedcells.push_back(cell); + else if(!del) _removedcells.push_back(cell); } void CellComplex::enqueueCells(std::map<Cell*, short int, Less_Cell>& cells, @@ -582,6 +562,7 @@ int CellComplex::coreduceComplex(int combine, bool omit, int heuristic) cit++; } } + for(int j = 1; j <= getDim(); j++) count += coreduction(j, -1, empty); @@ -751,8 +732,8 @@ int CellComplex::combine(int dim) CombinedCell* newCell = new CombinedCell(c1, c2, (or1 != or2)); _createCount++; - removeCell(c1, true, true); - removeCell(c2, true, true); + removeCell(c1, true, c1->isCombined()); + removeCell(c2, true, c2->isCombined()); insertCell(newCell); cit = firstCell(dim); @@ -835,8 +816,8 @@ int CellComplex::cocombine(int dim) CombinedCell* newCell = new CombinedCell(c1, c2, (or1 != or2), true ); _createCount++; - removeCell(c1, true, true); - removeCell(c2, true, true); + removeCell(c1, true, c1->isCombined()); + removeCell(c2, true, c2->isCombined()); insertCell(newCell); cit = firstCell(dim); diff --git a/Geo/Homology.cpp b/Geo/Homology.cpp index 8d527d3e571a81a0fb93d58e4e5aa213a726d7f8..1e8f66e340ba018cbdaa8bbae58ab18333642462 100644 --- a/Geo/Homology.cpp +++ b/Geo/Homology.cpp @@ -169,6 +169,7 @@ Homology::~Homology() void Homology::findHomologyBasis(std::vector<int> dim) { + double t0 = Cpu(); std::string domain = _getDomainString(_domain, _subdomain); Msg::Info(""); Msg::Info("To compute domain (%s) homology spaces", domain.c_str()); @@ -237,6 +238,9 @@ void Homology::findHomologyBasis(std::vector<int> dim) Msg::Info("H_2 = %d", _betti[2]); Msg::Info("H_3 = %d", _betti[3]); + double t3 = Cpu(); + Msg::Info("Done computing (%s) homology spaces (%g s)", + domain.c_str(), t3 - t0); Msg::StatusBar(false, "H_0: %d, H_1: %d, H_2: %d, H_3: %d", _betti[0], _betti[1], _betti[2], _betti[3]); @@ -248,6 +252,7 @@ void Homology::findHomologyBasis(std::vector<int> dim) void Homology::findCohomologyBasis(std::vector<int> dim) { + double t0 = Cpu(); std::string domain = _getDomainString(_domain, _subdomain); Msg::Info(""); Msg::Info("To compute domain (%s) cohomology spaces", domain.c_str()); @@ -321,6 +326,9 @@ void Homology::findCohomologyBasis(std::vector<int> dim) Msg::Info("H^2 = %d", _betti[2]); Msg::Info("H^3 = %d", _betti[3]); + double t3 = Cpu(); + Msg::Info("Done computing (%s) cohomology spaces (%g s)", + domain.c_str(), t3 - t0); Msg::StatusBar(false, "H^0: %d, H^1: %d, H^2: %d, H^3: %d", _betti[0], _betti[1], _betti[2], _betti[3]); @@ -427,6 +435,7 @@ void Homology::findCompatibleBasisPair(int master, std::vector<int> dim) void Homology::_addToModel(int dim, bool co, bool post, int physicalNumRequest) const { + if(dim < 0 || dim > 3) return; int pgnum = -1; std::vector<int> physicals; if(!co) {