libMesh
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
libMesh::QNodal Class Reference

This class implements nodal quadrature rules for various element types. More...

#include <quadrature_nodal.h>

Inheritance diagram for libMesh::QNodal:
[legend]

Public Member Functions

 QNodal (unsigned int dim, Order order=FIRST)
 Constructor.
 
 QNodal (const QNodal &)=default
 Copy/move ctor, copy/move assignment operator, and destructor are all explicitly defaulted for this simple class.
 
 QNodal (QNodal &&)=default
 
QNodaloperator= (const QNodal &)=default
 
QNodaloperator= (QNodal &&)=default
 
virtual ~QNodal ()=default
 
virtual QuadratureType type () const override
 
virtual std::unique_ptr< QBaseclone () const override
 
ElemType get_elem_type () const
 
unsigned int get_p_level () const
 
unsigned int n_points () const
 
unsigned int size () const
 Alias for n_points() to enable use in index_range.
 
unsigned int get_dim () const
 
const std::vector< Point > & get_points () const
 
std::vector< Point > & get_points ()
 
const std::vector< Real > & get_weights () const
 
std::vector< Real > & get_weights ()
 
Point qp (const unsigned int i) const
 
Real w (const unsigned int i) const
 
virtual void init (const Elem &e, unsigned int p_level=invalid_uint)
 Initializes the data structures for a quadrature rule for the element e.
 
virtual void init (const ElemType type=INVALID_ELEM, unsigned int p_level=0, bool simple_type_only=false)
 Initializes the data structures for a quadrature rule for an element of type type.
 
virtual void init (const QBase &other_rule)
 Initializes the data structures for a quadrature rule based on the element, element type, and p_level settings of other_rule.
 
virtual void init (const Elem &elem, const std::vector< Real > &vertex_distance_func, unsigned int p_level=0)
 Initializes the data structures for an element potentially "cut" by a signed distance function.
 
Order get_order () const
 
Order get_base_order () const
 
void print_info (std::ostream &os=libMesh::out) const
 Prints information relevant to the quadrature rule, by default to libMesh::out.
 
void scale (std::pair< Real, Real > old_range, std::pair< Real, Real > new_range)
 Maps the points of a 1D quadrature rule defined by "old_range" to another 1D interval defined by "new_range" and scales the weights accordingly.
 
virtual bool shapes_need_reinit ()
 

Static Public Member Functions

static std::unique_ptr< QBasebuild (std::string_view name, const unsigned int dim, const Order order=INVALID_ORDER)
 Builds a specific quadrature rule based on the name string.
 
static std::unique_ptr< QBasebuild (const QuadratureType qt, const unsigned int dim, const Order order=INVALID_ORDER)
 Builds a specific quadrature rule based on the QuadratureType.
 
static void print_info (std::ostream &out_stream=libMesh::out)
 Prints the reference information, by default to libMesh::out.
 
static std::string get_info ()
 Gets a string containing the reference information.
 
static unsigned int n_objects ()
 Prints the number of outstanding (created, but not yet destroyed) objects.
 
static void enable_print_counter_info ()
 Methods to enable/disable the reference counter output from print_info().
 
static void disable_print_counter_info ()
 

Public Attributes

bool allow_rules_with_negative_weights
 Flag (default true) controlling the use of quadrature rules with negative weights.
 
bool allow_nodal_pyramid_quadrature
 The flag's value defaults to false so that one does not accidentally use a nodal quadrature rule on Pyramid elements, since evaluating the inverse element Jacobian (e.g.
 

Protected Types

typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 Data structure to log the information.
 

Protected Member Functions

virtual void init_0D ()
 Initializes the 0D quadrature rule by filling the points and weights vectors with the appropriate values.
 
void tensor_product_quad (const QBase &q1D)
 Constructs a 2D rule from the tensor product of q1D with itself.
 
void tensor_product_hex (const QBase &q1D)
 Computes the tensor product quadrature rule [q1D x q1D x q1D] from the 1D rule q1D.
 
void tensor_product_prism (const QBase &q1D, const QBase &q2D)
 Computes the tensor product of a 1D quadrature rule and a 2D quadrature rule.
 
void increment_constructor_count (const std::string &name) noexcept
 Increments the construction counter.
 
void increment_destructor_count (const std::string &name) noexcept
 Increments the destruction counter.
 

Protected Attributes

unsigned int _dim
 The spatial dimension of the quadrature rule.
 
Order _order
 The polynomial order which the quadrature rule is capable of integrating exactly.
 
ElemType _type
 The type of element for which the current values have been computed.
 
const Elem_elem
 The element for which the current values were computed, or nullptr if values were computed without a specific element.
 
unsigned int _p_level
 The p-level of the element for which the current values have been computed.
 
std::vector< Point_points
 The locations of the quadrature points in reference element space.
 
std::vector< Real_weights
 The quadrature weights.
 

Static Protected Attributes

static Counts _counts
 Actually holds the data.
 
static Threads::atomic< unsigned int_n_objects
 The number of objects.
 
static Threads::spin_mutex _mutex
 Mutual exclusion object to enable thread-safe reference counting.
 
static bool _enable_print_counter = true
 Flag to control whether reference count information is printed when print_info is called.
 

Private Member Functions

virtual void init_1D () override
 Initializes the 1D quadrature rule by filling the points and weights vectors with the appropriate values.
 
virtual void init_2D () override
 Initializes the 2D quadrature rule by filling the points and weights vectors with the appropriate values.
 
virtual void init_3D () override
 Initializes the 3D quadrature rule by filling the points and weights vectors with the appropriate values.
 

Detailed Description

This class implements nodal quadrature rules for various element types.

For some element types, this corresponds to well-known quadratures such as the trapezoidal rule and Simpson's rule. For other element types (e.g. the serendipity QUAD8/HEX20/PRISM15) it implements a lower-order-accurate nodal quadrature which still generates a strictly positive definite (diagonal) mass matrix. Since the main purpose of this class is provide appropriate nodal quadrature rules, "order" arguments passed during initialization are ignored.

Author
John W. Peterson
Date
2019

Implements nodal quadrature for various element types.

Definition at line 44 of file quadrature_nodal.h.

Member Typedef Documentation

◆ Counts

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information.

The log is identified by the class name.

Definition at line 119 of file reference_counter.h.

Constructor & Destructor Documentation

◆ QNodal() [1/3]

libMesh::QNodal::QNodal ( unsigned int  dim,
Order  order = FIRST 
)
inlineexplicit

Constructor.

Declares the order of the quadrature rule. We explicitly call the init function in 1D since the other tensor-product rules require this one.

Note
The element type, EDGE2, will not be used internally, however if we called the function with INVALID_ELEM it would try to be smart and return, thinking it had already done the work.

Definition at line 58 of file quadrature_nodal.h.

59 :
60 QBase(dim,order)
61 {
62 if (dim == 1)
63 init(EDGE2);
64 }
unsigned int dim
virtual void init(const Elem &e, unsigned int p_level=invalid_uint)
Initializes the data structures for a quadrature rule for the element e.
Definition quadrature.C:65
QBase(unsigned int dim, Order order=INVALID_ORDER)
Constructor.
Definition quadrature.C:27

References dim, libMesh::EDGE2, and libMesh::QBase::init().

◆ QNodal() [2/3]

libMesh::QNodal::QNodal ( const QNodal )
default

Copy/move ctor, copy/move assignment operator, and destructor are all explicitly defaulted for this simple class.

◆ QNodal() [3/3]

libMesh::QNodal::QNodal ( QNodal &&  )
default

◆ ~QNodal()

virtual libMesh::QNodal::~QNodal ( )
virtualdefault

Member Function Documentation

◆ build() [1/2]

std::unique_ptr< QBase > libMesh::QBase::build ( const QuadratureType  qt,
const unsigned int  dim,
const Order  order = INVALID_ORDER 
)
staticinherited

Builds a specific quadrature rule based on the QuadratureType.

This enables selection of the quadrature rule at run-time.

This function allocates memory, therefore a std::unique_ptr<QBase> is returned so that the user does not accidentally leak it.

Definition at line 54 of file quadrature_build.C.

57{
58 switch (_qt)
59 {
60
61 case QCLOUGH:
62 {
63#ifdef DEBUG
64 if (_order > TWENTYTHIRD)
65 {
66 libMesh::out << "WARNING: Clough quadrature implemented" << std::endl
67 << " up to TWENTYTHIRD order." << std::endl;
68 }
69#endif
70
71 return std::make_unique<QClough>(_dim, _order);
72 }
73
74 case QGAUSS:
75 {
76
77#ifdef DEBUG
78 if (_order > FORTYTHIRD)
79 {
80 libMesh::out << "WARNING: Gauss quadrature implemented" << std::endl
81 << " up to FORTYTHIRD order." << std::endl;
82 }
83#endif
84
85 return std::make_unique<QGauss>(_dim, _order);
86 }
87
88 case QJACOBI_1_0:
89 {
90
91#ifdef DEBUG
92 if (_order > FORTYTHIRD)
93 {
94 libMesh::out << "WARNING: Jacobi(1,0) quadrature implemented" << std::endl
95 << " up to FORTYTHIRD order." << std::endl;
96 }
97
98 if (_dim > 1)
99 {
100 libMesh::out << "WARNING: Jacobi(1,0) quadrature implemented" << std::endl
101 << " in 1D only." << std::endl;
102 }
103#endif
104
105 return std::make_unique<QJacobi>(_dim, _order, 1, 0);
106 }
107
108 case QJACOBI_2_0:
109 {
110
111#ifdef DEBUG
112 if (_order > FORTYTHIRD)
113 {
114 libMesh::out << "WARNING: Jacobi(2,0) quadrature implemented" << std::endl
115 << " up to FORTYTHIRD order." << std::endl;
116 }
117
118 if (_dim > 1)
119 {
120 libMesh::out << "WARNING: Jacobi(2,0) quadrature implemented" << std::endl
121 << " in 1D only." << std::endl;
122 }
123#endif
124
125 return std::make_unique<QJacobi>(_dim, _order, 2, 0);
126 }
127
128 case QSIMPSON:
129 {
130
131#ifdef DEBUG
132 if (_order > THIRD)
133 {
134 libMesh::out << "WARNING: Simpson rule provides only" << std::endl
135 << " THIRD order!" << std::endl;
136 }
137#endif
138
139 return std::make_unique<QSimpson>(_dim);
140 }
141
142 case QTRAP:
143 {
144
145#ifdef DEBUG
146 if (_order > FIRST)
147 {
148 libMesh::out << "WARNING: Trapezoidal rule provides only" << std::endl
149 << " FIRST order!" << std::endl;
150 }
151#endif
152
153 return std::make_unique<QTrap>(_dim);
154 }
155
156 case QGRID:
157 return std::make_unique<QGrid>(_dim, _order);
158
160 return std::make_unique<QGrundmann_Moller>(_dim, _order);
161
162 case QMONOMIAL:
163 return std::make_unique<QMonomial>(_dim, _order);
164
165 case QGAUSS_LOBATTO:
166 return std::make_unique<QGaussLobatto>(_dim, _order);
167
168 case QCONICAL:
169 return std::make_unique<QConical>(_dim, _order);
170
171 case QNODAL:
172 return std::make_unique<QNodal>(_dim, _order);
173
174 default:
175 libmesh_error_msg("ERROR: Bad qt=" << _qt);
176 }
177}
unsigned int _dim
The spatial dimension of the quadrature rule.
Definition quadrature.h:379
Order _order
The polynomial order which the quadrature rule is capable of integrating exactly.
Definition quadrature.h:385
OStreamProxy out
@ FORTYTHIRD
Definition enum_order.h:85
@ TWENTYTHIRD
Definition enum_order.h:65

References libMesh::QBase::_dim, libMesh::QBase::_order, libMesh::FIRST, libMesh::FORTYTHIRD, libMesh::out, libMesh::QCLOUGH, libMesh::QCONICAL, libMesh::QGAUSS, libMesh::QGAUSS_LOBATTO, libMesh::QGRID, libMesh::QGRUNDMANN_MOLLER, libMesh::QJACOBI_1_0, libMesh::QJACOBI_2_0, libMesh::QMONOMIAL, libMesh::QNODAL, libMesh::QSIMPSON, libMesh::QTRAP, libMesh::THIRD, and libMesh::TWENTYTHIRD.

◆ build() [2/2]

std::unique_ptr< QBase > libMesh::QBase::build ( std::string_view  name,
const unsigned int  dim,
const Order  order = INVALID_ORDER 
)
staticinherited

Builds a specific quadrature rule based on the name string.

This enables selection of the quadrature rule at run-time. The input parameter name must be mappable through the Utility::string_to_enum<>() function.

This function allocates memory, therefore a std::unique_ptr<QBase> is returned so that the user does not accidentally leak it.

Definition at line 43 of file quadrature_build.C.

46{
47 return QBase::build (Utility::string_to_enum<QuadratureType> (type),
48 _dim,
49 _order);
50}
virtual QuadratureType type() const =0
static std::unique_ptr< QBase > build(std::string_view name, const unsigned int dim, const Order order=INVALID_ORDER)
Builds a specific quadrature rule based on the name string.

References libMesh::QBase::_dim, libMesh::QBase::_order, libMesh::QBase::build(), and libMesh::QBase::type().

Referenced by assemble_poisson(), libMesh::InfFE< Dim, T_radial, T_map >::attach_quadrature_rule(), libMesh::QBase::build(), libMesh::QBase::clone(), main(), libMesh::OverlapCoupling::OverlapCoupling(), libMesh::InfFE< Dim, T_radial, T_map >::reinit(), AllRBBTest::test_cylinder(), QuadratureTest::testBuild(), QuadratureTest::testJacobi(), and QuadratureTest::testPolynomials().

◆ clone()

std::unique_ptr< QBase > libMesh::QNodal::clone ( ) const
overridevirtual
Returns
A copy of this quadrature rule wrapped in a smart pointer.

Reimplemented from libMesh::QBase.

Definition at line 31 of file quadrature_nodal.C.

32{
33 return std::make_unique<QNodal>(*this);
34}

◆ disable_print_counter_info()

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 100 of file reference_counter.C.

101{
102 _enable_print_counter = false;
103 return;
104}
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called.

References libMesh::ReferenceCounter::_enable_print_counter.

◆ enable_print_counter_info()

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info().

Enabled by default.

Definition at line 94 of file reference_counter.C.

95{
97 return;
98}

References libMesh::ReferenceCounter::_enable_print_counter.

Referenced by libMesh::LibMeshInit::~LibMeshInit().

◆ get_base_order()

Order libMesh::QBase::get_base_order ( ) const
inlineinherited
Returns
The "base" order of the quadrature rule, independent of element.

This function should be used when comparing quadrature objects independently of their last initialization.

Definition at line 258 of file quadrature.h.

258{ return static_cast<Order>(_order); }

References libMesh::QBase::_order.

◆ get_dim()

unsigned int libMesh::QBase::get_dim ( ) const
inlineinherited

◆ get_elem_type()

ElemType libMesh::QBase::get_elem_type ( ) const
inlineinherited
Returns
The element type we're currently using.

Definition at line 121 of file quadrature.h.

121{ return _type; }
ElemType _type
The type of element for which the current values have been computed.
Definition quadrature.h:391

References libMesh::QBase::_type.

◆ get_info()

std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

48{
49#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50
51 std::ostringstream oss;
52
53 oss << '\n'
54 << " ---------------------------------------------------------------------------- \n"
55 << "| Reference count information |\n"
56 << " ---------------------------------------------------------------------------- \n";
57
58 for (const auto & [name, cd] : _counts)
59 oss << "| " << name << " reference count information:\n"
60 << "| Creations: " << cd.first << '\n'
61 << "| Destructions: " << cd.second << '\n';
62
63 oss << " ---------------------------------------------------------------------------- \n";
64
65 return oss.str();
66
67#else
68
69 return "";
70
71#endif
72}
static Counts _counts
Actually holds the data.
std::string name(const ElemQuality q)
This function returns a string containing some name for q.

References libMesh::ReferenceCounter::_counts.

Referenced by libMesh::ReferenceCounter::print_info().

◆ get_order()

Order libMesh::QBase::get_order ( ) const
inlineinherited
Returns
The current "total" order of the quadrature rule which can vary element by element, depending on the Elem::p_level(), which gets passed to us during init().

Each additional power of p increases the quadrature order required to integrate the mass matrix by 2, hence the formula below.

Todo:
This function should also be used in all of the Order switch statements in the rules themselves.

Definition at line 249 of file quadrature.h.

249{ return static_cast<Order>(_order + 2 * _p_level); }
unsigned int _p_level
The p-level of the element for which the current values have been computed.
Definition quadrature.h:403

References libMesh::QBase::_order, and libMesh::QBase::_p_level.

Referenced by libMesh::InfFE< Dim, T_radial, T_map >::attach_quadrature_rule(), libMesh::QBase::clone(), libMesh::QConical::conical_product_pyramid(), libMesh::QConical::conical_product_tet(), libMesh::QConical::conical_product_tri(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::QConical::init_1D(), libMesh::QGauss::init_1D(), libMesh::QGaussLobatto::init_1D(), libMesh::QGrundmann_Moller::init_1D(), libMesh::QJacobi::init_1D(), libMesh::QGauss::init_2D(), libMesh::QGaussLobatto::init_2D(), libMesh::QGrundmann_Moller::init_2D(), libMesh::QMonomial::init_2D(), libMesh::QGauss::init_3D(), libMesh::QGaussLobatto::init_3D(), libMesh::QGrundmann_Moller::init_3D(), libMesh::QMonomial::init_3D(), and libMesh::RBParametrizedFunction::preevaluate_parametrized_function_on_mesh().

◆ get_p_level()

unsigned int libMesh::QBase::get_p_level ( ) const
inlineinherited
Returns
The p-refinement level we're currently using.

Definition at line 126 of file quadrature.h.

126{ return _p_level; }

References libMesh::QBase::_p_level.

◆ get_points() [1/2]

std::vector< Point > & libMesh::QBase::get_points ( )
inlineinherited
Returns
A std::vector containing the quadrature point locations in reference element space as a writable reference.

Definition at line 162 of file quadrature.h.

162{ return _points; }
std::vector< Point > _points
The locations of the quadrature points in reference element space.
Definition quadrature.h:409

References libMesh::QBase::_points.

◆ get_points() [2/2]

const std::vector< Point > & libMesh::QBase::get_points ( ) const
inlineinherited

◆ get_weights() [1/2]

std::vector< Real > & libMesh::QBase::get_weights ( )
inlineinherited
Returns
A writable references to a std::vector containing the quadrature weights.

Definition at line 174 of file quadrature.h.

174{ return _weights; }
std::vector< Real > _weights
The quadrature weights.
Definition quadrature.h:415

References libMesh::QBase::_weights.

◆ get_weights() [2/2]

const std::vector< Real > & libMesh::QBase::get_weights ( ) const
inlineinherited

◆ increment_constructor_count()

void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the construction counter.

Should be called in the constructor of any derived class that will be reference counted.

Definition at line 183 of file reference_counter.h.

184{
185 libmesh_try
186 {
187 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
188 std::pair<unsigned int, unsigned int> & p = _counts[name];
189 p.first++;
190 }
191 libmesh_catch (...)
192 {
193 auto stream = libMesh::err.get();
194 stream->exceptions(stream->goodbit); // stream must not throw
195 libMesh::err << "Encountered unrecoverable error while calling "
196 << "ReferenceCounter::increment_constructor_count() "
197 << "for a(n) " << name << " object." << std::endl;
198 std::terminate();
199 }
200}
streamT * get()
Rather than implement every ostream/ios/ios_base function, we'll be lazy and make esoteric uses go th...
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition threads.C:30
OStreamProxy err

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< T >::ReferenceCountedObject(), libMesh::ReferenceCountedObject< T >::ReferenceCountedObject(), and libMesh::ReferenceCountedObject< T >::ReferenceCountedObject().

◆ increment_destructor_count()

void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the destruction counter.

Should be called in the destructor of any derived class that will be reference counted.

Definition at line 207 of file reference_counter.h.

208{
209 libmesh_try
210 {
211 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
212 std::pair<unsigned int, unsigned int> & p = _counts[name];
213 p.second++;
214 }
215 libmesh_catch (...)
216 {
217 auto stream = libMesh::err.get();
218 stream->exceptions(stream->goodbit); // stream must not throw
219 libMesh::err << "Encountered unrecoverable error while calling "
220 << "ReferenceCounter::increment_destructor_count() "
221 << "for a(n) " << name << " object." << std::endl;
222 std::terminate();
223 }
224}

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< T >::~ReferenceCountedObject().

◆ init() [1/4]

void libMesh::QBase::init ( const Elem e,
unsigned int  p_level = invalid_uint 
)
virtualinherited

Initializes the data structures for a quadrature rule for the element e.

If p_level is specified it overrides the element p_level() elevation to use.

Definition at line 65 of file quadrature.C.

67{
68 libmesh_assert_equal_to(elem.dim(), _dim);
69
70 // Default to the element p_level() value
71 if (p == invalid_uint)
72 p = elem.p_level();
73
74 ElemType t = elem.type();
75
76 // check to see if we have already
77 // done the work for this quadrature rule
78 //
79 // If we have something like a Polygon subclass then we're going to
80 // need to recompute to be safe; even if we're using the same
81 // element, it might have been distorted enough that its subtriangle
82 // triangulation has been changed.
83 if (t == _type && p == _p_level && !elem.runtime_topology())
84 return;
85 else
86 {
87 _elem = &elem;
88 _type = t;
89 _p_level = p;
90 }
91
92 switch(_elem->dim())
93 {
94 case 0:
95 this->init_0D();
96
97 return;
98
99 case 1:
100 this->init_1D();
101
102 return;
103
104 case 2:
105 this->init_2D();
106
107 return;
108
109 case 3:
110 this->init_3D();
111
112 return;
113
114 default:
115 libmesh_error_msg("Invalid dimension _dim = " << _dim);
116 }
117}
virtual unsigned short dim() const =0
virtual void init_2D()
Initializes the 2D quadrature rule by filling the points and weights vectors with the appropriate val...
Definition quadrature.C:208
virtual void init_0D()
Initializes the 0D quadrature rule by filling the points and weights vectors with the appropriate val...
Definition quadrature.C:198
virtual void init_1D()=0
Initializes the 1D quadrature rule by filling the points and weights vectors with the appropriate val...
const Elem * _elem
The element for which the current values were computed, or nullptr if values were computed without a ...
Definition quadrature.h:397
virtual void init_3D()
Initializes the 3D quadrature rule by filling the points and weights vectors with the appropriate val...
Definition quadrature.C:215
ElemType
Defines an enum for geometric element types.
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition libmesh.h:303

References libMesh::QBase::_dim, libMesh::QBase::_elem, libMesh::QBase::_p_level, libMesh::QBase::_type, libMesh::Elem::dim(), libMesh::QBase::init_0D(), libMesh::QBase::init_1D(), libMesh::QBase::init_2D(), libMesh::QBase::init_3D(), libMesh::invalid_uint, libMesh::Elem::p_level(), libMesh::Elem::runtime_topology(), and libMesh::Elem::type().

Referenced by libMesh::QBase::init(), libMesh::QBase::init(), libMesh::QClough::init_1D(), libMesh::QConical::init_1D(), libMesh::QMonomial::init_1D(), init_1D(), libMesh::QClough::init_2D(), libMesh::QGauss::init_2D(), libMesh::QGaussLobatto::init_2D(), libMesh::QMonomial::init_2D(), init_2D(), libMesh::QGauss::init_3D(), libMesh::QGaussLobatto::init_3D(), libMesh::QGrid::init_3D(), libMesh::QMonomial::init_3D(), init_3D(), libMesh::QSimpson::init_3D(), libMesh::QTrap::init_3D(), libMesh::OverlapCoupling::operator()(), libMesh::QClough::QClough(), libMesh::QConical::QConical(), libMesh::QGauss::QGauss(), libMesh::QGaussLobatto::QGaussLobatto(), libMesh::QGrid::QGrid(), libMesh::QGrundmann_Moller::QGrundmann_Moller(), libMesh::QJacobi::QJacobi(), libMesh::QMonomial::QMonomial(), QNodal(), libMesh::QSimpson::QSimpson(), libMesh::QTrap::QTrap(), and libMesh::FE< Dim, T >::reinit_default_dual_shape_coeffs().

◆ init() [2/4]

void libMesh::QBase::init ( const Elem elem,
const std::vector< Real > &  vertex_distance_func,
unsigned int  p_level = 0 
)
virtualinherited

Initializes the data structures for an element potentially "cut" by a signed distance function.

The array vertex_distance_func contains vertex values of the signed distance function. If the signed distance function changes sign on the vertices, then the element is considered to be cut.) This interface can be extended by derived classes in order to subdivide the element and construct a composite quadrature rule.

Definition at line 188 of file quadrature.C.

191{
192 // dispatch generic implementation
193 this->init(elem.type(), p_level);
194}

References libMesh::QBase::init(), and libMesh::Elem::type().

◆ init() [3/4]

void libMesh::QBase::init ( const ElemType  type = INVALID_ELEM,
unsigned int  p_level = 0,
bool  simple_type_only = false 
)
virtualinherited

Initializes the data structures for a quadrature rule for an element of type type.

Some types, such as Polygon subclasses, might require more detailed element information and so might not be compatible with this API.

New code should use the Elem-based API for most use cases, but some code may initialize quadrature rules with simple ElemType values like triangles and edges for use in tensor product or conical product constructions; this code can set the simple_type_only flag to avoid being identified as deprecated.

Definition at line 121 of file quadrature.C.

124{
125 // Some element types require data from a specific element, so can
126 // only be used with newer APIs.
127 if (t == C0POLYGON || t == C0POLYHEDRON)
128 libmesh_error_msg("Code (see stack trace) used an outdated quadrature function overload.\n"
129 "Quadrature rules on a C0Polygon are not defined by its ElemType alone.");
130
131 // This API is dangerous to use on general meshes, which may include
132 // element types where the desired quadrature depends on the
133 // physical element, but we still want to be able to initialize
134 // based on only a type for certain simple cases
135 if (t != EDGE2 && !simple_type_only)
136 libmesh_deprecated();
137
138 // check to see if we have already
139 // done the work for this quadrature rule
140 if (t == _type && p == _p_level)
141 return;
142 else
143 {
144 _elem = nullptr;
145 _type = t;
146 _p_level = p;
147 }
148
149 switch(_dim)
150 {
151 case 0:
152 this->init_0D();
153
154 return;
155
156 case 1:
157 this->init_1D();
158
159 return;
160
161 case 2:
162 this->init_2D();
163
164 return;
165
166 case 3:
167 this->init_3D();
168
169 return;
170
171 default:
172 libmesh_error_msg("Invalid dimension _dim = " << _dim);
173 }
174}

References libMesh::QBase::_dim, libMesh::QBase::_elem, libMesh::QBase::_p_level, libMesh::QBase::_type, libMesh::C0POLYGON, libMesh::C0POLYHEDRON, libMesh::EDGE2, libMesh::QBase::init_0D(), libMesh::QBase::init_1D(), libMesh::QBase::init_2D(), and libMesh::QBase::init_3D().

◆ init() [4/4]

void libMesh::QBase::init ( const QBase other_rule)
virtualinherited

Initializes the data structures for a quadrature rule based on the element, element type, and p_level settings of other_rule.

Definition at line 178 of file quadrature.C.

179{
180 if (other_rule._elem)
181 this->init(*other_rule._elem, other_rule._p_level);
182 else
183 this->init(other_rule._type, other_rule._p_level, true);
184}

References libMesh::QBase::_elem, libMesh::QBase::_p_level, libMesh::QBase::_type, and libMesh::QBase::init().

◆ init_0D()

void libMesh::QBase::init_0D ( )
protectedvirtualinherited

Initializes the 0D quadrature rule by filling the points and weights vectors with the appropriate values.

Generally this is just one point with weight 1.

Definition at line 198 of file quadrature.C.

199{
200 _points.resize(1);
201 _weights.resize(1);
202 _points[0] = Point(0.);
203 _weights[0] = 1.0;
204}

References libMesh::QBase::_points, and libMesh::QBase::_weights.

Referenced by libMesh::QBase::init(), and libMesh::QBase::init().

◆ init_1D()

void libMesh::QNodal::init_1D ( )
overrideprivatevirtual

Initializes the 1D quadrature rule by filling the points and weights vectors with the appropriate values.

The order of the rule will be defined by the implementing class. It is assumed that derived quadrature rules will at least define the init_1D function, therefore it is pure virtual.

Implements libMesh::QBase.

Definition at line 29 of file quadrature_nodal_1D.C.

30{
31 switch (_type)
32 {
33 case EDGE2:
34 {
35 // Nodal quadrature on an Edge2 is QTrap
36 QTrap rule(/*dim=*/1, /*ignored*/_order);
37 rule.init(*this);
38 _points.swap (rule.get_points());
39 _weights.swap(rule.get_weights());
40 return;
41 }
42 case EDGE3:
43 {
44 // Nodal quadrature on an Edge3 is QSimpson
45 QSimpson rule(/*dim=*/1, /*ignored*/_order);
46 rule.init(*this);
47 _points.swap (rule.get_points());
48 _weights.swap(rule.get_weights());
49 return;
50 }
51 case EDGE4:
52 {
53 // The 4-point variant of Simpson's rule. The quadrature
54 // points are in the same order as the reference element
55 // nodes.
56 _points = {Point(-1,0.,0.), Point(+1,0.,0.),
57 Point(-Real(1)/3,0.,0.), Point(Real(1)/3,0.,0.)};
58 _weights = {0.25, 0.25, 0.75, 0.75};
59 return;
60 }
61 default:
62 libmesh_error_msg("Element type not supported:" << Utility::enum_to_string(_type));
63 }
64}
std::string enum_to_string(const T e)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

References libMesh::QBase::_order, libMesh::QBase::_points, libMesh::QBase::_type, libMesh::QBase::_weights, libMesh::EDGE2, libMesh::EDGE3, libMesh::EDGE4, libMesh::Utility::enum_to_string(), libMesh::QBase::get_points(), libMesh::QBase::get_weights(), libMesh::QBase::init(), and libMesh::Real.

◆ init_2D()

void libMesh::QNodal::init_2D ( )
overrideprivatevirtual

Initializes the 2D quadrature rule by filling the points and weights vectors with the appropriate values.

The order of the rule will be defined by the implementing class. Should not be pure virtual since a derived quadrature rule may only be defined in 1D. If not overridden, throws an error.

Reimplemented from libMesh::QBase.

Definition at line 31 of file quadrature_nodal_2D.C.

32{
33#if LIBMESH_DIM > 1
34
35 switch (_type)
36 {
37
38 case QUAD4:
39 case QUADSHELL4:
40 case TRI3:
41 case TRISHELL3:
42 {
43 QTrap rule(/*dim=*/2, /*ignored*/_order);
44 rule.init(*this);
45 _points.swap (rule.get_points());
46 _weights.swap(rule.get_weights());
47 return;
48 }
49
50 case QUAD8:
51 case QUADSHELL8:
52 {
53 // A rule with 8 points which is exact for linears, and
54 // naturally produces a lumped approximation to the mass
55 // matrix. The quadrature points are numbered the same way as
56 // the reference element nodes.
57 _points =
58 {
59 Point(-1,-1), Point(+1,-1), Point(+1,+1), Point(-1,+1),
60 Point(0.,-1), Point(+1,0.), Point(0.,+1), Point(-1,0.)
61 };
62
63 // The weights for the Quad8 nodal quadrature rule are
64 // obtained from the following specific steps. Other
65 // "serendipity" type rules are obtained similarly.
66 //
67 // 1.) Due to the symmetry of the bi-unit square domain, we
68 // first note that there are only two "classes" of node in the
69 // Quad8: vertices (with associated weight wv) and edges (with
70 // associated weight we).
71 //
72 // 2.) In order for such a nodal quadrature rule to be exact
73 // for constants, the weights must sum to the area of the
74 // reference element, and therefore we must have:
75 // 4*wv + 4*we = 4 --> wv + we = 1
76 //
77 // 3.) Due to symmetry (once again), such a rule is then
78 // automatically exact for the linear polynomials "x" and "y",
79 // regardless of the values of wv and we.
80 //
81 // 4.) We therefore still have two unknowns and one equation.
82 // Attempting to additionally make the nodal quadrature rule
83 // exact for the quadratic polynomials "x^2" and "y^2" leads
84 // to a rule with negative weights, namely:
85 // wv = -1/3
86 // we = 4/3
87 // Note: these are the same values one obtains by integrating
88 // the corresponding Quad8 Lagrange basis functions over the
89 // reference element.
90 //
91 // Since the weights appear on the diagonal of the nodal
92 // quadrature rule's approximation to the mass matrix, rules
93 // with negative weights yield an indefinite mass matrix,
94 // i.e. one with both positive and negative eigenvalues. Rules
95 // with negative weights can also produce a negative integral
96 // approximation to a strictly positive integrand, which may
97 // be unacceptable in some situations.
98 //
99 // 5.) Requiring all positive weights therefore restricts the
100 // nodal quadrature rule to only be exact for linears. But
101 // there is still one free parameter remaining, and thus we
102 // need some other criterion in order to complete the
103 // description of the rule.
104 //
105 // Here, we have decided to choose the quadrature weights in
106 // such a way that the resulting nodal quadrature mass matrix
107 // approximation is "proportional" to the true mass matrix's
108 // diagonal entries for the reference element. We therefore
109 // pose the following constrained optimization problem:
110 //
111 // { min_{wv, we} |diag(M) - C*diag(W)|^2
112 // (O) {
113 // { subject to wv + we = 1
114 //
115 // where:
116 // * M is the true mass matrix
117 // * W is the nodal quadrature approximation to the mass
118 // matrix. In this particular case:
119 // diag(W) = [wv,wv,wv,wv,we,we,we,we]
120 // * C = tr(M) / vol(E) is the ratio between the trace of the
121 // true mass matrix and the volume of the reference
122 // element. For all Lagrange finite elements, we have C<1.
123 //
124 // 6.) The optimization problem (O) is solved directly by
125 // substituting the algebraic constraint into the functional
126 // which is to be minimized, then setting the derivative with
127 // respect to the remaining parameter equal to zero and
128 // solving. In the Quad8 and Hex20 cases, there is only one
129 // free parameter, while in the Prism15 case there are two
130 // free parameters, so a 2x2 system of linear equations must
131 // be solved.
132 Real wv = Real(12) / 79;
133 Real we = Real(67) / 79;
134
135 _weights = {wv, wv, wv, wv, we, we, we, we};
136
137 return;
138 }
139
140 case QUAD9:
141 case QUADSHELL9:
142 case TRI6:
143 {
144 QSimpson rule(/*dim=*/2, /*ignored*/_order);
145 rule.init(*this);
146 _points.swap (rule.get_points());
147 _weights.swap(rule.get_weights());
148 return;
149 }
150
151 case TRI7:
152 {
153 // We can't exactly represent cubics with only seven nodes,
154 // but with w_i = integral(phi_i) for Lagrange shape functions
155 // phi_i, we not only get exact integrals of every Lagrange
156 // shape function, including the cubic bubble, we also get
157 // exact integrals of the rest of P^3 too.
158 _points =
159 {
160 Point(0.,0.), Point(+1,0.), Point(0.,+1), Point(.5,0.),
161 Point(.5,.5), Point(0.,.5), Point(1/Real(3),1/Real(3))
162 };
163
164 Real wv = Real(1)/40;
165 Real we = Real(1)/15;
166 _weights = {wv, wv, wv, we, we, we, Real(9)/40};
167 return;
168 }
169
170 //---------------------------------------------
171 // Arbitrary polygon quadrature rules
172 case C0POLYGON:
173 {
174 // C0Polygon requires the newer Quadrature API
175 if (!_elem)
176 libmesh_error();
177
179
180 const C0Polygon & poly = *cast_ptr<const C0Polygon *>(_elem);
181
182 const unsigned int ns = poly.n_sides();
183 const Real pi_over_ns = libMesh::pi / ns;
184 const Real master_poly_area = ns * 0.25 / tan(pi_over_ns);
185
186 const unsigned int nn = poly.n_nodes();
187 const Real weight = master_poly_area / nn;
188 _weights.resize(nn, weight);
189
190 _points.resize(poly.n_nodes());
191 for (auto n : make_range(nn))
192 _points[n] = poly.master_point(n);
193
194 return;
195 }
196
197 default:
198 libmesh_error_msg("Element type not supported!:" << Utility::enum_to_string(_type));
199 }
200#endif
201}
virtual ElemType type() const =0
dof_id_type weight(const MeshBase &mesh, const processor_id_type pid)
Definition mesh_tools.C:444
libmesh_assert(ctx)
const Real pi
.
Definition libmesh.h:292
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition int_range.h:176

References libMesh::QBase::_elem, libMesh::QBase::_order, libMesh::QBase::_points, libMesh::QBase::_type, libMesh::QBase::_weights, libMesh::C0POLYGON, libMesh::Utility::enum_to_string(), libMesh::QBase::get_points(), libMesh::QBase::get_weights(), libMesh::QBase::init(), libMesh::libmesh_assert(), libMesh::make_range(), libMesh::Polygon::master_point(), libMesh::Polygon::n_nodes(), libMesh::Polygon::n_sides(), libMesh::pi, libMesh::QUAD4, libMesh::QUAD8, libMesh::QUAD9, libMesh::QUADSHELL4, libMesh::QUADSHELL8, libMesh::QUADSHELL9, libMesh::Real, libMesh::TRI3, libMesh::TRI6, libMesh::TRI7, libMesh::TRISHELL3, and libMesh::Elem::type().

◆ init_3D()

void libMesh::QNodal::init_3D ( )
overrideprivatevirtual

Initializes the 3D quadrature rule by filling the points and weights vectors with the appropriate values.

The order of the rule will be defined by the implementing class. Should not be pure virtual since a derived quadrature rule may only be defined in 1D. If not overridden, throws an error.

Reimplemented from libMesh::QBase.

Definition at line 30 of file quadrature_nodal_3D.C.

31{
32#if LIBMESH_DIM == 3
33
34 switch (_type)
35 {
36 case TET4:
37 case PRISM6:
38 case HEX8:
39 case PYRAMID5:
40 {
41 // Construct QTrap rule that matches our own nodal pyramid quadrature permissions
42 QTrap rule(/*dim=*/3, /*ignored*/_order);
43 rule.allow_nodal_pyramid_quadrature = this->allow_nodal_pyramid_quadrature;
44 rule.init(*this);
45 _points.swap (rule.get_points());
46 _weights.swap(rule.get_weights());
47 return;
48 }
49
50 case PRISM15:
51 {
52 // A rule with 15 points which is exact for linears, and
53 // naturally produces a lumped approximation to the mass
54 // matrix. The quadrature points are numbered the same way as
55 // the reference element nodes.
56 _points =
57 {
58 Point(0.,0.,-1), Point(+1,0.,-1), Point(0.,+1,-1),
59 Point(0.,0.,+1), Point(+1,0.,+1), Point(0.,+1,+1),
60 Point(.5,0.,-1), Point(.5,.5,-1), Point(0.,.5,-1),
61 Point(0.,0.,0.), Point(+1,0.,0.), Point(0.,+1,0.),
62 Point(.5,0.,+1), Point(.5,.5,+1), Point(0.,.5,+1),
63 };
64
65 // vertex (wv), tri edge (wt), and quad edge (wq) weights are
66 // obtained using the same approach that was used for the Quad8,
67 // see quadrature_nodal_2D.C for details.
68 Real wv = Real(1) / 34;
69 Real wt = Real(4) / 51;
70 Real wq = Real(2) / 17;
71
72 _weights = {wv, wv, wv, wv, wv, wv,
73 wt, wt, wt,
74 wq, wq, wq,
75 wt, wt, wt};
76
77 return;
78 }
79
80 case HEX20:
81 {
82 // A rule with 20 points which is exact for linears, and
83 // naturally produces a lumped approximation to the mass
84 // matrix. The quadrature points are numbered the same way as
85 // the reference element nodes.
86 _points =
87 {
88 Point(-1,-1,-1), Point(+1,-1,-1), Point(+1,+1,-1), Point(-1,+1,-1),
89 Point(-1,-1,+1), Point(+1,-1,+1), Point(+1,+1,+1), Point(-1,+1,+1),
90 Point(0.,-1,-1), Point(+1,0.,-1), Point(0.,+1,-1), Point(-1,0.,-1),
91 Point(-1,-1,0.), Point(+1,-1,0.), Point(+1,+1,0.), Point(-1,+1,0.),
92 Point(0.,-1,+1), Point(+1,0.,+1), Point(0.,+1,+1), Point(-1,0.,+1)
93 };
94
95 // vertex (wv), and edge (we) weights are obtained using the
96 // same approach that was used for the Quad8, see
97 // quadrature_nodal_2D.C for details.
98 Real wv = Real(7) / 31;
99 Real we = Real(16) / 31;
100
101 _weights = {wv, wv, wv, wv, wv, wv, wv, wv,
102 we, we, we, we, we, we, we, we, we, we, we, we};
103
104 return;
105 }
106
107 case TET10:
108 case PRISM18:
109 case HEX27:
110 case PYRAMID13:
111 case PYRAMID14:
112 {
113 // Construct QSimpson rule that matches our own nodal pyramid quadrature permissions
114 QSimpson rule(/*dim=*/3, /*ignored*/_order);
115 rule.allow_nodal_pyramid_quadrature = this->allow_nodal_pyramid_quadrature;
116 rule.init(*this);
117 _points.swap (rule.get_points());
118 _weights.swap(rule.get_weights());
119
120 // We can't do a proper Simpson rule for pyramids regardless
121 if (_type == PYRAMID13)
122 {
123 _points.resize(13);
124 _weights.resize(13);
125 }
126
127 return;
128 }
129
130 case PRISM20:
131 {
132 _points =
133 {
134 Point(0.,0.,-1), Point(+1,0.,-1), Point(0.,+1,-1),
135 Point(0.,0.,+1), Point(+1,0.,+1), Point(0.,+1,+1),
136 Point(.5,0.,-1), Point(.5,.5,-1), Point(0.,.5,-1),
137 Point(0.,0.,0.), Point(+1,0.,0.), Point(0.,+1,0.),
138 Point(.5,0.,+1), Point(.5,.5,+1), Point(0.,.5,+1),
139 Point(.5,0.,0.), Point(.5,.5,0.), Point(0.,.5,0.),
140 Point(1/Real(3),1/Real(3),-1), Point(1/Real(3),1/Real(3),+1)
141 };
142
143 // Symmetry gives us identical weights on vertices, triangle
144 // edges, square edges, triangle faces, square faces; then we
145 // have the midnode. Solving for weights which exactly
146 // integrate cubics and xi^2*zeta^2 would give a unique answer
147 // ... with wse=0 and wte<0. See Quad8 in
148 // quadrature_nodal_2D.C for discussion of this problem.
149 //
150 // Dropping the xi^2 zeta^2 constraint gives us a rank-1 null
151 // space to play with ... but adding anything from that null
152 // space to push wte closer to positive just pushes wse
153 // negative.
154 //
155 // Dropping exact integration of xi^3 type terms gives us a
156 // rank-2 null space. I just found the max(min(weight)) from
157 // that solution space using Octave. Someone who cares more
158 // than me might want to repeat this exercise with better than
159 // double precision...
160
161 constexpr Real wv = 8.546754839782711e-03;
162 constexpr Real wte = 8.548403936750599e-03;
163 constexpr Real wse = wv; // here's our min(weight) constraint...
164 constexpr Real wtf = 1.153811903370667e-01;
165 constexpr Real wsf = 2.136754673824396e-01;
166
167 _weights = {wv, wv, wv, wv, wv, wv,
168 wte, wte, wte, wse, wse, wse, wte, wte, wte,
169 wsf, wsf, wsf, wtf, wtf};
170
171 return;
172 }
173
174 case PRISM21:
175 {
176 _points =
177 {
178 Point(0.,0.,-1), Point(+1,0.,-1), Point(0.,+1,-1),
179 Point(0.,0.,+1), Point(+1,0.,+1), Point(0.,+1,+1),
180 Point(.5,0.,-1), Point(.5,.5,-1), Point(0.,.5,-1),
181 Point(0.,0.,0.), Point(+1,0.,0.), Point(0.,+1,0.),
182 Point(.5,0.,+1), Point(.5,.5,+1), Point(0.,.5,+1),
183 Point(.5,0.,0.), Point(.5,.5,0.), Point(0.,.5,0.),
184 Point(1/Real(3),1/Real(3),-1), Point(1/Real(3),1/Real(3),+1),
185 Point(1/Real(3),1/Real(3),0.)
186 };
187
188 // Symmetry gives us identical weights on vertices, triangle
189 // edges, square edges, triangle faces, square faces; then we
190 // have the midnode. Solving for weights which exactly
191 // integrate cubics, xi^2*zeta^2, and xi^3*zeta^2, gives a
192 // unique answer:
193 constexpr Real wv = Real(1)/120;
194 constexpr Real wte = Real(1)/45;
195 constexpr Real wse = Real(1)/30;
196 constexpr Real wtf = Real(3)/40;
197 constexpr Real wsf = Real(4)/45;
198
199 _weights = {wv, wv, wv, wv, wv, wv,
200 wte, wte, wte, wse, wse, wse, wte, wte, wte,
201 wsf, wsf, wsf, wtf, wtf, Real(3)/10};
202
203 return;
204 }
205
206 case PYRAMID18:
207 {
208 libmesh_error_msg_if(!allow_nodal_pyramid_quadrature,
209 "Nodal quadrature on Pyramid elements is not allowed by default since\n"
210 "the Jacobian of the inverse element map is not well-defined at the Pyramid apex.\n"
211 "Set the QBase::allow_nodal_pyramid_quadrature flag to true to ignore skip this check.");
212
213 _points =
214 {
215 Point(-1,-1,0.), Point(+1,-1,0.), Point(+1,+1,0.),
216 Point(-1,+1,0.), Point(0.,0.,+1), Point(0.,-1,0.),
217 Point(+1,0.,0.), Point(0.,+1,0.), Point(-1,0.,0.),
218 Point(-.5,-.5,.5), Point(-.5,.5,.5), Point(.5,.5,.5),
219 Point(-.5,.5,.5), Point(0.,0.,0.), Point(0.,-2/Real(3),1/Real(3)),
220 Point(2/Real(3),0.,1/Real(3)), Point(0.,2/Real(3),1/Real(3)),
221 Point(-2/Real(3),0.,1/Real(3))
222 };
223
224 // Even with triangle faces to play with, I can't seem to get
225 // exact integrals of any higher order functions without
226 // negative weights. So I punt and just use QTrap weights.
227 _weights = {1/Real(4), 1/Real(4), 1/Real(4), 1/Real(4), 1/Real(3),
228 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
229
230 return;
231 }
232
233 case TET14:
234 {
235 _points.resize(14);
236 _weights.resize(14);
237
238 _points[0](0) = 0.; _points[5](0) = .5;
239 _points[0](1) = 0.; _points[5](1) = .5;
240 _points[0](2) = 0.; _points[5](2) = 0.;
241
242 _points[1](0) = 1.; _points[6](0) = 0.;
243 _points[1](1) = 0.; _points[6](1) = .5;
244 _points[1](2) = 0.; _points[6](2) = 0.;
245
246 _points[2](0) = 0.; _points[7](0) = 0.;
247 _points[2](1) = 1.; _points[7](1) = 0.;
248 _points[2](2) = 0.; _points[7](2) = .5;
249
250 _points[3](0) = 0.; _points[8](0) = .5;
251 _points[3](1) = 0.; _points[8](1) = 0.;
252 _points[3](2) = 1.; _points[8](2) = .5;
253
254 _points[4](0) = .5; _points[9](0) = 0.;
255 _points[4](1) = 0.; _points[9](1) = .5;
256 _points[4](2) = 0.; _points[9](2) = .5;
257
258
259 _points[10](0) = 1/Real(3); _points[11](0) = 1/Real(3);
260 _points[10](1) = 1/Real(3); _points[11](1) = 0.;
261 _points[10](2) = 0.; _points[11](2) = 1/Real(3);
262
263 _points[12](0) = 1/Real(3); _points[13](0) = 0.;
264 _points[12](1) = 1/Real(3); _points[13](1) = 1/Real(3);
265 _points[12](2) = 1/Real(3); _points[13](2) = 1/Real(3);
266
267 // RHS:
268 //
269 // The ``optimal'' nodal quadrature here, the one that
270 // integrates every Lagrange polynomial on these nodes
271 // exactly, produces an indefinite mass matrix ...
272 //
273 // const Real wv = 1/Real(240);
274 // const Real we = 0;
275 // const Real wf = 3/Real(80);
276
277 // We could average that with our Tet10 rule and get:
278 //
279 // const Real wv = (1/Real(240)+1/Real(192))/2;
280 // const Real we = Real(14)/576/2;
281 // const Real wf = 3/Real(80)/2;
282 //
283 // Except our Tet10 rule won't actually exactly integrate
284 // quadratics! (exactly integrating quadratics wouldn't even
285 // have given a positive semidefinite mass matrix there...)
286 //
287 // John derived equations for wv and we based on symmetry and
288 // the requirement to exactly integrate quadratics; within
289 // those constraints we might pick the wf that maximizes the
290 // minimum nodal weight:
291 // const Real wf = Real(15)/440;
292 // const Real wv = -1/Real(120) + wf/3;
293 // const Real we = 1/Real(30) - wf*(Real(8)/9);
294 //
295 // But John also did the same clever optimization trick that
296 // quadrature_nodal_2D.C discusses in the context of Quad8 and
297 // Hex20 outputs, and for Tet14 that gives us:
298 const Real wv = Real(87)/47120;
299 const Real we = Real(164)/26505;
300 const Real wf = Real(1439)/47120;
301
302 _weights = {wv, wv, wv, wv, we, we, we, we, we, we, wf, wf, wf, wf};
303 return;
304 }
305
306 //---------------------------------------------
307 // Arbitrary polygon quadrature rules
308 case C0POLYHEDRON:
309 {
310 // Polyhedra require the newer Quadrature API
311 if (!_elem)
312 libmesh_error();
313
315
316 const C0Polyhedron & poly = *cast_ptr<const C0Polyhedron *>(_elem);
317
318 const Real master_poly_volume = _elem->volume();
319
320 // For polyhedra the master element is the physical element.
321 //
322 // Using even weights is not the most effective nodal rule for
323 // that case, but users who want an effective rule probably
324 // want a non-nodal rule anyway.
325 const unsigned int nn = poly.n_nodes();
326 const Real weight = master_poly_volume / nn;
327 _weights.resize(nn, weight);
328
329 _points.resize(poly.n_nodes());
330 for (auto n : make_range(nn))
331 _points[n] = poly.master_point(n);
332
333 return;
334 }
335
336
337 default:
338 libmesh_error_msg("ERROR: Unsupported type: " << Utility::enum_to_string(_type));
339 }
340#endif
341}
virtual Real volume() const
Definition elem.C:3462
bool allow_nodal_pyramid_quadrature
The flag's value defaults to false so that one does not accidentally use a nodal quadrature rule on P...
Definition quadrature.h:314

References libMesh::QBase::_elem, libMesh::QBase::_order, libMesh::QBase::_points, libMesh::QBase::_type, libMesh::QBase::_weights, libMesh::QBase::allow_nodal_pyramid_quadrature, libMesh::C0POLYHEDRON, libMesh::Utility::enum_to_string(), libMesh::QBase::get_points(), libMesh::QBase::get_weights(), libMesh::HEX20, libMesh::HEX27, libMesh::HEX8, libMesh::QBase::init(), libMesh::libmesh_assert(), libMesh::make_range(), libMesh::Polyhedron::master_point(), libMesh::Polyhedron::n_nodes(), libMesh::PRISM15, libMesh::PRISM18, libMesh::PRISM20, libMesh::PRISM21, libMesh::PRISM6, libMesh::PYRAMID13, libMesh::PYRAMID14, libMesh::PYRAMID18, libMesh::PYRAMID5, libMesh::Real, libMesh::TET10, libMesh::TET14, libMesh::TET4, libMesh::Elem::type(), and libMesh::Elem::volume().

◆ n_objects()

static unsigned int libMesh::ReferenceCounter::n_objects ( )
inlinestaticinherited

Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 85 of file reference_counter.h.

86 { return _n_objects; }
static Threads::atomic< unsigned int > _n_objects
The number of objects.

References libMesh::ReferenceCounter::_n_objects.

Referenced by libMesh::LibMeshInit::~LibMeshInit().

◆ n_points()

unsigned int libMesh::QBase::n_points ( ) const
inlineinherited
Returns
The number of points associated with the quadrature rule.

Definition at line 131 of file quadrature.h.

132 {
133 libmesh_assert (!_points.empty());
134 return cast_int<unsigned int>(_points.size());
135 }

References libMesh::QBase::_points, and libMesh::libmesh_assert().

Referenced by libMesh::ExactSolution::_compute_error(), alternative_fe_assembly(), LinearElasticity::assemble(), assemble(), assemble(), assemble_1D(), AssembleOptimization::assemble_A_and_F(), libMesh::ClawSystem::assemble_advection_matrices(), libMesh::ClawSystem::assemble_avg_coupling_matrices(), libMesh::ClawSystem::assemble_boundary_condition_matrices(), assemble_cd(), assemble_cd(), assemble_divgrad(), assemble_elasticity(), assemble_ellipticdg(), assemble_graddiv(), assemble_helmholtz(), libMesh::ClawSystem::assemble_jump_coupling_matrix(), assemble_mass(), libMesh::ClawSystem::assemble_mass_matrix(), assemble_matrices(), assemble_poisson(), assemble_poisson(), assemble_poisson(), assemble_shell(), assemble_stokes(), assemble_temperature_jump(), assemble_wave(), assembly_with_dg_fem_context(), AssemblyF0::boundary_assembly(), AssemblyF1::boundary_assembly(), AssemblyF2::boundary_assembly(), AssemblyA0::boundary_assembly(), AssemblyA1::boundary_assembly(), AssemblyA2::boundary_assembly(), A2::boundary_assembly(), A3::boundary_assembly(), F0::boundary_assembly(), Output0::boundary_assembly(), libMesh::System::calculate_norm(), compute_enriched_soln(), compute_jacobian(), libMesh::FEGenericBase< OutputType >::compute_periodic_constraints(), libMesh::FEGenericBase< OutputType >::compute_proj_constraints(), compute_residual(), libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), LinearElasticity::compute_stresses(), LargeDeformationElasticity::compute_stresses(), LinearElasticityWithContact::compute_stresses(), compute_stresses(), libMesh::QConical::conical_product_pyramid(), libMesh::QConical::conical_product_tet(), libMesh::QConical::conical_product_tri(), libMesh::HDGProblem::create_identity_jacobian(), libMesh::HDGProblem::create_identity_residual(), SecondOrderScalarSystemSecondOrderTimeSolverBase::damping_residual(), SecondOrderScalarSystemFirstOrderTimeSolverBase::damping_residual(), CoupledSystem::element_constraint(), NavierSystem::element_constraint(), LaplaceSystem::element_postprocess(), PoissonSystem::element_postprocess(), LaplaceQoI::element_qoi(), HeatSystem::element_qoi(), HeatSystem::element_qoi_derivative(), LaplaceSystem::element_qoi_derivative(), LaplaceQoI::element_qoi_derivative(), LaplaceSystem::element_time_derivative(), CoupledSystem::element_time_derivative(), HeatSystem::element_time_derivative(), PoissonSystem::element_time_derivative(), NavierSystem::element_time_derivative(), SolidSystem::element_time_derivative(), ElasticitySystem::element_time_derivative(), CurlCurlSystem::element_time_derivative(), SigmaPhysics::element_time_derivative(), FirstOrderScalarSystemBase::element_time_derivative(), SecondOrderScalarSystemFirstOrderTimeSolverBase::element_time_derivative(), HilbertSystem::element_time_derivative(), fe_assembly(), form_functionA(), form_functionB(), form_matrixA(), libMesh::VariationalSmootherSystem::get_target_to_reference_jacobian(), A0::interior_assembly(), A1::interior_assembly(), A2::interior_assembly(), F0::interior_assembly(), OutputAssembly::interior_assembly(), B::interior_assembly(), M0::interior_assembly(), EIM_IP_assembly::interior_assembly(), AssemblyA0::interior_assembly(), AssemblyA1::interior_assembly(), AssemblyA2::interior_assembly(), InnerProductAssembly::interior_assembly(), AssemblyF0::interior_assembly(), AssemblyF1::interior_assembly(), Ex6InnerProduct::interior_assembly(), AcousticsInnerProduct::interior_assembly(), LargeDeformationElasticity::jacobian(), LaplaceYoung::jacobian(), libMesh::FEMPhysics::mass_residual(), NavierSystem::mass_residual(), ElasticitySystem::mass_residual(), FirstOrderScalarSystemBase::mass_residual(), SecondOrderScalarSystemSecondOrderTimeSolverBase::mass_residual(), SecondOrderScalarSystemFirstOrderTimeSolverBase::mass_residual(), libMesh::FEAbstract::n_quadrature_points(), periodic_bc_test_poisson(), libMesh::QBase::print_info(), LargeDeformationElasticity::residual(), LaplaceYoung::residual(), LinearElasticityWithContact::residual_and_jacobian(), LaplaceSystem::side_constraint(), LaplaceSystem::side_postprocess(), CoupledSystemQoI::side_qoi(), LaplaceSystem::side_qoi_derivative(), CoupledSystemQoI::side_qoi_derivative(), ElasticitySystem::side_time_derivative(), CurlCurlSystem::side_time_derivative(), libMesh::QBase::size(), libMesh::QBase::tensor_product_hex(), libMesh::QBase::tensor_product_prism(), libMesh::QBase::tensor_product_quad(), and QuadratureTest::testPolynomial().

◆ operator=() [1/2]

QNodal & libMesh::QNodal::operator= ( const QNodal )
default

◆ operator=() [2/2]

QNodal & libMesh::QNodal::operator= ( QNodal &&  )
default

◆ print_info() [1/2]

void libMesh::QBase::print_info ( std::ostream &  os = libMesh::out) const
inherited

Prints information relevant to the quadrature rule, by default to libMesh::out.

Definition at line 43 of file quadrature.C.

44{
45 libmesh_assert(!_points.empty());
46 libmesh_assert(!_weights.empty());
47
48 Real summed_weights=0;
49 os << "N_Q_Points=" << this->n_points() << std::endl << std::endl;
50 for (auto qpoint: index_range(_points))
51 {
52 os << " Point " << qpoint << ":\n"
53 << " "
54 << _points[qpoint]
55 << "\n Weight:\n "
56 << " w=" << _weights[qpoint] << "\n" << std::endl;
57
58 summed_weights += _weights[qpoint];
59 }
60 os << "Summed Weights: " << summed_weights << std::endl;
61}
unsigned int n_points() const
Definition quadrature.h:131
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition int_range.h:153

References libMesh::QBase::_points, libMesh::QBase::_weights, libMesh::index_range(), libMesh::libmesh_assert(), libMesh::QBase::n_points(), and libMesh::Real.

◆ print_info() [2/2]

void libMesh::ReferenceCounter::print_info ( std::ostream &  out_stream = libMesh::out)
staticinherited

Prints the reference information, by default to libMesh::out.

Definition at line 81 of file reference_counter.C.

82{
84 out_stream << ReferenceCounter::get_info();
85}
static std::string get_info()
Gets a string containing the reference information.

References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().

Referenced by libMesh::LibMeshInit::~LibMeshInit().

◆ qp()

Point libMesh::QBase::qp ( const unsigned int  i) const
inlineinherited

◆ scale()

void libMesh::QBase::scale ( std::pair< Real, Real old_range,
std::pair< Real, Real new_range 
)
inherited

Maps the points of a 1D quadrature rule defined by "old_range" to another 1D interval defined by "new_range" and scales the weights accordingly.

Definition at line 222 of file quadrature.C.

224{
225 // Make sure we are in 1D
226 libmesh_assert_equal_to (_dim, 1);
227
228 Real
229 h_new = new_range.second - new_range.first,
230 h_old = old_range.second - old_range.first;
231
232 // Make sure that we have sane ranges
233 libmesh_assert_greater (h_new, 0.);
234 libmesh_assert_greater (h_old, 0.);
235
236 // Make sure there are some points
237 libmesh_assert_greater (_points.size(), 0);
238
239 // Compute the scale factor
240 Real scfact = h_new/h_old;
241
242 // We're mapping from old_range -> new_range
243 for (auto i : index_range(_points))
244 {
245 _points[i](0) = new_range.first +
246 (_points[i](0) - old_range.first) * scfact;
247
248 // Scale the weights
249 _weights[i] *= scfact;
250 }
251}

References libMesh::QBase::_dim, libMesh::QBase::_points, libMesh::QBase::_weights, libMesh::index_range(), and libMesh::Real.

Referenced by libMesh::QConical::conical_product_tet(), and libMesh::QConical::conical_product_tri().

◆ shapes_need_reinit()

virtual bool libMesh::QBase::shapes_need_reinit ( )
inlinevirtualinherited
Returns
true if the shape functions need to be recalculated, false otherwise.

This may be required if the number of quadrature points or their position changes.

Definition at line 286 of file quadrature.h.

286{ return false; }

◆ size()

unsigned int libMesh::QBase::size ( ) const
inlineinherited

Alias for n_points() to enable use in index_range.

Returns
The number of points associated with the quadrature rule.

Definition at line 142 of file quadrature.h.

143 {
144 return n_points();
145 }

References libMesh::QBase::n_points().

◆ tensor_product_hex()

void libMesh::QBase::tensor_product_hex ( const QBase q1D)
protectedinherited

Computes the tensor product quadrature rule [q1D x q1D x q1D] from the 1D rule q1D.

Used in the init_3D routines for hexahedral element types.

Definition at line 283 of file quadrature.C.

284{
285 const unsigned int np = q1D.n_points();
286
287 _points.resize(np * np * np);
288
289 _weights.resize(np * np * np);
290
291 unsigned int q=0;
292
293 for (unsigned int k=0; k<np; k++)
294 for (unsigned int j=0; j<np; j++)
295 for (unsigned int i=0; i<np; i++)
296 {
297 _points[q](0) = q1D.qp(i)(0);
298 _points[q](1) = q1D.qp(j)(0);
299 _points[q](2) = q1D.qp(k)(0);
300
301 _weights[q] = q1D.w(i) * q1D.w(j) * q1D.w(k);
302
303 q++;
304 }
305}

References libMesh::QBase::_points, libMesh::QBase::_weights, libMesh::QBase::n_points(), libMesh::QBase::qp(), and libMesh::QBase::w().

Referenced by libMesh::QGauss::init_3D(), libMesh::QGaussLobatto::init_3D(), libMesh::QGrid::init_3D(), libMesh::QSimpson::init_3D(), and libMesh::QTrap::init_3D().

◆ tensor_product_prism()

void libMesh::QBase::tensor_product_prism ( const QBase q1D,
const QBase q2D 
)
protectedinherited

Computes the tensor product of a 1D quadrature rule and a 2D quadrature rule.

Used in the init_3D routines for prismatic element types.

Definition at line 310 of file quadrature.C.

311{
312 const unsigned int n_points1D = q1D.n_points();
313 const unsigned int n_points2D = q2D.n_points();
314
315 _points.resize (n_points1D * n_points2D);
316 _weights.resize (n_points1D * n_points2D);
317
318 unsigned int q=0;
319
320 for (unsigned int j=0; j<n_points1D; j++)
321 for (unsigned int i=0; i<n_points2D; i++)
322 {
323 _points[q](0) = q2D.qp(i)(0);
324 _points[q](1) = q2D.qp(i)(1);
325 _points[q](2) = q1D.qp(j)(0);
326
327 _weights[q] = q2D.w(i) * q1D.w(j);
328
329 q++;
330 }
331
332}

References libMesh::QBase::_points, libMesh::QBase::_weights, libMesh::QBase::n_points(), libMesh::QBase::qp(), and libMesh::QBase::w().

Referenced by libMesh::QGauss::init_3D(), libMesh::QGrid::init_3D(), libMesh::QSimpson::init_3D(), and libMesh::QTrap::init_3D().

◆ tensor_product_quad()

void libMesh::QBase::tensor_product_quad ( const QBase q1D)
protectedinherited

Constructs a 2D rule from the tensor product of q1D with itself.

Used in the init_2D() routines for quadrilateral element types.

Definition at line 256 of file quadrature.C.

257{
258
259 const unsigned int np = q1D.n_points();
260
261 _points.resize(np * np);
262
263 _weights.resize(np * np);
264
265 unsigned int q=0;
266
267 for (unsigned int j=0; j<np; j++)
268 for (unsigned int i=0; i<np; i++)
269 {
270 _points[q](0) = q1D.qp(i)(0);
271 _points[q](1) = q1D.qp(j)(0);
272
273 _weights[q] = q1D.w(i)*q1D.w(j);
274
275 q++;
276 }
277}

References libMesh::QBase::_points, libMesh::QBase::_weights, libMesh::QBase::n_points(), libMesh::QBase::qp(), and libMesh::QBase::w().

Referenced by libMesh::QGauss::init_2D(), libMesh::QGaussLobatto::init_2D(), libMesh::QGrid::init_2D(), libMesh::QSimpson::init_2D(), and libMesh::QTrap::init_2D().

◆ type()

QuadratureType libMesh::QNodal::type ( ) const
overridevirtual
Returns
QNODAL.

Implements libMesh::QBase.

Definition at line 26 of file quadrature_nodal.C.

27{
28 return QNODAL;
29}

References libMesh::QNODAL.

◆ w()

Real libMesh::QBase::w ( const unsigned int  i) const
inlineinherited

Member Data Documentation

◆ _counts

ReferenceCounter::Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

Actually holds the data.

Definition at line 124 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::get_info().

◆ _dim

unsigned int libMesh::QBase::_dim
protectedinherited

◆ _elem

const Elem* libMesh::QBase::_elem
protectedinherited

The element for which the current values were computed, or nullptr if values were computed without a specific element.

Definition at line 397 of file quadrature.h.

Referenced by libMesh::QBase::init(), libMesh::QBase::init(), libMesh::QBase::init(), libMesh::QGauss::init_2D(), init_2D(), libMesh::QGauss::init_3D(), and init_3D().

◆ _enable_print_counter

bool libMesh::ReferenceCounter::_enable_print_counter = true
staticprotectedinherited

Flag to control whether reference count information is printed when print_info is called.

Definition at line 143 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().

◆ _mutex

Threads::spin_mutex libMesh::ReferenceCounter::_mutex
staticprotectedinherited

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 137 of file reference_counter.h.

◆ _n_objects

Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects
staticprotectedinherited

◆ _order

Order libMesh::QBase::_order
protectedinherited

◆ _p_level

unsigned int libMesh::QBase::_p_level
protectedinherited

◆ _points

std::vector<Point> libMesh::QBase::_points
protectedinherited

The locations of the quadrature points in reference element space.

Definition at line 409 of file quadrature.h.

Referenced by libMesh::QConical::conical_product_pyramid(), libMesh::QConical::conical_product_tet(), libMesh::QConical::conical_product_tri(), libMesh::QGauss::dunavant_rule(), libMesh::QGauss::dunavant_rule2(), libMesh::QBase::get_points(), libMesh::QBase::get_points(), libMesh::QGrundmann_Moller::gm_rule(), libMesh::QBase::init_0D(), libMesh::QClough::init_1D(), libMesh::QConical::init_1D(), libMesh::QGauss::init_1D(), libMesh::QGaussLobatto::init_1D(), libMesh::QGrundmann_Moller::init_1D(), libMesh::QGrid::init_1D(), libMesh::QJacobi::init_1D(), libMesh::QMonomial::init_1D(), init_1D(), libMesh::QSimpson::init_1D(), libMesh::QTrap::init_1D(), libMesh::QClough::init_2D(), libMesh::QGauss::init_2D(), libMesh::QGaussLobatto::init_2D(), libMesh::QGrid::init_2D(), libMesh::QMonomial::init_2D(), init_2D(), libMesh::QSimpson::init_2D(), libMesh::QTrap::init_2D(), libMesh::QGauss::init_3D(), libMesh::QGaussLobatto::init_3D(), libMesh::QGrundmann_Moller::init_3D(), libMesh::QGrid::init_3D(), libMesh::QMonomial::init_3D(), init_3D(), libMesh::QSimpson::init_3D(), libMesh::QTrap::init_3D(), libMesh::QGauss::keast_rule(), libMesh::QMonomial::kim_rule(), libMesh::QBase::n_points(), libMesh::QBase::print_info(), libMesh::QBase::qp(), libMesh::QBase::scale(), libMesh::QMonomial::stroud_rule(), libMesh::QBase::tensor_product_hex(), libMesh::QBase::tensor_product_prism(), libMesh::QBase::tensor_product_quad(), and libMesh::QMonomial::wissmann_rule().

◆ _type

ElemType libMesh::QBase::_type
protectedinherited

◆ _weights

std::vector<Real> libMesh::QBase::_weights
protectedinherited

The quadrature weights.

The order of the weights matches the ordering of the _points vector.

Definition at line 415 of file quadrature.h.

Referenced by libMesh::QConical::conical_product_pyramid(), libMesh::QConical::conical_product_tet(), libMesh::QConical::conical_product_tri(), libMesh::QGauss::dunavant_rule(), libMesh::QGauss::dunavant_rule2(), libMesh::QBase::get_weights(), libMesh::QBase::get_weights(), libMesh::QGrundmann_Moller::gm_rule(), libMesh::QBase::init_0D(), libMesh::QClough::init_1D(), libMesh::QConical::init_1D(), libMesh::QGauss::init_1D(), libMesh::QGaussLobatto::init_1D(), libMesh::QGrundmann_Moller::init_1D(), libMesh::QGrid::init_1D(), libMesh::QJacobi::init_1D(), libMesh::QMonomial::init_1D(), init_1D(), libMesh::QSimpson::init_1D(), libMesh::QTrap::init_1D(), libMesh::QClough::init_2D(), libMesh::QGauss::init_2D(), libMesh::QGaussLobatto::init_2D(), libMesh::QGrid::init_2D(), libMesh::QMonomial::init_2D(), init_2D(), libMesh::QSimpson::init_2D(), libMesh::QTrap::init_2D(), libMesh::QGauss::init_3D(), libMesh::QGaussLobatto::init_3D(), libMesh::QGrundmann_Moller::init_3D(), libMesh::QGrid::init_3D(), libMesh::QMonomial::init_3D(), init_3D(), libMesh::QSimpson::init_3D(), libMesh::QTrap::init_3D(), libMesh::QGauss::keast_rule(), libMesh::QMonomial::kim_rule(), libMesh::QBase::print_info(), libMesh::QBase::scale(), libMesh::QMonomial::stroud_rule(), libMesh::QBase::tensor_product_hex(), libMesh::QBase::tensor_product_prism(), libMesh::QBase::tensor_product_quad(), libMesh::QBase::w(), and libMesh::QMonomial::wissmann_rule().

◆ allow_nodal_pyramid_quadrature

bool libMesh::QBase::allow_nodal_pyramid_quadrature
inherited

The flag's value defaults to false so that one does not accidentally use a nodal quadrature rule on Pyramid elements, since evaluating the inverse element Jacobian (e.g.

dphi) is not well-defined at the Pyramid apex because the element Jacobian is zero there.

We do not want to completely prevent someone from using a nodal quadrature rule on Pyramids, however, since there are legitimate use cases (lumped mass matrix) so the flag can be set to true to override this behavior.

Definition at line 314 of file quadrature.h.

Referenced by init_3D(), libMesh::QSimpson::init_3D(), and libMesh::QTrap::init_3D().

◆ allow_rules_with_negative_weights

bool libMesh::QBase::allow_rules_with_negative_weights
inherited

Flag (default true) controlling the use of quadrature rules with negative weights.

Set this to false to require rules with all positive weights.

Rules with negative weights can be unsuitable for some problems. For example, it is possible for a rule with negative weights to obtain a negative result when integrating a positive function.

A particular example: if rules with negative weights are not allowed, a request for TET,THIRD (5 points) will return the TET,FIFTH (14 points) rule instead, nearly tripling the computational effort required!

Definition at line 301 of file quadrature.h.

Referenced by libMesh::QGrundmann_Moller::init_2D(), libMesh::QGauss::init_3D(), libMesh::QGrundmann_Moller::init_3D(), and libMesh::QMonomial::init_3D().


The documentation for this class was generated from the following files: