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


C++ CellTopology::getEdgeCount方法代码示例

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


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

示例1: modifyBasisByOrientation

  void
  OrientationTools<SpT>::
  modifyBasisByOrientation(/**/  Kokkos::DynRankView<outputValueType,outputProperties...> output,
                           const Kokkos::DynRankView<inputValueType, inputProperties...>  input,
                           const Kokkos::DynRankView<ortValueType,   ortProperties...>    orts,
                           const BasisPtrType basis ) {
#ifdef HAVE_INTREPID2_DEBUG
    {
      INTREPID2_TEST_FOR_EXCEPTION( input.rank() != output.rank(), std::invalid_argument,
                                    ">>> ERROR (OrientationTools::modifyBasisByOrientation): Input and output rank are not 3.");
      for (ordinal_type i=0;i<input.rank();++i)
        INTREPID2_TEST_FOR_EXCEPTION( input.dimension(i) != output.dimension(i), std::invalid_argument,
                                      ">>> ERROR (OrientationTools::modifyBasisByOrientation): Input and output dimension does not match.");

      INTREPID2_TEST_FOR_EXCEPTION( input.dimension(1) != basis->getCardinality(), std::invalid_argument,
                                    ">>> ERROR (OrientationTools::modifyBasisByOrientation): Field dimension of input/output does not match to basis cardinality.");
      INTREPID2_TEST_FOR_EXCEPTION( input.dimension(3) != basis->getBaseCellTopology().getDimension(), std::invalid_argument,
                                    ">>> ERROR (OrientationTools::modifyBasisByOrientation): Space dimension of input/output does not match to topology dimension.");
    }
#endif
    if (basis->requireOrientation()) {
      auto ordinalToTag = Kokkos::create_mirror_view(typename SpT::memory_space(), basis->getAllDofTags());
      auto tagToOrdinal = Kokkos::create_mirror_view(typename SpT::memory_space(), basis->getAllDofOrdinal());
      
      Kokkos::deep_copy(ordinalToTag, basis->getAllDofTags());
      Kokkos::deep_copy(tagToOrdinal, basis->getAllDofOrdinal());
      
      const ordinal_type 
        numCells  = output.dimension(0),
        //numBasis  = output.dimension(1),
        numPoints = output.dimension(2),
        dimBasis  = output.dimension(3);
      
      const CoeffMatrixDataViewType matData = createCoeffMatrix(basis);
      const shards::CellTopology cellTopo = basis->getBaseCellTopology();
      
      const ordinal_type 
        numVerts = cellTopo.getVertexCount(), 
        numEdges = cellTopo.getEdgeCount(),
        numFaces = cellTopo.getFaceCount();
      
      const ordinal_type intrDim = ( numEdges == 0 ? 1 : 
                                     numFaces == 0 ? 2 : 
                                     /**/            3 );
      
      for (auto cell=0;cell<numCells;++cell) {
        auto out = Kokkos::subview(output, cell, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
        auto in  = Kokkos::subview(input,  cell, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
        
        // vertex copy (no orientation)
        for (auto vertId=0;vertId<numVerts;++vertId) {
          const auto i = tagToOrdinal(0, vertId, 0);
          if (i != -1) // if dof does not exist i returns with -1
            for (auto j=0;j<numPoints;++j)
              for (auto k=0;k<dimBasis;++k)
                out(i, j, k) = in(i, j, k);
        }
        
        // interior copy
        {
          const auto ordIntr = tagToOrdinal(intrDim, 0, 0);
          if (ordIntr != -1) {
            const auto ndofIntr = ordinalToTag(ordIntr, 3);
            for (auto i=0;i<ndofIntr;++i) {
              const auto ii = tagToOrdinal(intrDim, 0, i);
              for (auto j=0;j<numPoints;++j)
                for (auto k=0;k<dimBasis;++k)
                  out(ii, j, k) = in(ii, j, k);
            }
          }
        }
        
        // edge transformation
        if (numEdges > 0) {
          ordinal_type ortEdges[12];
          orts(cell).getEdgeOrientation(ortEdges, numEdges);
          
          // apply coeff matrix
          for (auto edgeId=0;edgeId<numEdges;++edgeId) {
            const auto ordEdge = tagToOrdinal(1, edgeId, 0);
            
            if (ordEdge != -1) {
              const auto ndofEdge = ordinalToTag(ordEdge, 3);
              const auto mat = Kokkos::subview(matData, 
                                               edgeId, ortEdges[edgeId], 
                                               Kokkos::ALL(), Kokkos::ALL());
              
              for (auto j=0;j<numPoints;++j) 
                for (auto i=0;i<ndofEdge;++i) {
                  const auto ii = tagToOrdinal(1, edgeId, i);
                  
                  for (auto k=0;k<dimBasis;++k) {
                    double temp = 0.0;
                    for (auto l=0;l<ndofEdge;++l) {
                      const auto ll = tagToOrdinal(1, edgeId, l);
                      temp += mat(i,l)*in(ll, j, k);
                    }
                    out(ii, j, k) = temp;
                  }
                }
//.........这里部分代码省略.........
开发者ID:mhoemmen,项目名称:Trilinos,代码行数:101,代码来源:Intrepid2_OrientationToolsDefModifyBasis.hpp

示例2: main


//.........这里部分代码省略.........
    base_nodes(0, 3, 1) = 1.0;

    // element 0 has globally permuted edge node
    const int elt_0[2][3] = { { 0, 1, 2 },
                              { 0, 2, 1 } };
    
    // element 1 is locally permuted
    int elt_1[3] = { 1, 2, 3 };

    DefaultCubatureFactory<value_type> cubature_factory;

    // for all test orders
    for (int nx=0;nx<=maxp;++nx) {
      for (int ny=0;ny<=maxp-nx;++ny) {
        // polynomial order of approximation
        const int minp = std::max(nx+ny, 1);

        // test for all basis above order p
        const EPointType pointtype[] = { POINTTYPE_EQUISPACED, POINTTYPE_WARPBLEND };
        for (int ptype=0;ptype<2;++ptype) {
          for (int p=minp;p<=maxp;++p) {
            *outStream << "\n"                                              \
                       << "===============================================================================\n" \
                       << "  Order (nx,ny,p) = " << nx << ", " << ny << ", " << p << " , PointType = " << EPointTypeToString(pointtype[ptype]) << "\n" \
                       << "===============================================================================\n";

            BasisSet_HGRAD_TRI_Cn_FEM<value_type,FieldContainer<value_type> > basis_set(p, pointtype[ptype]);
            const auto& basis = basis_set.getCellBasis();
            const shards::CellTopology cell = basis.getBaseCellTopology();

            const int nbf = basis.getCardinality();

            const int nvert = cell.getVertexCount();
            const int nedge = cell.getEdgeCount();

            FieldContainer<value_type> nodes(1, 4, ndim);
            FieldContainer<value_type> cell_nodes(1, nvert, ndim);

            // ignore the subdimension; the matrix is always considered as 1D array
            FieldContainer<value_type> A(1, nbf, nbf), b(1, nbf);

            // ***** Test for different orientations *****
            for (int conf0=0;conf0<2;++conf0) {
              for (int ino=0;ino<3;++ino) {
                nodes(0, elt_0[conf0][ino], 0) = base_nodes(0, ino, 0);
                nodes(0, elt_0[conf0][ino], 1) = base_nodes(0, ino, 1);
              }
              nodes(0, 3, 0) = base_nodes(0, 3, 0);
              nodes(0, 3, 1) = base_nodes(0, 3, 1);

              // reset element connectivity
              elt_1[0] = 1;
              elt_1[1] = 2;
              elt_1[2] = 3;

              // for all permuations of element 1
              for (int conf1=0;conf1<6;++conf1) {
                // filter out left handed element
                fill_cell_nodes(cell_nodes, 
                                nodes, 
                                elt_1,
                                nvert, ndim);
                if (OrientationTools<value_type>::isLeftHandedCell(cell_nodes)) {
                  // skip left handed
                } else {
                  const int *element[2] = { elt_0[conf0], elt_1 };
开发者ID:crtrott,项目名称:Trilinos,代码行数:67,代码来源:test_04.cpp

示例3: getLocalToGlobalMap

      void getLocalToGlobalMap(int (*local2global)[2],
                               int &off_global,
                               const Basis<Scalar,ArrayType> &basis,
                               const int *element) {
        const int local = 0, global = 1;
        const int nbf = basis.getCardinality();
        const shards::CellTopology cell = basis.getBaseCellTopology();
        const int dim = cell.getDimension();

        int cnt = 0, off_element = 0;
        int subcell_verts[4], nids;

        const int nvert = cell.getVertexCount();
        for (int i=0;i<nvert;++i) {
          const int ord_vert = (off_element < nbf ? basis.getDofOrdinal(0, i, 0) : 0);
          const int dof_vert = (off_element < nbf ? basis.getDofTag(ord_vert)[3] : 0);
      
          local2global[cnt][local] = off_element;
          off_element += dof_vert;
          Orientation::getElementNodeMap(subcell_verts, nids,
                                         cell, element,
                                         0, i);
      
          if (!findNode(local2global[cnt][global], subcell_verts, nids, true)) {
            addNode(subcell_verts, nids, off_global);
            local2global[cnt][global] = off_global;
            off_global += dof_vert;
          }
          ++cnt;
        }
        const int nedge = cell.getEdgeCount();
        for (int i=0;i<nedge;++i) {
          const int ord_edge = (off_element < nbf ? basis.getDofOrdinal(1, i, 0) : 0);
          const int dof_edge = (off_element < nbf ? basis.getDofTag(ord_edge)[3] : 0);
      
          local2global[cnt][local] = off_element;
          off_element += dof_edge;
          Orientation::getElementNodeMap(subcell_verts, nids,
                                         cell, element,
                                         1, i);
      
          if (!findNode(local2global[cnt][global], subcell_verts, nids, true)) {
            addNode(subcell_verts, nids, off_global);
            local2global[cnt][global] = off_global;
            off_global += dof_edge;
          }
          ++cnt;
        }
        const int nface = cell.getFaceCount();
        for (int i=0;i<nface;++i) {
          const int ord_face = (off_element < nbf ? basis.getDofOrdinal(2, i, 0) : 0);
          const int dof_face = (off_element < nbf ? basis.getDofTag(ord_face)[3] : 0);
      
          local2global[cnt][local] = off_element;
          off_element += dof_face;
          Orientation::getElementNodeMap(subcell_verts, nids,
                                         cell, element,
                                         2, i);
      
          if (!findNode(local2global[cnt][global], subcell_verts, nids, true)) {
            addNode(subcell_verts, nids, off_global);
            local2global[cnt][global] = off_global;
            off_global += dof_face;
          }
          ++cnt;
        }
        {
          const int i = 0;
          const int ord_intr = (off_element < nbf ? basis.getDofOrdinal(dim, i, 0) : 0);
          const int dof_intr = (off_element < nbf ? basis.getDofTag(ord_intr)[3]   : 0);
      
          local2global[cnt][local] = off_element;
          off_element += dof_intr;
          Orientation::getElementNodeMap(subcell_verts, nids,
                                         cell, element,
                                         dim, i);
      
          if (!findNode(local2global[cnt][global], subcell_verts, nids, true)) {
            addNode(subcell_verts, nids, off_global);
            local2global[cnt][global] = off_global;
            off_global += dof_intr;
          }
          ++cnt;
        }
    
        // add the last offset
        local2global[cnt][local] = off_element;
        local2global[cnt][global] = -1; // invalid values
      }
开发者ID:crtrott,项目名称:Trilinos,代码行数:89,代码来源:Intrepid2_ToyMesh.hpp

示例4: main


//.........这里部分代码省略.........

            OrientationTools<value_type>::verbose = verbose;
            OrientationTools<value_type>::reverse = true; // for point matching only
            OrientationTools<value_type>::getModifiedBasisFunctions(ort_cell_vals,
                                                                    tmp_cell_vals,
                                                                    basis_set,
                                                                    ort);
            OrientationTools<value_type>::verbose = false;
          }

          // Step 4 : evaluate reference face basis functions for modified face points
          FieldContainer<double> ref_face_vals(nbf_face, npts);
          {
            // temporary face workspace
            FieldContainer<double> tmp_face_vals(nbf_face, npts);

            face_basis.getValues(tmp_face_vals, ort_face_pts, OPERATOR_VALUE);
            OrientationTools<value_type>::getBasisFunctionsByTopology(ref_face_vals,
                                                                      tmp_face_vals,
                                                                      face_basis);
          }

          // Step 5 : compare the basis functions to face functions
          {
            // strip the range of cell DOFs
            int off_cell = 0;
            {
              const int nvert = cell_topo.getVertexCount();
              for (int i=0;i<nvert;++i) {
                const int ord_vert = cell_basis.getDofOrdinal(0, i, 0);
                off_cell += cell_basis.getDofTag(ord_vert)[3];
              }
              if (off_cell < nbf_cell) {
                const int nedge = cell_topo.getEdgeCount();
                for (int i=0;i<nedge;++i) {
                  const int ord_edge = cell_basis.getDofOrdinal(1, i, 0);
                  off_cell += cell_basis.getDofTag(ord_edge)[3];
                }
              }
              if (off_cell < nbf_cell) {
                for (int i=0;i<test_face;++i) {
                  const int ord_face = cell_basis.getDofOrdinal(2, i, 0);
                  off_cell += cell_basis.getDofTag(ord_face)[3];
                }
              }
            }

            // strip the range of face DOFs
            int off_face = 0;
            {
              const int nvert = face_topo.getVertexCount();
              for (int i=0;i<nvert;++i) {
                const int ord_vert = face_basis.getDofOrdinal(0, i, 0);
                off_face += face_basis.getDofTag(ord_vert)[3];
              }
              if (off_face < nbf_face) {
                const int nedge = face_topo.getEdgeCount();
                for (int i=0;i<nedge;++i) {
                  const int ord_edge = face_basis.getDofOrdinal(1, i, 0);
                  off_face += face_basis.getDofTag(ord_edge)[3];
                }
              }
            }

            const int ndof = nbf_face - off_face;
            for (int i=0;i<ndof;++i) {
开发者ID:KineticTheory,项目名称:Trilinos,代码行数:67,代码来源:test_03.cpp


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