$extrastylesheet
quadrature_clough_2D.C
Go to the documentation of this file.
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_clough.h"
00022 #include "libmesh/quadrature_gauss.h"
00023 
00024 namespace libMesh
00025 {
00026 
00027 
00028 void QClough::init_2D(const ElemType type_in,
00029                       unsigned int p)
00030 {
00031 #if LIBMESH_DIM > 1
00032   QGauss gauss_rule(2, _order);
00033   gauss_rule.init(TRI6, p);
00034 
00035   //-----------------------------------------------------------------------
00036   // 2D quadrature rules
00037   switch (type_in)
00038     {
00039 
00040       //---------------------------------------------
00041       // Triangle quadrature rules
00042     case TRI3:
00043     case TRI6:
00044       {
00045         std::vector<Point> &gausspoints = gauss_rule.get_points();
00046         std::vector<Real> &gaussweights = gauss_rule.get_weights();
00047         std::size_t numgausspts = gausspoints.size();
00048         _points.resize(numgausspts*3);
00049         _weights.resize(numgausspts*3);
00050         for (std::size_t i = 0; i != numgausspts; ++i)
00051           {
00052             _points[3*i](0) = gausspoints[i](0) +
00053               gausspoints[i](1) / 3.;
00054             _points[3*i](1) = gausspoints[i](1) / 3.;
00055             _points[3*i+1](0) = gausspoints[i](1) / 3.;
00056             _points[3*i+1](1) = gausspoints[i](0) +
00057               gausspoints[i](1) / 3.;
00058             _points[3*i+2](0) = 1./3. +
00059               gausspoints[i](0) * 2./3. -
00060               gausspoints[i](1) / 3.;
00061             _points[3*i+2](1) = 1./3. -
00062               gausspoints[i](0) / 3. +
00063               gausspoints[i](1) * 2./3.;
00064             _weights[3*i] = gaussweights[i] / 3.;
00065             _weights[3*i+1] = _weights[3*i];
00066             _weights[3*i+2] = _weights[3*i];
00067           }
00068         return;
00069       }
00070 
00071 
00072       //---------------------------------------------
00073       // Unsupported type
00074     default:
00075       libmesh_error_msg("Element type not supported!:" << type_in);
00076     }
00077 #endif
00078 }
00079 
00080 } // namespace libMesh