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

Small cleanup.

parent 355a6c2a
No related branches found
No related tags found
No related merge requests found
...@@ -134,7 +134,8 @@ class Cell { ...@@ -134,7 +134,8 @@ class Cell {
return size; } return size; }
// get the (orig: original) cell boundary // get the (orig: original) cell boundary
void getBoundary(std::map<Cell*, short int, Less_Cell >& boundary, bool orig=false){ void getBoundary(std::map<Cell*, short int, Less_Cell>& boundary,
bool orig=false){
boundary.clear(); boundary.clear();
for(biter it = firstBoundary(); it != lastBoundary(); it++){ for(biter it = firstBoundary(); it != lastBoundary(); it++){
Cell* cell = it->first; Cell* cell = it->first;
...@@ -142,7 +143,8 @@ class Cell { ...@@ -142,7 +143,8 @@ class Cell {
if(orig && it->second.geto() != 0) boundary[cell] = it->second.geto(); if(orig && it->second.geto() != 0) boundary[cell] = it->second.geto();
} }
} }
void getCoboundary(std::map<Cell*, short int, Less_Cell >& coboundary, bool orig = false){ void getCoboundary(std::map<Cell*, short int, Less_Cell>& coboundary,
bool orig=false){
coboundary.clear(); coboundary.clear();
for(biter it = firstCoboundary(); it != lastCoboundary(); it++){ for(biter it = firstCoboundary(); it != lastCoboundary(); it++){
Cell* cell = it->first; Cell* cell = it->first;
...@@ -182,13 +184,13 @@ class Cell { ...@@ -182,13 +184,13 @@ class Cell {
// tools for combined cells // tools for combined cells
bool isCombined() const { return _combined; } bool isCombined() const { return _combined; }
virtual void getCells( std::map< Cell*, int, Less_Cell >& cells) {
typedef std::map<Cell*, int, Less_Cell>::iterator citer;
virtual void getCells(std::map<Cell*, int, Less_Cell>& cells) {
cells.clear(); cells.clear();
cells[this] = 1; cells[this] = 1;
return;
} }
virtual int getNumCells() const {return 1;} virtual int getNumCells() const { return 1; }
typedef std::map<Cell*, int, Less_Cell>::iterator citer;
bool operator==(const Cell& c2) const { bool operator==(const Cell& c2) const {
return (this->getNum() == c2.getNum()); return (this->getNum() == c2.getNum());
......
...@@ -203,8 +203,8 @@ int CellComplex::reduction(int dim, bool omit, ...@@ -203,8 +203,8 @@ int CellComplex::reduction(int dim, bool omit,
citer cit = firstCell(dim-1); citer cit = firstCell(dim-1);
while(cit != lastCell(dim-1)){ while(cit != lastCell(dim-1)){
Cell* cell = *cit; Cell* cell = *cit;
if( cell->getCoboundarySize() == 1 if(cell->getCoboundarySize() == 1 &&
&& inSameDomain(cell, cell->firstCoboundary()->first)){ inSameDomain(cell, cell->firstCoboundary()->first)){
cit++; cit++;
if(dim == getDim() && omit){ if(dim == getDim() && omit){
omittedCells.push_back(cell->firstCoboundary()->first); omittedCells.push_back(cell->firstCoboundary()->first);
...@@ -576,6 +576,9 @@ bool CellComplex::restoreComplex() ...@@ -576,6 +576,9 @@ bool CellComplex::restoreComplex()
_deleteCount++; _deleteCount++;
} }
_newcells.clear(); _newcells.clear();
Msg::Info("Restored Cell Complex:");
Msg::Info(" %d volumes, %d faces, %d edges and %d vertices",
getSize(3), getSize(2), getSize(1), getSize(0));
return true; return true;
} }
else { else {
......
...@@ -278,13 +278,13 @@ void Chain<C>::addMeshElement(MElement* e, C coeff) ...@@ -278,13 +278,13 @@ void Chain<C>::addMeshElement(MElement* e, C coeff)
template <class C> template <class C>
void Chain<C>::addElemChain(const ElemChain& c, C coeff) void Chain<C>::addElemChain(const ElemChain& c, C coeff)
{ {
if(coeff == 0) return;
if(_dim != -1 && _dim != c.getDim()) { if(_dim != -1 && _dim != c.getDim()) {
Msg::Error("Cannot add %d-elementrary chain to %d-chain", Msg::Error("Cannot add elementrary d%-chain to %d-chain",
c.getDim(), _dim); c.getDim(), _dim);
return; return;
} }
if(_dim == -1) _dim = c.getDim(); if(_dim == -1) _dim = c.getDim();
if(coeff == 0) return;
std::pair<ecit, bool> ii = _elemChains.insert( std::make_pair(c, coeff) ); std::pair<ecit, bool> ii = _elemChains.insert( std::make_pair(c, coeff) );
if(!ii.second) { if(!ii.second) {
ii.first->second += coeff*c.compareOrientation(ii.first->first); ii.first->second += coeff*c.compareOrientation(ii.first->first);
...@@ -310,7 +310,7 @@ Chain<C>& Chain<C>::operator*=(const C& coeff) ...@@ -310,7 +310,7 @@ Chain<C>& Chain<C>::operator*=(const C& coeff)
for(ecit it = _elemChains.begin(); it != _elemChains.end(); it++) for(ecit it = _elemChains.begin(); it != _elemChains.end(); it++)
it->second *= coeff; it->second *= coeff;
return *this; return *this;
} }
template <class C> template <class C>
void Chain<C>::addToModel(GModel* m, bool post) const void Chain<C>::addToModel(GModel* m, bool post) const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment