libMesh::QGrid Class Reference

#include <quadrature_grid.h>

Inheritance diagram for libMesh::QGrid:

Public Member Functions

 QGrid (const unsigned int _dim, const Order _order=INVALID_ORDER)
 
 ~QGrid ()
 
QuadratureType type () const
 
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=libMesh::out) const
 
void scale (std::pair< Real, Real > old_range, std::pair< Real, Real > new_range)
 
virtual bool shapes_need_reinit ()
 

Static Public Member Functions

static AutoPtr< QBasebuild (const std::string &name, const unsigned int _dim, const Order _order=INVALID_ORDER)
 
static AutoPtr< QBasebuild (const QuadratureType _qt, const unsigned int _dim, const Order _order=INVALID_ORDER)
 
static void print_info (std::ostream &out=libMesh::out)
 
static std::string get_info ()
 
static unsigned int n_objects ()
 
static void enable_print_counter_info ()
 
static void disable_print_counter_info ()
 

Public Attributes

bool allow_rules_with_negative_weights
 

Protected Types

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

Protected Member Functions

virtual void init_0D (const ElemType type=INVALID_ELEM, unsigned int p_level=0)
 
void increment_constructor_count (const std::string &name)
 
void increment_destructor_count (const std::string &name)
 

Protected Attributes

libMesh::err<< "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{libMesh::err<< "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 Protected Attributes

static Counts _counts
 
static Threads::atomic
< unsigned int > 
_n_objects
 
static Threads::spin_mutex _mutex
 
static bool _enable_print_counter = true
 

Private Member Functions

void init_1D (const ElemType _type=INVALID_ELEM, unsigned int p_level=0)
 
void init_2D (const ElemType _type=INVALID_ELEM, unsigned int p_level=0)
 
void init_3D (const ElemType _type=INVALID_ELEM, unsigned int p_level=0)
 

Detailed Description

This class creates quadrature points on a uniform grid, Order points on a side.

Definition at line 42 of file quadrature_grid.h.

Member Typedef Documentation

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 113 of file reference_counter.h.

Constructor & Destructor Documentation

libMesh::QGrid::QGrid ( const unsigned int  _dim,
const Order  _order = INVALID_ORDER 
)
inline

Constructor. Declares the order of the quadrature rule.

Definition at line 79 of file quadrature_grid.h.

80  : QBase(d,o)
81 {
82 }
libMesh::QGrid::~QGrid ( )
inline

Destructor.

Definition at line 88 of file quadrature_grid.h.

89 {
90 }

Member Function Documentation

AutoPtr< QBase > libMesh::QBase::build ( const std::string &  name,
const unsigned int  _dim,
const Order  _order = INVALID_ORDER 
)
staticinherited

Builds a specific quadrature rule, identified through the name string. An AutoPtr<QBase> is returned to prevent a memory leak. This way the user need not remember to delete the object. Enables run-time decision of the quadrature rule. The input parameter name must be mappable through the Utility::string_to_enum<>() function.

Definition at line 37 of file quadrature_build.C.

Referenced by libMesh::InfFE< friend_Dim, friend_T_radial, friend_T_map >::attach_quadrature_rule().

40 {
41  return QBase::build (Utility::string_to_enum<QuadratureType> (type),
42  _dim,
43  _order);
44 }
AutoPtr< QBase > libMesh::QBase::build ( const QuadratureType  _qt,
const unsigned int  _dim,
const Order  _order = INVALID_ORDER 
)
staticinherited

Builds a specific quadrature rule, identified through the QuadratureType. An AutoPtr<QBase> is returned to prevent a memory leak. This way the user need not remember to delete the object. Enables run-time decision of the quadrature rule.

Definition at line 48 of file quadrature_build.C.

References libMesh::err, libMeshEnums::FIRST, libMeshEnums::FORTYTHIRD, libMesh::out, libMeshEnums::QCLOUGH, libMeshEnums::QGAUSS, libMeshEnums::QJACOBI_1_0, libMeshEnums::QJACOBI_2_0, libMeshEnums::QSIMPSON, libMeshEnums::QTRAP, libMeshEnums::THIRD, and libMeshEnums::TWENTYTHIRD.

51 {
52  switch (_qt)
53  {
54 
55  case QCLOUGH:
56  {
57 #ifdef DEBUG
58  if (_order > TWENTYTHIRD)
59  {
60  libMesh::out << "WARNING: Clough quadrature implemented" << std::endl
61  << " up to TWENTYTHIRD order." << std::endl;
62  }
63 #endif
64 
65  AutoPtr<QBase> ap(new QClough(_dim, _order));
66  return ap;
67  }
68 
69  case QGAUSS:
70  {
71 
72 #ifdef DEBUG
73  if (_order > FORTYTHIRD)
74  {
75  libMesh::out << "WARNING: Gauss quadrature implemented" << std::endl
76  << " up to FORTYTHIRD order." << std::endl;
77  }
78 #endif
79 
80  AutoPtr<QBase> ap(new QGauss(_dim, _order));
81  return ap;
82  }
83 
84  case QJACOBI_1_0:
85  {
86 
87 #ifdef DEBUG
88  if (_order > TWENTYTHIRD)
89  {
90  libMesh::out << "WARNING: Jacobi(1,0) quadrature implemented" << std::endl
91  << " up to TWENTYTHIRD order." << std::endl;
92  }
93 
94  if (_dim > 1)
95  {
96  libMesh::out << "WARNING: Jacobi(1,0) quadrature implemented" << std::endl
97  << " in 1D only." << std::endl;
98  }
99 #endif
100 
101  AutoPtr<QBase> ap(new QJacobi(_dim, _order, 1, 0));
102  return ap;
103  }
104 
105  case QJACOBI_2_0:
106  {
107 
108 #ifdef DEBUG
109  if (_order > TWENTYTHIRD)
110  {
111  libMesh::out << "WARNING: Jacobi(2,0) quadrature implemented" << std::endl
112  << " up to TWENTYTHIRD order." << std::endl;
113  }
114 
115  if (_dim > 1)
116  {
117  libMesh::out << "WARNING: Jacobi(2,0) quadrature implemented" << std::endl
118  << " in 1D only." << std::endl;
119  }
120 #endif
121 
122  AutoPtr<QBase> ap(new QJacobi(_dim, _order, 2, 0));
123  return ap;
124  }
125 
126  case QSIMPSON:
127  {
128 
129 #ifdef DEBUG
130  if (_order > THIRD)
131  {
132  libMesh::out << "WARNING: Simpson rule provides only" << std::endl
133  << " THIRD order!" << std::endl;
134  }
135 #endif
136 
137  AutoPtr<QBase> ap(new QSimpson(_dim));
138  return ap;
139  }
140 
141  case QTRAP:
142  {
143 
144 #ifdef DEBUG
145  if (_order > FIRST)
146  {
147  libMesh::out << "WARNING: Trapezoidal rule provides only" << std::endl
148  << " FIRST order!" << std::endl;
149  }
150 #endif
151 
152  AutoPtr<QBase> ap(new QTrap(_dim));
153  return ap;
154  }
155 
156 
157  default:
158  {
159  libMesh::err << "ERROR: Bad qt=" << _qt << std::endl;
160  libmesh_error();
161  }
162  }
163 
164 
165  libmesh_error();
166  AutoPtr<QBase> ap(NULL);
167  return ap;
168 }
void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 106 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

107 {
108  _enable_print_counter = false;
109  return;
110 }
void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

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

Definition at line 100 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

101 {
102  _enable_print_counter = true;
103  return;
104 }
unsigned int libMesh::QBase::get_dim ( ) const
inlineinherited
ElemType libMesh::QBase::get_elem_type ( ) const
inlineinherited
Returns
the current element type we're set up for

Definition at line 104 of file quadrature.h.

105  { return _type; }
std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().

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

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 (Counts::iterator it = _counts.begin();
59  it != _counts.end(); ++it)
60  {
61  const std::string name(it->first);
62  const unsigned int creations = it->second.first;
63  const unsigned int destructions = it->second.second;
64 
65  oss << "| " << name << " reference count information:\n"
66  << "| Creations: " << creations << '\n'
67  << "| Destructions: " << destructions << '\n';
68  }
69 
70  oss << " ---------------------------------------------------------------------------- \n";
71 
72  return oss.str();
73 
74 #else
75 
76  return "";
77 
78 #endif
79 }
Order libMesh::QBase::get_order ( ) const
inlineinherited
Returns
the order of the quadrature rule.

Definition at line 169 of file quadrature.h.

Referenced by libMesh::InfFE< friend_Dim, friend_T_radial, friend_T_map >::attach_quadrature_rule().

169 { return static_cast<Order>(_order + _p_level); }
unsigned int libMesh::QBase::get_p_level ( ) const
inlineinherited
Returns
the current p refinement level we're initialized with

Definition at line 110 of file quadrature.h.

111  { return _p_level; }
const std::vector<Point>& libMesh::QBase::get_points ( ) const
inlineinherited
Returns
a std::vector containing the quadrature point locations on a reference object.

Definition at line 129 of file quadrature.h.

References libMesh::QBase::_points.

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

129 { return _points; }
std::vector<Point>& libMesh::QBase::get_points ( )
inlineinherited
Returns
a std::vector containing the quadrature point locations on a reference object as a writeable reference.

Definition at line 135 of file quadrature.h.

References libMesh::QBase::_points.

135 { return _points; }
const std::vector<Real>& libMesh::QBase::get_weights ( ) const
inlineinherited
Returns
a std::vector containing the quadrature weights.

Definition at line 140 of file quadrature.h.

References libMesh::QBase::_weights.

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

140 { return _weights; }
std::vector<Real>& libMesh::QBase::get_weights ( )
inlineinherited
Returns
a std::vector containing the quadrature weights.

Definition at line 145 of file quadrature.h.

References libMesh::QBase::_weights.

145 { return _weights; }
void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
inlineprotectedinherited

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

Definition at line 163 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

164 {
165  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
166  std::pair<unsigned int, unsigned int>& p = _counts[name];
167 
168  p.first++;
169 }
void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
inlineprotectedinherited

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

Definition at line 176 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

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

177 {
178  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
179  std::pair<unsigned int, unsigned int>& p = _counts[name];
180 
181  p.second++;
182 }
void libMesh::QBase::init ( const ElemType  type = INVALID_ELEM,
unsigned int  p_level = 0 
)
inherited

Initializes the data structures to contain a quadrature rule for an object of type type.

Definition at line 27 of file quadrature.C.

References libMesh::QBase::init_0D(), libMesh::QBase::init_1D(), and libMesh::QBase::init_2D().

Referenced by libMesh::QClough::init_1D(), libMesh::QTrap::init_2D(), init_2D(), libMesh::QClough::init_2D(), libMesh::QGauss::init_2D(), libMesh::QSimpson::init_2D(), libMesh::QMonomial::init_2D(), libMesh::QTrap::init_3D(), init_3D(), libMesh::QGauss::init_3D(), libMesh::QSimpson::init_3D(), libMesh::QMonomial::init_3D(), libMesh::QGauss::QGauss(), libMesh::QJacobi::QJacobi(), libMesh::QSimpson::QSimpson(), and libMesh::QTrap::QTrap().

29 {
30  // check to see if we have already
31  // done the work for this quadrature rule
32  if (t == _type && p == _p_level)
33  return;
34  else
35  {
36  _type = t;
37  _p_level = p;
38  }
39 
40 
41 
42  switch(_dim)
43  {
44  case 0:
45  this->init_0D(_type,_p_level);
46 
47  return;
48 
49  case 1:
50  this->init_1D(_type,_p_level);
51 
52  return;
53 
54  case 2:
55  this->init_2D(_type,_p_level);
56 
57  return;
58 
59  case 3:
60  this->init_3D(_type,_p_level);
61 
62  return;
63 
64  default:
65  libmesh_error();
66  }
67 }
void libMesh::QBase::init_0D ( const ElemType  type = INVALID_ELEM,
unsigned int  p_level = 0 
)
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 71 of file quadrature.C.

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

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

73 {
74  _points.resize(1);
75  _weights.resize(1);
76  _points[0] = Point(0.);
77  _weights[0] = 1.0;
78 }
void libMesh::QGrid::init_1D ( const ElemType  type = INVALID_ELEM,
unsigned int  p_level = 0 
)
privatevirtual

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 30 of file quadrature_grid_1D.C.

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

32 {
33  //----------------------------------------------------------------------
34  // 1D quadrature rules
35 
36  // We ignore p - the grid rule is just for experimentation
37 
38  _points.resize(_order + 1);
39  _weights.resize(_order + 1);
40  for (int i = 0; i != _order + 1; ++i)
41  {
42  _points[i](0) = 2.0 * (double)i / (double)_order - 1.0;
43  _weights[i] = 2.0 / (double)(_order + 1);
44  }
45  return;
46 }
void libMesh::QGrid::init_2D ( const ElemType  = INVALID_ELEM,
unsigned int  = 0 
)
privatevirtual

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 redefined, gives an error (when DEBUG defined) when called.

Reimplemented from libMesh::QBase.

Definition at line 27 of file quadrature_grid_2D.C.

References libMesh::QBase::_points, libMesh::QBase::_weights, libMeshEnums::EDGE2, libMesh::err, libMesh::QBase::init(), libMeshEnums::QUAD4, libMeshEnums::QUAD8, libMeshEnums::QUAD9, libMeshEnums::TRI3, and libMeshEnums::TRI6.

29 {
30 #if LIBMESH_DIM > 1
31 
32  //-----------------------------------------------------------------------
33  // 2D quadrature rules
34 
35  // We ignore p - the grid rule is just for experimentation
36 
37  switch (type_in)
38  {
39 
40 
41  //---------------------------------------------
42  // Quadrilateral quadrature rules
43  case QUAD4:
44  case QUAD8:
45  case QUAD9:
46  {
47  // We compute the 2D quadrature rule as a tensor
48  // product of the 1D quadrature rule.
49  QGrid q1D(1,_order);
50  q1D.init(EDGE2);
51  tensor_product_quad( q1D );
52  return;
53  }
54 
55 
56  //---------------------------------------------
57  // Triangle quadrature rules
58  case TRI3:
59  case TRI6:
60  {
61  _points.resize((_order + 1)*(_order + 2)/2);
62  _weights.resize((_order + 1)*(_order + 2)/2);
63 
64  unsigned int pt = 0;
65  for (int i = 0; i != _order + 1; ++i)
66  {
67  for (int j = 0; j != _order + 1 - i; ++j)
68  {
69  _points[pt](0) = (double)i / (double)_order;
70  _points[pt](1) = (double)j / (double)_order;
71  _weights[pt] = 1.0 / (double)(_order+1) /
72  (double)(_order+2);
73  pt++;
74  }
75  }
76  return;
77  }
78 
79  //---------------------------------------------
80  // Unsupported type
81  default:
82  {
83  libMesh::err << "Element type not supported!:" << type_in << std::endl;
84  libmesh_error();
85  }
86  }
87 
88  libmesh_error();
89 
90  return;
91 
92 #endif
93 }
void libMesh::QGrid::init_3D ( const ElemType  _type = INVALID_ELEM,
unsigned int  p_level = 0 
)
private

Definition at line 27 of file quadrature_grid_3D.C.

References libMesh::QBase::_points, libMesh::QBase::_weights, libMeshEnums::EDGE2, libMesh::err, libMeshEnums::HEX20, libMeshEnums::HEX27, libMeshEnums::HEX8, libMesh::QBase::init(), libMeshEnums::PRISM15, libMeshEnums::PRISM18, libMeshEnums::PRISM6, libMeshEnums::PYRAMID14, libMeshEnums::PYRAMID5, libMeshEnums::TET10, libMeshEnums::TET4, and libMeshEnums::TRI3.

29 {
30 #if LIBMESH_DIM == 3
31 
32  //-----------------------------------------------------------------------
33  // 3D quadrature rules
34 
35  // We ignore p - the grid rule is just for experimentation
36  switch (type_in)
37  {
38  //---------------------------------------------
39  // Hex quadrature rules
40  case HEX8:
41  case HEX20:
42  case HEX27:
43  {
44  // We compute the 3D quadrature rule as a tensor
45  // product of the 1D quadrature rule.
46  QGrid q1D(1,_order);
47  q1D.init(EDGE2);
48 
49  tensor_product_hex( q1D );
50 
51  return;
52  }
53 
54 
55 
56  //---------------------------------------------
57  // Tetrahedral quadrature rules
58  case TET4:
59  case TET10:
60  {
61  _points.resize((_order+1)*(_order+2)*(_order+3)/6);
62  _weights.resize((_order+1)*(_order+2)*(_order+3)/6);
63 
64  unsigned int pt = 0;
65  for (int i = 0; i != _order + 1; ++i)
66  {
67  for (int j = 0; j != _order + 1 - i; ++j)
68  {
69  for (int k = 0; k != _order + 1 - i - j; ++k)
70  {
71  _points[pt](0) = (double)i / (double)_order;
72  _points[pt](1) = (double)j / (double)_order;
73  _points[pt](2) = (double)k / (double)_order;
74  _weights[pt] = 1.0 / (double)(_order+1) /
75  (double)(_order+2) / (double)(_order+3);
76  pt++;
77  }
78  }
79  }
80  return;
81  }
82 
83 
84  // Prism quadrature rules
85  case PRISM6:
86  case PRISM15:
87  case PRISM18:
88  {
89  // We compute the 3D quadrature rule as a tensor
90  // product of the 1D quadrature rule and a 2D
91  // triangle quadrature rule
92 
93  QGrid q1D(1,_order);
94  QGrid q2D(2,_order);
95 
96  // Initialize
97  q1D.init(EDGE2);
98  q2D.init(TRI3);
99 
100  tensor_product_prism(q1D, q2D);
101 
102  return;
103  }
104 
105 
106 
107  //---------------------------------------------
108  // Pyramid
109  case PYRAMID5:
110  case PYRAMID14:
111  {
112  _points.resize((_order+1)*(_order+2)*(_order+3)/6);
113  _weights.resize((_order+1)*(_order+2)*(_order+3)/6);
114 
115  unsigned int pt = 0;
116  for (int k = 0; k != _order + 1; ++k)
117  {
118  for (int i = 0; i != _order + 1 - k; ++i)
119  {
120  for (int j = 0; j != _order + 1 - k; ++j)
121  {
122  _points[pt](0) = 2.0 * (double)i / (double)_order
123  - 1.0 + (double)k / (double)_order;
124  _points[pt](1) = 2.0 * (double)j / (double)_order
125  - 1.0 + (double)k / (double)_order;
126  _points[pt](2) = (double)k / (double)_order;
127  _weights[pt] = 1.0 / (double)(_order+1) /
128  (double)(_order+2) / (double)(_order+3);
129  pt++;
130  }
131  }
132  }
133  return;
134  }
135 
136 
137 
138  //---------------------------------------------
139  // Unsupported type
140  default:
141  {
142  libMesh::err << "ERROR: Unsupported type: " << type_in << std::endl;
143  libmesh_error();
144  }
145  }
146 
147  libmesh_error();
148 
149  return;
150 
151 #endif
152 }
static unsigned int libMesh::ReferenceCounter::n_objects ( )
inlinestaticinherited

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

Definition at line 79 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

80  { return _n_objects; }
unsigned int libMesh::QBase::n_points ( ) const
inlineinherited
Returns
the number of points associated with the quadrature rule.

Definition at line 116 of file quadrature.h.

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

Referenced by libMesh::QConical::conical_product_pyramid(), libMesh::QConical::conical_product_tet(), libMesh::QConical::conical_product_tri(), libMesh::ProjectFEMSolution::operator()(), and libMesh::QBase::print_info().

117  { libmesh_assert (!_points.empty());
118  return libmesh_cast_int<unsigned int>(_points.size()); }
void libMesh::ReferenceCounter::print_info ( std::ostream &  out = libMesh::out)
staticinherited

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

Definition at line 88 of file reference_counter.C.

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

89 {
91 }
void libMesh::QBase::print_info ( std::ostream &  os = libMesh::out) const
inlineinherited

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

Definition at line 362 of file quadrature.h.

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

Referenced by libMesh::operator<<().

363 {
364  libmesh_assert(!_points.empty());
365  libmesh_assert(!_weights.empty());
366 
367  os << "N_Q_Points=" << this->n_points() << std::endl << std::endl;
368  for (unsigned int qpoint=0; qpoint<this->n_points(); qpoint++)
369  {
370  os << " Point " << qpoint << ":\n"
371  << " "
372  << _points[qpoint]
373  << " Weight:\n "
374  << " w=" << _weights[qpoint] << "\n" << std::endl;
375  }
376 }
Point libMesh::QBase::qp ( const unsigned int  i) const
inlineinherited
Returns
the $ i^{th} $ quadrature point on the reference object.

Definition at line 150 of file quadrature.h.

References libMesh::QBase::_points.

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

151  { libmesh_assert_less (i, _points.size()); return _points[i]; }
void libMesh::QBase::scale ( std::pair< Real, Real old_range,
std::pair< Real, Real new_range 
)
inherited

Maps the points of a 1D interval quadrature rule (typically [-1,1]) to any other 1D interval (typically [0,1]) and scales the weights accordingly. The quadrature rule will be mapped from the entries of old_range to the entries of new_range.

Definition at line 82 of file quadrature.C.

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

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

84 {
85  // Make sure we are in 1D
86  libmesh_assert_equal_to (_dim, 1);
87 
88  // Make sure that we have sane ranges
89  libmesh_assert_greater (new_range.second, new_range.first);
90  libmesh_assert_greater (old_range.second, old_range.first);
91 
92  // Make sure there are some points
93  libmesh_assert_greater (_points.size(), 0);
94 
95  // We're mapping from old_range -> new_range
96  for (unsigned int i=0; i<_points.size(); i++)
97  {
98  _points[i](0) =
99  (_points[i](0) - old_range.first) *
100  (new_range.second - new_range.first) /
101  (old_range.second - old_range.first) +
102  new_range.first;
103  }
104 
105  // Compute the scale factor and scale the weights
106  const Real scfact = (new_range.second - new_range.first) /
107  (old_range.second - old_range.first);
108 
109  for (unsigned int i=0; i<_points.size(); i++)
110  _weights[i] *= scfact;
111 }
virtual bool libMesh::QBase::shapes_need_reinit ( )
inlinevirtualinherited

Returns true if the shape functions need to be recalculated.

This can happen if the number of points or their positions change.

By default this will return false.

Definition at line 198 of file quadrature.h.

198 { return false; }
QuadratureType libMesh::QGrid::type ( ) const
inlinevirtual
Returns
QGRID

Implements libMesh::QBase.

Definition at line 60 of file quadrature_grid.h.

References libMeshEnums::QGRID.

60 { return QGRID; }
Real libMesh::QBase::w ( const unsigned int  i) const
inlineinherited
Returns
the $ i^{th} $ quadrature weight.

Definition at line 156 of file quadrature.h.

References libMesh::QBase::_weights.

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

157  { libmesh_assert_less (i, _weights.size()); return _weights[i]; }

Member Data Documentation

ReferenceCounter::Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited
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 137 of file reference_counter.h.

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

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

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 131 of file reference_counter.h.

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

The number of objects. Print the reference count information when the number returns to 0.

Definition at line 126 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().

libMesh::err<< "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 { libMesh::err << "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> libMesh::QBase::_points
protectedinherited
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 ONLY use (potentially) safer but more expensive rules with all positive weights.

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 215 of file quadrature.h.

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


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

Site Created By: libMesh Developers
Last modified: February 07 2014 16:58:01 UTC

Hosted By:
SourceForge.net Logo