libMesh
quadrature_gm_2D.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 
19 
20 // Local includes
21 #include "libmesh/quadrature_gm.h"
22 #include "libmesh/enum_to_string.h"
23 
24 namespace libMesh
25 {
26 
28 {
29  // Nearly all GM rules contain negative weights, so if you are not
30  // allowing rules with negative weights, we cannot continue!
31  libmesh_error_msg_if(!allow_rules_with_negative_weights,
32  "You requested a Grundmann-Moller rule but\n"
33  << "are not allowing rules with negative weights!\n"
34  << "Either select a different quadrature class or\n"
35  << "set allow_rules_with_negative_weights==true.");
36 
37  switch (_type)
38  {
39  case TRI3:
40  case TRISHELL3:
41  case TRI3SUBDIVISION:
42  case TRI6:
43  case TRI7:
44  {
45  switch(get_order())
46  {
47 
48  default:
49  {
50  // Untested above _order=23 but should work...
51  gm_rule(get_order()/2, /*dim=*/2);
52  return;
53  }
54  } // end switch (order)
55  } // end case TRI
56 
57  default:
58  libmesh_error_msg("ERROR: Unsupported element type: " << Utility::enum_to_string(_type));
59  } // end switch (_type)
60 }
61 
62 } // namespace libMesh
bool allow_rules_with_negative_weights
Flag (default true) controlling the use of quadrature rules with negative weights.
Definition: quadrature.h:301
virtual void init_2D() override
Initializes the 2D quadrature rule by filling the points and weights vectors with the appropriate val...
ElemType _type
The type of element for which the current values have been computed.
Definition: quadrature.h:391
The libMesh namespace provides an interface to certain functionality in the library.
void gm_rule(unsigned int s, unsigned int dim)
This routine is called from init_2D() and init_3D().
Definition: quadrature_gm.C:57
Order get_order() const
Definition: quadrature.h:249
std::string enum_to_string(const T e)