diff --git a/Geo/CellComplex.cpp b/Geo/CellComplex.cpp index 97dd976a421a49f6bc988f6d3f9ff293c7d9aa59..7162aefca01548b6132a36cf79ea3b32c2d01302 100644 --- a/Geo/CellComplex.cpp +++ b/Geo/CellComplex.cpp @@ -717,8 +717,8 @@ int CellComplex::cocombine(int dim){ it++; int or2 = (*it).second; Cell* c2 = (*it).first; - - if(!(*c1 == *c2) + + if(!(*c1 == *c2) && abs(or1) == abs(or2) && inSameDomain(s, c1) && inSameDomain(s, c2) && c1->getNumVertices() < getSize(dim) // heuristics for mammoth cell birth control && c2->getNumVertices() < getSize(dim)){ @@ -771,12 +771,13 @@ int CellComplex::combine(int dim){ bd_c = cell->getBoundary(); enqueueCells(bd_c, Q, Qset); while(Q.size() != 0){ - + Cell* s = Q.front(); Q.pop(); cbd_c = s->getOrientedCoboundary(); if(s->getCoboundarySize() == 2){ + std::map<Cell*, int, Less_Cell>::iterator it = cbd_c.begin(); int or1 = (*it).second; Cell* c1 = (*it).first; @@ -784,7 +785,7 @@ int CellComplex::combine(int dim){ int or2 = (*it).second; Cell* c2 = (*it).first; - if(!(*c1 == *c2) + if(!(*c1 == *c2) && abs(or1) == abs(or2) && inSameDomain(s, c1) && inSameDomain(s, c2) && c1->getNumVertices() < getSize(dim) // heuristics for mammoth cell birth control && c2->getNumVertices() < getSize(dim)){ diff --git a/Geo/CellComplex.h b/Geo/CellComplex.h index c5a901e6c7c8382ddde06eb8748a43d0ce74f54c..92ac46b1949342d4518ce0ec5e4b06fa7e5702b2 100644 --- a/Geo/CellComplex.h +++ b/Geo/CellComplex.h @@ -66,7 +66,9 @@ class Cell // for some algorithms to omit this cell bool _immune; - + + + // mutable list of cells on the boundary and on the coboundary of this cell std::map< Cell*, int, Less_Cell > _boundary; std::map< Cell*, int, Less_Cell > _coboundary; diff --git a/Geo/ChainComplex.cpp b/Geo/ChainComplex.cpp index 77e528b9cb559a66210552ca9baf7bb24ebf4115..172fe594e721428fb0381020be120cf9f03ac441 100644 --- a/Geo/ChainComplex.cpp +++ b/Geo/ChainComplex.cpp @@ -88,67 +88,26 @@ ChainComplex::ChainComplex(CellComplex* cellComplex){ gmp_matrix_get_elem(elem, bdCell->getIndex(), cell->getIndex(), _HMatrix[dim]); old_elem = mpz_get_si(elem); mpz_set_si(elem, old_elem + (*it).second); - if( (old_elem + (*it).second) > 1 || (old_elem + (*it).second) < -1 ){ + /*if( (old_elem + (*it).second) > 1 || (old_elem + (*it).second) < -1 ){ printf("Warning: Invalid incidence index: %d! HMatrix: %d.", (old_elem + (*it).second), dim); printf(" Set to %d. \n", (old_elem + (*it).second) % 2); mpz_set_si(elem, (old_elem + (*it).second) % 2); - } + }*/ gmp_matrix_set_elem(elem, bdCell->getIndex(), cell->getIndex(), _HMatrix[dim]); } } } } - } - - mpz_clear(elem); - - } - - /* - else{ - - long int elems[rows*cols]; - - std::set<Cell*, Less_Cell>::iterator high = cellComplex->firstCell(dim); - std::set<Cell*, Less_Cell>::iterator low = cellComplex->firstCell(dim-1); - - unsigned int i = 0; - while(i < rows*cols){ - while(low != cellComplex->lastCell(dim-1)){ - Cell* lowcell = *low; - Cell* highcell = *high; - if(!(highcell->inSubdomain() || lowcell->inSubdomain())){ - - - std::list< std::pair<int, Cell*> >bdHigh = highcell->getBoundary(); - for(std::list< std::pair<int, Cell*> >::iterator it = bdHigh.begin(); it != bdHigh.end(); it++){ - Cell* bdCell = (*it).second; - if(bdCell->getTag() == lowcell->getTag()) elems[i] = (*it).first; - else elems[i] = 0; - } - - - elems[i] = cellComplex->kappa(*high, *low); - i++; - } - low++; - } - low = cellComplex->firstCell(dim-1); - high++; - } - _HMatrix[dim] = create_gmp_matrix_int(rows, cols, elems); + } + mpz_clear(elem); } - */ - _kerH[dim] = NULL; _codH[dim] = NULL; _JMatrix[dim] = NULL; _QMatrix[dim] = NULL; - _Hbasis[dim] = NULL; - + _Hbasis[dim] = NULL; } - return; }