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


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

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


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

示例1: main


//.........这里部分代码省略.........
  Mesh::VertexHandle corners[4];
  classify_boundary( &mesh, corners, curves, err );
  if (MSQ_CHKERR(err)) return 1;
  
    // new, "deformed" domain will be an 2HDx2HD planar square
  const double corner_coords[][3] = { {-HD,-HD, Z},
                                      { HD,-HD, Z},
                                      { HD, HD, Z},
                                      {-HD, HD, Z} };
  LineDomain lines[4] = { 
    LineDomain( Vector3D(corner_coords[0]), Vector3D( 1, 0, 0) ),
    LineDomain( Vector3D(corner_coords[1]), Vector3D( 0, 1, 0) ),
    LineDomain( Vector3D(corner_coords[2]), Vector3D(-1, 0, 0) ),
    LineDomain( Vector3D(corner_coords[3]), Vector3D( 0,-1, 0) ) };
  PlanarDomain surface( PlanarDomain::XY, Z );
  
    // save initial mesh state
  DeformingCurveSmoother curve_tool;
  for (int i = 0; i < 4; ++i) {
    curve_tool.store_initial_mesh( &mesh, &curves[i][0], curves[i].size(), &lines[i], err );
    if (MSQ_CHKERR(err)) return 1;
  }
  DeformingDomainWrapper dd_wrapper;
  dd_wrapper.store_initial_mesh( &mesh, err );
  if (MSQ_CHKERR(err)) return 1;
  
    // move corner vertices to new location
  for (int i = 0; i < 4; ++i) {
    Vector3D vect(corner_coords[i]);
    mesh.vertex_set_coordinates( corners[i], vect, err );
    if (MSQ_CHKERR(err)) return 1;
  }
  std::vector<bool> fixed(4,true);
  mesh.vertices_set_fixed_flag( corners, fixed, 4, err );
  if (MSQ_CHKERR(err)) return 1;
  
    // smooth curves
  for (int i = 0; i < 4; ++i) {
    curve_tool.smooth_curve( &mesh, &curves[i][0], curves[i].size(), &lines[i],
                             DeformingCurveSmoother::PROPORTIONAL, err );
    if (MSQ_CHKERR(err)) return 1;
    fixed.resize(curves[i].size(),true);
    mesh.vertices_set_fixed_flag( &curves[i][0], fixed, curves[i].size(), err );
    if (MSQ_CHKERR(err)) return 1;
  }
  
  MeshDomainAssoc mesh_and_domain1 = MeshDomainAssoc(&mesh, &surface);
  t.reset();
  dd_wrapper.run_instructions( &mesh_and_domain1, err );
  if (MSQ_CHKERR(err)) return 1;
  double dd_secs = t.since_birth();
  std::cout << std::endl << "DeformingDomainWrapper file (term crit=0.01) completed in " 
            << dd_secs << " seconds" << std::endl;

    // Do it all again for the next test
  mesh.clear();
  mesh.read_vtk( deforming_domain_file_name_1, err ); 
  if (MSQ_CHKERR(err)) return 1;

  std::vector<Mesh::VertexHandle> curves2[4];
  Mesh::VertexHandle corners2[4];
  classify_boundary( &mesh, corners2, curves2, err );
  if (MSQ_CHKERR(err)) return 1;
  
    // new, "deformed" domain will be an 2HDx2HD planar square
  const double corner_coords2[][3] = { {-HD,-HD, Z},
开发者ID:00liujj,项目名称:trilinos,代码行数:67,代码来源:main.cpp


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