Select Git revision
OrthogonalPoly.cpp
-
Christophe Geuzaine authored
This reverts commit 07cc55d9
Christophe Geuzaine authoredThis reverts commit 07cc55d9
meshGFaceTransfinite.cpp 12.99 KiB
// Gmsh - Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
#include <map>
#include "meshGFace.h"
#include "GVertex.h"
#include "GEdge.h"
#include "GFace.h"
#include "MVertex.h"
#include "MElement.h"
#include "Context.h"
#include "GmshMessage.h"
#include "Numeric.h"
#define SQU(a) ((a)*(a))
extern Context_T CTX;
/*
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)
int MeshTransfiniteSurface(GFace *gf)
{
if(gf->meshAttributes.Method != MESH_TRANSFINITE) return 0;
Msg::StatusBar(2, true, "Meshing surface %d (transfinite)", gf->tag());
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
GEdgeLoop el(gf->edges());
for(GEdgeLoop::iter it = el.begin(); it != el.end(); it++)
corners.push_back(it->getBeginVertex()->mesh_vertices[0]);
}
if(corners.size () != 3 && corners.size () != 4){
Msg::Error("Surface %d is transfinite but has %d corners",
gf->tag(), corners.size());
return 0;
}
std::vector<MVertex*> d_vertices;
std::vector<int> indices;
computeEdgeLoops(gf, d_vertices, indices);
if(indices.size () != 2){