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


C++ PatchData::fill方法代码示例

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


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

示例1: test_all_nodes

void MsqMeshEntityTest::test_all_nodes( EntityTopology type, unsigned num_nodes )
{
  const unsigned num_vtx = 27;
  double coords[3*num_vtx] = {0.0};
  size_t conn[num_vtx];
  for (size_t i = 0; i < num_vtx; ++i)
    conn[i] = i;
  bool fixed[num_vtx] = {false};
  CPPUNIT_ASSERT(num_nodes <= num_vtx);
  
  MsqError err;
  PatchData pd;
  size_t n = num_nodes;
  pd.fill( num_nodes, coords, 1, &type, &n, conn, fixed, err );
  ASSERT_NO_ERROR(err);
  
  MsqMeshEntity& elem = pd.element_by_index(0);
  NodeSet all = elem.all_nodes(err);
  ASSERT_NO_ERROR(err);
  CPPUNIT_ASSERT_EQUAL( num_nodes, all.num_nodes() );
  CPPUNIT_ASSERT( all.have_any_corner_node() );
  bool mid_edge, mid_face, mid_reg;
  TopologyInfo::higher_order( type, num_nodes, mid_edge, mid_face, mid_reg, err );
  ASSERT_NO_ERROR(err);
  CPPUNIT_ASSERT_EQUAL( mid_edge, !!all.have_any_mid_edge_node() );
  CPPUNIT_ASSERT_EQUAL( mid_face, !!all.have_any_mid_face_node() );
  CPPUNIT_ASSERT_EQUAL( mid_reg,  !!all.have_any_mid_region_node() );
  
}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:29,代码来源:MsqMeshEntityTest.cpp

示例2: create_qm_two_pyr_patch

     /* Patch used in several quality metric tests.
        Our pyr patch is made of two pyramids.  The first is a perfect
        pyramid (the ideal for most metrics).  The second is an arbitrary
        pyramid.
     */
   inline void create_qm_two_pyr_patch(PatchData &pyrPatch, MsqError &err)
   {
     /* Equilateral triangles
     double coords[] = { 1, -1, 0,
                         1,  1, 0,
                        -1,  1, 0,
                        -1, -1, 0,
                         0,  0, sqrt(2) };
     */
     /* Unit height */
     double coords[] = { 
                         /* Equilateral triangles */
                    /*   1, -1, 0,
                         1,  1, 0,
                        -1,  1, 0,
                        -1, -1, 0,
                         0,  0, sqrt(2)  */                   
                         /* Unit height */
                         1, -1, 0,
                         1,  1, 0,
                        -1,  1, 0,
                        -1, -1, 0,
                         0,  0, 2,
                         /* Apex for a squashed pyramid */
                         0,  0, -1
                         };
     

     const size_t conn[] = { 0, 1, 2, 3, 4, 
                             3, 2, 1, 0, 5 };
     
     pyrPatch.fill( 6, coords, 2, PYRAMID, conn, 0, err );
   }
开发者ID:bddavid,项目名称:mesquite,代码行数:38,代码来源:PatchDataInstances.hpp

示例3: destroy_patch_with_domain

   /*! \fn create_six_quads_patch(PatchData &four_quads, MsqError &err)
     our 2D set up: 6 quads, 1 center vertex outcentered by (0,-0.5), the other centered
      7____6____5___11
      |    |    |    |
      | 2  |  3 | 5  |
      8-_  |  _-4---10       vertex 1 is at (0,0)
      |  -_0_-  |    |       vertex 11 is at (3,2)
      | 0  |  1 | 4  |
      1----2----3----9

      use destroy_patch_with_domain() in sync.
   */
   inline void create_six_quads_patch_with_domain(PatchData &pd, MsqError &err) 
   {
     // associates domain
     Vector3D pnt(0,0,0);
     Vector3D s_norm(0,0,3);
     pd.set_domain( new PlanarDomain(s_norm, pnt) );

     double coords[] = { 1,.5, 0,
                         0, 0, 0,
                         1, 0, 0,
                         2, 0, 0,
                         2, 1, 0,
                         2, 2, 0,
                         1, 2, 0,
                         0, 2, 0,
                         0, 1, 0,
                         3, 0, 0,
                         3, 1, 0,
                         3, 2, 0 };

     size_t indices[] = { 1,  2,  0, 8,
                          2,  3,  4, 0,
                          8,  0,  6, 7,
                          0,  4,  5, 6,
                          3,  9, 10, 4,
                          4, 10, 11, 5 };
     
     bool fixed[] = { false, true, true, true, 
                      false, true, true, true, 
                      true, true, true, true };
     
     pd.fill( 12, coords, 6, QUADRILATERAL, indices, fixed, err );
   }
开发者ID:bddavid,项目名称:mesquite,代码行数:45,代码来源:PatchDataInstances.hpp

示例4: init_pd

static bool init_pd( PatchData& pd ) {
  MsqError err;
  const double coords[] = { 0,0,0, 1,1,1, 2,2,2 };
  const bool fixed[] = { false, true, true };
  const size_t indices[] = { 0, 1, 2 };
  pd.fill( 3, coords, 1, TRIANGLE, indices, fixed, err );
  return !err;
}
开发者ID:haripandey,项目名称:trilinos,代码行数:8,代码来源:ObjectiveFunctionTests.cpp

示例5: create_ideal_element_patch

  // Create patch containing one ideal element, optionally higher-order.
  // For 2D elements, will attach appropriate planar domain.
  inline void create_ideal_element_patch( PatchData& pd,
                                          EntityTopology type, 
                                          size_t num_nodes,
                                          MsqError& err )
  {
     static PlanarDomain zplane(PlanarDomain::XY);
     static Settings settings;
     settings.set_slaved_ho_node_mode( Settings::SLAVE_NONE );
     pd.attach_settings( &settings );
     
  
       // build list of vertex coordinates
     const Vector3D* corners = unit_edge_element( type );
     std::vector<Vector3D> coords( corners, corners+TopologyInfo::corners(type) );
     bool mids[4] = {false};
     TopologyInfo::higher_order( type, num_nodes, mids[1], mids[2], mids[3], err );
     MSQ_ERRRTN(err);
     std::vector<size_t> conn(coords.size());
     for (unsigned i = 0; i < coords.size(); ++i)
       conn[i] = i;
 
     for (unsigned dim = 1; dim <= TopologyInfo::dimension(type); ++dim) {
       if (!mids[dim])
         continue;
       
       int num_side;
       if (dim == TopologyInfo::dimension(type))
         num_side = 1;
       else
         num_side = TopologyInfo::adjacent( type, dim );
       
       for (int s = 0; s < num_side; ++s) {
         unsigned idx = TopologyInfo::higher_order_from_side( type, num_nodes, dim, s, err );
         MSQ_ERRRTN(err);
         conn.push_back(idx);
       
         unsigned n;
         const unsigned* side = TopologyInfo::side_vertices( type, dim, s, n, err );
         MSQ_ERRRTN(err);
         Vector3D avg = coords[side[0]];
         for (unsigned v = 1; v < n; ++v)
           avg += coords[side[v]];
         avg *= 1.0/n;
         coords.push_back(avg);
       }
     }
     
     bool* fixed = new bool[coords.size()];
     std::fill( fixed, fixed+coords.size(), false );
     pd.fill( coords.size(), coords[0].to_array(), 1, &type, 
              &num_nodes, &conn[0], fixed, err );
     delete [] fixed;
     MSQ_ERRRTN(err);
     
     if (TopologyInfo::dimension(type) == 2)
       pd.set_domain( &zplane );
  }
开发者ID:bddavid,项目名称:mesquite,代码行数:59,代码来源:PatchDataInstances.hpp

示例6: setUp

  void setUp()
  {
    tolEps=1.e-12;
      // set up the unit vectors
    e1.set(1,0,0);
    e2.set(0,1,0);
    e3.set(0,0,1);
    
    MsqPrintError err(cout);
    
    
    double hcoords[] = { 1.0, 1.0, 1.0,
                         2.0, 1.0, 1.0,
                         2.0, 2.0, 1.0,
                         1.0, 2.0, 1.0,
                         1.0, 1.0, 2.0,
                         2.0, 1.0, 2.0,
                         2.0, 2.0, 2.0,
                         1.0, 2.0, 2.0 };
    size_t hconn[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
    one_hex_patch.fill( 8, hcoords, 1, HEXAHEDRON, hconn, 0, err );
    

    double tcoords[] = { 1.0, 1.0, 1.0,
                         2.0, 1.0, 1.0,
                         1.5, 1+sqrt(3.0)/2.0, 1.0,
                         1.5, 1+sqrt(3.0)/6.0, 1+sqrt(2.0)/sqrt(3.0) };
    size_t tconn[] = { 0, 1, 2, 3 };
    one_tet_patch.fill( 4, tcoords, 1, TETRAHEDRON, tconn, 0, err );

    double qcoords[] = { 1.0, 1.0, 1.0,
                         2.0, 1.0, 1.0,
                         2.0, 2.0, 1.0,
                         1.0, 2.0, 1.0 };
    size_t qconn[] = { 0, 1, 2, 3 };
    one_qua_patch.fill( 4, qcoords, 1, QUADRILATERAL, qconn, 0, err );
    
    double rcoords[] = { 1.0, 1.0, 1.0,
                         2.0, 1.0, 1.0,
                         1.5, 1+sqrt(3.0)/2.0, 1.0 };
    size_t rconn[] = { 0, 1, 2 };
    one_tri_patch.fill( 3, rcoords, 1, TRIANGLE, rconn, 0, err );
  }
开发者ID:haripandey,项目名称:trilinos,代码行数:43,代码来源:MsqVertexTest.cpp

示例7: create_one_quad_patch

 //! creates a Patch containing an ideal quadrilateral
 inline void create_one_quad_patch(PatchData &one_qua_patch, MsqError &err)
 {
   double coords[] = { 1, 1, 1,
                       2, 1, 1,
                       2, 2, 1,
                       1, 2 , 1 };
   
   size_t indices[4] = { 0, 1, 2, 3 };
   
   one_qua_patch.fill( 4, coords, 1, QUADRILATERAL, indices, 0, err );
 }
开发者ID:bddavid,项目名称:mesquite,代码行数:12,代码来源:PatchDataInstances.hpp

示例8: create_one_tet_patch

   //! creates a Patch containing an ideal tetrahedra
   inline void create_one_tet_patch(PatchData &one_tet_patch, MsqError &err)
   {
     double coords[] = { 1.0, 1.0, 1.0,
                         2.0, 1.0, 1.0,
                         1.5, 1+sqrt(3.0)/2.0, 1.0,
                         1.5, 1+sqrt(3.0)/6.0, 1+sqrt(2.0)/sqrt(3.0) };

     size_t indices[4] = { 0, 1, 2, 3 };

     one_tet_patch.fill( 4, coords, 1, TETRAHEDRON, indices, 0, err );
   }
开发者ID:bddavid,项目名称:mesquite,代码行数:12,代码来源:PatchDataInstances.hpp

示例9: create_qm_two_tet_patch

     /* Patch used in several quality metric tests.
        Our tet patch is made of two tets.  tet_1 is a perfect
        equilateral (the ideal for most metrics).  tet_2 is an arbitrary
        tet.
     */
   inline void create_qm_two_tet_patch(PatchData &tetPatch, MsqError &err)
   {
     double coords[] = { 0.0, 0.0, 0.0,
                         1.0, 0.0, 0.0,
                         0.5, sqrt(3.0)/2.0, 0.0,
                         0.5, sqrt(3.0)/6.0, sqrt(2.0)/sqrt(3.0),
                         2.0, 3.0, -.5 };
     

     const size_t conn[] = { 0, 1, 2, 3, 1, 4, 2, 3 };
     
     tetPatch.fill( 5, coords, 2, TETRAHEDRON, conn, 0, err );
   }
开发者ID:bddavid,项目名称:mesquite,代码行数:18,代码来源:PatchDataInstances.hpp

示例10: create_one_wdg_patch

 //! create patch containing one ideal wedge
 inline void create_one_wdg_patch( PatchData& one_wdg_patch, MsqError& err )
 {
   double hgt = 0.5 * MSQ_SQRT_THREE;
   double coords[] = { 0.0, 0.0, 0.0,
                       1.0, 0.0, 0.0,
                       0.5, hgt, 0.0,
                       0.0, 0.0, 1.0,
                       1.0, 0.0, 1.0,
                       0.5, hgt, 1.0 };
                       
   size_t indices[6] = { 0, 1, 2, 3, 4, 5 };
   
   one_wdg_patch.fill( 6, coords, 1, PRISM, indices, 0, err );
 } 
开发者ID:bddavid,项目名称:mesquite,代码行数:15,代码来源:PatchDataInstances.hpp

示例11: test_unsigned_area_common

void MsqMeshEntityTest::test_unsigned_area_common( EntityTopology type,
                                                   const double* coords,
                                                   double expected )
{
  MsqError err;
  PatchData pd;

  pd.fill( TopologyInfo::corners( type ), coords, 1, type, conn, fixed, err );
  ASSERT_NO_ERROR(err);
  
  double a = pd.element_by_index(0).compute_unsigned_area( pd, err );
  ASSERT_NO_ERROR(err);
  
  CPPUNIT_ASSERT_DOUBLES_EQUAL( expected, a, 1e-8 );
}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:15,代码来源:MsqMeshEntityTest.cpp

示例12: create_one_tri_patch

     /*! \fn create_one_tri_patch(PatchData &one_tri_patch, MsqError &err)
            2
           / \      creates a Patch containing an ideal triangle
          /   \
         0-----1
         This Patch also has the normal information. 
     */
   inline void create_one_tri_patch(PatchData &one_tri_patch, MsqError &err)
   {
       /* ************** Creates normal info ******************* */
     Vector3D pnt(0,0,0);
     Vector3D s_norm(0,0,3);
     one_tri_patch.set_domain( new PlanarDomain( s_norm, pnt ) );

       /* *********************FILL tri************************* */
     double coords[] = { 1, 1, 1,
                         2, 1, 1,
                         1.5, 1+sqrt(3.0)/2.0, 1 };
     
     size_t indices[3] = { 0, 1, 2 };
     one_tri_patch.fill( 3, coords, 1, TRIANGLE, indices, 0, err );
   }
开发者ID:bddavid,项目名称:mesquite,代码行数:22,代码来源:PatchDataInstances.hpp

示例13: create_one_hex_patch

 /*! creates a patch containing one ideal hexahedra
 */
  inline void create_one_hex_patch(PatchData &one_hex_patch, MsqError &err)
  {
    double coords[] = { 1.0, 1.0, 1.0,
                        2.0, 1.0, 1.0,
                        2.0, 2.0, 1.0,
                        1.0, 2.0, 1.0,
                        1.0, 1.0, 2.0,
                        2.0, 1.0, 2.0,
                        2.0, 2.0, 2.0,
                        1.0, 2.0, 2.0 };
    
    size_t indices[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
    
    one_hex_patch.fill( 8, coords, 1, HEXAHEDRON, indices, 0, err );
  }
开发者ID:bddavid,项目名称:mesquite,代码行数:17,代码来源:PatchDataInstances.hpp

示例14: create_qm_two_tri_patch_with_domain

   /* Patch used in several quality metric tests.
      Our triangular patch is made of two tris.  tri_1 is a perfect
      equilateral (the ideal for most metrics).  tri_2 is an arbitrary
      triangle.
      Memory allocated in this function must be deallocated with
      destroy_patch_with_domain().
   */
   inline void create_qm_two_tri_patch_with_domain(PatchData &triPatch, MsqError &err) 
   {
     Vector3D pnt(0,0,0);
     Vector3D s_norm(0,0,3);
     triPatch.set_domain( new PlanarDomain(s_norm, pnt) );

     double coords[] = { 0.0, 0.0, 0.0,
                         1.0, 0.0, 0.0,
                         0.5, sqrt(3.0)/2.0, 0.0,
                         2.0, -4.0, 2.0 };
     

     const size_t conn[] = { 0, 1, 2, 0, 3, 1 };
     
     triPatch.fill( 4, coords, 2, TRIANGLE, conn, 0, err );
   }
开发者ID:bddavid,项目名称:mesquite,代码行数:23,代码来源:PatchDataInstances.hpp

示例15: create_qm_two_quad_patch_with_domain

     /* Patch used in several quality metric tests.
       Our quad patch is made of two quads.  quad_1 is a perfect
       square (the ideal for most metrics).  quad_2 is an arbitrary
       quad.
       Memory allocated in this function must be deallocated with
       destroy_patch_with_domain().
     */
   inline void create_qm_two_quad_patch_with_domain(PatchData &quadPatch, MsqError &err)
   {
     Vector3D pnt(0,0,0);
     Vector3D s_norm(0,0,3);
     quadPatch.set_domain( new PlanarDomain(s_norm, pnt) );

     double coords[] = { 0.0, 0.0, 0.0,
                         1.0, 0.0, 0.0,
                         1.0, 1.0, 0.0,
                         0.0, 1.0, 0.0,
                         2.0, -1.0, .5,
                         1.5, 1.0, 1.0 };
     
     const size_t conn[] = { 0, 1, 2, 3, 1, 4, 5, 2 };
     
     quadPatch.fill( 6, coords, 2, QUADRILATERAL, conn, 0, err );
   }
开发者ID:bddavid,项目名称:mesquite,代码行数:24,代码来源:PatchDataInstances.hpp


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