#include <quadrature.h>
Inherits ReferenceCountedObject< QBase >.
Inherited by QClough, QConical, QGauss, QGrid, QGrundmann_Moller, QJacobi, QMonomial, QSimpson, and QTrap.
virtual ~QBase ()
virtual QuadratureType type () const =0
ElemType get_elem_type () const
unsigned int get_p_level () const
unsigned int n_points () const
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
void init (const ElemType _type=INVALID_ELEM, unsigned int p_level=0)
Order get_order () const
void print_info (std::ostream &os=std::cout) const
void scale (std::pair< Real, Real > old_range, std::pair< Real, Real > new_range)
static AutoPtr< QBase > build (const std::string &name, const unsigned int _dim, const Order _order=INVALID_ORDER)
static AutoPtr< QBase > build (const QuadratureType _qt, const unsigned int _dim, const Order _order=INVALID_ORDER)
static std::string get_info ()
static void print_info ()
static unsigned int n_objects ()
bool allow_rules_with_negative_weights
typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
QBase (const unsigned int _dim, const Order _order=INVALID_ORDER)
virtual void init_0D (const ElemType _type=INVALID_ELEM, unsigned int p_level=0)
virtual void init_1D (const ElemType _type=INVALID_ELEM, unsigned int p_level=0)=0
virtual void init_2D (const ElemType, unsigned int=0)
void increment_constructor_count (const std::string &name)
void increment_destructor_count (const std::string &name)
std::cerr<< 'ERROR: Seems as if this quadrature rule'<< std::endl<< ' is not implemented for 2D.'<< std::endl;libmesh_error();}#endif virtual void init_3D(const ElemType, unsigned int=0)#ifndef DEBUG{}#else{std::cerr<< 'ERROR: Seems as if this quadrature rule'<< std::endl<< ' is not implemented for 3D.'<< std::endl;libmesh_error();}#endif void tensor_product_quad(const QBase &q1D);void tensor_product_hex(const QBase &q1D);void tensor_product_prism(const QBase &q1D, const QBase &q2D);const unsigned int _dim;const Order _order;ElemType _type;unsigned int _p_level;std::vector< Point > _points
std::vector< Real > _weights
static Counts _counts
static Threads::atomic< unsigned int > _n_objects
static Threads::spin_mutex _mutex
std::ostream & operator<< (std::ostream &os, const QBase &q)
This is the QBase class. It provides the basic functionality from which various quadrature rules can be derived. The class contains dim dimensional points describing the quadrature locations (referenced to a master object) and associated weights.
Author:
Definition at line 53 of file quadrature.h.
Definition at line 105 of file reference_counter.h.
Definition at line 336 of file quadrature.h.
:
allow_rules_with_negative_weights(true),
_dim(d),
_order(o),
_type(INVALID_ELEM),
_p_level(0)
{
}
Definition at line 69 of file quadrature.h.
{}
Definition at line 36 of file quadrature_build.C.
References Utility::string_to_enum< QuadratureType >().
Referenced by InfFE< Dim, T_radial, T_map >::attach_quadrature_rule().
{
return QBase::build (Utility::string_to_enum<QuadratureType> (type),
_dim,
_order);
}
Definition at line 47 of file quadrature_build.C.
References libMeshEnums::FIRST, libMeshEnums::FORTYTHIRD, libMeshEnums::QCLOUGH, libMeshEnums::QGAUSS, libMeshEnums::QJACOBI_1_0, libMeshEnums::QJACOBI_2_0, libMeshEnums::QSIMPSON, libMeshEnums::QTRAP, libMeshEnums::THIRD, and libMeshEnums::TWENTYTHIRD.
{
switch (_qt)
{
case QCLOUGH:
{
#ifdef DEBUG
if (_order > TWENTYTHIRD)
{
std::cout << 'WARNING: Clough quadrature implemented' << std::endl
<< ' up to TWENTYTHIRD order.' << std::endl;
}
#endif
AutoPtr<QBase> ap(new QClough(_dim, _order));
return ap;
}
case QGAUSS:
{
#ifdef DEBUG
if (_order > FORTYTHIRD)
{
std::cout << 'WARNING: Gauss quadrature implemented' << std::endl
<< ' up to FORTYTHIRD order.' << std::endl;
}
#endif
AutoPtr<QBase> ap(new QGauss(_dim, _order));
return ap;
}
case QJACOBI_1_0:
{
#ifdef DEBUG
if (_order > TWENTYTHIRD)
{
std::cout << 'WARNING: Jacobi(1,0) quadrature implemented' << std::endl
<< ' up to TWENTYTHIRD order.' << std::endl;
}
if (_dim > 1)
{
std::cout << 'WARNING: Jacobi(1,0) quadrature implemented' << std::endl
<< ' in 1D only.' << std::endl;
}
#endif
AutoPtr<QBase> ap(new QJacobi(_dim, _order, 1, 0));
return ap;
}
case QJACOBI_2_0:
{
#ifdef DEBUG
if (_order > TWENTYTHIRD)
{
std::cout << 'WARNING: Jacobi(2,0) quadrature implemented' << std::endl
<< ' up to TWENTYTHIRD order.' << std::endl;
}
if (_dim > 1)
{
std::cout << 'WARNING: Jacobi(2,0) quadrature implemented' << std::endl
<< ' in 1D only.' << std::endl;
}
#endif
AutoPtr<QBase> ap(new QJacobi(_dim, _order, 2, 0));
return ap;
}
case QSIMPSON:
{
#ifdef DEBUG
if (_order > THIRD)
{
std::cout << 'WARNING: Simpson rule provides only' << std::endl
<< ' THIRD order!' << std::endl;
}
#endif
AutoPtr<QBase> ap(new QSimpson(_dim));
return ap;
}
case QTRAP:
{
#ifdef DEBUG
if (_order > FIRST)
{
std::cout << 'WARNING: Trapezoidal rule provides only' << std::endl
<< ' FIRST order!' << std::endl;
}
#endif
AutoPtr<QBase> ap(new QTrap(_dim));
return ap;
}
default:
{
std::cerr << 'ERROR: Bad qt=' << _qt << std::endl;
libmesh_error();
}
}
libmesh_error();
AutoPtr<QBase> ap(NULL);
return ap;
}
Definition at line 121 of file quadrature.h.
Referenced by InfFE< Dim, T_radial, T_map >::attach_quadrature_rule(), QConical::conical_product_pyramid(), QConical::conical_product_tet(), and QConical::conical_product_tri().
{ return _dim; }
Definition at line 103 of file quadrature.h.
{ return _type; }
Definition at line 45 of file reference_counter.C.
References ReferenceCounter::_counts, and Quality::name().
Referenced by ReferenceCounter::print_info().
{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
std::ostringstream out;
out << '
<< ' ----------------------------------------------------------------------------
<< '| Reference count information |
<< ' ---------------------------------------------------------------------------- ;
for (Counts::iterator it = _counts.begin();
it != _counts.end(); ++it)
{
const std::string name(it->first);
const unsigned int creations = it->second.first;
const unsigned int destructions = it->second.second;
out << '| ' << name << ' reference count information:
<< '| Creations: ' << creations << '
<< '| Destructions: ' << destructions << ';
}
out << ' ---------------------------------------------------------------------------- ;
return out.str();
#else
return '';
#endif
}
Definition at line 167 of file quadrature.h.
Referenced by InfFE< Dim, T_radial, T_map >::attach_quadrature_rule().
{ return static_cast<Order>(_order + _p_level); }
Definition at line 109 of file quadrature.h.
{ return _p_level; }
Definition at line 127 of file quadrature.h.
References _points.
Referenced by FE< Dim, T >::edge_reinit(), QClough::init_1D(), QMonomial::init_2D(), QGauss::init_2D(), QClough::init_2D(), QMonomial::init_3D(), QGauss::init_3D(), InfFE< Dim, T_radial, T_map >::init_face_shape_functions(), InfFE< Dim, T_radial, T_map >::reinit(), and REINIT_ERROR().
{ return _points; }
Definition at line 133 of file quadrature.h.
References _points.
{ return _points; }
Definition at line 138 of file quadrature.h.
References _weights.
Referenced by FE< Dim, T >::edge_reinit(), QClough::init_1D(), QMonomial::init_2D(), QGauss::init_2D(), QClough::init_2D(), QMonomial::init_3D(), QGauss::init_3D(), InfFE< Dim, T_radial, T_map >::init_face_shape_functions(), and REINIT_ERROR().
{ return _weights; }
Definition at line 143 of file quadrature.h.
References _weights.
{ return _weights; }
Definition at line 149 of file reference_counter.h.
References ReferenceCounter::_counts, Quality::name(), and Threads::spin_mtx.
Referenced by ReferenceCountedObject< Value >::ReferenceCountedObject().
{
Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
std::pair<unsigned int, unsigned int>& p = _counts[name];
p.first++;
}
Definition at line 167 of file reference_counter.h.
References ReferenceCounter::_counts, Quality::name(), and Threads::spin_mtx.
Referenced by ReferenceCountedObject< Value >::~ReferenceCountedObject().
{
Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
std::pair<unsigned int, unsigned int>& p = _counts[name];
p.second++;
}
Definition at line 26 of file quadrature.C.
References init_0D(), init_1D(), and init_2D().
Referenced by FE< Dim, T >::edge_reinit(), QClough::init_1D(), QTrap::init_2D(), QSimpson::init_2D(), QMonomial::init_2D(), QGrid::init_2D(), QGauss::init_2D(), QClough::init_2D(), QTrap::init_3D(), QSimpson::init_3D(), QMonomial::init_3D(), QGrid::init_3D(), QGauss::init_3D(), InfFE< Dim, T_radial, T_map >::init_face_shape_functions(), QGauss::QGauss(), QJacobi::QJacobi(), QSimpson::QSimpson(), QTrap::QTrap(), InfFE< Dim, T_radial, T_map >::reinit(), and REINIT_ERROR().
{
// check to see if we have already
// done the work for this quadrature rule
if (t == _type && p == _p_level)
return;
else
{
_type = t;
_p_level = p;
}
switch(_dim)
{
case 0:
this->init_0D(_type,_p_level);
return;
case 1:
this->init_1D(_type,_p_level);
return;
case 2:
this->init_2D(_type,_p_level);
return;
case 3:
this->init_3D(_type,_p_level);
return;
default:
libmesh_error();
}
}
Definition at line 70 of file quadrature.C.
References _points, and _weights.
Referenced by init().
{
_points.resize(1);
_weights.resize(1);
_points[0] = Point(0.);
_weights[0] = 1.0;
}
Implemented in QClough, QConical, QGauss, QGrundmann_Moller, QGrid, QJacobi, QMonomial, QSimpson, and QTrap.
Reimplemented in QClough, QConical, QGauss, QGrid, QMonomial, QSimpson, and QTrap.
Definition at line 234 of file quadrature.h.
Referenced by init().
{}
Definition at line 76 of file reference_counter.h.
References ReferenceCounter::_n_objects.
Referenced by System::read_serialized_blocked_dof_objects(), and System::write_serialized_blocked_dof_objects().
{ return _n_objects; }
Definition at line 115 of file quadrature.h.
References _points.
Referenced by FEBase::coarsened_dof_values(), QConical::conical_product_pyramid(), QConical::conical_product_tet(), QConical::conical_product_tri(), FEMSystem::eulerian_residual(), InfFE< Dim, T_radial, T_map >::init_face_shape_functions(), FEMSystem::mass_residual(), and print_info().
{ libmesh_assert (!_points.empty()); return _points.size(); }
Definition at line 350 of file quadrature.h.
References _points, _weights, n_points(), and qp().
Referenced by operator<<().
{
libmesh_assert(!_points.empty());
libmesh_assert(!_weights.empty());
os << 'N_Q_Points=' << this->n_points() << std::endl << std::endl;
for (unsigned int qp=0; qp<this->n_points(); qp++)
{
os << ' Point ' << qp << ':
<< ' '
<< _points[qp]
<< ' Weight:'
<< ' w=' << _weights[qp] << ' << std::endl;
}
}
Definition at line 83 of file reference_counter.C.
References ReferenceCounter::get_info().
{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
std::cout << ReferenceCounter::get_info();
#endif
}
Definition at line 148 of file quadrature.h.
References _points.
Referenced by QConical::conical_product_pyramid(), QConical::conical_product_tet(), QConical::conical_product_tri(), and print_info().
{ libmesh_assert (i < _points.size()); return _points[i]; }
Definition at line 81 of file quadrature.C.
References _points, and _weights.
Referenced by QConical::conical_product_tet(), and QConical::conical_product_tri().
{
// Make sure we are in 1D
libmesh_assert(_dim == 1);
// Make sure that we have sane ranges
libmesh_assert(new_range.second > new_range.first);
libmesh_assert(old_range.second > old_range.first);
// Make sure there are some points
libmesh_assert(_points.size() > 0);
// We're mapping from old_range -> new_range
for (unsigned int i=0; i<_points.size(); i++)
{
_points[i](0) =
(_points[i](0) - old_range.first) *
(new_range.second - new_range.first) /
(old_range.second - old_range.first) +
new_range.first;
}
// Compute the scale factor and scale the weights
const Real scfact = (new_range.second - new_range.first) /
(old_range.second - old_range.first);
for (unsigned int i=0; i<_points.size(); i++)
_weights[i] *= scfact;
}
Implemented in QClough, QConical, QGauss, QGrundmann_Moller, QGrid, QJacobi, QMonomial, QSimpson, and QTrap.
Referenced by InfFE< Dim, T_radial, T_map >::attach_quadrature_rule().
Definition at line 154 of file quadrature.h.
References _weights.
Referenced by QConical::conical_product_pyramid(), QConical::conical_product_tet(), QConical::conical_product_tri(), QGauss::init_3D(), QGauss::keast_rule(), QMonomial::kim_rule(), and QMonomial::stroud_rule().
{ libmesh_assert (i < _weights.size()); return _weights[i]; }
Definition at line 196 of file quadrature.C.
{
q.print_info(os);
return os;
}
Definition at line 110 of file reference_counter.h.
Referenced by ReferenceCounter::get_info(), ReferenceCounter::increment_constructor_count(), and ReferenceCounter::increment_destructor_count().
Definition at line 123 of file reference_counter.h.
Definition at line 118 of file reference_counter.h.
Referenced by ReferenceCounter::n_objects(), ReferenceCounter::ReferenceCounter(), and ReferenceCounter::~ReferenceCounter().
Definition at line 320 of file quadrature.h.
Referenced by QConical::conical_product_pyramid(), QConical::conical_product_tet(), QConical::conical_product_tri(), QGauss::dunavant_rule(), QGauss::dunavant_rule2(), get_points(), QGrundmann_Moller::gm_rule(), init_0D(), QTrap::init_1D(), QSimpson::init_1D(), QJacobi::init_1D(), QGrid::init_1D(), QGauss::init_1D(), QClough::init_1D(), QTrap::init_2D(), QSimpson::init_2D(), QMonomial::init_2D(), QGrid::init_2D(), QGauss::init_2D(), QClough::init_2D(), QTrap::init_3D(), QSimpson::init_3D(), QMonomial::init_3D(), QGrid::init_3D(), QGauss::init_3D(), QGauss::keast_rule(), QMonomial::kim_rule(), n_points(), print_info(), qp(), scale(), QMonomial::stroud_rule(), and QMonomial::wissmann_rule().
Definition at line 325 of file quadrature.h.
Referenced by QConical::conical_product_pyramid(), QConical::conical_product_tet(), QConical::conical_product_tri(), QGauss::dunavant_rule(), QGauss::dunavant_rule2(), get_weights(), QGrundmann_Moller::gm_rule(), init_0D(), QTrap::init_1D(), QSimpson::init_1D(), QJacobi::init_1D(), QGrid::init_1D(), QGauss::init_1D(), QClough::init_1D(), QTrap::init_2D(), QSimpson::init_2D(), QMonomial::init_2D(), QGrid::init_2D(), QGauss::init_2D(), QClough::init_2D(), QTrap::init_3D(), QSimpson::init_3D(), QMonomial::init_3D(), QGrid::init_3D(), QGauss::init_3D(), QGauss::keast_rule(), QMonomial::kim_rule(), print_info(), scale(), QMonomial::stroud_rule(), w(), and QMonomial::wissmann_rule().
Negative weights typically appear in Gaussian quadrature rules over three-dimensional elements. 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 203 of file quadrature.h.
Referenced by QMonomial::init_3D(), QGrundmann_Moller::init_3D(), and QGauss::init_3D().
Generated automatically by Doxygen for libMesh from the source code.