25 #ifndef GAUSSIAN_QUADRATURE_HPP_INCLUDED
26 #define GAUSSIAN_QUADRATURE_HPP_INCLUDED
29 #include "../library/lib_domain.hpp"
61 template <
class scalar_t>
62 Eigen::Matrix<scalar_t, Eigen::Dynamic, 2>
gauss_impl(
size_t N)
64 typedef Eigen::Matrix<scalar_t, Eigen::Dynamic, Eigen::Dynamic>
mat_t;
69 for (
size_t n = 0; n < N-1; ++n)
71 scalar_t v = scalar_t(n+1);
72 scalar_t u = v / sqrt(4.0*v*v - 1);
78 Eigen::SelfAdjointEigenSolver<mat_t> solver(
J);
79 Eigen::Matrix<scalar_t, Eigen::Dynamic, 2> V;
81 V.col(0) = solver.eigenvalues();
82 V.col(1) = 2.0 * solver.eigenvectors().row(0).cwiseAbs2();
88 template <
class Domain>
96 template <
class Domain>
136 size_t N = degree/2+1;
138 auto V = gauss_impl<scalar_t>(N);
141 for(
size_t i = 0; i < N; ++i)
184 base_t((degree/2+1) * (degree/2+1))
186 size_t N = degree/2+1;
187 auto V = gauss_impl<scalar_t>(N);
190 for(
size_t i = 0; i < N; ++i)
192 for(
size_t j = 0; j < N; ++j)
195 xi << V(i,0), V(j,0);
206 static std::array<size_t, 15>
const dunavant_num = {
256 base_t(degree < dunavant_num.size() ? dunavant_num[degree] : 0)
507 throw std::out_of_range(
"unsupported dunavant degree: " + std::to_string(degree) +
508 " (max degree: " + std::to_string(dunavant_num.size()-1) +
")");
520 template<
class Domain>
560 Eigen::Matrix<scalar_t, Eigen::Dynamic, 2> V(N, 2);
566 2.5000000000000000e-01, 1.0000000000000000e+00;
570 1.1200880616697619e-01, 7.1853931903038448e-01,
571 6.0227690811873813e-01, 2.8146068096961557e-01;
575 6.3890793087325398e-02, 5.1340455223236336e-01,
576 3.6899706371561874e-01, 3.9198004120148755e-01,
577 7.6688030393894147e-01, 9.4615406566149127e-02;
581 4.1448480199383221e-02, 3.8346406814513512e-01,
582 2.4527491432060225e-01, 3.8687531777476264e-01,
583 5.5616545356027580e-01, 1.9043512695014242e-01,
584 8.4898239453298519e-01, 3.9225487129959831e-02;
588 2.9134472151972100e-02, 2.9789347178289399e-01,
589 1.7397721332089799e-01, 3.4977622651322399e-01,
590 4.1170252028490201e-01, 2.3448829004405200e-01,
591 6.7731417458281995e-01, 9.8930459516633096e-02,
592 8.9477136103100796e-01, 1.8911552143195801e-02;
601 9.0426309621996510e-03, 1.2095513195457051e-01,
602 5.3971266222500633e-02, 1.8636354256407187e-01,
603 1.3531182463925079e-01, 1.9566087327775999e-01,
604 2.4705241628715982e-01, 1.7357714218290693e-01,
605 3.8021253960933232e-01, 1.3569567299548421e-01,
606 5.2379231797184322e-01, 9.3646758538110525e-02,
607 6.6577520551642455e-01, 5.5787727351415871e-02,
608 7.9419041601196627e-01, 2.7159810899233330e-02,
609 8.9816109121900356e-01, 9.5151826028485147e-03,
610 9.6884798871863353e-01, 1.6381576335982632e-03;
619 4.3831101754754041e-03, 6.7009978916493712e-02,
620 2.5935898105330615e-02, 1.1226415028670574e-01,
621 6.5596095412316244e-02, 1.3176017703967990e-01,
622 1.2210193407333160e-01, 1.3521764906193473e-01,
623 1.9339526237400712e-01, 1.2788179864568036e-01,
624 2.7677283870610203e-01, 1.1353290749021942e-01,
625 3.6901512713974294e-01, 9.5205239784358658e-02,
626 4.6652432896470658e-01, 7.5389314167395957e-02,
627 5.6547347379181734e-01, 5.6078424492653718e-02,
628 6.6196291901245641e-01, 3.8768295375018233e-02,
629 7.5217888337878580e-01, 2.4451483268750077e-02,
630 8.3254803386618959e-01, 1.3624630138238846e-02,
631 8.9988205012089806e-01, 6.3164475985907614e-03,
632 9.5150618874340986e-01, 2.1388899159444715e-03,
633 9.8536446812213196e-01, 3.6061381833540662e-04;
642 2.5883279559219554e-03, 4.3142752133208076e-02,
643 1.5209662349560232e-02, 7.5383709908589364e-02,
644 3.8536550372165329e-02, 9.3053267451663049e-02,
645 7.2181613815873902e-02, 1.0145671184982975e-01,
646 1.1546052648763315e-01, 1.0320176205607207e-01,
647 1.6744285627532968e-01, 1.0002254980527317e-01,
648 2.2698378726020249e-01, 9.3259799300297680e-02,
649 2.9275496094154585e-01, 8.4028952871941051e-02,
650 3.6327742985785888e-01, 7.3285589130030734e-02,
651 4.3695714009076830e-01, 6.1850336913730292e-02,
652 5.1212259467896737e-01, 5.0416604438374681e-02,
653 5.8706404491440989e-01, 3.9551370005298382e-02,
654 6.6007341331490943e-01, 2.9694077895812843e-02,
655 7.2948408392968744e-01, 2.1156315355427099e-02,
656 7.9370967198708586e-01, 1.4123732938964021e-02,
657 8.5128089278912578e-01, 8.6609745043354988e-03,
658 9.0087968085441761e-01, 4.7199401462036054e-03,
659 9.4136974912909166e-01, 2.1513974039652061e-03,
660 9.7182274107526323e-01, 7.1972821465320265e-04,
661 9.9153808143871203e-01, 1.2042767633021674e-04;
664 throw std::out_of_range(
"unsupported log Gauss degree");
684 size_t N = degree / 2 + 1;
689 for (
size_t i = 0; i < V.rows(); ++i)
696 #endif // GAUSSIAN_QUADRATURE_HPP_INCLUDED