/usr/include/gmsh/MLine.h is in libgmsh-dev 2.8.5+dfsg-1.1+b1.
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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | // 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>.
#ifndef _MLINE_H_
#define _MLINE_H_
#include "MElement.h"
#include "nodalBasis.h"
/*
* MLine
*
* 0-----+-----1 --> u
*
*/
class MLine : public MElement {
protected:
MVertex *_v[2];
void _getEdgeVertices(std::vector<MVertex*> &v) const
{
v[0] = _v[0];
v[1] = _v[1];
}
public :
MLine(MVertex *v0, MVertex *v1, int num=0, int part=0)
: MElement(num, part)
{
_v[0] = v0; _v[1] = v1;
}
MLine(const std::vector<MVertex*> &v, int num=0, int part=0)
: MElement(num, part)
{
for(int i = 0; i < 2; i++) _v[i] = v[i];
}
~MLine(){}
virtual int getDim() const { return 1; }
virtual int getNumVertices() const { return 2; }
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 double getInnerRadius(); // half-length of segment line
virtual double getLength(); // length of segment line
virtual double getVolume();
virtual void getVertexInfo(const MVertex * vertex, int &ithVertex) const
{
ithVertex = _v[0] == vertex ? 0 : 1;
}
virtual int getNumEdges(){ return 1; }
virtual MEdge getEdge(int num) const{ return MEdge(_v[0], _v[1]); }
virtual int getNumEdgesRep(bool curved){ return 1; }
virtual void getEdgeRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n)
{
_getEdgeRep(_v[0], _v[1], x, y, z, n);
}
virtual void getEdgeVertices(const int num, std::vector<MVertex*> &v) const
{
v.resize(2);
_getEdgeVertices(v);
}
virtual int getNumFaces(){ return 0; }
virtual MFace getFace(int num){ return MFace(); }
virtual int getNumFacesRep(bool curved){ return 0; }
virtual void getFaceRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n){}
virtual int getType() const { return TYPE_LIN; }
virtual int getTypeForMSH() const { return MSH_LIN_2; }
virtual int getTypeForUNV() const { return 21; } // linear beam
virtual int getTypeForVTK() const { return 3; }
virtual const char *getStringForPOS() const { return "SL"; }
virtual const char *getStringForBDF() const { return "CBAR"; }
virtual const char *getStringForINP() const { return "T3D2"/*"C1D2"*/; }
virtual void reverse()
{
MVertex *tmp = _v[0]; _v[0] = _v[1]; _v[1] = tmp;
}
virtual const JacobianBasis* getJacobianFuncSpace(int o=-1) const;
virtual bool isInside(double u, double v, double w) const
{
double tol = _isInsideTolerance;
if(u < -(1. + tol) || u > (1. + tol) || fabs(v) > tol || fabs(w) > tol)
return false;
return true;
}
virtual void getNode(int num, double &u, double &v, double &w) const
{
v = w = 0.;
switch(num) {
case 0 : u = -1.; break;
case 1 : u = 1.; break;
default: u = 0.; break;
}
}
virtual SPoint3 barycenterUVW() const
{
return SPoint3(0, 0, 0);
}
virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts);
virtual void discretize(double tol, std::vector<SPoint3> &dpts, std::vector<double> &ts);
};
/*
* MLine3
*
* 0-----2----1
*
*/
class MLine3 : public MLine {
protected:
MVertex *_vs[1];
public :
MLine3(MVertex *v0, MVertex *v1, MVertex *v2, int num=0, int part=0)
: MLine(v0, v1, num, part)
{
_vs[0] = v2;
_vs[0]->setPolynomialOrder(2);
}
MLine3(const std::vector<MVertex*> &v, int num=0, int part=0)
: MLine(v, num, part)
{
_vs[0] = v[2];
_vs[0]->setPolynomialOrder(2);
}
~MLine3(){}
virtual int getPolynomialOrder() const { return 2; }
virtual int getNumVertices() const { return 3; }
virtual MVertex *getVertex(int num){ return num < 2 ? _v[num] : _vs[num - 2]; }
virtual const MVertex *getVertex(int num) const{ return num < 2 ? _v[num] : _vs[num - 2]; }
virtual MVertex *getVertexUNV(int num)
{
static const int map[3] = {0, 2, 1};
return getVertex(map[num]);
}
virtual MVertex *getVertexINP(int num){ return getVertexUNV(num); }
virtual int getNumEdgeVertices() const { return 1; }
virtual int getNumEdgesRep(bool curved);
virtual void getEdgeRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n);
virtual void getEdgeVertices(const int num, std::vector<MVertex*> &v) const
{
v.resize(3);
MLine::_getEdgeVertices(v);
v[2] = _vs[0];
}
virtual int getTypeForMSH() const { return MSH_LIN_3; }
virtual int getTypeForUNV() const { return 24; } // parabolic beam
virtual int getTypeForVTK() const { return 21; }
virtual const char *getStringForPOS() const { return "SL2"; }
virtual const char *getStringForINP() const { return "T3D3"/*"C1D3"*/; }
virtual void getNode(int num, double &u, double &v, double &w) const
{
num < 2 ? MLine::getNode(num, u, v, w) : MElement::getNode(num, u, v, w);
}
virtual void discretize(double tol, std::vector<SPoint3> &dpts, std::vector<double> &ts);
};
/*
* MLineN
*
* 0---2---...-(N-1)-1
*
*/
class MLineN : public MLine {
protected:
std::vector<MVertex *> _vs;
public :
MLineN(MVertex *v0, MVertex *v1, const std::vector<MVertex*> &vs, int num=0, int part=0)
: MLine(v0, v1, num, part), _vs(vs)
{
for(unsigned int i = 0; i < _vs.size(); i++)
_vs[i]->setPolynomialOrder(_vs.size() + 1);
}
MLineN(const std::vector<MVertex*> &v, int num=0, int part=0)
: MLine(v[0] , v[1], num, part)
{
for(unsigned int i = 2; i < v.size(); i++)
_vs.push_back(v[i]);
for(unsigned int i = 0; i < _vs.size(); i++)
_vs[i]->setPolynomialOrder(_vs.size() + 1);
}
~MLineN(){}
virtual int getPolynomialOrder() const { return _vs.size() + 1; }
virtual int getNumVertices() const { return _vs.size() + 2; }
virtual MVertex *getVertex(int num){ return num < 2 ? _v[num] : _vs[num - 2]; }
virtual const MVertex *getVertex(int num) const{ return num < 2 ? _v[num] : _vs[num - 2]; }
virtual int getNumEdgeVertices() const { return _vs.size(); }
virtual int getNumEdgesRep(bool curved);
virtual void getEdgeRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n);
virtual void getEdgeVertices(const int num, std::vector<MVertex*> &v) const
{
v.resize(2 + _vs.size());
MLine::_getEdgeVertices(v);
for(unsigned int i = 0; i != _vs.size(); ++i) v[i+2] = _vs[i];
}
virtual int getTypeForMSH() const
{
if(_vs.size() == 0) return MSH_LIN_2;
if(_vs.size() == 1) return MSH_LIN_3;
if(_vs.size() == 2) return MSH_LIN_4;
if(_vs.size() == 3) return MSH_LIN_5;
if(_vs.size() == 4) return MSH_LIN_6;
if(_vs.size() == 5) return MSH_LIN_7;
if(_vs.size() == 6) return MSH_LIN_8;
if(_vs.size() == 7) return MSH_LIN_9;
if(_vs.size() == 8) return MSH_LIN_10;
if(_vs.size() == 9) return MSH_LIN_11;
Msg::Error("no tag matches a line with %d vertices", 8+_vs.size());
return 0;
}
virtual void getNode(int num, double &u, double &v, double &w) const
{
num < 2 ? MLine::getNode(num, u, v, w) : MElement::getNode(num, u, v, w);
}
virtual void discretize(double tol, std::vector<SPoint3> &dpts, std::vector<double> &ts);
};
struct compareMLinePtr {
bool operator () (MLine *l1, MLine *l2) const
{
static Less_Edge le;
return le(l1->getEdge(0), l2->getEdge(0));
}
};
#endif
|