$extrastylesheet
00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 // Local includes 00021 #include "libmesh/quadrature_simpson.h" 00022 00023 namespace libMesh 00024 { 00025 00026 00027 00028 00029 00030 void QSimpson::init_3D(const ElemType type_in, 00031 unsigned int) 00032 { 00033 #if LIBMESH_DIM == 3 00034 00035 //----------------------------------------------------------------------- 00036 // 3D quadrature rules 00037 switch (type_in) 00038 { 00039 //--------------------------------------------- 00040 // Hex quadrature rules 00041 case HEX8: 00042 case HEX20: 00043 case HEX27: 00044 { 00045 // We compute the 3D quadrature rule as a tensor 00046 // product of the 1D quadrature rule. 00047 QSimpson q1D(1); 00048 q1D.init(EDGE2); 00049 00050 tensor_product_hex( q1D ); 00051 00052 return; 00053 } 00054 00055 00056 00057 //--------------------------------------------- 00058 // Tetrahedral quadrature rules 00059 case TET4: 00060 case TET10: 00061 { 00062 // This rule is created by combining 8 subtets 00063 // which use the trapezoidal rule. The weights 00064 // may seem a bit odd, but they are correct, 00065 // and should add up to 1/6, the volume of the 00066 // reference tet. The points of this rule are 00067 // at the nodal points of the TET10, allowing 00068 // you to generate diagonal element stiffness 00069 // matrices when using quadratic elements. 00070 // It should be able to integrate something 00071 // better than linears, but I'm not sure how 00072 // high. 00073 00074 _points.resize(10); 00075 _weights.resize(10); 00076 00077 _points[0](0) = 0.; _points[5](0) = .5; 00078 _points[0](1) = 0.; _points[5](1) = .5; 00079 _points[0](2) = 0.; _points[5](2) = 0.; 00080 00081 _points[1](0) = 1.; _points[6](0) = 0.; 00082 _points[1](1) = 0.; _points[6](1) = .5; 00083 _points[1](2) = 0.; _points[6](2) = 0.; 00084 00085 _points[2](0) = 0.; _points[7](0) = 0.; 00086 _points[2](1) = 1.; _points[7](1) = 0.; 00087 _points[2](2) = 0.; _points[7](2) = .5; 00088 00089 _points[3](0) = 0.; _points[8](0) = .5; 00090 _points[3](1) = 0.; _points[8](1) = 0.; 00091 _points[3](2) = 1.; _points[8](2) = .5; 00092 00093 _points[4](0) = .5; _points[9](0) = 0.; 00094 _points[4](1) = 0.; _points[9](1) = .5; 00095 _points[4](2) = 0.; _points[9](2) = .5; 00096 00097 00098 _weights[0] = .0052083333333333333333333333333333333333333333; // 1./192. 00099 _weights[1] = _weights[0]; 00100 _weights[2] = _weights[0]; 00101 _weights[3] = _weights[0]; 00102 00103 _weights[4] = .0243055555555555555555555555555555555555555555; // 14./576. 00104 _weights[5] = _weights[4]; 00105 _weights[6] = _weights[4]; 00106 _weights[7] = _weights[4]; 00107 _weights[8] = _weights[4]; 00108 _weights[9] = _weights[4]; 00109 00110 return; 00111 } 00112 00113 00114 00115 //--------------------------------------------- 00116 // Prism quadrature rules 00117 case PRISM6: 00118 case PRISM15: 00119 case PRISM18: 00120 { 00121 // We compute the 3D quadrature rule as a tensor 00122 // product of the 1D quadrature rule and a 2D 00123 // triangle quadrature rule 00124 00125 QSimpson q1D(1); 00126 QSimpson q2D(2); 00127 00128 // Initialize 00129 q1D.init(EDGE2); 00130 q2D.init(TRI3); 00131 00132 tensor_product_prism(q1D, q2D); 00133 00134 return; 00135 } 00136 00137 00138 //--------------------------------------------- 00139 // Unsupported type 00140 default: 00141 libmesh_error_msg("ERROR: Unsupported type: " << type_in); 00142 } 00143 #endif 00144 } 00145 00146 } // namespace libMesh