⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 quadrature_gauss_1d.c

📁 一个用来实现偏微分方程中网格的计算库
💻 C
📖 第 1 页 / 共 2 页
字号:
// $Id: quadrature_gauss_1D.C 2948 2008-07-31 16:04:51Z jwpeterson $// The libMesh Finite Element Library.// Copyright (C) 2002-2007  Benjamin S. Kirk, John W. Peterson  // This library is free software; you can redistribute it and/or// modify it under the terms of the GNU Lesser General Public// License as published by the Free Software Foundation; either// version 2.1 of the License, or (at your option) any later version.  // This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU// Lesser General Public License for more details.  // You should have received a copy of the GNU Lesser General Public// License along with this library; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA// C++ includes// Local includes#include "quadrature_gauss.h" void QGauss::init_1D(const ElemType,                     unsigned int p){  //----------------------------------------------------------------------  // 1D quadrature rules  switch(_order + 2*p)    {    case CONSTANT:    case FIRST:      {	_points.resize (1);	_weights.resize(1);		_points[0](0)  = 0.;		_weights[0]    = 2.;		return;      }    case SECOND:    case THIRD:      {	_points.resize (2);	_weights.resize(2);	      	_points[0](0) = -5.7735026918962576450914878050196e-01L; // -sqrt(3)/3	_points[1]    = -_points[0];	_weights[0]   = 1.;	_weights[1]   = _weights[0];	return;      }    case FOURTH:    case FIFTH:      {	_points.resize (3);	_weights.resize(3);	      	_points[ 0](0) = -7.7459666924148337703585307995648e-01L;	_points[ 1](0) = 0.;	_points[ 2]    = -_points[0];	_weights[ 0]   = 5.5555555555555555555555555555556e-01L;	_weights[ 1]   = 8.8888888888888888888888888888889e-01L;	_weights[ 2]   = _weights[0];	return;      }    case SIXTH:    case SEVENTH:      {	_points.resize (4);	_weights.resize(4);	      	_points[ 0](0) = -8.6113631159405257522394648889281e-01L;	_points[ 1](0) = -3.3998104358485626480266575910324e-01L;	_points[ 2]    = -_points[1];	_points[ 3]    = -_points[0];	_weights[ 0]   = 3.4785484513745385737306394922200e-01L;	_weights[ 1]   = 6.5214515486254614262693605077800e-01L;	_weights[ 2]   = _weights[1];	_weights[ 3]   = _weights[0];	return;      }    case EIGHTH:    case NINTH:      {	_points.resize (5);	_weights.resize(5);	      	_points[ 0](0) = -9.0617984593866399279762687829939e-01L;	_points[ 1](0) = -5.3846931010568309103631442070021e-01L;	_points[ 2](0) = 0.;	_points[ 3]    = -_points[1];	_points[ 4]    = -_points[0];	_weights[ 0]   = 2.3692688505618908751426404071992e-01L;	_weights[ 1]   = 4.7862867049936646804129151483564e-01L;	_weights[ 2]   = 5.6888888888888888888888888888889e-01L;	_weights[ 3]   = _weights[1];	_weights[ 4]   = _weights[0];	return;      }    case TENTH:    case ELEVENTH:      {	_points.resize (6);	_weights.resize(6);	      	_points[ 0](0) = -9.3246951420315202781230155449399e-01L;	_points[ 1](0) = -6.6120938646626451366139959501991e-01L;	_points[ 2](0) = -2.3861918608319690863050172168071e-01L;	_points[ 3]    = -_points[2];	_points[ 4]    = -_points[1];	_points[ 5]    = -_points[0];	_weights[ 0]   = 1.7132449237917034504029614217273e-01L;	_weights[ 1]   = 3.6076157304813860756983351383772e-01L;	_weights[ 2]   = 4.6791393457269104738987034398955e-01L;	_weights[ 3]   = _weights[2];	_weights[ 4]   = _weights[1];	_weights[ 5]   = _weights[0];	return;      }    case TWELFTH:    case THIRTEENTH:      {	_points.resize (7);	_weights.resize(7);	      	_points[ 0](0) = -9.4910791234275852452618968404785e-01L;	_points[ 1](0) = -7.4153118559939443986386477328079e-01L;	_points[ 2](0) = -4.0584515137739716690660641207696e-01L;	_points[ 3](0) = 0.;	_points[ 4]    = -_points[2];	_points[ 5]    = -_points[1];	_points[ 6]    = -_points[0];	_weights[ 0]   = 1.2948496616886969327061143267908e-01L;	_weights[ 1]   = 2.7970539148927666790146777142378e-01L;	_weights[ 2]   = 3.8183005050511894495036977548898e-01L;	_weights[ 3]   = 4.1795918367346938775510204081633e-01L;	_weights[ 4]   = _weights[2];	_weights[ 5]   = _weights[1];	_weights[ 6]   = _weights[0];	return;      }    case FOURTEENTH:    case FIFTEENTH:      {	_points.resize (8);	_weights.resize(8);	      	_points[ 0](0) = -9.6028985649753623168356086856947e-01L;	_points[ 1](0) = -7.9666647741362673959155393647583e-01L;	_points[ 2](0) = -5.2553240991632898581773904918925e-01L;	_points[ 3](0) = -1.8343464249564980493947614236018e-01L;	_points[ 4]    = -_points[3];	_points[ 5]    = -_points[2];	_points[ 6]    = -_points[1];	_points[ 7]    = -_points[0];	_weights[ 0]   = 1.0122853629037625915253135430996e-01L;	_weights[ 1]   = 2.2238103445337447054435599442624e-01L;	_weights[ 2]   = 3.1370664587788728733796220198660e-01L;	_weights[ 3]   = 3.6268378337836198296515044927720e-01L;	_weights[ 4]   = _weights[3];	_weights[ 5]   = _weights[2];	_weights[ 6]   = _weights[1];	_weights[ 7]   = _weights[0];	return;      }    case SIXTEENTH:    case SEVENTEENTH:      {	_points.resize (9);	_weights.resize(9);	_points[ 0](0) = -9.6816023950762608983557620290367e-01L;	_points[ 1](0) = -8.3603110732663579429942978806973e-01L;	_points[ 2](0) = -6.1337143270059039730870203934147e-01L;	_points[ 3](0) = -3.2425342340380892903853801464334e-01L;	_points[ 4](0) = 0.;	_points[ 5]    = -_points[3];	_points[ 6]    = -_points[2];	_points[ 7]    = -_points[1];	_points[ 8]    = -_points[0];	_weights[ 0]   = 8.1274388361574411971892158110524e-02L;	_weights[ 1]   = 1.8064816069485740405847203124291e-01L;	_weights[ 2]   = 2.6061069640293546231874286941863e-01L;	_weights[ 3]   = 3.1234707704000284006863040658444e-01L;	_weights[ 4]   = 3.3023935500125976316452506928697e-01L;	_weights[ 5]   = _weights[3];	_weights[ 6]   = _weights[2];	_weights[ 7]   = _weights[1];	_weights[ 8]   = _weights[0];	return;      }    case EIGHTTEENTH:    case NINTEENTH:      {	_points.resize (10);	_weights.resize(10);	_points[ 0](0) = -9.7390652851717172007796401208445e-01L;	_points[ 1](0) = -8.6506336668898451073209668842349e-01L;	_points[ 2](0) = -6.7940956829902440623432736511487e-01L;	_points[ 3](0) = -4.3339539412924719079926594316578e-01L;	_points[ 4](0) = -1.4887433898163121088482600112972e-01L;	_points[ 5]    = -_points[4];	_points[ 6]    = -_points[3];	_points[ 7]    = -_points[2];	_points[ 8]    = -_points[1];	_points[ 9]    = -_points[0];	_weights[ 0]   = 6.6671344308688137593568809893332e-02L;	_weights[ 1]   = 1.4945134915058059314577633965770e-01L;	_weights[ 2]   = 2.1908636251598204399553493422816e-01L;	_weights[ 3]   = 2.6926671930999635509122692156947e-01L;	_weights[ 4]   = 2.9552422471475287017389299465134e-01L;	_weights[ 5]   = _weights[4];	_weights[ 6]   = _weights[3];	_weights[ 7]   = _weights[2];	_weights[ 8]   = _weights[1];	_weights[ 9]   = _weights[0];	return;      }          case TWENTIETH:    case TWENTYFIRST:      {	_points.resize (11);	_weights.resize(11);	_points[ 0](0) = -9.7822865814605699280393800112286e-01L;	_points[ 1](0) = -8.8706259976809529907515776930393e-01L;	_points[ 2](0) = -7.3015200557404932409341625203115e-01L;	_points[ 3](0) = -5.1909612920681181592572566945861e-01L;	_points[ 4](0) = -2.6954315595234497233153198540086e-01L;	_points[ 5](0) = 0.;	_points[ 6]    = -_points[4];	_points[ 7]    = -_points[3];	_points[ 8]    = -_points[2];	_points[ 9]    = -_points[1];	_points[10]    = -_points[0];	_weights[ 0]   = 5.5668567116173666482753720442549e-02L;	_weights[ 1]   = 1.2558036946490462463469429922394e-01L;	_weights[ 2]   = 1.8629021092773425142609764143166e-01L;	_weights[ 3]   = 2.3319376459199047991852370484318e-01L;	_weights[ 4]   = 2.6280454451024666218068886989051e-01L;	_weights[ 5]   = 2.7292508677790063071448352833634e-01L;	_weights[ 6]   = _weights[4];	_weights[ 7]   = _weights[3];	_weights[ 8]   = _weights[2];	_weights[ 9]   = _weights[1];	_weights[10]   = _weights[0];	return;      }    case TWENTYSECOND:    case TWENTYTHIRD:      {	_points.resize (12);	_weights.resize(12);	_points[ 0](0) = -9.8156063424671925069054909014928e-01L;	_points[ 1](0) = -9.0411725637047485667846586611910e-01L;	_points[ 2](0) = -7.6990267419430468703689383321282e-01L;	_points[ 3](0) = -5.8731795428661744729670241894053e-01L;	_points[ 4](0) = -3.6783149899818019375269153664372e-01L;	_points[ 5](0) = -1.2523340851146891547244136946385e-01L;	_points[ 6]    = -_points[5];	_points[ 7]    = -_points[4];	_points[ 8]    = -_points[3];	_points[ 9]    = -_points[2];	_points[10]    = -_points[1];	_points[11]    = -_points[0];	_weights[ 0]   = 4.7175336386511827194615961485017e-02L;	_weights[ 1]   = 1.0693932599531843096025471819400e-01L;	_weights[ 2]   = 1.6007832854334622633465252954336e-01L;	_weights[ 3]   = 2.0316742672306592174906445580980e-01L;	_weights[ 4]   = 2.3349253653835480876084989892483e-01L;	_weights[ 5]   = 2.4914704581340278500056243604295e-01L;	_weights[ 6]   = _weights[5];	_weights[ 7]   = _weights[4];	_weights[ 8]   = _weights[3];	_weights[ 9]   = _weights[2];	_weights[10]   = _weights[1];	_weights[11]   = _weights[0];	return;      }          case TWENTYFOURTH:    case TWENTYFIFTH:      {	_points.resize (13);	_weights.resize(13);	_points[ 0](0) = -9.8418305471858814947282944880711e-01L;	_points[ 1](0) = -9.1759839922297796520654783650072e-01L;	_points[ 2](0) = -8.0157809073330991279420648958286e-01L;	_points[ 3](0) = -6.4234933944034022064398460699552e-01L;	_points[ 4](0) = -4.4849275103644685287791285212764e-01L;	_points[ 5](0) = -2.3045831595513479406552812109799e-01L;	_points[ 6](0) = 0.;	_points[ 7]    = -_points[5];	_points[ 8]    = -_points[4];	_points[ 9]    = -_points[3];	_points[10]    = -_points[2];	_points[11]    = -_points[1];	_points[12]    = -_points[0];	_weights[ 0]   = 4.0484004765315879520021592200986e-02L;	_weights[ 1]   = 9.2121499837728447914421775953797e-02L;	_weights[ 2]   = 1.3887351021978723846360177686887e-01L;	_weights[ 3]   = 1.7814598076194573828004669199610e-01L;	_weights[ 4]   = 2.0781604753688850231252321930605e-01L;	_weights[ 5]   = 2.2628318026289723841209018603978e-01L;	_weights[ 6]   = 2.3255155323087391019458951526884e-01L;	_weights[ 7]   = _weights[5];	_weights[ 8]   = _weights[4];	_weights[ 9]   = _weights[3];	_weights[10]   = _weights[2];	_weights[11]   = _weights[1];	_weights[12]   = _weights[0];	return;      }    case TWENTYSIXTH:    case TWENTYSEVENTH:      {	_points.resize (14);	_weights.resize(14);	_points[ 0](0) = -9.8628380869681233884159726670405e-01L;	_points[ 1](0) = -9.2843488366357351733639113937787e-01L;	_points[ 2](0) = -8.2720131506976499318979474265039e-01L;	_points[ 3](0) = -6.8729290481168547014801980301933e-01L;	_points[ 4](0) = -5.1524863635815409196529071855119e-01L;	_points[ 5](0) = -3.1911236892788976043567182416848e-01L;	_points[ 6](0) = -1.0805494870734366206624465021983e-01L;	_points[ 7]    = -_points[6];	_points[ 8]    = -_points[5];	_points[ 9]    = -_points[4];	_points[10]    = -_points[3];	_points[11]    = -_points[2];	_points[12]    = -_points[1];	_points[13]    = -_points[0];	_weights[ 0]   = 3.5119460331751863031832876138192e-02L;	_weights[ 1]   = 8.0158087159760209805633277062854e-02L;	_weights[ 2]   = 1.2151857068790318468941480907248e-01L;	_weights[ 3]   = 1.5720316715819353456960193862384e-01L;	_weights[ 4]   = 1.8553839747793781374171659012516e-01L;	_weights[ 5]   = 2.0519846372129560396592406566122e-01L;	_weights[ 6]   = 2.1526385346315779019587644331626e-01L;	_weights[ 7]   = _weights[6];	_weights[ 8]   = _weights[5];	_weights[ 9]   = _weights[4];	_weights[10]   = _weights[3];	_weights[11]   = _weights[2];	_weights[12]   = _weights[1];	_weights[13]   = _weights[0];	return;      }    case TWENTYEIGHTH:    case TWENTYNINTH:      {	_points.resize (15);	_weights.resize(15);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -