Skip to content
Snippets Groups Projects
Commit 262b1281 authored by Matti Pellika's avatar Matti Pellika
Browse files

Simplify

parent 4fa51484
No related branches found
No related tags found
No related merge requests found
......@@ -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,28 +225,12 @@ 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(unsigned int i = 0; i < _removedcells.size(); i++) {
delete _removedcells.at(i);
......@@ -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);
......
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment