Select Git revision
SBoundingBox3d.cpp
Forked from
gmsh / gmsh
Source project has a limited visibility.
-
Jean-François Remacle authoredJean-François Remacle authored
discreteFace.cpp 33.97 KiB
// Gmsh - Copyright (C) 1997-2016 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@onelab.info>.
#include "GmshConfig.h"
#include "GmshMessage.h"
#include "discreteFace.h"
#include "discreteDiskFace.h"
#include "Geo.h"
#include "GFaceCompound.h"
#include "Context.h"
#include "OS.h"
#include <stack>
#include <queue>
#include <complex>
// #include <cmath>
#if defined(HAVE_PETSC)
#include "linearSystemPETSc.h"
#endif
#include "MPoint.h"
#if defined(HAVE_METIS)
extern "C" {
#include <metis.h>
}
#endif
static inline double getAlpha(MTriangle* tri, int edj){
double alpha;
if (edj==0)
alpha = 0.;
else{
MVertex *v0, *v1, *v2;
v0 = tri->getVertex(0);
v1 = tri->getVertex(1);
v2 = tri->getVertex(2);
SVector3 a(v1->x()-v0->x(),v1->y()-v0->y(),v1->z()-v0->z());
SVector3 b(v2->x()-v0->x(),v2->y()-v0->y(),v2->z()-v0->z());
SVector3 n = crossprod(a,b); n.normalize();
v0 = tri->getEdge(0).getSortedVertex(0);
v1 = tri->getEdge(0).getSortedVertex(1);
SVector3 U(v1->x()-v0->x(),v1->y()-v0->y(),v1->z()-v0->z());
U.normalize();
SVector3 V = crossprod(n,U); V.normalize();
v0 = tri->getEdge(edj).getSortedVertex(0);
v1 = tri->getEdge(edj).getSortedVertex(1);
SVector3 e(v1->x()-v0->x(),v1->y()-v0->y(),v1->z()-v0->z());
e.normalize();
alpha = std::atan2(dot(e,V),dot(e,U));
}
return alpha;
}
static inline void crouzeixRaviart(const std::vector<double> &U,std::vector<double> &F){
F.resize(3);