Skip to content
Snippets Groups Projects
Commit 1b806775 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

pp

parent fb8d9871
No related branches found
No related tags found
No related merge requests found
......@@ -122,10 +122,10 @@ static bool computeEquidistantParameters(GFace *gf, double u0, double uN,
return true;
}
// --------- Creation of high-order edge vertices -----------
static bool getEdgeVerticesonGeo(GEdge *ge, MVertex *v0, MVertex *v1, std::vector<MVertex*> &ve, int nPts = 1)
static bool getEdgeVerticesonGeo(GEdge *ge, MVertex *v0, MVertex *v1,
std::vector<MVertex*> &ve, int nPts = 1)
{
double u0 = 0., u1 = 0., US[100];
bool reparamOK = reparamMeshVertexOnEdge(v0, ge, u0);
......@@ -169,7 +169,8 @@ static bool getEdgeVerticesonGeo(GEdge *ge, MVertex *v0, MVertex *v1, std::vecto
return true;
}
static bool getEdgeVerticesonGeo(GFace *gf, MVertex *v0, MVertex *v1, std::vector<MVertex*> &ve, int nPts = 1)
static bool getEdgeVerticesonGeo(GFace *gf, MVertex *v0, MVertex *v1,
std::vector<MVertex*> &ve, int nPts = 1)
{
SPoint2 p0, p1;
double US[100], VS[100];
......@@ -253,9 +254,11 @@ static void getEdgeVertices(GEdge *ge, MElement *ele, std::vector<MVertex*> &ve,
const bool increasing = getMinMaxVert(veOld[0], veOld[1], vMin, vMax);
std::pair<MVertex*, MVertex*> p(vMin, vMax);
std::vector<MVertex*> veEdge;
// Get vertices on geometry if asked
bool gotVertOnGeo = linear ? false :
getEdgeVerticesonGeo(ge, veOld[0], veOld[1], veEdge, nPts); // Get vertices on geometry if asked
if (!gotVertOnGeo) // If not on geometry, create from mesh interpolation
getEdgeVerticesonGeo(ge, veOld[0], veOld[1], veEdge, nPts);
// If not on geometry, create from mesh interpolation
if (!gotVertOnGeo)
interpVerticesInExistingEdge(ge, ele, veEdge, nPts);
newHOVert.insert(newHOVert.end(), veEdge.begin(), veEdge.end());
if(increasing) // Add newly created vertices to list
......@@ -288,9 +291,11 @@ static void getEdgeVertices(GFace *gf, MElement *ele, std::vector<MVertex*> &ve,
veEdge.assign(edgeVertices[p].rbegin(), edgeVertices[p].rend());
}
else { // Vertices do not exist, create them
// Get vertices on geometry if asked
bool gotVertOnGeo = linear ? false :
getEdgeVerticesonGeo(gf, veOld[0], veOld[1], veEdge, nPts); // Get vertices on geometry if asked
if (!gotVertOnGeo) { // If not on geometry, create from mesh interpolation
getEdgeVerticesonGeo(gf, veOld[0], veOld[1], veEdge, nPts);
if (!gotVertOnGeo) {
// If not on geometry, create from mesh interpolation
const MLineN edgeEl(veOld, ele->getPolynomialOrder());
interpVerticesInExistingEdge(gf, &edgeEl, veEdge, nPts);
}
......@@ -306,7 +311,8 @@ static void getEdgeVertices(GFace *gf, MElement *ele, std::vector<MVertex*> &ve,
// Get new interior vertices for an edge in a 3D element
static void getEdgeVertices(GRegion *gr, MElement *ele, std::vector<MVertex*> &ve,
std::vector<MVertex*> &newHOVert, edgeContainer &edgeVertices,
std::vector<MVertex*> &newHOVert,
edgeContainer &edgeVertices,
bool linear, int nPts = 1)
{
for(int i = 0; i < ele->getNumEdges(); i++) {
......@@ -335,7 +341,6 @@ static void getEdgeVertices(GRegion *gr, MElement *ele, std::vector<MVertex*> &v
}
}
// --------- Creation of high-order face vertices -----------
static void reorientTrianglePoints(std::vector<MVertex*> &vtcs, int orientation,
......@@ -441,9 +446,9 @@ static void reorientQuadPoints(std::vector<MVertex*> &vtcs, int orientation,
}
}
static int getNewFacePointsInVolume(MElement *incomplete, int nPts, fullMatrix<double> &points)
static int getNewFacePointsInVolume(MElement *incomplete, int nPts,
fullMatrix<double> &points)
{
int startFace = 0;
switch (incomplete->getType()){
......@@ -589,25 +594,6 @@ static void interpVerticesInExistingFace(GEntity *ge, const MElement *faceEl,
}
}
//static void interpVerticesInIncompleteFace(GRegion *gr, const MFace &face, const std::vector<MVertex*> &ve,
// std::vector<MVertex*> &veFace, int nPts)
//{
// MElement *incomplete;
//
// fullMatrix<double> points;
// int start = getNewFacePointsInFace(face.getNumVertices(), nPts, points);
// for (int k = start; k < points.size1(); k++) {
// double t1 = points(k, 0);
// double t2 = points(k, 1);
// SPoint3 pos;
// incomplete->pnt(t1, t2, 0, pos);
// MVertex* v = new MVertex(pos.x(), pos.y(), pos.z(), gr);
// veFace.push_back(v);
// }
// delete incomplete;
//}
// Get new interior vertices for a 2D element
static void getFaceVertices(GFace *gf, MElement *incomplete, MElement *ele,
std::vector<MVertex*> &vf, std::vector<MVertex*> &newHOVert,
......@@ -646,7 +632,8 @@ static void getFaceVertices(GRegion *gr, MElement *incomplete, MElement *ele,
std::vector<MVertex*> vtcs = fIter->second;
int orientation;
bool swap;
if (fIter->first.computeCorrespondence(face, orientation, swap)) { // Check correspondence and apply permutation if needed
if (fIter->first.computeCorrespondence(face, orientation, swap)) {
// Check correspondence and apply permutation if needed
if(face.getNumVertices() == 3 && nPts > 1)
reorientTrianglePoints(vtcs, orientation, swap);
else if(face.getNumVertices() == 4)
......@@ -742,12 +729,10 @@ static void getFaceVertices(GRegion *gr, MElement *incomplete, MElement *ele,
}
}
// --------- Creation of high-order volume vertices -----------
static int getNewVolumePoints(MElement *incomplete, int nPts, fullMatrix<double> &points)
{
int startInter = 0;
switch (incomplete->getType()){
......@@ -767,7 +752,8 @@ static int getNewVolumePoints(MElement *incomplete, int nPts, fullMatrix<double>
Msg::Error("getFaceAndInteriorVertices not implemented for order %i", nPts+1);
break;
}
startInter = ((nPts+2)*(nPts+3)*(nPts+4)-(nPts-2)*(nPts-1)*(nPts))/6; // = 4+6*(p-1)+4*(p-2)*(p-1)/2 = 4*(p+1)*(p+2)/2-6*(p-1)-2*4 = 2*p*p+2
startInter = ((nPts+2)*(nPts+3)*(nPts+4)-(nPts-2)*(nPts-1)*(nPts))/6;
// = 4+6*(p-1)+4*(p-2)*(p-1)/2 = 4*(p+1)*(p+2)/2-6*(p-1)-2*4 = 2*p*p+2
break;
case TYPE_HEX :
switch (nPts){
......@@ -784,7 +770,8 @@ static int getNewVolumePoints(MElement *incomplete, int nPts, fullMatrix<double>
Msg::Error("getFaceAndInteriorVertices not implemented for order %i", nPts+1);
break;
}
startInter = (nPts+2)*(nPts+2)*(nPts+2) - (nPts)*(nPts)*(nPts) ; // = 6*(p-1)*(p-1)+12*(p-1)+8 = 6*(p+1)*(p+1)-12*(p-1)-2*8 = 6*p*p+2
startInter = (nPts+2)*(nPts+2)*(nPts+2) - (nPts)*(nPts)*(nPts) ;
// = 6*(p-1)*(p-1)+12*(p-1)+8 = 6*(p+1)*(p+1)-12*(p-1)-2*8 = 6*p*p+2
break;
case TYPE_PRI :
switch (nPts){
......@@ -801,7 +788,9 @@ static int getNewVolumePoints(MElement *incomplete, int nPts, fullMatrix<double>
Msg::Error("getFaceAndInteriorVertices not implemented for order %i", nPts+1);
break;
}
startInter = 4*(nPts+1)*(nPts+1)+2; // = 4*p*p+2 = 6+9*(p-1)+2*(p-2)*(p-1)/2+3*(p-1)*(p-1) = 2*(p+1)*(p+2)/2+3*(p+1)*(p+1)-9*(p-1)-2*6
startInter = 4*(nPts+1)*(nPts+1)+2;
// = 4*p*p+2 = 6+9*(p-1)+2*(p-2)*(p-1)/2+3*(p-1)*(p-1)
// = 2*(p+1)*(p+2)/2+3*(p+1)*(p+1)-9*(p-1)-2*6
break;
case TYPE_PYR:
switch (nPts){
......@@ -829,7 +818,8 @@ static int getNewVolumePoints(MElement *incomplete, int nPts, fullMatrix<double>
// Get new interior vertices for a 3D element (except pyramid)
static void getVolumeVertices(GRegion *gr, MElement *incomplete, MElement *ele,
std::vector<MVertex*> &vr, std::vector<MVertex*> &newHOVert,
std::vector<MVertex*> &vr,
std::vector<MVertex*> &newHOVert,
bool linear, int nPts = 1)
{
fullMatrix<double> points;
......@@ -849,8 +839,10 @@ static void getVolumeVertices(GRegion *gr, MElement *incomplete, MElement *ele,
}
// Get new interior vertices for a pyramid
static void getVolumeVerticesPyramid(GRegion *gr, MElement *ele, const std::vector<MVertex*> &ve,
std::vector<MVertex*> &vr, std::vector<MVertex*> &newHOVert,
static void getVolumeVerticesPyramid(GRegion *gr, MElement *ele,
const std::vector<MVertex*> &ve,
std::vector<MVertex*> &vr,
std::vector<MVertex*> &newHOVert,
bool linear, int nPts = 1)
{
vr.reserve((nPts-1)*(nPts)*(2*(nPts-1)+1)/6);
......@@ -976,16 +968,19 @@ static void setHighOrder(GEdge *ge, std::vector<MVertex*> &newHOVert,
std::vector<MVertex*> ve;
getEdgeVertices(ge, l, ve, newHOVert, edgeVertices, linear, nbPts);
if(nbPts == 1)
lines2.push_back(new MLine3(l->getVertex(0), l->getVertex(1), ve[0], l->getPartition()));
lines2.push_back(new MLine3(l->getVertex(0), l->getVertex(1),
ve[0], l->getPartition()));
else
lines2.push_back(new MLineN(l->getVertex(0), l->getVertex(1), ve, l->getPartition()));
lines2.push_back(new MLineN(l->getVertex(0), l->getVertex(1),
ve, l->getPartition()));
delete l;
}
ge->lines = lines2;
ge->deleteVertexArrays();
}
static MTriangle *setHighOrder(MTriangle *t, GFace *gf, std::vector<MVertex*> &newHOVert,
static MTriangle *setHighOrder(MTriangle *t, GFace *gf,
std::vector<MVertex*> &newHOVert,
edgeContainer &edgeVertices,
faceContainer &faceVertices,
bool linear, bool incomplete, int nPts)
......@@ -1008,7 +1003,8 @@ static MTriangle *setHighOrder(MTriangle *t, GFace *gf, std::vector<MVertex*> &n
}
}
static MQuadrangle *setHighOrder(MQuadrangle *q, GFace *gf, std::vector<MVertex*> &newHOVert,
static MQuadrangle *setHighOrder(MQuadrangle *q, GFace *gf,
std::vector<MVertex*> &newHOVert,
edgeContainer &edgeVertices,
faceContainer &faceVertices,
bool linear, bool incomplete, int nPts)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment