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


C++ Partition::Range方法代码示例

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


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

示例1: ConstructComposite_per


//.........这里部分代码省略.........
  // enlarge grid by periodic geometric mapping of these subranges


  per_corr_c_type c_corr_per;
  per_corr_v_type v_corr_per;

  EnlargeGridVC(G,
		per_ovlp1,
		TransformGeom(geom,T1),
		id_per_v1,
		v_corr_per,
		c_corr_per);
  EnlargeGridVC(G,
		per_ovlp2,
		TransformGeom(geom,T2),
		id_per_v2,
		v_corr_per,
		c_corr_per);

  // should work automatically
  Prtng.update();

  /*
  ofstream oogl_output;
  oogl_output.open("construct-overlap.oogl");
  GraphicsDevice Dev = OOGLDevice(oogl_output);
  Dev << BeginGroup("m-mesh")       << ViewGrid(G,geom)                    << EndGroup
      << BeginGroup("m-vertex-hdl") << ViewGFAsString(vertex2handle(G), geom) << EndGroup
      << BeginGroup("m-cell-hdl")   << ViewGFAsString(cell2handle(G),   geom) << EndGroup;
  oogl_output.close();
  */

  // identify added ranges with their source
  GridSelfMap<fine_grid_type> grid_map(G);

  for(pviter v0 = v_corr_per.domain().begin(); v0  != v_corr_per.domain().end(); ++v0)
    grid_map.TheVertexMap()[v_corr_per(*v0)] = *v0;

  for(pciter c = c_corr_per.domain().begin(); c  != c_corr_per.domain().end(); ++c)
    grid_map.TheCellMap()[c_corr_per(*c)] = *c;


  // attach temporal partitions to added grid ranges -- partitions
  // are in principle inherited from src ranges, but are assigned a new
  // partition number to avoid conflicts if partitions are self-neighboured
  // under periodic wrapping.
  map_unique map_partition;
  typedef typename enumerated_cell_range<fine_grid_type>::ElementIterator RgeCellIterator;
  for(RgeCellIterator C = per_ovlp_cells_1.FirstCell(); ! C.IsDone(); ++C)
    Prtng.set_partition(G.cell(c_corr_per(C.handle())), map_partition(Prtng.partition(*C)));
  for(RgeCellIterator CC = per_ovlp_cells_2.FirstCell(); ! CC.IsDone(); ++CC)
    Prtng.set_partition(G.cell(c_corr_per(CC.handle())), map_partition(Prtng.partition(*CC)));



  coarse_grid_type& CrsG(CG.TheCoarseGrid());

  grid_function<CoarseCell,int> cell2part(CG.TheCoarseGrid());
  bijective_mapping<int, CoarseCell> part2cell;
  for(CoarseCellIterator P = CrsG.FirstCell(); ! P.IsDone(); ++P) {
    cell2part[*P] = CoarseCellCorr(P.handle());
    part2cell[cell2part(*P)] = *P;
    part2cell[map_partition(cell2part(*P))] = *P;  // "virtual" partition
  }


  //--------------------- construct overlap structures  -------------------------

  // overlap tied to the global grid
  typedef dyn_overlap<coarse_grid_type, fine_grid_type> overlap_type;
  grid_function<CoarseCell, overlap_type>               Ovlp(CrsG);
  for(CoarseCellIterator PP = CrsG.FirstCell(); ! PP.IsDone(); ++PP) {
    Ovlp[*PP].init(CrsG,Prtng.TheGrid());
  }

  ConstructOverlap(Ovlp,CrsG,Prtng,ovlp_pattern, part2cell, cell2part, grid_map);

  /*
  for(CoarseCellIterator P0 = CrsG.FirstCell(); ! P0.IsDone(); ++P0) {
    cerr << "Overlap " << CrsG.handle(*P0) << '\n'
	 << "------------------------------------------\n";
    write_ovlp(Ovlp[*P0],cerr);
    cerr << "------------------------------------------\n";
  }
  */

  //--------------------- construct local grids  ---------------------------------

  for(CoarseCellIterator P1 = CrsG.FirstCell(); ! P1.IsDone(); ++P1) {
    CG.OvrlpGrid(*P1).init(CG.TheCoarseGrid());
    ConstructLocalOverlappingGrid(CG.OvrlpGrid(*P1),
				  Prtng.Range(cell2part(*P1)), geom,
				  Ovlp[*P1], v_corr[*P1], c_corr[*P1]);
  }

  //---------------------------- do checkings   ------------------------------------

  check_composite_grid(CG);

}
开发者ID:BackupTheBerlios,项目名称:gral,代码行数:101,代码来源:construct-composite-periodic.C


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