/* gauss-quad.c * * Rouben Rostamian * 2011-05-01 * 2013-02-02: * changed the prototype from gauss_qdat(int *d, int *n) to gauss_qdat(int *n) * removed the typedef on static Gauss_qdat * renamed the quadrature coordinates from xi to x */ #include #include #include "gauss-quad.h" /* begin machine-generated code */ static struct Gauss_qdat quaddata1[] = { /* n = 1 */ { 0.00000000000000000000, 2.00000000000000000000}, { 0.0, -1.0}, }; static struct Gauss_qdat quaddata2[] = { /* n = 2 */ { -0.57735026918962576451, 1.00000000000000000000}, { 0.57735026918962576451, 1.00000000000000000000}, { 0.0, -1.0}, }; static struct Gauss_qdat quaddata3[] = { /* n = 3 */ { -0.77459666924148337704, 0.55555555555555555556}, { 0.00000000000000000000, 0.88888888888888888889}, { 0.77459666924148337704, 0.55555555555555555556}, { 0.0, -1.0}, }; /**A:quaddata4**/ static struct Gauss_qdat quaddata4[] = { /* n = 4 */ { -0.86113631159405257522, 0.34785484513745385737}, { -0.33998104358485626480, 0.65214515486254614263}, { 0.33998104358485626480, 0.65214515486254614263}, { 0.86113631159405257522, 0.34785484513745385737}, { 0.0, -1.0}, }; /**B:quaddata4**/ static struct Gauss_qdat quaddata5[] = { /* n = 5 */ { -0.90617984593866399280, 0.23692688505618908751}, { -0.53846931010568309104, 0.47862867049936646804}, { 0.00000000000000000000, 0.56888888888888888889}, { 0.53846931010568309104, 0.47862867049936646804}, { 0.90617984593866399280, 0.23692688505618908751}, { 0.0, -1.0}, }; static struct Gauss_qdat quaddata6[] = { /* n = 6 */ { -0.93246951420315202781, 0.17132449237917034504}, { -0.66120938646626451366, 0.36076157304813860757}, { -0.23861918608319690863, 0.46791393457269104739}, { 0.23861918608319690863, 0.46791393457269104739}, { 0.66120938646626451366, 0.36076157304813860757}, { 0.93246951420315202781, 0.17132449237917034504}, { 0.0, -1.0}, }; static struct Gauss_qdat quaddata7[] = { /* n = 7 */ { -0.94910791234275852453, 0.12948496616886969327}, { -0.74153118559939443986, 0.27970539148927666790}, { -0.40584515137739716691, 0.38183005050511894495}, { 0.00000000000000000000, 0.41795918367346938776}, { 0.40584515137739716691, 0.38183005050511894495}, { 0.74153118559939443986, 0.27970539148927666790}, { 0.94910791234275852453, 0.12948496616886969327}, { 0.0, -1.0}, }; static struct Gauss_qdat quaddata8[] = { /* n = 8 */ { -0.96028985649753623168, 0.10122853629037625915}, { -0.79666647741362673959, 0.22238103445337447054}, { -0.52553240991632898582, 0.31370664587788728734}, { -0.18343464249564980494, 0.36268378337836198297}, { 0.18343464249564980494, 0.36268378337836198297}, { 0.52553240991632898582, 0.31370664587788728734}, { 0.79666647741362673959, 0.22238103445337447054}, { 0.96028985649753623168, 0.10122853629037625915}, { 0.0, -1.0}, }; static struct Gauss_qdat quaddata9[] = { /* n = 9 */ { -0.96816023950762608984, 0.08127438836157441197}, { -0.83603110732663579430, 0.18064816069485740406}, { -0.61337143270059039731, 0.26061069640293546232}, { -0.32425342340380892904, 0.31234707704000284007}, { 0.00000000000000000000, 0.33023935500125976316}, { 0.32425342340380892904, 0.31234707704000284007}, { 0.61337143270059039731, 0.26061069640293546232}, { 0.83603110732663579430, 0.18064816069485740406}, { 0.96816023950762608984, 0.08127438836157441197}, { 0.0, -1.0}, }; static struct Gauss_qdat quaddata10[] = { /* n = 10 */ { -0.97390652851717172008, 0.06667134430868813759}, { -0.86506336668898451073, 0.14945134915058059315}, { -0.67940956829902440623, 0.21908636251598204400}, { -0.43339539412924719080, 0.26926671930999635509}, { -0.14887433898163121088, 0.29552422471475287017}, { 0.14887433898163121088, 0.29552422471475287017}, { 0.43339539412924719080, 0.26926671930999635509}, { 0.67940956829902440623, 0.21908636251598204400}, { 0.86506336668898451073, 0.14945134915058059315}, { 0.97390652851717172008, 0.06667134430868813759}, { 0.0, -1.0}, }; static struct Gauss_qdat quaddata11[] = { /* n = 11 */ { -0.97822865814605699280, 0.05566856711617366648}, { -0.88706259976809529908, 0.12558036946490462463}, { -0.73015200557404932409, 0.18629021092773425143}, { -0.51909612920681181593, 0.23319376459199047992}, { -0.26954315595234497233, 0.26280454451024666218}, { 0.00000000000000000000, 0.27292508677790063071}, { 0.26954315595234497233, 0.26280454451024666218}, { 0.51909612920681181593, 0.23319376459199047992}, { 0.73015200557404932409, 0.18629021092773425143}, { 0.88706259976809529908, 0.12558036946490462463}, { 0.97822865814605699280, 0.05566856711617366648}, { 0.0, -1.0}, }; static struct Gauss_qdat quaddata12[] = { /* n = 12 */ { -0.98156063424671925069, 0.04717533638651182719}, { -0.90411725637047485668, 0.10693932599531843096}, { -0.76990267419430468704, 0.16007832854334622633}, { -0.58731795428661744730, 0.20316742672306592175}, { -0.36783149899818019375, 0.23349253653835480876}, { -0.12523340851146891547, 0.24914704581340278500}, { 0.12523340851146891547, 0.24914704581340278500}, { 0.36783149899818019375, 0.23349253653835480876}, { 0.58731795428661744730, 0.20316742672306592175}, { 0.76990267419430468704, 0.16007832854334622633}, { 0.90411725637047485668, 0.10693932599531843096}, { 0.98156063424671925069, 0.04717533638651182719}, { 0.0, -1.0}, }; static struct Gauss_qdat quaddata13[] = { /* n = 13 */ { -0.98418305471858814947, 0.04048400476531587952}, { -0.91759839922297796521, 0.09212149983772844791}, { -0.80157809073330991279, 0.13887351021978723846}, { -0.64234933944034022064, 0.17814598076194573828}, { -0.44849275103644685288, 0.20781604753688850231}, { -0.23045831595513479407, 0.22628318026289723841}, { 0.00000000000000000000, 0.23255155323087391019}, { 0.23045831595513479407, 0.22628318026289723841}, { 0.44849275103644685288, 0.20781604753688850231}, { 0.64234933944034022064, 0.17814598076194573828}, { 0.80157809073330991279, 0.13887351021978723846}, { 0.91759839922297796521, 0.09212149983772844791}, { 0.98418305471858814947, 0.04048400476531587952}, { 0.0, -1.0}, }; static struct Gauss_qdat quaddata14[] = { /* n = 14 */ { -0.98628380869681233884, 0.03511946033175186303}, { -0.92843488366357351734, 0.08015808715976020981}, { -0.82720131506976499319, 0.12151857068790318469}, { -0.68729290481168547015, 0.15720316715819353457}, { -0.51524863635815409197, 0.18553839747793781374}, { -0.31911236892788976044, 0.20519846372129560397}, { -0.10805494870734366207, 0.21526385346315779020}, { 0.10805494870734366207, 0.21526385346315779020}, { 0.31911236892788976044, 0.20519846372129560397}, { 0.51524863635815409197, 0.18553839747793781374}, { 0.68729290481168547015, 0.15720316715819353457}, { 0.82720131506976499319, 0.12151857068790318469}, { 0.92843488366357351734, 0.08015808715976020981}, { 0.98628380869681233884, 0.03511946033175186303}, { 0.0, -1.0}, }; static struct Gauss_qdat quaddata15[] = { /* n = 15 */ { -0.98799251802048542849, 0.03075324199611726835}, { -0.93727339240070590431, 0.07036604748810812471}, { -0.84820658341042721620, 0.10715922046717193501}, { -0.72441773136017004742, 0.13957067792615431445}, { -0.57097217260853884754, 0.16626920581699393355}, { -0.39415134707756336990, 0.18616100001556221103}, { -0.20119409399743452230, 0.19843148532711157646}, { 0.00000000000000000000, 0.20257824192556127288}, { 0.20119409399743452230, 0.19843148532711157646}, { 0.39415134707756336990, 0.18616100001556221103}, { 0.57097217260853884754, 0.16626920581699393355}, { 0.72441773136017004742, 0.13957067792615431445}, { 0.84820658341042721620, 0.10715922046717193501}, { 0.93727339240070590431, 0.07036604748810812471}, { 0.98799251802048542849, 0.03075324199611726835}, { 0.0, -1.0}, }; static struct Gauss_qdat *QuadTables[] = { NULL, /* no 0-point quadrature */ quaddata1, quaddata2, quaddata3, quaddata4, quaddata5, quaddata6, quaddata7, quaddata8, quaddata9, quaddata10, quaddata11, quaddata12, quaddata13, quaddata14, quaddata15, }; /* end machine-generated code */ /* Receives a request for an n-point quadrature table. * Changes n if necessary to bring it into the range * of the available tables. * * A polynomial of degree 2n-1 will be integrated exactly, within * floating point roundoff errors, with this quadrature table. */ struct Gauss_qdat *gauss_qdat(int *n) { int ntables = (sizeof QuadTables / sizeof QuadTables[0]) - 1; if (*n < 1) *n = 1; else if (*n > ntables) *n = ntables; return QuadTables[*n]; }