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 28 of file MaxQpsThread.h.

Constructor & Destructor Documentation

◆ MaxQpsThread() [1/2]

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

Definition at line 19 of file MaxQpsThread.C.

23  : _fe_problem(fe_problem),
24  _qtype(qtype),
25  _order(order),
26  _face_order(face_order),
27  _max(0),
29 {
30 }
unsigned int _max
Maximum number of qps encountered.
Definition: MaxQpsThread.h:54
unsigned int _max_shape_funcs
Maximum number of shape functions encountered.
Definition: MaxQpsThread.h:57
Order _face_order
Definition: MaxQpsThread.h:49
FEProblemBase & _fe_problem
Definition: MaxQpsThread.h:45
QuadratureType _qtype
Definition: MaxQpsThread.h:47

◆ MaxQpsThread() [2/2]

MaxQpsThread::MaxQpsThread ( MaxQpsThread x,
Threads::split  split 
)

Definition at line 33 of file MaxQpsThread.C.

34  : _fe_problem(x._fe_problem),
35  _qtype(x._qtype),
36  _order(x._order),
37  _face_order(x._face_order),
38  _max(x._max),
39  _max_shape_funcs(x._max_shape_funcs)
40 {
41 }
unsigned int _max
Maximum number of qps encountered.
Definition: MaxQpsThread.h:54
unsigned int _max_shape_funcs
Maximum number of shape functions encountered.
Definition: MaxQpsThread.h:57
Order _face_order
Definition: MaxQpsThread.h:49
static PetscErrorCode Vec x
FEProblemBase & _fe_problem
Definition: MaxQpsThread.h:45
QuadratureType _qtype
Definition: MaxQpsThread.h:47

Member Function Documentation

◆ join()

void MaxQpsThread::join ( const MaxQpsThread y)

Definition at line 97 of file MaxQpsThread.C.

98 {
99  if (y._max > _max)
100  _max = y._max;
101 
104 }
unsigned int _max
Maximum number of qps encountered.
Definition: MaxQpsThread.h:54
unsigned int _max_shape_funcs
Maximum number of shape functions encountered.
Definition: MaxQpsThread.h:57

◆ max()

unsigned int MaxQpsThread::max ( ) const
inline

Definition at line 40 of file MaxQpsThread.h.

Referenced by FEProblemBase::createQRules().

40 { return _max; }
unsigned int _max
Maximum number of qps encountered.
Definition: MaxQpsThread.h:54

◆ max_shape_funcs()

unsigned int MaxQpsThread::max_shape_funcs ( ) const
inline

Definition at line 42 of file MaxQpsThread.h.

Referenced by FEProblemBase::createQRules().

42 { return _max_shape_funcs; }
unsigned int _max_shape_funcs
Maximum number of shape functions encountered.
Definition: MaxQpsThread.h:57

◆ operator()()

void MaxQpsThread::operator() ( const ConstElemRange &  range)

Definition at line 44 of file MaxQpsThread.C.

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

Member Data Documentation

◆ _face_order

Order MaxQpsThread::_face_order
protected

Definition at line 49 of file MaxQpsThread.h.

Referenced by operator()().

◆ _fe_problem

FEProblemBase& MaxQpsThread::_fe_problem
protected

Definition at line 45 of file MaxQpsThread.h.

◆ _max

unsigned int MaxQpsThread::_max
protected

Maximum number of qps encountered.

Definition at line 54 of file MaxQpsThread.h.

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

◆ _max_shape_funcs

unsigned int MaxQpsThread::_max_shape_funcs
protected

Maximum number of shape functions encountered.

Definition at line 57 of file MaxQpsThread.h.

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

◆ _order

Order MaxQpsThread::_order
protected

Definition at line 48 of file MaxQpsThread.h.

Referenced by operator()().

◆ _qtype

QuadratureType MaxQpsThread::_qtype
protected

Definition at line 47 of file MaxQpsThread.h.

Referenced by operator()().

◆ _tid

THREAD_ID MaxQpsThread::_tid
protected

Definition at line 51 of file MaxQpsThread.h.

Referenced by operator()().


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