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


C++ Obj::markBoundaryCells方法代码示例

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


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

示例1: main

int main(int argc, char *argv[])
{
  MPI_Comm       comm;
  Options        options;
  PetscErrorCode ierr;

  PetscFunctionBegin;
  ierr = PetscInitialize(&argc, &argv, (char *) 0, NULL);CHKERRQ(ierr);
  comm = PETSC_COMM_WORLD;

  try {
    ierr = ProcessOptions(comm, &options);CHKERRQ(ierr);
    Obj<ALE::Mesh> mesh;
    Mesh mesh_set[options.levels];
    for (int i = 0; i < options.levels; i++) {
      ierr = MeshCreate(comm, &mesh_set[i]);CHKERRQ(ierr);
    };
    ierr = CreateMesh(comm, mesh, &options);CHKERRQ(ierr);
    
    MeshSetMesh(mesh_set[0], mesh);
    ierr = MeshIDBoundary(mesh_set[0]);
    mesh->markBoundaryCells("marker");
    ierr = PetscPrintf(mesh->comm(), "%d boundary vertices, %d boundary cells\n", mesh->getLabelStratum("marker", 1)->size(), mesh->getLabelStratum("marker", 2)->size());
    ierr = MeshSpacingFunction(mesh_set[0]);
    //ierr = MeshIDBoundary(mesh_set[0]);
//    mesh->createLabel("marker");
//    mesh->markBoundaryCells("marker", 1, 2, false);
    MeshCreateHierarchyLabel_Link(mesh_set[0], options.coarseFactor, options.levels, &mesh_set[1],NULL,options.curvatureCutoff );
    Obj<ALE::Mesh> ale_meshes[options.levels];
    for (int i = 0; i < options.levels; i++) {
      MeshGetMesh(mesh_set[i], ale_meshes[i]);
    }
    Hierarchy_qualityInfo(ale_meshes, options.levels);
    //ierr = MeshCoarsenMesh(m, pow(options.coarseFactor, 2), &n);
    //ierr = MeshGetMesh(n, mesh);
    //ierr = MeshLocateInMesh(m, n);
   // Obj<ALE::Mesh::sieve_type> sieve = new ALE::Mesh::sieve_type(mesh->comm(), 0);
   // mesh->getTopology()->setPatch(options.levels, sieve);
   // mesh->getTopology()->stratify();
    char vtkfilename[128];
    for (int i = 0; i < options.levels; i++) {
      sprintf(vtkfilename, "testMesh%d.vtk", i);
      ierr = OutputVTK(ale_meshes[i], &options, vtkfilename);CHKERRQ(ierr);
    }
  } catch (ALE::Exception e) {
    std::cout << e << std::endl;
  }
  ierr = PetscFinalize();CHKERRQ(ierr);
  PetscFunctionReturn(0);
}
开发者ID:,项目名称:,代码行数:50,代码来源:

示例2: main

int main(int argc, char *argv[])
{
  MPI_Comm       comm;
  Options        options;
  PetscErrorCode ierr;

  PetscFunctionBegin;
  ierr = PetscInitialize(&argc, &argv, (char *) 0, NULL);CHKERRQ(ierr);
  comm = PETSC_COMM_WORLD;

  try {
    ierr = ProcessOptions(comm, &options);CHKERRQ(ierr);
    Obj<ALE::Mesh> m;
    Mesh mesh;
    ierr = MeshCreate(comm, &mesh);
    m = new ALE::Mesh(comm, options.debug);
    ierr = CreateMesh(comm, m, &options);CHKERRQ(ierr);
    ierr = MeshSetMesh(mesh, m);
    //ierr = MeshIDBoundary(mesh);
    //create the spacing function on the original mesh
    
    m->markBoundaryCells("marker");
    //    PetscPrintf(m->comm(), "marked the boundary cells\n");

    int nMeshes;
    Obj<ALE::Mesh> * coarsened_mesh = Hierarchy_createHierarchy_adaptive(m, 60, 10, options.coarseFactor, &nMeshes);
    Hierarchy_qualityInfo(coarsened_mesh, nMeshes);
    char vtkfilename[256];
    sprintf(vtkfilename, "fine_mesh.vtk");
    ierr = OutputVTK(m, &options, vtkfilename);CHKERRQ(ierr);
    for (int i = 1; i < nMeshes; i++) {
      sprintf(vtkfilename, "coarse_mesh%d.vtk", i);
      ierr = OutputVTK(coarsened_mesh[i], &options, vtkfilename);CHKERRQ(ierr);
    } 
  } catch (ALE::Exception e) {
    std::cout << e << std::endl;
  }
  ierr = PetscFinalize();
  PetscFunctionReturn(0);
}
开发者ID:Kun-Qu,项目名称:petsc,代码行数:40,代码来源:ex_coarsen.c


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