Select Git revision
elasticitySolver.cpp
Forked from
gmsh / gmsh
Source project has a limited visibility.
meshGFaceTransfinite.cpp 14.15 KiB
// $Id: meshGFaceTransfinite.cpp,v 1.27 2008-05-04 08:31:16 geuzaine Exp $
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// 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 "Message.h"
#include "Numeric.h"
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 != TRANSFINI) return 0;
Msg::Status(2, true, "Meshing surface %d (transfinite)", gf->tag());
std::vector <MVertex *> corners, d_vertices;
std::vector <int> indices;
for(unsigned int i = 0; i < gf->meshAttributes.corners.size(); i++)
corners.push_back(gf->meshAttributes.corners[i]->mesh_vertices[0]);
computeEdgeLoops(gf, d_vertices, indices);
if(corners.size () != 3 && corners.size () != 4){
Msg::Error("Surface %d is transfinite but has %d corners",
gf->tag(), corners.size());