void CopyOverlappingGrid(OG & og_dest, OG_SRC const& og_src, CCORR_CRS const& src2dest_coarse_c, // IN: C(Coarse_src) -> C(Coarse) VCORR & src2dest_v, CCORR & src2dest_c) { ConstructGrid0(og_dest.TheGrid(), og_src .TheGrid(), src2dest_v, src2dest_c); og_dest.fine_grid_complete(); CopyOverlap(og_dest.TheOverlap(), og_src .TheOverlap(), og_dest.TheCoarseGrid(), src2dest_coarse_c, og_dest.TheGrid(), src2dest_v, src2dest_c); // og_dest.calc_dependent_information() }
void ConstructMPIDistributedFromMaster ( MPIDistributedGrid<CG,FG> & DistrG, // OUT: to be constructed FGEOM & DistrGeom, // [OUT] to date, implicitely constructed partitioning<MG> & Prtng, // IN: contains partitioning & master GEOM const & MasterGeom, // IN: geometry for master grid overlap_pattern const & ovlp_pattern, // IN: logical dscr. of overlap VCORRLOC & per_v_1, // IN: mapping of periodic bd // (optional, may be empty) VCORRLOC & per_v_2, // inverse of per_v_1 TRAFO const & T1, // IN: geometric transf. corr. to per_v_1 TRAFO const & T2, // inverse of T1 VCORR & master2distr_v, // map vertices of master to those of DistrG CCORR & master2distr_c // same for cells ) { typedef grid_types<CG> cgt; typedef typename cgt::Cell CoarseCell; typedef typename cgt::CellIterator CoarseCellIterator; typedef grid_types<FG> fgt; typedef typename fgt::cell_handle cell_handle; typedef typename fgt::vertex_handle vertex_handle; typedef FGEOM geometry_type; //----------- (1) construct composite grid for ALL partitions ------------- // it would be enough to construct the local part & neighbor parts // of the composite grid! CompositeGrid<CG,FG> compG; typedef bijective_mapping<vertex_handle,vertex_handle> vertex_corr_map; typedef bijective_mapping<cell_handle, cell_handle> cell_corr_map; grid_function<CoarseCell, vertex_corr_map> master2part_v; grid_function<CoarseCell, cell_corr_map> master2part_c; ConstructComposite_per(compG,Prtng,MasterGeom,ovlp_pattern, per_v_1,per_v_2, T1, T2, master2part_v, master2part_c); // composite geometry -- should be constructed in ConstructComposite_per above. grid_function<CoarseCell,geometry_type> compGeom(compG.TheCoarseGrid()); for(CoarseCellIterator CC = compG.TheCoarseGrid().FirstCell(); ! CC.IsDone(); ++CC) compGeom[*CC] = geometry_type(compG.Grid(*CC)); //---------- (2) copy the appropriate local part to the distributed grid -------- DistrG.set_coarse_grid(compG.TheCoarseGrid()); cell_corr_map distr2coarse; ConstructCellCorrespondence(DistrG.TheCoarseGrid(), compG.TheCoarseGrid(), distr2coarse); CoarseCell mMyC = DistrG.MyCell(); CoarseCell cMyC = compG.TheCoarseGrid().cell(distr2coarse(mMyC.handle())); cell_corr_map part2distr_c; vertex_corr_map part2distr_v; // this should be done outside, // using the master2distr mappings. DistrGeom.set_grid(DistrG.TheGrid()); // Use CopyOverlappingGrid for the stuff below?? ConstructGridVC(DistrG.TheGrid(), DistrGeom, compG.Grid(cMyC), compGeom(cMyC), part2distr_v, part2distr_c); DistrG.TheOvrlpGrid().fine_grid_complete(); inverse_mapping<cell_handle, cell_handle> coarse2distr(distr2coarse.inverse()); CopyOverlap(DistrG.TheOverlap(), compG.Overlap(cMyC), DistrG.TheCoarseGrid(), coarse2distr, DistrG.TheGrid(), part2distr_v, part2distr_c); // chain correspondance maps // master2distr_v = part2distr_v o master2part_v // mapping_assign(master2distr_v, compose_map(make_unary_fct_ref(part2distr_v), // make_unary_fct_ref(master2part_v))); typedef typename vertex_corr_map::domain_type dom_type_v; typedef typename dom_type_v::const_iterator dom_iter_v; for(dom_iter_v v = master2part_v[cMyC].domain().begin(); v != master2part_v[cMyC].domain().end(); ++v) master2distr_v[*v] = part2distr_v(master2part_v[cMyC](*v)); // mapping_assign(master2distr_c, compose_map(make_unary_fct_ref(part2distr_c), // make_unary_fct_ref(master2part_c))); typedef typename cell_corr_map::domain_type dom_type_c; typedef typename dom_type_c::const_iterator dom_iter_c; for(dom_iter_c c = master2part_c[cMyC].domain().begin(); c != master2part_c[cMyC].domain().end(); ++c) master2distr_c[*c] = part2distr_c(master2part_c[cMyC](*c)); }
static int BitBlt_SRCCOPY_16bpp(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HDC hdcSrc, int nXSrc, int nYSrc) { int y; uint8 *srcp; uint8 *dstp; if ((hdcDest->selectedObject != hdcSrc->selectedObject) || CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc) == 0) { for (y = 0; y < nHeight; y++) { srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (srcp != 0 && dstp != 0) { gdi_copy_mem(dstp, srcp, nWidth * hdcDest->bytesPerPixel); } } return 0; } if (nYSrc < nYDest) { /* copy down (bottom to top) */ for (y = nHeight - 1; y >= 0; y--) { srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (srcp != 0 && dstp != 0) { gdi_copy_mem(dstp, srcp, nWidth * hdcDest->bytesPerPixel); } } } else if (nYSrc > nYDest || nXSrc > nXDest) { /* copy up or left (top top bottom) */ for (y = 0; y < nHeight; y++) { srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (srcp != 0 && dstp != 0) { gdi_copy_mem(dstp, srcp, nWidth * hdcDest->bytesPerPixel); } } } else { /* copy straight right */ for (y = 0; y < nHeight; y++) { srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (srcp != 0 && dstp != 0) { gdi_copy_memb(dstp, srcp, nWidth * hdcDest->bytesPerPixel); } } } return 0; }
void ConstructLocalOverlappingGrid(OvlpGrid & ovlp_grid, CellRange const& owned_c, Geometry const& geom, Overlap & ovlp, VertexCorr & v_corr, CellCorr & c_corr) { typedef typename CellRange::grid_type grid_type; enumerated_subrange<grid_type> owned(owned_c.TheGrid(),owned_c); // Fixme!! Geometry dummy(ovlp_grid.TheGrid()); ConstructGridVC(ovlp_grid.TheGrid(), // SubrangeFromCells(owned_c), dummy, owned, geom, v_corr, // global -> local c_corr); // global -> local enumerated_subrange<grid_type> copied(ovlp.cells().copied().TheGrid(), ovlp.cells().copied()); // construct vertex identification by shared vertices typedef grid_types<grid_type> gt; typedef typename gt::vertex_handle vertex_handle; bijective_mapping<vertex_handle,vertex_handle> id_shared; typedef typename Overlap::vertex_range_type vrange; typedef typename vrange::const_iterator v_range_iter; for(v_range_iter shv = ovlp.vertices().shared().begin(); shv != ovlp.vertices().shared().end(); ++shv) id_shared[*shv] = v_corr(*shv); EnlargeGridVC(ovlp_grid.TheGrid(), // SubRangeFromCells(ovlp.cells().copied()), copied, geom, // restriction_map(v_corr, ovlp.vertices().shared()), // identify shared id_shared, v_corr, // v_corr remains unchanged on shared vertices c_corr); ovlp_grid.fine_grid_complete(); //--------------------- copy the overlap ranges ------------------------------- // make private ranges mark_private_range(ovlp.cells().privee(), owned_c.FirstCell(), ovlp.cells().exposed(),ovlp.cells().shared(), ovlp.cells().copied()); mark_private_range(ovlp.vertices().privee(), VerticesOfCells(owned_c).FirstVertex(), ovlp.vertices().exposed(),ovlp.vertices().shared(), ovlp.vertices().copied()); //-- not necessary: ovlp_grid.init_overlap(); typedef typename Overlap::CoarseCell CoarseCell; typedef typename Overlap::coarse_grid_type coarse_grid_type; typedef typename grid_types<coarse_grid_type>::cell_handle coarse_cell_handle; // semantics: ovlp_grid.TheOverlap() = ovlp mod global --> local ({v,c}_corr) CopyOverlap(ovlp_grid.TheOverlap(), ovlp, ovlp_grid.TheCoarseGrid(), stdext::identity<coarse_cell_handle>(), // ovlp.TheCoarse() == ovlp_grid.TheCoarse() ovlp_grid.TheGrid(), // ovlp_grid.TheGrid() == local grid, // ovlp .TheGrid() == global_grid v_corr, // ovlp.TheGrid() --> ovlp_grid.TheGrid() c_corr); // ( global --> local ) }