Skip to content
Snippets Groups Projects
Select Git revision
  • a875509bb09d4481dd903881c6252f2f2694a6de
  • master default
  • cgnsUnstructured
  • partitioning
  • poppler
  • HighOrderBLCurving
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
  • gmsh_2_8_6
26 results

meshGFaceTransfinite.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    meshGFaceTransfinite.cpp 16.44 KiB
    // Gmsh - Copyright (C) 1997-2013 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to the public mailing list <gmsh@geuz.org>.
    
    #include <map>
    #include "meshGFace.h"
    #include "GVertex.h"
    #include "GEdge.h"
    #include "GFace.h"
    #include "MVertex.h"
    #include "MTriangle.h"
    #include "MQuadrangle.h"
    #include "Context.h"
    #include "GmshMessage.h"
    #include "Numeric.h"
    
    #define SQU(a)      ((a)*(a))
    
    /*
       s4 +-----c3-----+ s3
          |            |
          |            |
         c4            c2
          |            |
          |            |
       s1 +-----c1-----+ s2
    */
    
    // f(u,v) = (1-u) c4(v) + u c2(v) + (1-v) c1(u) + v c3(u)
    //          - [ (1-u)(1-v) s1 + u(1-v) s2 + uv s3 + (1-u)v s4 ]
    #define TRAN_QUA(c1,c2,c3,c4,s1,s2,s3,s4,u,v) \
       (1.-u)*c4+u*c2+(1.-v)*c1+v*c3-((1.-u)*(1.-v)*s1+u*(1.-v)*s2+u*v*s3+(1.-u)*v*s4)
    
    // s1=s4=c4
    // f(u,v) = u c2 (v) + (1-v) c1(u) + v c3(u) - u(1-v) s2 - uv s3
    #define TRAN_TRI(c1,c2,c3,s1,s2,s3,u,v) u*c2+(1.-v)*c1+v*c3-(u*(1.-v)*s2+u*v*s3)
    
    void findTransfiniteCorners(GFace *gf, std::vector<MVertex*> &corners)
    {
      if(gf->meshAttributes.corners.size()){
        // corners have been specified explicitly
        for(unsigned int i = 0; i < gf->meshAttributes.corners.size(); i++)
          corners.push_back(gf->meshAttributes.corners[i]->mesh_vertices[0]);
      }
      else{
        // try to find the corners automatically
        std::list<GEdge*> fedges = gf->edges();
        GEdgeLoop el(fedges);
        for(GEdgeLoop::iter it = el.begin(); it != el.end(); it++)
          corners.push_back(it->getBeginVertex()->mesh_vertices[0]);
    
        // try reaaally hard for 3-sided faces
        if(corners.size() == 3){
          GEdge *first = 0, *last = 0;
          for(std::list<GEdge*>::iterator it = fedges.begin(); it != fedges.end(); it++){
            if(((*it)->getBeginVertex()->mesh_vertices[0] == corners[0] &&
                (*it)->getEndVertex()->mesh_vertices[0] == corners[1]) ||
               ((*it)->getBeginVertex()->mesh_vertices[0] == corners[1] &&
                (*it)->getEndVertex()->mesh_vertices[0] == corners[0])){
              first = *it;
            }
            if(((*it)->getBeginVertex()->mesh_vertices[0] == corners[2] &&
                (*it)->getEndVertex()->mesh_vertices[0] == corners[0]) ||
               ((*it)->getBeginVertex()->mesh_vertices[0] == corners[0] &&
                (*it)->getEndVertex()->mesh_vertices[0] == corners[2])){
              last = *it;
            }
          }
          if(first && last){