From c4c6d08c3bc0e98f8aa0eceaf9e87e7357798423 Mon Sep 17 00:00:00 2001 From: Matti Pellika <matti.pellikka@tut.fi> Date: Thu, 27 Jun 2013 09:04:45 +0000 Subject: [PATCH] Need for info --- Geo/CellComplex.cpp | 11 +++++++++++ Geo/CellComplex.h | 7 ++----- Geo/ChainComplex.cpp | 4 ++-- Geo/Homology.cpp | 19 +++++++++++++++---- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Geo/CellComplex.cpp b/Geo/CellComplex.cpp index f003cb6891..6638f0fd74 100644 --- a/Geo/CellComplex.cpp +++ b/Geo/CellComplex.cpp @@ -421,6 +421,17 @@ int CellComplex::coreduction(int dim, int omit, return count; } +int CellComplex::getSize(int dim, bool orig) { + if(dim == -1) { + unsigned int size = 0; + if(!orig) for(int i = 0; i < 4; i++) size += _cells[i].size(); + else for(int i = 0; i < 4; i++) size += _ocells[i].size(); + return size; + } + if(!orig) return _cells[dim].size(); + else return _ocells[dim].size(); +} + int CellComplex::getDomain(Cell* cell, std::string& str) { int domain = 0; diff --git a/Geo/CellComplex.h b/Geo/CellComplex.h index 830e7f4767..2f2520128a 100644 --- a/Geo/CellComplex.h +++ b/Geo/CellComplex.h @@ -101,12 +101,9 @@ class CellComplex bool simplicial() const { return _simplicial; } bool relative() const { return _relative; } - - // get the number of certain dimensional cells - int getSize(int dim, bool orig=false){ - if(!orig) return _cells[dim].size(); - else return _ocells[dim].size(); } + // if dim = -1 return the number of all cells + int getSize(int dim, bool orig=false); // get domain of a cell // cell in domain relative to subdomain -> domain = 0 diff --git a/Geo/ChainComplex.cpp b/Geo/ChainComplex.cpp index ff44be42f9..114f90766e 100644 --- a/Geo/ChainComplex.cpp +++ b/Geo/ChainComplex.cpp @@ -661,8 +661,8 @@ void ChainComplex::smoothenChain(std::map<Cell*, int, Less_Cell>& cells) } eraseNullCells(cells); int size = cells.size(); - Msg::Info("Simplified a %d-chain from %d cells to %d cells", - dim, start, size); + Msg::Debug("Simplified a %d-chain from %d cells to %d cells", + dim, start, size); } void ChainComplex::eraseNullCells(std::map<Cell*, int, Less_Cell>& cells) diff --git a/Geo/Homology.cpp b/Geo/Homology.cpp index 2733322dd9..4a42bf3a77 100644 --- a/Geo/Homology.cpp +++ b/Geo/Homology.cpp @@ -181,9 +181,11 @@ void Homology::findHomologyBasis(std::vector<int> dim) if(_cellComplex == NULL) _createCellComplex(); if(_cellComplex->isReduced()) _cellComplex->restoreComplex(); + Msg::StatusBar(true, "Reducing cell complex..."); double t1 = Cpu(); + double size1 = _cellComplex->getSize(-1); _cellComplex->reduceComplex(_combine, _omit); if(_combine > 1 && !_smoothen) { @@ -195,7 +197,9 @@ void Homology::findHomologyBasis(std::vector<int> dim) } double t2 = Cpu(); - Msg::StatusBar(true, "Done reducing cell complex (%g s)", t2 - t1); + double size2 = _cellComplex->getSize(-1); + Msg::StatusBar(true, "Done reducing cell complex (%g s, %g \%)", + t2 - t1, (1.-size2/size1)*100.); Msg::Info("%d volumes, %d faces, %d edges, and %d vertices", _cellComplex->getSize(3), _cellComplex->getSize(2), _cellComplex->getSize(1), _cellComplex->getSize(0)); @@ -265,9 +269,10 @@ void Homology::findCohomologyBasis(std::vector<int> dim) if(_cellComplex == NULL) _createCellComplex(); if(_cellComplex->isReduced()) _cellComplex->restoreComplex(); - Msg::StatusBar(true, "Reducing cell complex..."); + Msg::StatusBar(true, "Reducing cell complex..."); double t1 = Cpu(); + double size1 = _cellComplex->getSize(-1); _cellComplex->coreduceComplex(_combine, _omit, _heuristic); @@ -281,8 +286,10 @@ void Homology::findCohomologyBasis(std::vector<int> dim) } double t2 = Cpu(); + double size2 = _cellComplex->getSize(-1); - Msg::StatusBar(true, "Done reducing cell complex (%g s)", t2 - t1); + Msg::StatusBar(true, "Done reducing cell complex (%g s, %g \%)", + t2 - t1, (1.-size2/size1)*100.); Msg::Info("%d volumes, %d faces, %d edges, and %d vertices", _cellComplex->getSize(3), _cellComplex->getSize(2), _cellComplex->getSize(1), _cellComplex->getSize(0)); @@ -521,11 +528,15 @@ void Homology::findBettiNumbers() Msg::StatusBar(true, "Reducing cell complex..."); double t1 = Cpu(); + double size1 = _cellComplex->getSize(-1); _cellComplex->bettiReduceComplex(); double t2 = Cpu(); - Msg::StatusBar(true, "Done reducing cell complex (%g s)", t2 - t1); + double size2 = _cellComplex->getSize(-1); + + Msg::StatusBar(true, "Done reducing cell complex (%g s, %g \%)", + t2 - t1, (1.-size2/size1)*100.); Msg::Info("%d volumes, %d faces, %d edges, and %d vertices", _cellComplex->getSize(3), _cellComplex->getSize(2), _cellComplex->getSize(1), _cellComplex->getSize(0)); -- GitLab