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


C++ MeshImpl::elements_get_attached_vertices方法代码示例

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


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

示例1: setUp

   /* Automatically called by CppUnit before each test function. */
  void setUp()
  {
      // Read a VTK file -- 1 triangle flanked by 1 quad on each side (1 tri + 3 quads)
    mMesh = new Mesquite::MeshImpl;
    mMesh->read_vtk(MESH_FILES_DIR "2D/VTK/hybrid_3quad_1tri.vtk", mErr);
    CPPUNIT_ASSERT(!mErr);

      // Get mesh data
    mMesh->get_all_elements( mElements, mErr );
    CPPUNIT_ASSERT(!mErr);
    mMesh->elements_get_attached_vertices( &mElements[0],
                                           mElements.size(),
                                           mConnectivity,
                                           mOffsets,
                                           mErr );
    CPPUNIT_ASSERT(!mErr);
    
      // Construct list of vertices w/out duplicates from
      // connectivity list.
    std::vector<Mesquite::Mesh::VertexHandle>::iterator new_end;
    mVertices = mConnectivity;
    std::sort( mVertices.begin(), mVertices.end() );
    new_end = std::unique( mVertices.begin(), mVertices.end() );
    mVertices.resize( new_end - mVertices.begin() );
  }
开发者ID:haripandey,项目名称:trilinos,代码行数:26,代码来源:MeshInterfaceTest.cpp

示例2: main

int main( int argc, char* argv[] )
{
  unsigned i;
  const char* input_file = MESH_FILES_DIR "3D/VTK/mixed-hex-pyr-tet.vtk";
  if (argc == 2)
    input_file = argv[1];
  else if (argc != 1)
  {
    std::cerr << "Invalid arguments.\n";
    return 2;
  }
  
  
  Mesquite::MsqPrintError err(cout);
  IdealWeightMeanRatio m1;
  IdealWeightInverseMeanRatio m2(err);
  ConditionNumberQualityMetric m3;
  QualityMetric* metrics[] = { &m1, &m2, &m3, 0 };

    // Read Mesh
  Mesquite::MeshImpl mesh;
  mesh.read_vtk(MESH_FILES_DIR "3D/VTK/12-pyramid-unit-sphere.vtk", err);
  CPPUNIT_ASSERT(!err);
  Mesquite::MeshImpl ideal_mesh;
  ideal_mesh.read_vtk(MESH_FILES_DIR "3D/VTK/12-pyramid-unit-sphere.vtk", err);
  CPPUNIT_ASSERT(!err);

    // Check that the mesh read correctly, and contains what is
    // expected later.

    // Get mesh data
    // Expecting file to contain 12 pyramid elements constructed
    // from 15 vertices.
  std::vector<Mesh::VertexHandle> vert_array;
  std::vector<Mesh::ElementHandle> elem_array;
  std::vector<size_t> conn_offsets;
  mesh.get_all_elements( elem_array, err ); 
  CPPUNIT_ASSERT(!err);
  CPPUNIT_ASSERT( elem_array.size() == 12 );
  mesh.elements_get_attached_vertices( &elem_array[0],
                                        elem_array.size(),
                                        vert_array,
                                        conn_offsets,
                                        err );
  CPPUNIT_ASSERT(!err);
  CPPUNIT_ASSERT(vert_array.size() == 60);
  CPPUNIT_ASSERT(conn_offsets.size() == 13);
  EntityTopology type_array[12];
  mesh.elements_get_topologies( &elem_array[0], type_array, 12, err );
  CPPUNIT_ASSERT(!err);
  
    // Verify element types and number of vertices
  for (i = 0; i < 12; ++i)
  {
    CPPUNIT_ASSERT( type_array[i] == PYRAMID );
    CPPUNIT_ASSERT( conn_offsets[i] == 5*i );
  }
  
    // All pyramids should share a common apex, at the
    // center of the sphere
  Mesh::VertexHandle apex_handle = vert_array[4];
  for (i = 1; i < 12; ++i)
  {
    CPPUNIT_ASSERT( vert_array[5*i+4] == apex_handle );
  }
  
    // Verify that apex is at origin and all other vertices are
    // on unit sphere
  MsqVertex vertices[60];
  mesh.vertices_get_coordinates( &vert_array[0], vertices, 60, err );
  CPPUNIT_ASSERT(!err);
  for (i = 0; i < 60; ++i)
  {
    if (vert_array[i] == apex_handle)
      CPPUNIT_ASSERT( vertices[i].within_tolerance_box( Vector3D(0,0,0), 1e-6 ) );
    else
      CPPUNIT_ASSERT( fabs(1.0 - vertices[i].length()) < 1e-6 );
  }
  
    // Try smoothing w/out moving the free vertex and verify that
    // the smoother didn't move the vertex
  Vector3D position(0,0,0);
  for (i = 0; metrics[i] != NULL; ++i)
    CPPUNIT_ASSERT( !smooth_mesh( &mesh, &ideal_mesh, apex_handle, position, metrics[i] ) );
  
    // Now try moving the vertex and see if the smoother moves it back
    // to the origin
  position.set( 0.1, 0.1, 0.1 );
  for (i = 0; metrics[i] != NULL; ++i)
    CPPUNIT_ASSERT( !smooth_mesh( &mesh, &ideal_mesh, apex_handle, position, metrics[i] ) );
  
    // Now try moving the vertex further and see if the smoother moves it back
    // to the origin
  position.set( 0.3, 0.3, 0.3 );
  for (i = 0; metrics[i] != NULL; ++i)
    CPPUNIT_ASSERT( !smooth_mesh( &mesh, &ideal_mesh, apex_handle, position, metrics[i] ) );

    // Now try smoothing a real mixed mesh
  CPPUNIT_ASSERT( !smooth_mixed_mesh( input_file ) );

//.........这里部分代码省略.........
开发者ID:haripandey,项目名称:trilinos,代码行数:101,代码来源:main.cpp


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