| 1773 | } |
| 1774 | |
| 1775 | void AddSingularNode (const typename SingularMLExpansion<elem_type, T_Kappa>::Node & singnode, bool allow_refine, |
| 1776 | Array<RecordingRS> * recording) |
| 1777 | { |
| 1778 | if (mp.SH().Order() < 0) return; |
| 1779 | if (singnode.mp.SH().Order() < 0) return; |
| 1780 | // if (L2Norm(singnode.mp.SH().Coefs()) == 0) return; |
| 1781 | if (level > params.maxlevel) |
| 1782 | { |
| 1783 | singnodes.Append(&singnode); |
| 1784 | return; |
| 1785 | } |
| 1786 | |
| 1787 | // static Timer t("AddSingularNode"); RegionTimer reg(t); |
| 1788 | |
| 1789 | Vec<3> dist = center-singnode.center; |
| 1790 | |
| 1791 | // if (L2Norm(dist)*mp.Kappa() > (mp.Order()+singnode.mp.Order())) |
| 1792 | if (L2Norm(dist) > params.separation*(r + singnode.r)) |
| 1793 | { |
| 1794 | if (singnode.mp.Order() > 2 * mp.Order() && |
| 1795 | singnode.childs[0] && |
| 1796 | singnode.childs[0]->mp.Order() < singnode.mp.Order()) |
| 1797 | { |
| 1798 | for (auto & child : singnode.childs) |
| 1799 | AddSingularNode (*child, allow_refine, recording); |
| 1800 | return; |
| 1801 | } |
| 1802 | |
| 1803 | // static Timer t("mptool transform Helmholtz-criterion"); RegionTimer r(t); |
| 1804 | if (recording) |
| 1805 | *recording += RecordingRS(&singnode.mp, &mp, dist); |
| 1806 | else |
| 1807 | singnode.mp.TransformAdd(mp, dist); |
| 1808 | return; |
| 1809 | } |
| 1810 | |
| 1811 | |
| 1812 | if ( singnode.childs[0]==nullptr ) |
| 1813 | { |
| 1814 | singnodes.Append(&singnode); |
| 1815 | return; |
| 1816 | } |
| 1817 | |
| 1818 | if (r > singnode.r) |
| 1819 | { |
| 1820 | if (allow_refine) |
| 1821 | { |
| 1822 | if (!childs[0]) |
| 1823 | CreateChilds(true); |
| 1824 | |
| 1825 | for (auto & ch : childs) |
| 1826 | ch -> AddSingularNode (singnode, allow_refine, recording); |
| 1827 | } |
| 1828 | else |
| 1829 | { |
| 1830 | if (total_targets < 1000 || recording) |
| 1831 | { |
| 1832 | for (auto & ch : childs) |
no test coverage detected