当前位置: 首页>>代码示例>>C++>>正文


C++ Polynomial::compose方法代码示例

本文整理汇总了C++中Polynomial::compose方法的典型用法代码示例。如果您正苦于以下问题:C++ Polynomial::compose方法的具体用法?C++ Polynomial::compose怎么用?C++ Polynomial::compose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Polynomial的用法示例。


在下文中一共展示了Polynomial::compose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Polynomial


//.........这里部分代码省略.........
                 (Polynomial(1, 0, 1, 0)) +
                 (Polynomial(1, 0, 0, 1))),

      Polynomial((Polynomial(1, 0, 0, 0) - Polynomial(1, 1, 0, 0)) +
                 (Polynomial(1, 0, 1, 0))                          +
                 (Polynomial(1, 0, 0, 1)))
    };

  // Basis //
  basis = new Polynomial**[nRefSpace];

  for(size_t s = 0; s < nRefSpace; s++)
    basis[s] = new Polynomial*[nFunction];

  // Vertex Based //
  for(size_t s = 0; s < nRefSpace; s++){
    basis[s][0] = new Polynomial(lagrange[0]);
    basis[s][1] = new Polynomial(lagrange[1]);
    basis[s][2] = new Polynomial(lagrange[2]);
    basis[s][3] = new Polynomial(lagrange[3]);
    basis[s][4] = new Polynomial(lagrange[4]);
    basis[s][5] = new Polynomial(lagrange[5]);
    basis[s][6] = new Polynomial(lagrange[6]);
    basis[s][7] = new Polynomial(lagrange[7]);
  }

  // Edge Based //
  for(size_t s = 0; s < nRefSpace; s++){
    size_t i = nVertex;

    for(size_t e = 0; e < 12; e++){
      for(size_t l = 1; l < order; l++){
        basis[s][i] =
          new Polynomial(legendre[l].compose(lifting[edgeIdx[s][e][1]] -
                                             lifting[edgeIdx[s][e][0]])
                         *
                         (lagrange[edgeIdx[s][e][0]] +
                          lagrange[edgeIdx[s][e][1]]));

        i++;
      }
    }
  }

  // Face Based //
  for(size_t s = 0; s < nRefSpace; s++){
    size_t i = nVertex + nEdge;

    for(size_t f = 0; f < 6; f++){
      for(size_t l1 = 1; l1 < order; l1++){
        for(size_t l2 = 1; l2 < order; l2++){
          Polynomial sum =
            lagrange[faceIdx[s][f][0]] +
            lagrange[faceIdx[s][f][1]] +
            lagrange[faceIdx[s][f][2]] +
            lagrange[faceIdx[s][f][3]];

          basis[s][i] =
            new Polynomial(legendre[l1].compose(lifting[faceIdx[s][f][0]] -
                                                lifting[faceIdx[s][f][1]])  *

                           legendre[l2].compose(lifting[faceIdx[s][f][0]] -
                                                lifting[faceIdx[s][f][3]])  *
                           sum);
          i++;
        }
开发者ID:cycheung,项目名称:gmsh,代码行数:67,代码来源:HexNodeBasis.cpp

示例2: Polynomial

QuadNodeBasis::QuadNodeBasis(size_t order){
  // Set Basis Type //
  this->order = order;

  type = TYPE_QUA;
  dim  = 2;

  nVertex   = 4;
  nEdge     = 4 * (order - 1);
  nFace     =     (order - 1) * (order - 1);
  nCell     = 0;
  nFunction = nVertex + nEdge + nFace + nCell;

  // Reference Space //
  const size_t nOrientation = ReferenceSpaceManager::getNOrientation(type);

  const vector<vector<vector<size_t> > >&
    edgeIdx = ReferenceSpaceManager::getEdgeNodeIndex(type);

  const vector<vector<vector<size_t> > >&
    faceIdx = ReferenceSpaceManager::getFaceNodeIndex(type);

  // Legendre Polynomial //
  Polynomial* legendre = new Polynomial[order];
  Legendre::integrated(legendre, order);

  // Lagrange & Lifting //
  const Polynomial lagrange[4] =
    {
      Polynomial((Polynomial(1, 0, 0, 0) - Polynomial(1, 1, 0, 0)) *
                 (Polynomial(1, 0, 0, 0) - Polynomial(1, 0, 1, 0))),

      Polynomial((Polynomial(1, 1, 0, 0)) *
                 (Polynomial(1, 0, 0, 0) - Polynomial(1, 0, 1, 0))),

      Polynomial((Polynomial(1, 1, 0, 0)) *
                 (Polynomial(1, 0, 1, 0))),

      Polynomial((Polynomial(1, 0, 0, 0) - Polynomial(1, 1, 0, 0)) *
                 (Polynomial(1, 0, 1, 0)))
    };

  const Polynomial lifting[4] =
    {
      Polynomial((Polynomial(1, 0, 0, 0) - Polynomial(1, 1, 0, 0)) +
                 (Polynomial(1, 0, 0, 0) - Polynomial(1, 0, 1, 0))),

      Polynomial((Polynomial(1, 1, 0, 0)) +
                 (Polynomial(1, 0, 0, 0) - Polynomial(1, 0, 1, 0))),

      Polynomial((Polynomial(1, 1, 0, 0)) +
                 (Polynomial(1, 0, 1, 0))),

      Polynomial((Polynomial(1, 0, 0, 0) - Polynomial(1, 1, 0, 0)) +
                 (Polynomial(1, 0, 1, 0)))
    };

  // Basis //
  basis = new Polynomial**[nOrientation];

  for(size_t s = 0; s < nOrientation; s++)
    basis[s] = new Polynomial*[nFunction];

  // Vertex Based //
  for(size_t s = 0; s < nOrientation; s++){
    basis[s][0] = new Polynomial(lagrange[0]);
    basis[s][1] = new Polynomial(lagrange[1]);
    basis[s][2] = new Polynomial(lagrange[2]);
    basis[s][3] = new Polynomial(lagrange[3]);
  }

  // Edge Based //
  for(size_t s = 0; s < nOrientation; s++){
    size_t i = nVertex;

    for(size_t e = 0; e < 4; e++){
      for(size_t l = 1; l < order; l++){
        basis[s][i] =
          new Polynomial(legendre[l].compose(lifting[edgeIdx[s][e][1]] -
                                             lifting[edgeIdx[s][e][0]])
                         *
                         (lagrange[edgeIdx[s][e][0]] +
                          lagrange[edgeIdx[s][e][1]]));

        i++;
      }
    }
  }

  // Face Based //

  // NB: We use (*(*faceIdx[s])[f])[]
  //     where f = 0, because triangles
  //     have only ONE face: the face '0'

  for(size_t s = 0; s < nOrientation; s++){
    size_t i = nVertex + nEdge;

    for(size_t l1 = 1; l1 < order; l1++){
      for(size_t l2 = 1; l2 < order; l2++){
//.........这里部分代码省略.........
开发者ID:iyer-arvind,项目名称:gmsh,代码行数:101,代码来源:QuadNodeBasis.cpp


注:本文中的Polynomial::compose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。