[Gmsh] Extruded mesh new algorithm again

mb mi.benham at free.fr
Thu May 10 20:02:29 CEST 2007


Hello

Sorry for my previous mail, the code I posted in it was totally
wrong.... The good phase1 method must be the following:

void phase1(GRegion *gr,
	    std::set<MVertex*, MVertexLessThanLexicographic> &pos,
	    std::set<std::pair<MVertex*, MVertex*> > &edges)
{
  ExtrudeParams *ep = gr->meshAttributes.extrude;
  GFace *from = gr->model()->faceByTag(std::abs(ep->geo.Source));
  if(!from) return;

  for(unsigned int i = 0; i < from->triangles.size(); i++){
    for(int j = 0; j < ep->mesh.NbLayer; j++) {
      for(int k = 0; k < ep->mesh.NbElmLayer[j]; k++) {
	      std::vector<MVertex*> v;
      	if(getExtrudedVertices(from->triangles[i], ep, j, k, pos, v) == 6){
        if(v[1] < v[0])createEdge(v[1], v[3], edges);
        else createEdge(v[0], v[4], edges);
        if(v[1] < v[2])createEdge(v[1], v[5], edges);
        else createEdge(v[4], v[2], edges);
        if(v[0] < v[2])createEdge(v[0], v[5], edges);
        else createEdge(v[3], v[2], edges);
      	}
      }
    }
  }
}

Replacing old one with this, insures that no more swapping is necessary in phase2 so that extrusion always work without the need of tuning parameters, and indeed, 
phase2 find 0 swappings from the 1st iteration, and hence phase2 pass can be avoided.
The full meshGRegionExtruded.cpp is in attachment.

Michel Benhamou, Paris.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: meshGRegionExtruded.cpp
Type: text/x-c++src
Size: 15931 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20070510/46817cfb/attachment.cpp>