Skip to content
Snippets Groups Projects
Commit 2b6f6ac0 authored by Amaury Johnen's avatar Amaury Johnen
Browse files

No commit message

No commit message
parent 0a5fb2b8
Branches
Tags
No related merge requests found
...@@ -165,7 +165,6 @@ class MPyramid : public MElement { ...@@ -165,7 +165,6 @@ class MPyramid : public MElement {
} }
static int faces_pyramid(const int face, const int vert) static int faces_pyramid(const int face, const int vert)
{ {
// only triangular faces
static const int f[5][4] = { static const int f[5][4] = {
{0, 1, 4, -1}, {0, 1, 4, -1},
{3, 0, 4, -1}, {3, 0, 4, -1},
......
...@@ -27,8 +27,8 @@ JacobianBasis::JacobianBasis(int tag) ...@@ -27,8 +27,8 @@ JacobianBasis::JacobianBasis(int tag)
{ {
const int parentType = ElementType::ParentTypeFromTag(tag); const int parentType = ElementType::ParentTypeFromTag(tag);
const int order = ElementType::OrderFromTag(tag); const int order = ElementType::OrderFromTag(tag);
const int jacobianOrder = JacobianBasis::jacobianOrder(parentType, order); const int jacobianOrder = JacobianBasis::jacobianOrder(parentType, order);
const int primJacobianOrder = JacobianBasis::jacobianOrder(parentType, 1); const int primJacobianOrder = JacobianBasis::jacobianOrder(parentType, 1);
fullMatrix<double> lagPoints; // Sampling points fullMatrix<double> lagPoints; // Sampling points
...@@ -728,7 +728,8 @@ fullMatrix<double> JacobianBasis::generateJacPointsPyramid(int order) ...@@ -728,7 +728,8 @@ fullMatrix<double> JacobianBasis::generateJacPointsPyramid(int order)
return points; return points;
} }
int JacobianBasis::jacobianOrder(int parentType, int order) { int JacobianBasis::jacobianOrder(int parentType, int order)
{
switch (parentType) { switch (parentType) {
case TYPE_PNT : return 0; case TYPE_PNT : return 0;
case TYPE_LIN : return order - 1; case TYPE_LIN : return order - 1;
...@@ -745,3 +746,14 @@ int JacobianBasis::jacobianOrder(int parentType, int order) { ...@@ -745,3 +746,14 @@ int JacobianBasis::jacobianOrder(int parentType, int order) {
return 0; return 0;
} }
} }
void JacobianBasis::getGradientsFromNodes(const fullMatrix<double> &nodes,
fullMatrix<double> *dxyzdX,
fullMatrix<double> *dxyzdY,
fullMatrix<double> *dxyzdZ) const
{
if (dxyzdX) gradShapeMatX.mult(nodes, *dxyzdX);
if (dxyzdY) gradShapeMatY.mult(nodes, *dxyzdY);
if (dxyzdZ) gradShapeMatZ.mult(nodes, *dxyzdZ);
}
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
class JacobianBasis { class JacobianBasis {
private: private:
const bezierBasis *bezier;
fullMatrix<double> gradShapeMatX, gradShapeMatY, gradShapeMatZ; fullMatrix<double> gradShapeMatX, gradShapeMatY, gradShapeMatZ;
fullMatrix<double> gradShapeMatXFast, gradShapeMatYFast, gradShapeMatZFast; fullMatrix<double> gradShapeMatXFast, gradShapeMatYFast, gradShapeMatZFast;
fullVector<double> primGradShapeBarycenterX, primGradShapeBarycenterY, primGradShapeBarycenterZ; fullVector<double> primGradShapeBarycenterX, primGradShapeBarycenterY, primGradShapeBarycenterZ;
...@@ -41,6 +39,8 @@ class JacobianBasis { ...@@ -41,6 +39,8 @@ class JacobianBasis {
fullMatrix<double> &JDJ) const; fullMatrix<double> &JDJ) const;
public : public :
const bezierBasis *bezier;
JacobianBasis(int tag); JacobianBasis(int tag);
// Get methods // Get methods
...@@ -106,6 +106,12 @@ class JacobianBasis { ...@@ -106,6 +106,12 @@ class JacobianBasis {
} }
// Jacobian basis order and pyramidal basis // Jacobian basis order and pyramidal basis
void getGradientsFromNodes(const fullMatrix<double> &nodes,
fullMatrix<double> *dxyzdX,
fullMatrix<double> *dxyzdY,
fullMatrix<double> *dxyzdZ) const;
//
static int jacobianOrder(int parentType, int order); static int jacobianOrder(int parentType, int order);
static fullMatrix<double> generateJacMonomialsPyramid(int order); static fullMatrix<double> generateJacMonomialsPyramid(int order);
static fullMatrix<double> generateJacPointsPyramid(int order); static fullMatrix<double> generateJacPointsPyramid(int order);
......
...@@ -247,6 +247,10 @@ namespace { ...@@ -247,6 +247,10 @@ namespace {
return subPoints; return subPoints;
} }
Msg::Error("Subpoints for pyramid p>1 not implemented !");
return std::vector< fullMatrix<double> >();
/*
std::vector< fullMatrix<double> > subPoints(8); std::vector< fullMatrix<double> > subPoints(8);
fullMatrix<double> ref, prox; fullMatrix<double> ref, prox;
...@@ -296,6 +300,7 @@ namespace { ...@@ -296,6 +300,7 @@ namespace {
} }
return subPoints; return subPoints;
*/
} }
// Matrices generation // Matrices generation
...@@ -378,18 +383,18 @@ namespace { ...@@ -378,18 +383,18 @@ namespace {
for (int j = 0; j < ndofs; j++) { for (int j = 0; j < ndofs; j++) {
bez2Lag(i, j) = bez2Lag(i, j) =
nChoosek(order, exponent(j, 2)) nChoosek(order, exponent(j, 2))
* pow(point(i, 2), exponent(j, 2)) //FIXME use pow_int * pow_int(point(i, 2), exponent(j, 2))
* pow(1. - point(i, 2), order - exponent(j, 2)); * pow_int(1. - point(i, 2), order - exponent(j, 2));
double p = order + 2 - exponent(j, 2); double p = order + 2 - exponent(j, 2);
double denom = 1. - point(i, 2); double denom = 1. - point(i, 2);
bez2Lag(i, j) *= bez2Lag(i, j) *=
nChoosek(p, exponent(j, 0)) nChoosek(p, exponent(j, 0))
* nChoosek(p, exponent(j, 1)) * nChoosek(p, exponent(j, 1))
* pow(point(i, 0) / denom, exponent(j, 0)) * pow_int(point(i, 0) / denom, exponent(j, 0))
* pow(point(i, 1) / denom, exponent(j, 1)) * pow_int(point(i, 1) / denom, exponent(j, 1))
* pow(1. - point(i, 0) / denom, p - exponent(j, 0)) * pow_int(1. - point(i, 0) / denom, p - exponent(j, 0))
* pow(1. - point(i, 1) / denom, p - exponent(j, 1)); * pow_int(1. - point(i, 1) / denom, p - exponent(j, 1));
} }
} }
return bez2Lag; return bez2Lag;
...@@ -458,16 +463,23 @@ void bezierBasis::_construct(int parentType, int p) ...@@ -458,16 +463,23 @@ void bezierBasis::_construct(int parentType, int p)
dim = 3; dim = 3;
numLagCoeff = 8; numLagCoeff = 8;
exponents = JacobianBasis::generateJacMonomialsPyramid(order); exponents = JacobianBasis::generateJacMonomialsPyramid(order);
subPoints = generateSubPointsPyr(order); if (order < 2) {
subPoints = generateSubPointsPyr(order);
numDivisions = static_cast<int>(subPoints.size()); numDivisions = static_cast<int>(subPoints.size());
}
else {
numDivisions = 8;
static int a = 0;
if (++a == 1) Msg::Warning("Subdivision not available for pyramid p>1");
}
fullMatrix<double> bezierPoints = exponents; fullMatrix<double> bezierPoints = exponents;
bezierPoints.scale(1. / (order + 2)); bezierPoints.scale(1. / (order + 2));
matrixBez2Lag = generateBez2LagMatrixPyramid(exponents, bezierPoints, order); matrixBez2Lag = generateBez2LagMatrixPyramid(exponents, bezierPoints, order);
matrixBez2Lag.invert(matrixLag2Bez); matrixBez2Lag.invert(matrixLag2Bez);
subDivisor = generateSubDivisorPyramid(exponents, subPoints, matrixLag2Bez, order); if (order < 2)
subDivisor = generateSubDivisorPyramid(exponents, subPoints, matrixLag2Bez, order);
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment