Skip to content
Snippets Groups Projects
Commit 66f8726a authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

A

Merge branch 'master' of http://gitlab.onelab.info/gmsh/gmsh
parents 343a6934 a1753272
No related branches found
No related tags found
No related merge requests found
...@@ -516,7 +516,7 @@ static int getNewFacePointsInVolume(MElement *incomplete, int nPts, ...@@ -516,7 +516,7 @@ static int getNewFacePointsInVolume(MElement *incomplete, int nPts,
case TYPE_PYR: case TYPE_PYR:
switch (nPts){ switch (nPts){
case 0: case 0:
case 1: return -1; case 1: points = BasisFactory::getNodalBasis(MSH_PYR_14)->points; break;
case 2: points = BasisFactory::getNodalBasis(MSH_PYR_30)->points; break; case 2: points = BasisFactory::getNodalBasis(MSH_PYR_30)->points; break;
case 3: points = BasisFactory::getNodalBasis(MSH_PYR_55)->points; break; case 3: points = BasisFactory::getNodalBasis(MSH_PYR_55)->points; break;
case 4: points = BasisFactory::getNodalBasis(MSH_PYR_91)->points; break; case 4: points = BasisFactory::getNodalBasis(MSH_PYR_91)->points; break;
...@@ -1224,10 +1224,10 @@ static MPyramid *setHighOrder(MPyramid *p, GRegion *gr, ...@@ -1224,10 +1224,10 @@ static MPyramid *setHighOrder(MPyramid *p, GRegion *gr,
{ {
std::vector<MVertex*> ve, vf, vr; std::vector<MVertex*> ve, vf, vr;
getEdgeVertices(gr, p, ve, newHOVert, edgeVertices, linear, nPts); getEdgeVertices(gr, p, ve, newHOVert, edgeVertices, linear, nPts);
// MPyramidN incpl(p->getVertex(0), p->getVertex(1), p->getVertex(2), MPyramidN incpl(p->getVertex(0), p->getVertex(1), p->getVertex(2),
// p->getVertex(3), p->getVertex(4), ve, nPts + 1, 0, p->getPartition()); p->getVertex(3), p->getVertex(4), ve, nPts + 1, 0, p->getPartition());
// getFaceVertices(gr, &incpl, p, vf, faceVertices, edgeVertices, linear, nPts); getFaceVertices(gr, &incpl, p, vf, newHOVert, faceVertices, edgeVertices, linear, nPts);
getFaceVertices(gr, 0, p, vf, newHOVert, faceVertices, edgeVertices, linear, nPts); // getFaceVertices(gr, 0, p, vf, newHOVert, faceVertices, edgeVertices, linear, nPts);
ve.insert(ve.end(), vf.begin(), vf.end()); ve.insert(ve.end(), vf.begin(), vf.end());
getVolumeVerticesPyramid(gr, p, ve, vr, newHOVert, linear, nPts); getVolumeVerticesPyramid(gr, p, ve, vr, newHOVert, linear, nPts);
ve.insert(ve.end(), vr.begin(), vr.end()); ve.insert(ve.end(), vr.begin(), vr.end());
......
...@@ -9,8 +9,12 @@ ...@@ -9,8 +9,12 @@
BergotBasis::BergotBasis(int p): order(p) BergotBasis::BergotBasis(int p,bool incpl): order(p),incomplete(incpl)
{ {
if (incomplete && order > 2) {
Msg::Error("Incomplete pyramids of order %i not yet implemented",order);
}
} }
...@@ -20,6 +24,13 @@ BergotBasis::~BergotBasis() ...@@ -20,6 +24,13 @@ BergotBasis::~BergotBasis()
} }
bool BergotBasis::validIJ(int i,int j) const {
if (!incomplete) return (i<=order) && (j<=order);
if (i+j <= order) return true;
if (i+j == order+1) return i==1 || j==1;
return false;
}
// Values of Bergot basis functions for coordinates (u,v,w) in the unit pyramid: // Values of Bergot basis functions for coordinates (u,v,w) in the unit pyramid:
// f = L_i(uhat)*L_j(vhat)*(1-w)^max(i,j)*P_k^{2*max(i,j)+2,0}(what) // f = L_i(uhat)*L_j(vhat)*(1-w)^max(i,j)*P_k^{2*max(i,j)+2,0}(what)
...@@ -55,13 +66,14 @@ void BergotBasis::f(double u, double v, double w, double* val) const ...@@ -55,13 +66,14 @@ void BergotBasis::f(double u, double v, double w, double* val) const
int index = 0; int index = 0;
for (int i=0;i<=order;i++) { for (int i=0;i<=order;i++) {
for (int j=0;j<=order;j++) { for (int j=0;j<=order;j++) {
if (validIJ(i,j)) {
int mIJ = std::max(i,j); int mIJ = std::max(i,j);
double fact = pow(1.-w, mIJ); double fact = pow(1.-w, mIJ);
std::vector<double> &wf = wFcts[mIJ]; std::vector<double> &wf = wFcts[mIJ];
for (int k=0; k<=order-mIJ; k++,index++) val[index] = uFcts[i] * vFcts[j] * wf[k] * fact; for (int k=0; k<=order-mIJ; k++,index++) val[index] = uFcts[i] * vFcts[j] * wf[k] * fact;
} }
} }
}
} }
...@@ -107,6 +119,7 @@ void BergotBasis::df(double u, double v, double w, double grads[][3]) const ...@@ -107,6 +119,7 @@ void BergotBasis::df(double u, double v, double w, double grads[][3]) const
int index = 0; int index = 0;
for (int i=0;i<=order;i++) { for (int i=0;i<=order;i++) {
for (int j=0;j<=order;j++) { for (int j=0;j<=order;j++) {
if (validIJ(i,j)) {
int mIJ = std::max(i,j); int mIJ = std::max(i,j);
std::vector<double> &wf = wFcts[mIJ], &wg = wGrads[mIJ]; std::vector<double> &wf = wFcts[mIJ], &wg = wGrads[mIJ];
if (mIJ == 0) { // Indeterminate form for mIJ = 0 if (mIJ == 0) { // Indeterminate form for mIJ = 0
...@@ -152,5 +165,6 @@ void BergotBasis::df(double u, double v, double w, double grads[][3]) const ...@@ -152,5 +165,6 @@ void BergotBasis::df(double u, double v, double w, double grads[][3]) const
} }
} }
} }
} }
}
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
class BergotBasis { class BergotBasis {
public: public:
BergotBasis(int p); BergotBasis(int p,bool incpl=false);
virtual ~BergotBasis(); virtual ~BergotBasis();
int size() const { const int n = order+1; return n*(n+1)*(2*n+1)/6; } int size() const { const int n = order+1; return n*(n+1)*(2*n+1)/6; }
...@@ -31,9 +31,12 @@ class BergotBasis { ...@@ -31,9 +31,12 @@ class BergotBasis {
void initialize() {}; void initialize() {};
bool validIJ(int i,int j) const;
private: private:
int order; //!< maximal order of surrounding functional spaces (on triangle / quad) int order; //!< maximal order of surrounding functional spaces (on triangle / quad)
bool incomplete; //!< serendipity interpolation
}; };
......
...@@ -46,8 +46,6 @@ IntPt *getGQPyrPts(int order) ...@@ -46,8 +46,6 @@ IntPt *getGQPyrPts(int order)
int iU = (i - iW*nbPtUV2)/nbPtUV; int iU = (i - iW*nbPtUV2)/nbPtUV;
int iV = (i - iW*nbPtUV2 - iU*nbPtUV); int iV = (i - iW*nbPtUV2 - iU*nbPtUV);
// std::cout << "Points " << iU << " " << iV << " " << iW << std::endl;
double wt = linWt[iU]*linWt[iV]*GJ20Wt[iW]; double wt = linWt[iU]*linWt[iV]*GJ20Wt[iW];
double up = linPt[iU]; double up = linPt[iU];
......
...@@ -137,6 +137,7 @@ fullMatrix<double> gmshGeneratePointsPyramid(int order, bool serendip) ...@@ -137,6 +137,7 @@ fullMatrix<double> gmshGeneratePointsPyramid(int order, bool serendip)
points(i, 0) = duv + points(i, 0) * 2. / order; points(i, 0) = duv + points(i, 0) * 2. / order;
points(i, 1) = duv + points(i, 1) * 2. / order; points(i, 1) = duv + points(i, 1) * 2. / order;
} }
return points; return points;
} }
......
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
pyramidalBasis::pyramidalBasis(int tag) : nodalBasis(tag), bergot(0) pyramidalBasis::pyramidalBasis(int tag) : nodalBasis(tag), bergot(0)
{ {
if (serendip) { if (serendip && order > 2) {
Msg::Warning("Serendipity pyramid not implemented yet"); Msg::Warning("Serendipity pyramid for order %i not yet implemented",order);
return; return;
} }
bergot = new BergotBasis(order); bergot = new BergotBasis(order,serendip);
int num_points = points.size1(); int num_points = points.size1();
...@@ -36,6 +36,7 @@ pyramidalBasis::pyramidalBasis(int tag) : nodalBasis(tag), bergot(0) ...@@ -36,6 +36,7 @@ pyramidalBasis::pyramidalBasis(int tag) : nodalBasis(tag), bergot(0)
int idx = 0; int idx = 0;
for (int i=0;i<=order;i++) { for (int i=0;i<=order;i++) {
for (int j=0;j<=order;j++) { for (int j=0;j<=order;j++) {
if (bergot->validIJ(i,j)) {
for (int k=0;k<=order-std::max(i,j);k++,idx++) { for (int k=0;k<=order-std::max(i,j);k++,idx++) {
monomials(idx,0) = i; monomials(idx,0) = i;
monomials(idx,1) = j; monomials(idx,1) = j;
...@@ -51,6 +52,7 @@ pyramidalBasis::pyramidalBasis(int tag) : nodalBasis(tag), bergot(0) ...@@ -51,6 +52,7 @@ pyramidalBasis::pyramidalBasis(int tag) : nodalBasis(tag), bergot(0)
} }
} }
} }
}
VDM.invert(coefficients); VDM.invert(coefficients);
delete[] fval; delete[] fval;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment