/usr/include/gmsh/MTrihedron.h is in libgmsh-dev 2.15.0+dfsg1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | #ifndef _MTRIHEDRON_H_
#define _MTRIHEDRON_H_
#include "MElement.h"
/*
* MTrihedron
* A MTrihedron is a plane element composed of
* a quadrangle and two triangles.
* It serves as an interface between two non-conforming
* elements
*
* v
* ^
* |
* 3-----------2
* |'\ | |
* | '\ | |
* | +---- | --> u
* | '\ |
* | '\ |
* 0-----------1
*
*/
class MTrihedron : public MElement {
protected:
MVertex *_v[4];
void _getEdgeVertices(const int num, std::vector<MVertex*> &v) const
{
v[0] = _v[edges_trihedron(num, 0)];
v[1] = _v[edges_trihedron(num, 1)];
}
void _getFaceVertices(const int num, std::vector<MVertex*> &v) const
{
if(num > 0) {
v[0] = _v[faces_trihedron(num, 0)];
v[1] = _v[faces_trihedron(num, 1)];
v[2] = _v[faces_trihedron(num, 2)];
}
else {
v[0] = _v[0];
v[1] = _v[1];
v[2] = _v[2];
v[3] = _v[3];
}
}
public:
MTrihedron(MVertex *v0, MVertex *v1, MVertex *v2, MVertex *v3, int num=0, int part=0)
: MElement(num, part)
{
_v[0] = v0; _v[1] = v1; _v[2] = v2; _v[3] = v3;
}
MTrihedron(const std::vector<MVertex*> &v, int num=0, int part=0)
: MElement(num, part)
{
for(int i = 0; i < 4; i++) _v[i] = v[i];
}
~MTrihedron(){}
virtual int getDim() const { return 3; } //Can have a volume...
virtual int getNumVertices() const { return 4; }
virtual MVertex *getVertex(int num){ return _v[num]; }
virtual const MVertex *getVertex(int num) const { return _v[num]; }
virtual void setVertex(int num, MVertex *v){ _v[num] = v; }
virtual int getNumEdges()const{ return 5; }
virtual MEdge getEdge(int num) const
{
return MEdge(_v[edges_trihedron(num, 0)], _v[edges_trihedron(num, 1)]);
}
virtual int getNumEdgesRep(bool curved){ return 5; }
virtual void getEdgeRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n)
{
MEdge e(getEdge(num));
_getEdgeRep(e.getVertex(0), e.getVertex(1), x, y, z, n, 0);
}
virtual void getEdgeVertices(const int num, std::vector<MVertex*> &v) const
{
v.resize(2);
_getEdgeVertices(num, v);
}
virtual int getNumFaces(){ return 3; }
virtual MFace getFace(int num)
{
if(num > 0)
return MFace(_v[faces_trihedron(num, 0)],
_v[faces_trihedron(num, 1)],
_v[faces_trihedron(num, 2)]);
else
return MFace(_v[0], _v[1], _v[2], _v[3]);
}
virtual int getNumFacesRep(bool curved){ return 2; }
virtual void getFaceRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n)
{
static const int f[2][3] = {
{0, 1, 3}, {1, 2, 3}
};
_getFaceRep(getVertex(f[num][0]), getVertex(f[num][1]), getVertex(f[num][2]),
x, y, z, n);
}
virtual void getFaceVertices(const int num, std::vector<MVertex*> &v) const
{
v.resize((num == 0) ? 4 : 3);
_getFaceVertices(num, v);
}
virtual int getType() const { return TYPE_TRIH; }
virtual int getTypeForMSH() const { return MSH_TRIH_4; }
virtual void reverse()
{
MVertex *tmp = _v[1]; _v[1] = _v[3]; _v[3] = tmp;
}
virtual int getVolumeSign(){return 0;};
virtual double getVolume(){return 0;};
virtual bool setVolumePositive(){return false;};
virtual void getNode(int num, double &u, double &v, double &w) const
{
w = 0;
switch(num) {
case 0 : u = -1.; v = -1.; break;
case 1 : u = 1.; v = -1.; break;
case 2 : u = 1.; v = 1.; break;
case 3 : u = -1.; v = 1.; break;
default: u = 0.; v = 0.; break;
}
}
virtual SPoint3 barycenterUVW() const
{
return SPoint3(0., 0., 0.);
}
virtual bool isInside(double u, double v, double w) const
{
double tol = getTolerance();
if(u < -(1. + tol) || v < -(1. + tol) || u > (1. + tol) || v > (1. + tol) ||
fabs(w) > tol)
return false;
return true;
}
static int edges_trihedron(const int edge, const int vert)
{
static const int e[5][2] = {
{0, 1},
{1, 2},
{2, 3},
{3, 0},
{1, 3},
};
return e[edge][vert];
}
static int faces_trihedron(const int face, const int vert)
{
static const int f[3][4] = {
{0, 1, 2, 3},
{0, 3, 1, -1},
{1, 3, 2, -1},
};
return f[face][vert];
}
};
#endif
|