libMesh::QConical Class Reference

#include <quadrature_conical.h>

Inheritance diagram for libMesh::QConical:

Public Member Functions

 QConical (const unsigned int _dim, const Order _order=INVALID_ORDER)
 
 ~QConical ()
 
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, unsigned int=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)
 
void conical_product_tri (unsigned int p)
 
void conical_product_tet (unsigned int p)
 
void conical_product_pyramid (unsigned int p)
 

Detailed Description

This class implements the so-called conical product quadrature rules for Tri and Tet elements. These rules are generally non-optimal in the number of evaluation points, but have the nice property of having all positive weights and being well-defined to any order for which their underlying 1D Gauss and Jacobi quadrature rules are available.

The construction of these rules is given by e.g.

Stroud, A.H. "Approximate Calculation of Multiple Integrals.", 1972

Definition at line 43 of file quadrature_conical.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::QConical::QConical ( const unsigned int  _dim,
const Order  _order = INVALID_ORDER 
)

Constructor. Declares the order of the quadrature rule.

Definition at line 35 of file quadrature_conical.C.

36  : QBase(d,o)
37 {
38 }
libMesh::QConical::~QConical ( )

Destructor.

Definition at line 43 of file quadrature_conical.C.

44 {
45 }

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::QConical::conical_product_pyramid ( unsigned int  p)
private

Implementation of conical product rule for a Pyramid in 3D of order = _order+2*p.

Definition at line 180 of file quadrature_conical.C.

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

Referenced by init_3D().

181 {
182  // Be sure the underlying rule object was built with the same dimension as the
183  // rule we are about to construct.
184  libmesh_assert_equal_to (this->get_dim(), 3);
185 
186  QGauss gauss1D(1,static_cast<Order>(_order+2*p));
187  QJacobi jac1D(1,static_cast<Order>(_order+2*p),2,0);
188 
189  // These rules should have the same number of points
190  libmesh_assert_equal_to (gauss1D.n_points(), jac1D.n_points());
191 
192  // Save the number of points as a convenient variable
193  const unsigned int np = gauss1D.n_points();
194 
195  // Resize the points and weights vectors
196  _points.resize(np * np * np);
197  _weights.resize(np * np * np);
198 
199  // Compute the conical product
200  unsigned int q = 0;
201  for (unsigned int i=0; i<np; ++i)
202  for (unsigned int j=0; j<np; ++j)
203  for (unsigned int k=0; k<np; ++k, ++q)
204  {
205  const Real xi=gauss1D.qp(i)(0);
206  const Real yj=gauss1D.qp(j)(0);
207  const Real zk=jac1D.qp(k)(0);
208 
209  _points[q](0) = (1.-zk) * xi;
210  _points[q](1) = (1.-zk) * yj;
211  _points[q](2) = zk;
212  _weights[q] = gauss1D.w(i) * gauss1D.w(j) * jac1D.w(k);
213  }
214 
215 
216 }
void libMesh::QConical::conical_product_tet ( unsigned int  p)
private

Implementation of conical product rule for a Tet in 3D of order = _order+2*p.

Definition at line 103 of file quadrature_conical.C.

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

Referenced by init_3D().

104 {
105  // Be sure the underlying rule object was built with the same dimension as the
106  // rule we are about to construct.
107  libmesh_assert_equal_to (this->get_dim(), 3);
108 
109  QGauss gauss1D(1,static_cast<Order>(_order+2*p));
110  QJacobi jacA1D(1,static_cast<Order>(_order+2*p),1,0);
111  QJacobi jacB1D(1,static_cast<Order>(_order+2*p),2,0);
112 
113  // The Gauss rule needs to be scaled to [0,1]
114  std::pair<Real, Real> old_range(-1.0L, 1.0L);
115  std::pair<Real, Real> new_range( 0.0L, 1.0L);
116  gauss1D.scale(old_range,
117  new_range);
118 
119  // Now construct the points and weights for the conical product rule.
120 
121  // All rules should have the same number of points
122  libmesh_assert_equal_to (gauss1D.n_points(), jacA1D.n_points());
123  libmesh_assert_equal_to (jacA1D.n_points(), jacB1D.n_points());
124 
125  // Save the number of points as a convenient variable
126  const unsigned int np = gauss1D.n_points();
127 
128  // All rules should be between x=0 and x=1
129  libmesh_assert_greater_equal (gauss1D.qp(0)(0), 0.0);
130  libmesh_assert_less_equal (gauss1D.qp(np-1)(0), 1.0);
131  libmesh_assert_greater_equal (jacA1D.qp(0)(0), 0.0);
132  libmesh_assert_less_equal (jacA1D.qp(np-1)(0), 1.0);
133  libmesh_assert_greater_equal (jacB1D.qp(0)(0), 0.0);
134  libmesh_assert_less_equal (jacB1D.qp(np-1)(0), 1.0);
135 
136  // Resize the points and weights vectors
137  _points.resize(np * np * np);
138  _weights.resize(np * np * np);
139 
140  // Compute the conical product
141  unsigned int gp = 0;
142  for (unsigned int i=0; i<np; i++)
143  for (unsigned int j=0; j<np; j++)
144  for (unsigned int k=0; k<np; k++)
145  {
146  _points[gp](0) = jacB1D.qp(k)(0); //t[k];
147  _points[gp](1) = jacA1D.qp(j)(0) * (1.-jacB1D.qp(k)(0)); //s[j]*(1.-t[k]);
148  _points[gp](2) = gauss1D.qp(i)(0) * (1.-jacA1D.qp(j)(0)) * (1.-jacB1D.qp(k)(0)); //r[i]*(1.-s[j])*(1.-t[k]);
149  _weights[gp] = gauss1D.w(i) * jacA1D.w(j) * jacB1D.w(k); //A[i]*B[j]*C[k];
150  gp++;
151  }
152 }
void libMesh::QConical::conical_product_tri ( unsigned int  p)
private

Implementation of conical product rule for a Tri in 2D of order = _order+2*p.

Definition at line 52 of file quadrature_conical.C.

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

Referenced by init_2D().

53 {
54  // Be sure the underlying rule object was built with the same dimension as the
55  // rule we are about to construct.
56  libmesh_assert_equal_to (this->get_dim(), 2);
57 
58  QGauss gauss1D(1,static_cast<Order>(_order+2*p));
59  QJacobi jac1D(1,static_cast<Order>(_order+2*p),1,0);
60 
61  // The Gauss rule needs to be scaled to [0,1]
62  std::pair<Real, Real> old_range(-1.0L, 1.0L);
63  std::pair<Real, Real> new_range( 0.0L, 1.0L);
64  gauss1D.scale(old_range,
65  new_range);
66 
67  // Now construct the points and weights for the conical product rule.
68 
69  // Both rules should have the same number of points.
70  libmesh_assert_equal_to (gauss1D.n_points(), jac1D.n_points());
71 
72  // Save the number of points as a convenient variable
73  const unsigned int np = gauss1D.n_points();
74 
75  // Both rules should be between x=0 and x=1
76  libmesh_assert_greater_equal (gauss1D.qp(0)(0), 0.0);
77  libmesh_assert_less_equal (gauss1D.qp(np-1)(0), 1.0);
78  libmesh_assert_greater_equal (jac1D.qp(0)(0), 0.0);
79  libmesh_assert_less_equal (jac1D.qp(np-1)(0), 1.0);
80 
81  // Resize the points and weights vectors
82  _points.resize(np * np);
83  _weights.resize(np * np);
84 
85  // Compute the conical product
86  unsigned int gp = 0;
87  for (unsigned int i=0; i<np; i++)
88  for (unsigned int j=0; j<np; j++)
89  {
90  _points[gp](0) = jac1D.qp(j)(0); //s[j];
91  _points[gp](1) = gauss1D.qp(i)(0) * (1.-jac1D.qp(j)(0)); //r[i]*(1.-s[j]);
92  _weights[gp] = gauss1D.w(i) * jac1D.w(j); //A[i]*B[j];
93  gp++;
94  }
95 }
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
Returns
the dimension of the quadrature rule.

Definition at line 123 of file quadrature.h.

Referenced by libMesh::InfFE< friend_Dim, friend_T_radial, friend_T_map >::attach_quadrature_rule(), conical_product_pyramid(), conical_product_tet(), and conical_product_tri().

123 { return _dim; }
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(), libMesh::QClough::init_2D(), libMesh::QGrid::init_2D(), libMesh::QGauss::init_2D(), libMesh::QSimpson::init_2D(), libMesh::QMonomial::init_2D(), libMesh::QTrap::init_3D(), libMesh::QGrid::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::QConical::init_1D ( const ElemType  type,
unsigned  p_level = 0 
)
inlineprivatevirtual

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 65 of file quadrature_conical.h.

67  {
68  // See about making this non-pure virtual in the base class
69  libmesh_error();
70  }
void libMesh::QConical::init_2D ( const ElemType  _type = INVALID_ELEM,
unsigned int  p_level = 0 
)
privatevirtual

The conical product rules are defined in 2D only for Tris.

Reimplemented from libMesh::QBase.

Definition at line 27 of file quadrature_conical_2D.C.

References conical_product_tri(), libMesh::err, libMeshEnums::TRI3, and libMeshEnums::TRI6.

29 {
30  switch (type_in)
31  {
32  case TRI3:
33  case TRI6:
34  {
35  this->conical_product_tri(p);
36  return;
37 
38  } // end case TRI3, TRI6
39 
40 
41 
42  //---------------------------------------------
43  // Unsupported element type
44  default:
45  {
46  libMesh::err << "ERROR: Unsupported element type: " << type_in << std::endl;
47  libmesh_error();
48  }
49  } // end switch (type_in)
50 
51  // We must have returned or errored-out by this point. If not,
52  // throw an error now.
53  libmesh_error();
54  return;
55 }
void libMesh::QConical::init_3D ( const ElemType  _type = INVALID_ELEM,
unsigned int  p_level = 0 
)
private

The conical product rules are defined in 3D only for Tets.

Definition at line 27 of file quadrature_conical_3D.C.

References conical_product_pyramid(), conical_product_tet(), libMesh::err, libMeshEnums::PYRAMID14, libMeshEnums::PYRAMID5, libMeshEnums::TET10, and libMeshEnums::TET4.

29 {
30  switch (type_in)
31  {
32  case TET4:
33  case TET10:
34  {
35  this->conical_product_tet(p);
36  return;
37 
38  } // end case TET4, TET10
39 
40  case PYRAMID5:
41  case PYRAMID14:
42  {
43  this->conical_product_pyramid(p);
44  return;
45 
46  } // end case PYRAMID5
47 
48 
49  //---------------------------------------------
50  // Unsupported element type
51  default:
52  {
53  libMesh::err << "ERROR: Unsupported element type: " << type_in << std::endl;
54  libmesh_error();
55  }
56  } // end switch (type_in)
57 
58  // We must have returned or errored-out by this point. If not,
59  // throw an error now.
60  libmesh_error();
61  return;
62 }
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 conical_product_pyramid(), conical_product_tet(), 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 conical_product_pyramid(), conical_product_tet(), and 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 conical_product_tet(), and 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::QConical::type ( ) const
inlinevirtual
Returns
the QuadratureType for this class

Implements libMesh::QBase.

Definition at line 61 of file quadrature_conical.h.

References libMeshEnums::QCONICAL.

61 { return QCONICAL; }
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 conical_product_pyramid(), conical_product_tet(), and 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