Select Git revision
discreteRegion.cpp
-
Christophe Geuzaine authoredChristophe Geuzaine authored
meshGRegionDelaunayInsertion.cpp 58.58 KiB
// Gmsh - Copyright (C) 1997-2014 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 <set>
#include <map>
#include <algorithm>
#include "GmshMessage.h"
#include "robustPredicates.h"
#include "OS.h"
#include "BackgroundMesh.h"
#include "meshGRegion.h"
#include "meshGRegionLocalMeshMod.h"
#include "meshGRegionDelaunayInsertion.h"
#include "GModel.h"
#include "GRegion.h"
#include "MTriangle.h"
#include "Numeric.h"
#include "Context.h"
#include "HilbertCurve.h"
int MTet4::radiusNorm = 2;
static double LIMIT_ = 1;
static void createAllEmbeddedFaces (GRegion *gr, std::set<MFace, Less_Face> &allEmbeddedFaces)
{
std::list<GFace*> f = gr->embeddedFaces();
for (std::list<GFace*>::iterator it = f.begin() ; it != f.end(); ++it){
for (unsigned int i = 0; i < (*it)->triangles.size(); i++){
allEmbeddedFaces.insert ((*it)->triangles[i]->getFace(0));
}
}
}
static bool isActive(MTet4 *t, double limit_, int &active)
{
if (t->isDeleted()) return false;
for (active = 0; active < 4; active++){
MTet4 *neigh = t->getNeigh(active);
if (!neigh || (neigh->getRadius() < limit_ && neigh->getRadius() > 0)) {
return true;
}
}
return false;
}
int MTet4::inCircumSphere(const double *p) const
{
double pa[3] = {base->getVertex(0)->x(),
base->getVertex(0)->y(),
base->getVertex(0)->z()};
double pb[3] = {base->getVertex(1)->x(),
base->getVertex(1)->y(),
base->getVertex(1)->z()};
double pc[3] = {base->getVertex(2)->x(),
base->getVertex(2)->y(),
base->getVertex(2)->z()};
double pd[3] = {base->getVertex(3)->x(),
base->getVertex(3)->y(),
base->getVertex(3)->z()};
double result = robustPredicates::insphere(pa, pb, pc, pd, (double*)p) *
robustPredicates::orient3d(pa, pb, pc, pd);
return (result > 0) ? 1 : 0;
}
static int faces[4][3] = {{0,1,2}, {0,2,3}, {0,3,1}, {1,3,2}};
struct faceXtet{
MVertex *v[3],*unsorted[3];