libMesh
quadrature_trap_3D.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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
21 #include "libmesh/quadrature_trap.h"
22 #include "libmesh/enum_to_string.h"
23 
24 namespace libMesh
25 {
26 
27 void QTrap::init_3D(const ElemType, unsigned int)
28 {
29 #if LIBMESH_DIM == 3
30 
31  //-----------------------------------------------------------------------
32  // 3D quadrature rules
33  switch (_type)
34  {
35  //---------------------------------------------
36  // Hex quadrature rules
37  case HEX8:
38  case HEX20:
39  case HEX27:
40  {
41  // We compute the 3D quadrature rule as a tensor
42  // product of the 1D quadrature rule.
43  QTrap q1D(1);
44  q1D.init(EDGE2);
45 
46  tensor_product_hex( q1D );
47 
48  return;
49  }
50 
51 
52 
53  //---------------------------------------------
54  // Tetrahedral quadrature rules
55  case TET4:
56  case TET10:
57  {
58  _points.resize(4);
59  _weights.resize(4);
60 
61  _points[0](0) = 0.;
62  _points[0](1) = 0.;
63  _points[0](2) = 0.;
64 
65  _points[1](0) = 1.;
66  _points[1](1) = 0.;
67  _points[1](2) = 0.;
68 
69  _points[2](0) = 0.;
70  _points[2](1) = 1.;
71  _points[2](2) = 0.;
72 
73  _points[3](0) = 0.;
74  _points[3](1) = 0.;
75  _points[3](2) = 1.;
76 
77 
78 
79  _weights[0] = 1/Real(24);
80  _weights[1] = _weights[0];
81  _weights[2] = _weights[0];
82  _weights[3] = _weights[0];
83 
84  return;
85  }
86 
87 
88 
89  //---------------------------------------------
90  // Prism quadrature rules
91  case PRISM6:
92  case PRISM15:
93  case PRISM18:
94  {
95  // We compute the 3D quadrature rule as a tensor
96  // product of the 1D quadrature rule and a 2D
97  // triangle quadrature rule
98 
99  QTrap q1D(1);
100  QTrap q2D(2);
101 
102  // Initialize
103  q1D.init(EDGE2);
104  q2D.init(TRI3);
105 
106  tensor_product_prism(q1D, q2D);
107 
108  return;
109  }
110 
111 
112  //---------------------------------------------
113  // Unsupported type
114  default:
115  libmesh_error_msg("ERROR: Unsupported type: " << Utility::enum_to_string(_type));
116  }
117 #endif
118 }
119 
120 } // namespace libMesh
libMesh::HEX20
Definition: enum_elem_type.h:48
libMesh::PRISM6
Definition: enum_elem_type.h:50
libMesh::QBase::tensor_product_hex
void tensor_product_hex(const QBase &q1D)
Computes the tensor product quadrature rule [q1D x q1D x q1D] from the 1D rule q1D.
Definition: quadrature.C:198
libMesh::HEX8
Definition: enum_elem_type.h:47
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::TET10
Definition: enum_elem_type.h:46
libMesh::QTrap
This class implements trapezoidal quadrature.
Definition: quadrature_trap.h:38
libMesh::QBase::init
virtual void init(const ElemType type=INVALID_ELEM, unsigned int p_level=0)
Initializes the data structures for a quadrature rule for an element of type type.
Definition: quadrature.C:59
libMesh::TET4
Definition: enum_elem_type.h:45
libMesh::PRISM15
Definition: enum_elem_type.h:51
libMesh::HEX27
Definition: enum_elem_type.h:49
libMesh::QBase::_type
ElemType _type
The type of element for which the current values have been computed.
Definition: quadrature.h:351
libMesh::TRI3
Definition: enum_elem_type.h:39
libMesh::Utility::enum_to_string
std::string enum_to_string(const T e)
libMesh::QBase::tensor_product_prism
void tensor_product_prism(const QBase &q1D, const QBase &q2D)
Computes the tensor product of a 1D quadrature rule and a 2D quadrature rule.
Definition: quadrature.C:225
libMesh::QBase::_weights
std::vector< Real > _weights
The quadrature weights.
Definition: quadrature.h:369
libMesh::QTrap::init_3D
virtual void init_3D(const ElemType, unsigned int) override
Initializes the 3D quadrature rule by filling the points and weights vectors with the appropriate val...
Definition: quadrature_trap_3D.C:27
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::PRISM18
Definition: enum_elem_type.h:52
libMesh::QBase::_points
std::vector< Point > _points
The locations of the quadrature points in reference element space.
Definition: quadrature.h:363
libMesh::EDGE2
Definition: enum_elem_type.h:35
libMesh::ElemType
ElemType
Defines an enum for geometric element types.
Definition: enum_elem_type.h:33