Skip to content
Snippets Groups Projects
Commit b01261ae authored by Emilie Marchandise's avatar Emilie Marchandise
Browse files

Stats quad vertices degree

parent 980e34fb
No related branches found
No related tags found
No related merge requests found
......@@ -184,7 +184,7 @@ statisticsWindow::statisticsWindow(int deltaFontSize)
void statisticsWindow::compute(bool elementQuality)
{
//emi hack
//emi hack - MINIMUM ANGLES
// double minAngle = 120.0;
// double meanAngle = 0.0;
// int count = 0;
......@@ -205,6 +205,43 @@ void statisticsWindow::compute(bool elementQuality)
// printf("Angles = min=%g av=%g \n", minAngle, meanAngle);
//hack emi
//Emi hack - MESH DEGREE VERTICES
std::vector<GEntity*> entities;
GModel::current()->getEntities(entities);
std::map<MVertex*, int > vert2Deg;
for(unsigned int i = 0; i < entities.size(); i++){
if(entities[i]->dim() < 2) continue;
for(unsigned int j = 0; j < entities[i]->getNumMeshElements(); j++){
MElement *e = entities[i]->getMeshElement(j);
for(unsigned int k = 0; k < e->getNumVertices(); k++){
MVertex *v = e->getVertex(k);
if (v->onWhat()->dim() < 2) continue;
std::map<MVertex*, int >::iterator it = vert2Deg.find(v);
if (it == vert2Deg.end()) {
vert2Deg.insert(std::make_pair(v,1));
}
else{
int nbE = it->second+1;
it->second = nbE;
}
}
}
}
int dMin = 10;
int dMax = 0;
int d4 = 0;
int nbElems = vert2Deg.size();
std::map<MVertex*, int >::const_iterator itmap = vert2Deg.begin();
for(; itmap !=vert2Deg.end(); itmap++){
MVertex *v = itmap->first;
int nbE = itmap->second;
dMin = std::min(nbE, dMin);
dMax = std::max(nbE, dMax);
if (nbE == 4) d4 += 1;
}
printf("Stats degree vertices: dMin=%d , dMax=%d, d4=%g \n", dMin, dMax, (double)d4/nbElems);
//end emi hack
int num = 0;
static double s[50];
static char label[50][256];
......
......@@ -794,7 +794,7 @@ static bool meshGenerator(GFace *gf, int RECUR_ITER,
if (Msg::GetVerbosity() == 10){
GEdge *ge = new discreteEdge(gf->model(), 1000, 0, 0);
MElementOctree octree(gf->model());
printf("Writing voronoi and skeleton.pos \n");
Msg::Info("Writing voronoi and skeleton.pos");
doc.Voronoi();
doc.makePosView("voronoi.pos", gf);
doc.printMedialAxis(octree.getInternalOctree(), "skeleton.pos", gf, ge);
......
......@@ -133,8 +133,10 @@ void GMSH_DistancePlugin::printView(std::vector<GEntity*> _entities,
}
fprintf(fName,"){");
for (unsigned int i = 0; i < dist.size(); i++){
if (_minScale > 0)
if (_minScale > 0 && _maxScale > 0)
dist[i]=_minScale+((dist[i]-minDist)/(maxDist-minDist))*(_maxScale-_minScale);
else if (_minScale > 0 && _maxScale < 0)
dist[i]=_minScale+dist[i];
out->push_back(dist[i]);
if (i) fprintf(fName,",%g", dist[i]);
else fprintf(fName,"%g", dist[i]);
......
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