| 1839 | } |
| 1840 | |
| 1841 | BoxList |
| 1842 | GetBndryCells (const BoxArray& ba, |
| 1843 | int ngrow) |
| 1844 | { |
| 1845 | BL_ASSERT(ba.ok()); |
| 1846 | BL_ASSERT(!ba.empty()); |
| 1847 | // |
| 1848 | // First get list of all ghost cells. |
| 1849 | // |
| 1850 | const IndexType btype = ba.ixType(); |
| 1851 | |
| 1852 | BoxList bcells = ba.boxList(); |
| 1853 | bcells.simplify(); |
| 1854 | |
| 1855 | BoxArray tba(bcells); |
| 1856 | |
| 1857 | BoxList gcells(btype); |
| 1858 | BoxList bl_diff(btype); |
| 1859 | for (int i = 0, N = static_cast<int>(tba.size()); i < N; ++i) |
| 1860 | { |
| 1861 | const Box& bx = tba[i]; |
| 1862 | amrex::boxDiff(bl_diff, amrex::grow(bx,ngrow), bx); |
| 1863 | gcells.join(bl_diff); |
| 1864 | } |
| 1865 | // |
| 1866 | // Now strip out intersections with original BoxArray. |
| 1867 | // |
| 1868 | std::vector< std::pair<int,Box> > isects; |
| 1869 | |
| 1870 | bcells.clear(); |
| 1871 | BoxList pieces(btype); |
| 1872 | BoxList bl_tmp(btype); |
| 1873 | |
| 1874 | for (const Box& gbx : gcells) |
| 1875 | { |
| 1876 | tba.intersections(gbx, isects); |
| 1877 | if (isects.empty()) |
| 1878 | { |
| 1879 | bcells.push_back(gbx); |
| 1880 | } |
| 1881 | else |
| 1882 | { |
| 1883 | pieces.clear(); |
| 1884 | for (const auto& isec : isects) { |
| 1885 | pieces.push_back(isec.second); |
| 1886 | } |
| 1887 | bl_tmp.complementIn(gbx,pieces); |
| 1888 | bcells.join(bl_tmp); |
| 1889 | } |
| 1890 | } |
| 1891 | |
| 1892 | gcells = amrex::removeOverlap(bcells); |
| 1893 | gcells.simplify(); |
| 1894 | |
| 1895 | return gcells; |
| 1896 | } |
| 1897 | |
| 1898 |
no test coverage detected