www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
MaxQpsThread Class Reference

This class determines the maximum number of Quadrature Points and Shape Functions used for a given simulation based on the variable discretizations, and quadrature rules used for all variables in the system. More...

#include <MaxQpsThread.h>

Public Member Functions

 MaxQpsThread (FEProblemBase &fe_problem, QuadratureType type, Order order, Order face_order)
 
 MaxQpsThread (MaxQpsThread &x, Threads::split split)
 
void operator() (const ConstElemRange &range)
 
void join (const MaxQpsThread &y)
 
unsigned int max () const
 
unsigned int max_shape_funcs () const
 

Protected Attributes

FEProblemBase_fe_problem
 
QuadratureType _qtype
 
Order _order
 
Order _face_order
 
THREAD_ID _tid
 
unsigned int _max
 Maximum number of qps encountered. More...
 
unsigned int _max_shape_funcs
 Maximum number of shape functions encountered. More...
 

Detailed Description

This class determines the maximum number of Quadrature Points and Shape Functions used for a given simulation based on the variable discretizations, and quadrature rules used for all variables in the system.

Definition at line 33 of file MaxQpsThread.h.

Constructor & Destructor Documentation

LIBMESH_DEFINE_HASH_POINTERS MaxQpsThread::MaxQpsThread ( FEProblemBase fe_problem,
QuadratureType  type,
Order  order,
Order  face_order 
)

Definition at line 24 of file MaxQpsThread.C.

28  : _fe_problem(fe_problem),
29  _qtype(qtype),
30  _order(order),
31  _face_order(face_order),
32  _max(0),
34 {
35 }
unsigned int _max
Maximum number of qps encountered.
Definition: MaxQpsThread.h:59
unsigned int _max_shape_funcs
Maximum number of shape functions encountered.
Definition: MaxQpsThread.h:62
Order _face_order
Definition: MaxQpsThread.h:54
FEProblemBase & _fe_problem
Definition: MaxQpsThread.h:50
QuadratureType _qtype
Definition: MaxQpsThread.h:52
MaxQpsThread::MaxQpsThread ( MaxQpsThread x,
Threads::split  split 
)

Definition at line 38 of file MaxQpsThread.C.

40  _qtype(x._qtype),
41  _order(x._order),
43  _max(x._max),
45 {
46 }
unsigned int _max
Maximum number of qps encountered.
Definition: MaxQpsThread.h:59
unsigned int _max_shape_funcs
Maximum number of shape functions encountered.
Definition: MaxQpsThread.h:62
Order _face_order
Definition: MaxQpsThread.h:54
FEProblemBase & _fe_problem
Definition: MaxQpsThread.h:50
QuadratureType _qtype
Definition: MaxQpsThread.h:52

Member Function Documentation

void MaxQpsThread::join ( const MaxQpsThread y)

Definition at line 96 of file MaxQpsThread.C.

97 {
98  if (y._max > _max)
99  _max = y._max;
100 
103 }
unsigned int _max
Maximum number of qps encountered.
Definition: MaxQpsThread.h:59
unsigned int _max_shape_funcs
Maximum number of shape functions encountered.
Definition: MaxQpsThread.h:62
unsigned int MaxQpsThread::max ( ) const
inline

Definition at line 45 of file MaxQpsThread.h.

Referenced by FEProblemBase::createQRules().

45 { return _max; }
unsigned int _max
Maximum number of qps encountered.
Definition: MaxQpsThread.h:59
unsigned int MaxQpsThread::max_shape_funcs ( ) const
inline

Definition at line 47 of file MaxQpsThread.h.

Referenced by FEProblemBase::createQRules().

47 { return _max_shape_funcs; }
unsigned int _max_shape_funcs
Maximum number of shape functions encountered.
Definition: MaxQpsThread.h:62
void MaxQpsThread::operator() ( const ConstElemRange &  range)

Definition at line 49 of file MaxQpsThread.C.

50 {
51  ParallelUniqueId puid;
52  _tid = puid.id;
53 
54  // For short circuiting reinit
55  std::set<ElemType> seen_it;
56  for (const auto & elem : range)
57  {
58  // Only reinit if the element type has not previously been seen
59  if (seen_it.insert(elem->type()).second)
60  {
61  FEType fe_type(FIRST, LAGRANGE);
62  unsigned int dim = elem->dim();
63  unsigned int side = 0; // we assume that any element will have at least one side ;)
64 
65  // We cannot mess with the FE objects in Assembly, because we might need to request second
66  // derivatives
67  // later on. If we used them, we'd call reinit on them, thus making the call to request second
68  // derivatives harmful (i.e. leading to segfaults/asserts). Thus, we have to use a locally
69  // allocated object here.
70  std::unique_ptr<FEBase> fe(FEBase::build(dim, fe_type));
71 
72  // figure out the number of qps for volume
73  std::unique_ptr<QBase> qrule(QBase::build(_qtype, dim, _order));
74  fe->attach_quadrature_rule(qrule.get());
75  fe->reinit(elem);
76  if (qrule->n_points() > _max)
77  _max = qrule->n_points();
78 
79  unsigned int n_shape_funcs = fe->n_shape_functions();
80  if (n_shape_funcs > _max_shape_funcs)
81  _max_shape_funcs = n_shape_funcs;
82 
83  // figure out the number of qps for the face
84  // NOTE: user might specify higher order rule for faces, thus possibly ending up with more qps
85  // than in the volume
86  std::unique_ptr<QBase> qrule_face(QBase::build(_qtype, dim - 1, _face_order));
87  fe->attach_quadrature_rule(qrule_face.get());
88  fe->reinit(elem, side);
89  if (qrule_face->n_points() > _max)
90  _max = qrule_face->n_points();
91  }
92  }
93 }
unsigned int _max
Maximum number of qps encountered.
Definition: MaxQpsThread.h:59
unsigned int _max_shape_funcs
Maximum number of shape functions encountered.
Definition: MaxQpsThread.h:62
Order _face_order
Definition: MaxQpsThread.h:54
QuadratureType _qtype
Definition: MaxQpsThread.h:52
THREAD_ID _tid
Definition: MaxQpsThread.h:56

Member Data Documentation

Order MaxQpsThread::_face_order
protected

Definition at line 54 of file MaxQpsThread.h.

Referenced by operator()().

FEProblemBase& MaxQpsThread::_fe_problem
protected

Definition at line 50 of file MaxQpsThread.h.

unsigned int MaxQpsThread::_max
protected

Maximum number of qps encountered.

Definition at line 59 of file MaxQpsThread.h.

Referenced by join(), max(), and operator()().

unsigned int MaxQpsThread::_max_shape_funcs
protected

Maximum number of shape functions encountered.

Definition at line 62 of file MaxQpsThread.h.

Referenced by join(), max_shape_funcs(), and operator()().

Order MaxQpsThread::_order
protected

Definition at line 53 of file MaxQpsThread.h.

Referenced by operator()().

QuadratureType MaxQpsThread::_qtype
protected

Definition at line 52 of file MaxQpsThread.h.

Referenced by operator()().

THREAD_ID MaxQpsThread::_tid
protected

Definition at line 56 of file MaxQpsThread.h.

Referenced by operator()().


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