From f27fc0c2a4b60ee8aacbfc456a607e90b87d6dac Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sun, 13 Nov 2016 17:01:21 +0000 Subject: [PATCH] some inlines --- Geo/MHexahedron.cpp | 14 -------------- Geo/MHexahedron.h | 15 +++++++++++++-- Geo/MPrism.cpp | 8 ++++++++ Geo/MPrism.h | 10 ++-------- Geo/MQuadrangle.cpp | 9 --------- Geo/MQuadrangle.h | 8 +++++++- Geo/MTetrahedron.cpp | 9 --------- Geo/MTetrahedron.h | 6 +++++- Geo/MTriangle.cpp | 6 ------ Geo/MTriangle.h | 5 ++++- 10 files changed, 39 insertions(+), 51 deletions(-) diff --git a/Geo/MHexahedron.cpp b/Geo/MHexahedron.cpp index 184dd63ac0..a6be2acab4 100644 --- a/Geo/MHexahedron.cpp +++ b/Geo/MHexahedron.cpp @@ -36,20 +36,6 @@ void MHexahedron::getEdgeRep(bool curved, int num, double *x, double *y, double } } -void MHexahedron::getFaceRep(bool curved, int num, double *x, double *y, double *z, - SVector3 *n) -{ - static const int f[12][3] = { - {0, 3, 2}, {0, 2, 1}, - {0, 1, 5}, {0, 5, 4}, - {0, 4, 7}, {0, 7, 3}, - {1, 2, 6}, {1, 6, 5}, - {2, 3, 7}, {2, 7, 6}, - {4, 5, 6}, {4, 6, 7} - }; - _getFaceRep(_v[f[num][0]], _v[f[num][1]], _v[f[num][2]], x, y, z, n); -} - int MHexahedron::getVolumeSign() { double mat[3][3]; diff --git a/Geo/MHexahedron.h b/Geo/MHexahedron.h index d7609e7903..733eb3d310 100644 --- a/Geo/MHexahedron.h +++ b/Geo/MHexahedron.h @@ -86,9 +86,20 @@ class MHexahedron : public MElement { } virtual double getInnerRadius(); virtual double angleShapeMeasure(); - virtual void getFaceInfo (const MFace & face, int &ithFace, int &sign, int &rot)const; + virtual void getFaceInfo(const MFace & face, int &ithFace, int &sign, int &rot) const; virtual int getNumFacesRep(bool curved){ return 12; } - virtual void getFaceRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n); + virtual void getFaceRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n) + { + static const int f[12][3] = { + {0, 3, 2}, {0, 2, 1}, + {0, 1, 5}, {0, 5, 4}, + {0, 4, 7}, {0, 7, 3}, + {1, 2, 6}, {1, 6, 5}, + {2, 3, 7}, {2, 7, 6}, + {4, 5, 6}, {4, 6, 7} + }; + _getFaceRep(_v[f[num][0]], _v[f[num][1]], _v[f[num][2]], x, y, z, n); + } virtual void getFaceVertices(const int num, std::vector<MVertex*> &v) const { v.resize(4); diff --git a/Geo/MPrism.cpp b/Geo/MPrism.cpp index 488da65857..864f043e1d 100644 --- a/Geo/MPrism.cpp +++ b/Geo/MPrism.cpp @@ -12,6 +12,14 @@ #include "qualityMeasures.h" #endif +void MPrism::getEdgeRep(bool curved, int num, double *x, double *y, double *z, + SVector3 *n) +{ + static const int f[9] = {0, 1, 2, 0, 2, 3, 1, 1, 1}; + MEdge e(getEdge(num)); + _getEdgeRep(e.getVertex(0), e.getVertex(1), x, y, z, n, f[num]); +} + int MPrism::getVolumeSign() { double mat[3][3]; diff --git a/Geo/MPrism.h b/Geo/MPrism.h index a9925a73af..eed632a9da 100644 --- a/Geo/MPrism.h +++ b/Geo/MPrism.h @@ -72,12 +72,7 @@ class MPrism : public MElement { return MEdge(_v[edges_prism(num, 0)], _v[edges_prism(num, 1)]); } virtual int getNumEdgesRep(bool curved){ return 9; } - virtual void getEdgeRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n) - { - static const int f[9] = {0, 1, 2, 0, 2, 3, 1, 1, 1}; - MEdge e(getEdge(num)); - _getEdgeRep(e.getVertex(0), e.getVertex(1), x, y, z, n, f[num]); - } + 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); @@ -107,8 +102,7 @@ class MPrism : public MElement { {0, 3, 5}, {0, 5, 2}, {1, 2, 5}, {1, 5, 4} }; - _getFaceRep(getVertex(f[num][0]), getVertex(f[num][1]), getVertex(f[num][2]), - x, y, z, n); + _getFaceRep(_v[f[num][0]], _v[f[num][1]], _v[f[num][2]], x, y, z, n); } virtual void getFaceVertices(const int num, std::vector<MVertex*> &v) const { diff --git a/Geo/MQuadrangle.cpp b/Geo/MQuadrangle.cpp index 89f345394e..d7a3bea47f 100644 --- a/Geo/MQuadrangle.cpp +++ b/Geo/MQuadrangle.cpp @@ -40,15 +40,6 @@ void MQuadrangle::getEdgeRep(bool curved, int num, double *x, double *y, double } } -void MQuadrangle::getFaceRep(bool curved, int num, double *x, double *y, double *z, - SVector3 *n) -{ - static const int f[2][3] = { - {0, 1, 2}, {0, 2, 3} - }; - _getFaceRep(_v[f[num][0]], _v[f[num][1]], _v[f[num][2]], x, y, z, n); -} - int MQuadrangleN::getNumEdgesRep(bool curved) { return curved ? 4 * CTX::instance()->mesh.numSubEdges : 4; diff --git a/Geo/MQuadrangle.h b/Geo/MQuadrangle.h index 092e44cbc5..37bad4302e 100644 --- a/Geo/MQuadrangle.h +++ b/Geo/MQuadrangle.h @@ -92,7 +92,13 @@ class MQuadrangle : public MElement { virtual int getNumFaces(){ return 1; } virtual MFace getFace(int num){ 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); + virtual void getFaceRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n) + { + static const int f[2][3] = { + {0, 1, 2}, {0, 2, 3} + }; + _getFaceRep(_v[f[num][0]], _v[f[num][1]], _v[f[num][2]], x, y, z, n); + } virtual void getFaceVertices(const int num, std::vector<MVertex*> &v) const { v.resize(4); diff --git a/Geo/MTetrahedron.cpp b/Geo/MTetrahedron.cpp index 0bb4f764f8..f112e68065 100644 --- a/Geo/MTetrahedron.cpp +++ b/Geo/MTetrahedron.cpp @@ -39,15 +39,6 @@ void MTetrahedron::getEdgeRep(bool curved, int num, double *x, double *y, double } } -void MTetrahedron::getFaceRep(bool curved, int num, double *x, double *y, double *z, - SVector3 *n) -{ - MVertex *v0 = _v[faces_tetra(num, 0)]; - MVertex *v1 = _v[faces_tetra(num, 1)]; - MVertex *v2 = _v[faces_tetra(num, 2)]; - _getFaceRep(v0, v1, v2, x, y, z, n); -} - SPoint3 MTetrahedron::circumcenter() { #if defined(HAVE_MESH) diff --git a/Geo/MTetrahedron.h b/Geo/MTetrahedron.h index 2adaf8aa35..eebced5667 100644 --- a/Geo/MTetrahedron.h +++ b/Geo/MTetrahedron.h @@ -83,7 +83,11 @@ class MTetrahedron : public MElement { } virtual void getFaceInfo(const MFace & face, int &ithFace, int &sign, int &rot) const; virtual int getNumFacesRep(bool curved){ return 4; } - virtual void getFaceRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n); + virtual void getFaceRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n) + { + _getFaceRep(_v[faces_tetra(num, 0)], _v[faces_tetra(num, 1)], _v[faces_tetra(num, 2)], + x, y, z, n); + } virtual void getFaceVertices(const int num, std::vector<MVertex*> &v) const { v.resize(3); diff --git a/Geo/MTriangle.cpp b/Geo/MTriangle.cpp index 203758f576..534d60006c 100644 --- a/Geo/MTriangle.cpp +++ b/Geo/MTriangle.cpp @@ -39,12 +39,6 @@ void MTriangle::getEdgeRep(bool curved, int num, double *x, double *y, double *z } } -void MTriangle::getFaceRep(bool curved, int num, double *x, double *y, double *z, - SVector3 *n) -{ - _getFaceRep(_v[0], _v[1], _v[2], x, y, z, n); -} - SPoint3 MTriangle::circumcenter() { double p1[3] = {_v[0]->x(), _v[0]->y(), _v[0]->z()}; diff --git a/Geo/MTriangle.h b/Geo/MTriangle.h index a49ae4eb34..0a7958f164 100644 --- a/Geo/MTriangle.h +++ b/Geo/MTriangle.h @@ -99,7 +99,10 @@ class MTriangle : public MElement { return MFace(_v[0], _v[1], _v[2]); } virtual int getNumFacesRep(bool curved){ return 1; } - virtual void getFaceRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n); + virtual void getFaceRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n) + { + _getFaceRep(_v[0], _v[1], _v[2], x, y, z, n); + } virtual void getFaceVertices(const int num, std::vector<MVertex*> &v) const { v.resize(3); -- GitLab