Beispiel #1
0
polynomialBasis::polynomialBasis(int tag) : nodalBasis(tag)
{
  switch(parentType) {
  case TYPE_PNT: monomials = gmshGenerateMonomialsLine(0); break;
  case TYPE_LIN: monomials = gmshGenerateMonomialsLine(order); break;
  case TYPE_TRI:
    monomials = gmshGenerateMonomialsTriangle(order, serendip);
    break;
  case TYPE_QUA:
    monomials = serendip ? gmshGenerateMonomialsQuadSerendipity(order) :
                           gmshGenerateMonomialsQuadrangle(order);
    break;
  case TYPE_TET:
    monomials = gmshGenerateMonomialsTetrahedron(order, serendip);
    break;
  case TYPE_PRI:
    monomials = serendip ? gmshGenerateMonomialsPrismSerendipity(order) :
                           gmshGenerateMonomialsPrism(order);
    break;
  case TYPE_HEX:
    monomials = serendip ? gmshGenerateMonomialsHexaSerendipity(order) :
                           gmshGenerateMonomialsHexahedron(order);
    break;
  }

  coefficients = generateLagrangeMonomialCoefficients(monomials, points);
}
Beispiel #2
0
void bezierBasis::_construct(int parentType, int p)
{
  order = p;
  fullMatrix<double> exponents;
  std::vector< fullMatrix<double> > subPoints;

  if (parentType == TYPE_PYR) {
    dim = 3;
    numLagCoeff = 8;
    exponents = JacobianBasis::generateJacMonomialsPyramid(order);
    subPoints = generateSubPointsPyr(order);

    numDivisions = static_cast<int>(subPoints.size());

    fullMatrix<double> bezierPoints = exponents;
    bezierPoints.scale(1. / (order + 2));

    matrixBez2Lag = generateBez2LagMatrixPyramid(exponents, bezierPoints, order);
    matrixBez2Lag.invert(matrixLag2Bez);
    subDivisor = generateSubDivisorPyramid(exponents, subPoints, matrixLag2Bez, order);
    return;
  }

  int dimSimplex;
  switch (parentType) {
    case TYPE_PNT :
      dim = 0;
      numLagCoeff = 1;
      dimSimplex = 0;
      exponents = gmshGenerateMonomialsLine(0);
      subPoints.push_back(gmshGeneratePointsLine(0));
      break;
    case TYPE_LIN : {
      dim = 1;
      numLagCoeff = 2;
      dimSimplex = 0;
      exponents = gmshGenerateMonomialsLine(order);
      subPoints = generateSubPointsLine(order);
      break;
    }
    case TYPE_TRI : {
      dim = 2;
      numLagCoeff = 3;
      dimSimplex = 2;
      exponents = gmshGenerateMonomialsTriangle(order);
      subPoints = generateSubPointsTriangle(order);
      break;
    }
    case TYPE_QUA : {
      dim = 2;
      numLagCoeff = 4;
      dimSimplex = 0;
      exponents = gmshGenerateMonomialsQuadrangle(order);
      subPoints = generateSubPointsQuad(order);
      break;
    }
    case TYPE_TET : {
      dim = 3;
      numLagCoeff = 4;
      dimSimplex = 3;
      exponents = gmshGenerateMonomialsTetrahedron(order);
      subPoints = generateSubPointsTetrahedron(order);
      break;
    }
    case TYPE_PRI : {
      dim = 3;
      numLagCoeff = 6;
      dimSimplex = 2;
      exponents = gmshGenerateMonomialsPrism(order);
      subPoints = generateSubPointsPrism(order);
      break;
    }
    case TYPE_HEX : {
      dim = 3;
      numLagCoeff = 8;
      dimSimplex = 0;
      exponents = gmshGenerateMonomialsHexahedron(order);
      subPoints = generateSubPointsHex(order);
      break;
    }
    default : {
      Msg::Error("Unknown function space of parentType %d : "
          "reverting to TET_1", parentType);
      dim = 3;
      order = 0;
      numLagCoeff = 4;
      dimSimplex = 3;
      exponents = gmshGenerateMonomialsTetrahedron(order);
      subPoints = generateSubPointsTetrahedron(order);
      break;
    }
  }
  numDivisions = static_cast<int>(subPoints.size());

  fullMatrix<double> bezierPoints = exponents;
  bezierPoints.scale(1./order);

  matrixBez2Lag = generateBez2LagMatrix(exponents, bezierPoints, order, dimSimplex);
  matrixBez2Lag.invert(matrixLag2Bez);
  subDivisor = generateSubDivisor(exponents, subPoints, matrixLag2Bez, order, dimSimplex);
}