quadrature_grid_2D.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 // Local includes
22 
23 namespace libMesh
24 {
25 
26 
27 void QGrid::init_2D(const ElemType type_in,
28  unsigned int)
29 {
30 #if LIBMESH_DIM > 1
31 
32  //-----------------------------------------------------------------------
33  // 2D quadrature rules
34 
35  // We ignore p - the grid rule is just for experimentation
36 
37  switch (type_in)
38  {
39 
40 
41  //---------------------------------------------
42  // Quadrilateral quadrature rules
43  case QUAD4:
44  case QUAD8:
45  case QUAD9:
46  {
47  // We compute the 2D quadrature rule as a tensor
48  // product of the 1D quadrature rule.
49  QGrid q1D(1,_order);
50  q1D.init(EDGE2);
51  tensor_product_quad( q1D );
52  return;
53  }
54 
55 
56  //---------------------------------------------
57  // Triangle quadrature rules
58  case TRI3:
59  case TRI6:
60  {
61  _points.resize((_order + 1)*(_order + 2)/2);
62  _weights.resize((_order + 1)*(_order + 2)/2);
63 
64  unsigned int pt = 0;
65  for (int i = 0; i != _order + 1; ++i)
66  {
67  for (int j = 0; j != _order + 1 - i; ++j)
68  {
69  _points[pt](0) = (double)i / (double)_order;
70  _points[pt](1) = (double)j / (double)_order;
71  _weights[pt] = 1.0 / (double)(_order+1) /
72  (double)(_order+2);
73  pt++;
74  }
75  }
76  return;
77  }
78 
79  //---------------------------------------------
80  // Unsupported type
81  default:
82  {
83  libMesh::err << "Element type not supported!:" << type_in << std::endl;
84  libmesh_error();
85  }
86  }
87 
88  libmesh_error();
89 
90  return;
91 
92 #endif
93 }
94 
95 } // namespace libMesh

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:06 UTC

Hosted By:
SourceForge.net Logo