diff --git a/Geo/CellComplex.cpp b/Geo/CellComplex.cpp index 3b4e06baba8a2ba809208328c1fed919f4ed07fc..b052551d55461b6c38d5ab7041588a305ec45cab 100644 --- a/Geo/CellComplex.cpp +++ b/Geo/CellComplex.cpp @@ -85,7 +85,7 @@ void CellComplex::insertCell(Cell* cell) _newcells.push_back(cell); std::pair<citer, bool> insertInfo = _cells[cell->getDim()].insert(cell); if(!insertInfo.second){ - Msg::Warning("Cell not inserted"); + Msg::Debug("Cell not inserted"); Cell* oldCell = (*insertInfo.first); cell->printCell(); oldCell->printCell(); @@ -246,8 +246,8 @@ int CellComplex::coreduction(int dim, bool omit, int CellComplex::reduceComplex(bool docombine, bool omit) { - Msg::Info("Cell Complex reduction:"); - Msg::Info(" %d volumes, %d faces, %d edges and %d vertices", + Msg::Debug("Cell Complex reduction:"); + Msg::Debug(" %d volumes, %d faces, %d edges and %d vertices", getSize(3), getSize(2), getSize(1), getSize(0)); int count = 0; @@ -277,7 +277,7 @@ int CellComplex::reduceComplex(bool docombine, bool omit) } } - Msg::Info(" %d volumes, %d faces, %d edges and %d vertices", + Msg::Debug(" %d volumes, %d faces, %d edges and %d vertices", getSize(3), getSize(2), getSize(1), getSize(0)); if(docombine) combine(3); @@ -286,7 +286,7 @@ int CellComplex::reduceComplex(bool docombine, bool omit) reduction(1, false, empty); if(docombine) combine(1); - Msg::Info(" %d volumes, %d faces, %d edges and %d vertices", + Msg::Debug(" %d volumes, %d faces, %d edges and %d vertices", getSize(3), getSize(2), getSize(1), getSize(0)); return 0; @@ -306,8 +306,8 @@ void CellComplex::removeSubdomain() int CellComplex::coreduceComplex(bool docombine, bool omit) { - Msg::Info("Cell Complex coreduction:"); - Msg::Info(" %d volumes, %d faces, %d edges and %d vertices", + Msg::Debug("Cell Complex coreduction:"); + Msg::Debug(" %d volumes, %d faces, %d edges and %d vertices", getSize(3), getSize(2), getSize(1), getSize(0)); int count = 0; @@ -342,7 +342,7 @@ int CellComplex::coreduceComplex(bool docombine, bool omit) } } - Msg::Info(" %d volumes, %d faces, %d edges and %d vertices", + Msg::Debug(" %d volumes, %d faces, %d edges and %d vertices", getSize(3), getSize(2), getSize(1), getSize(0)); if(docombine) cocombine(0); @@ -353,7 +353,7 @@ int CellComplex::coreduceComplex(bool docombine, bool omit) coreduction(3, false, empty); coherent(); - Msg::Info(" %d volumes, %d faces, %d edges and %d vertices", + Msg::Debug(" %d volumes, %d faces, %d edges and %d vertices", getSize(3), getSize(2), getSize(1), getSize(0)); return 0; @@ -361,9 +361,9 @@ int CellComplex::coreduceComplex(bool docombine, bool omit) int CellComplex::combine(int dim) { - //Msg::Info("Cell complex before combining:"); - //Msg::Info(" %d volumes, %d faces, %d edges and %d vertices", - // getSize(3), getSize(2), getSize(1), getSize(0)); + Msg::Debug("Cell complex before combining:"); + Msg::Debug(" %d volumes, %d faces, %d edges and %d vertices", + getSize(3), getSize(2), getSize(1), getSize(0)); if(dim < 1 || dim > 3) return 0; std::queue<Cell*> Q; @@ -410,9 +410,9 @@ int CellComplex::combine(int dim) } } - //Msg::Info("Cell complex after combining:"); - //Msg::Info(" %d volumes, %d faces, %d edges and %d vertices", - // getSize(3), getSize(2), getSize(1), getSize(0)); + Msg::Debug("Cell complex after combining:"); + Msg::Debug(" %d volumes, %d faces, %d edges and %d vertices", + getSize(3), getSize(2), getSize(1), getSize(0)); return count; } @@ -420,9 +420,9 @@ int CellComplex::combine(int dim) int CellComplex::cocombine(int dim) { - //Msg::Info("Cell complex before cocombining:"); - //Msg::Info(" %d volumes, %d faces, %d edges and %d vertices", - // getSize(3), getSize(2), getSize(1), getSize(0)); + Msg::Debug("Cell complex before cocombining:"); + Msg::Debug(" %d volumes, %d faces, %d edges and %d vertices", + getSize(3), getSize(2), getSize(1), getSize(0)); if(dim < 0 || dim > 2) return 0; @@ -472,9 +472,9 @@ int CellComplex::cocombine(int dim) } } - //Msg::Info("Cell complex after cocombining:"); - //Msg::Info(" %d volumes, %d faces, %d edges and %d vertices", - // getSize(3), getSize(2), getSize(1), getSize(0)); + Msg::Debug("Cell complex after cocombining:"); + Msg::Debug(" %d volumes, %d faces, %d edges and %d vertices", + getSize(3), getSize(2), getSize(1), getSize(0)); return count; } @@ -493,12 +493,12 @@ bool CellComplex::coherent() int ori = (*it).second; citer cit = _cells[bdCell->getDim()].find(bdCell); if(cit == lastCell(bdCell->getDim())){ - Msg::Warning("Boundary cell not in cell complex! Boundary removed"); + Msg::Debug("Boundary cell not in cell complex! Boundary removed"); cell->removeBoundaryCell(bdCell, false); coherent = false; } if(!bdCell->hasCoboundary(cell)){ - Msg::Warning("Incoherent boundary/coboundary pair! Fixed"); + Msg::Debug("Incoherent boundary/coboundary pair! Fixed"); bdCell->addCoboundaryCell(ori, cell, false); coherent = false; } @@ -512,12 +512,12 @@ bool CellComplex::coherent() int ori = (*it).second; citer cit = _cells[cbdCell->getDim()].find(cbdCell); if(cit == lastCell(cbdCell->getDim())){ - Msg::Warning("Coboundary cell not in cell complex! Coboundary removed"); + Msg::Debug("Coboundary cell not in cell complex! Coboundary removed"); cell->removeCoboundaryCell(cbdCell, false); coherent = false; } if(!cbdCell->hasBoundary(cell)){ - Msg::Warning("Incoherent coboundary/boundary pair! Fixed"); + Msg::Debug("Incoherent coboundary/boundary pair! Fixed"); cbdCell->addBoundaryCell(ori, cell, false); coherent = false; } diff --git a/Geo/ChainComplex.cpp b/Geo/ChainComplex.cpp index da18eec876ddb37109e440d2f14bb752a1318a2c..66b51a27b3c131d1f19d75c9bc7a5ef98de584a6 100644 --- a/Geo/ChainComplex.cpp +++ b/Geo/ChainComplex.cpp @@ -78,7 +78,7 @@ ChainComplex::ChainComplex(CellComplex* cellComplex, int domain) || bdCell->getIndex() < 1 || cell->getIndex() > (int)gmp_matrix_cols( _HMatrix[dim]) || cell->getIndex() < 1){ - Msg::Warning("Index out of bound! HMatrix: %d", dim); + Msg::Debug("Index out of bound! HMatrix: %d", dim); } else{ gmp_matrix_get_elem(elem, bdCell->getIndex(), diff --git a/Geo/Homology.cpp b/Geo/Homology.cpp index 197462d8d5a259bd42f16db1bf5a3e31c47a2d8c..975f4bb941b8026a66a02b705daf51972eb71289 100644 --- a/Geo/Homology.cpp +++ b/Geo/Homology.cpp @@ -9,6 +9,7 @@ #if defined(HAVE_POST) #include "PView.h" +#include "PViewOptions.h" #endif #if defined(HAVE_KBIPACK) @@ -515,21 +516,6 @@ int Chain::createPGroup() physicalInfo[physicalNum] = getName(); physicalMap[entityNum] = physicalInfo; - // hide mesh - /*opt_mesh_points(0, GMSH_SET, 0); - opt_mesh_lines(0, GMSH_SET, 0); - opt_mesh_triangles(0, GMSH_SET, 0); - opt_mesh_quadrangles(0, GMSH_SET, 0); - opt_mesh_tetrahedra(0, GMSH_SET, 0); - opt_mesh_hexahedra(0, GMSH_SET, 0); - opt_mesh_prisms(0, GMSH_SET, 0); - opt_mesh_pyramids(0, GMSH_SET, 0);*/ - - // show post-processing normals, tangents and element boundaries - //opt_view_normals(0, GMSH_SET, 20); - //opt_view_tangents(0, GMSH_SET, 20); - //opt_view_show_element(0, GMSH_SET, 1); - if(!data.empty()){ this->getCellComplex()->getModel()->storeChain(getDim(), entityMap, physicalMap); @@ -537,8 +523,14 @@ int Chain::createPGroup() getDim(), physicalNum); #if defined(HAVE_POST) // create PView for instant visualization - new PView(getName(), "ElementData", this->getCellComplex()->getModel(), - data, 0, 1); + PView* view = new PView(getName(), "ElementData", + this->getCellComplex()->getModel(), data, 0, 1); + // the user should be interested about the orientations + int size = 30; + PViewOptions* opt = view->getOptions(); + if(opt->tangents == 0) opt->tangents = size; + if(opt->normals == 0) opt->normals = size; + view->setOptions(opt); #endif } diff --git a/Geo/Homology.h b/Geo/Homology.h index 65ebee142cceffccba09c6b7fb6b9cb573278bd4..9b664a79e017ce89ba9ebd34945e8fab1af97974 100644 --- a/Geo/Homology.h +++ b/Geo/Homology.h @@ -1,8 +1,8 @@ // Gmsh - Copyright (C) 1997-2011 C. Geuzaine, J.-F. Remacle -// +// // See the LICENSE.txt file for license information. Please report all // bugs and problems to <gmsh@geuz.org>. -// +// // Contributed by Matti Pellikka <matti.pellikka@tut.fi>. #ifndef _HOMOLOGY_H_ @@ -31,7 +31,7 @@ class Chain; class Homology { private: - + // the Gmsh model for homology computation GModel* _model; @@ -41,7 +41,7 @@ class Homology std::vector<int> _subdomain; // corresponding geometrical entities std::vector<GEntity*> _domainEntities; - std::vector<GEntity*> _subdomainEntities; + std::vector<GEntity*> _subdomainEntities; // use cell combining bool _combine; @@ -55,20 +55,20 @@ class Homology // file name to store the results std::string _fileName; - + std::map<int, Chain*> _basisChains; public: - + Homology(GModel* model, std::vector<int> physicalDomain, - std::vector<int> physicalSubdomain, + std::vector<int> physicalSubdomain, bool combine=true, bool omit=true, bool smoothen=true); ~Homology(); - + // create a cell complex from a mesh in geometrical entities of Gmsh CellComplex* createCellComplex(std::vector<GEntity*>& domainEntities, std::vector<GEntity*>& subdomainEntities); - CellComplex* createCellComplex() { + CellComplex* createCellComplex() { return createCellComplex(_domainEntities, _subdomainEntities); } void setFileName(std::string fileName) { _fileName = fileName; } @@ -79,12 +79,12 @@ class Homology // experimental void findHomSequence() {} - void computeRanks() {} - + void computeRanks() {} + // create a string describing the generator std::string getDomainString(const std::vector<int>& domain, const std::vector<int>& subdomain); - + // write the generators to a file bool writeGeneratorsMSH(bool binary=false); // store dim-dimensional cells of cellComplex as a physical group @@ -98,7 +98,7 @@ class Homology // A class representing a chain. // Used to store generators of the homology spaces and visualize them in Gmsh. class Chain { - + private: // cells and their coefficients in this chain std::map< Cell*, int, Less_Cell > _cells; @@ -108,12 +108,12 @@ class Chain { int _num; // cell complex this chain belongs to CellComplex* _cellComplex; - + // torsion coefficient int _torsion; - + int _dim; - + public: Chain(std::map<Cell*, int, Less_Cell>& chain, CellComplex* cellComplex, int num, @@ -126,29 +126,29 @@ class Chain { int getTorsion() const { return _torsion; } int getDim() const { return _dim; } CellComplex* getCellComplex() const { return _cellComplex; } - void getCells(std::map<Cell*, int, Less_Cell> cells) const { + void getCells(std::map<Cell*, int, Less_Cell> cells) const { cells = _cells; } - + // erase cells from the chain with zero coefficient void eraseNullCells(); - - // number of cells in this chain + + // number of cells in this chain int getSize() const { return _cells.size();} - + // get/set chain name std::string getName() const { return _name; } void setName(std::string name) { _name=name; } // get/set physical group number int getNum() const { return _num; } void setNum(int num) { _num=num; } - + // append this chain to a MSH ASCII file as $ElementData // for debugging only int writeChainMSH(const std::string &name); // create a Gmsh physical group from this chain. int createPGroup(); - + }; #endif