libMesh
fe_type.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2025 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 // Local includes
19 #include "libmesh/fe_type.h"
20 #include "libmesh/quadrature_clough.h"
21 #include "libmesh/quadrature_gauss.h"
22 
23 // C++ Includes
24 #include <memory>
25 
26 
27 namespace libMesh
28 {
29 
30 // ---------------------------------------
31 // FEType class members
32 
33 std::unique_ptr<QBase>
35  const int extraorder) const
36 {
37  // Clough elements have at least piecewise cubic functions
38  if (family == CLOUGH)
39  {
40  Order o = static_cast<Order>(std::max(static_cast<unsigned int>(this->default_quadrature_order()),
41  static_cast<unsigned int>(7 + extraorder)));
42  return std::make_unique<QClough>(dim, o);
43  }
44 
45  if (family == SUBDIVISION)
46  return std::make_unique<QGauss>(dim, static_cast<Order>(1 + extraorder));
47 
48  return std::make_unique<QGauss>(dim, static_cast<Order>(this->default_quadrature_order() + extraorder));
49 }
50 
51 
52 std::unique_ptr<QBase>
54  const int extraorder) const
55 {
56  // Clough elements have at least piecewise cubic functions
57  if (family == CLOUGH)
58  {
59  Order o = static_cast<Order>(std::max(static_cast<unsigned int>(this->unweighted_quadrature_order()),
60  static_cast<unsigned int>(3 + extraorder)));
61  return std::make_unique<QClough>(dim, o);
62  }
63 
64  if (family == SUBDIVISION)
65  return std::make_unique<QGauss>(dim, static_cast<Order>(1 + extraorder));
66 
67  return std::make_unique<QGauss>(dim, static_cast<Order>(this->unweighted_quadrature_order() + extraorder));
68 }
69 
70 } // namespace libMesh
FEFamily family
The type of finite element.
Definition: fe_type.h:221
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
Order unweighted_quadrature_order() const
Definition: fe_type.h:377
unsigned int dim
Order default_quadrature_order() const
Definition: fe_type.h:371
The libMesh namespace provides an interface to certain functionality in the library.
std::unique_ptr< QBase > default_quadrature_rule(const unsigned int dim, const int extraorder=0) const
Definition: fe_type.C:34
std::unique_ptr< QBase > unweighted_quadrature_rule(const unsigned int dim, const int extraorder=0) const
Definition: fe_type.C:53