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

No commit message

No commit message
parent f787c2c2
No related branches found
No related tags found
No related merge requests found
...@@ -1446,6 +1446,57 @@ bool GFaceCompound::checkAspectRatio() const ...@@ -1446,6 +1446,57 @@ bool GFaceCompound::checkAspectRatio() const
} }
void GFaceCompound::coherenceNormals()
{
std::map<MEdge, std::set<MTriangle*>, Less_Edge > edge2tris;
for(int i=0; i< triangles.size(); i++){
MTriangle *t = triangles[i];
for (int j=0; j<3; j++){
MEdge me = t->getEdge(j);
std::map<MEdge, std::set<MTriangle*>, Less_Edge >::iterator it = edge2tris.find(me);
if (it == edge2tris.end()) {
std::set<MTriangle*> mySet;
mySet.insert(t);
edge2tris.insert(std::make_pair(me, mySet));
}
else{
std::set<MTriangle*> mySet = it->second;
mySet.insert(t);
it->second = mySet;
}
}
}
std::set<MTriangle* > touched;
int iE, si, iE2, si2;
touched.insert(triangles[0]);
while(touched.size() != triangles.size()){
for(int i = 0; i< triangles.size(); i++){
MTriangle *t = triangles[i];
std::set<MTriangle*>::iterator it2 = touched.find(t);
if(it2 != touched.end()){
for (int j=0; j<3; j++){
MEdge me = t->getEdge(j);
t->getEdgeInfo(me, iE,si);
std::map<MEdge, std::set<MTriangle*>, Less_Edge >::iterator it = edge2tris.find(me);
std::set<MTriangle*> mySet = it->second;
for(std::set<MTriangle*>::iterator itt = mySet.begin(); itt != mySet.end(); itt++){
if (*itt != t){
(*itt)->getEdgeInfo(me,iE2,si2);
if(si == si2) (*itt)->revert();
touched.insert(*itt);
}
}
}
}
}
}
return;
}
void GFaceCompound::buildAllNodes() const void GFaceCompound::buildAllNodes() const
{ {
......
...@@ -101,6 +101,7 @@ class GFaceCompound : public GFace { ...@@ -101,6 +101,7 @@ class GFaceCompound : public GFace {
virtual int genusGeom () const; virtual int genusGeom () const;
virtual bool checkTopology() const; virtual bool checkTopology() const;
bool parametrize() const ; bool parametrize() const ;
void coherenceNormals();
void partitionFaceCM(); void partitionFaceCM();
virtual std::list<GFace*> getCompounds() const {return _compound;}; virtual std::list<GFace*> getCompounds() const {return _compound;};
mutable int nbSplit; mutable int nbSplit;
......
...@@ -1454,6 +1454,7 @@ void partitionAndRemesh(GFaceCompound *gf) ...@@ -1454,6 +1454,7 @@ void partitionAndRemesh(GFaceCompound *gf)
} }
Msg::Info("*** Mesh of surface %d done by assembly remeshed faces", gf->tag()); Msg::Info("*** Mesh of surface %d done by assembly remeshed faces", gf->tag());
gf->coherenceNormals();
gf->meshStatistics.status = GFace::DONE; gf->meshStatistics.status = GFace::DONE;
//CreateOutputFile("toto.msh", CTX::instance()->mesh.format); //CreateOutputFile("toto.msh", CTX::instance()->mesh.format);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment