| 1845 | } // interpolate_data |
| 1846 | |
| 1847 | void |
| 1848 | spread_data(const int stencil_sz, |
| 1849 | const int* const ig_lower, |
| 1850 | const int* const ig_upper, |
| 1851 | const int* const stencil_lower, |
| 1852 | const int* const stencil_upper, |
| 1853 | const double* const dx, |
| 1854 | ArrayData<NDIM, double>& q_data, |
| 1855 | const int q_comp, |
| 1856 | const MLSWeight& Psi, |
| 1857 | const double& Q) |
| 1858 | { |
| 1859 | int istart[NDIM], istop[NDIM]; |
| 1860 | double fac = 1.0; |
| 1861 | for (unsigned int d = 0; d < NDIM; ++d) |
| 1862 | { |
| 1863 | istart[d] = std::max(ig_lower[d] - stencil_lower[d], 0); |
| 1864 | istop[d] = (stencil_sz - 1) - std::max(stencil_upper[d] - ig_upper[d], 0); |
| 1865 | fac /= dx[d]; |
| 1866 | } |
| 1867 | |
| 1868 | #if (NDIM == 3) |
| 1869 | for (int i2 = istart[2]; i2 <= istop[2]; ++i2) |
| 1870 | { |
| 1871 | const int ic2 = stencil_lower[2] + i2; |
| 1872 | #endif |
| 1873 | for (int i1 = istart[1]; i1 <= istop[1]; ++i1) |
| 1874 | { |
| 1875 | const int ic1 = stencil_lower[1] + i1; |
| 1876 | for (int i0 = istart[0]; i0 <= istop[0]; ++i0) |
| 1877 | { |
| 1878 | const int ic0 = stencil_lower[0] + i0; |
| 1879 | #if (NDIM == 2) |
| 1880 | const hier::Index<NDIM> idx(ic0, ic1); |
| 1881 | q_data(idx, q_comp) += Q * Psi[i1][i0] * fac; |
| 1882 | #elif (NDIM == 3) |
| 1883 | const hier::Index<NDIM> idx(ic0, ic1, ic2); |
| 1884 | q_data(idx, q_comp) += Q * Psi[i2][i1][i0] * fac; |
| 1885 | #endif |
| 1886 | } |
| 1887 | } |
| 1888 | #if (NDIM == 3) |
| 1889 | } |
| 1890 | #endif |
| 1891 | } // spread_data |
| 1892 | |
| 1893 | // For internal use - convert to an enumeration. This may make it into the |
| 1894 | // public interface one day but for backwards compatibility we accept only |
| 1895 | // strings for now. |
| 1896 | enum KernelType |
| 1897 | { |
| 1898 | BSPLINE_3, |
| 1899 | BSPLINE_4, |
| 1900 | BSPLINE_5, |
| 1901 | BSPLINE_6, |
| 1902 | COMPOSITE_BSPLINE_23, |
| 1903 | COMPOSITE_BSPLINE_32, |
| 1904 | COMPOSITE_BSPLINE_34, |