https://mooseframework.inl.gov
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)
 
 MaxQpsThread (MaxQpsThread &x, Threads::split split)
 
void operator() (const libMesh::ConstElemRange &range)
 
void join (const MaxQpsThread &y)
 
unsigned int max () const
 

Protected Attributes

FEProblemBase_fe_problem
 
THREAD_ID _tid
 
unsigned int _max
 Maximum number of qps 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 27 of file MaxQpsThread.h.

Constructor & Destructor Documentation

◆ MaxQpsThread() [1/2]

LIBMESH_DEFINE_HASH_POINTERS MaxQpsThread::MaxQpsThread ( FEProblemBase fe_problem)

Definition at line 20 of file MaxQpsThread.C.

20 : _fe_problem(fe_problem), _max(0) {}
unsigned int _max
Maximum number of qps encountered.
Definition: MaxQpsThread.h:47
FEProblemBase & _fe_problem
Definition: MaxQpsThread.h:42

◆ MaxQpsThread() [2/2]

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

Definition at line 23 of file MaxQpsThread.C.

25 {
26 }
unsigned int _max
Maximum number of qps encountered.
Definition: MaxQpsThread.h:47
FEProblemBase & _fe_problem
Definition: MaxQpsThread.h:42

Member Function Documentation

◆ join()

void MaxQpsThread::join ( const MaxQpsThread y)

Definition at line 82 of file MaxQpsThread.C.

83 {
84  if (y._max > _max)
85  _max = y._max;
86 }
unsigned int _max
Maximum number of qps encountered.
Definition: MaxQpsThread.h:47

◆ max()

unsigned int MaxQpsThread::max ( ) const
inline

Definition at line 39 of file MaxQpsThread.h.

Referenced by FEProblemBase::updateMaxQps().

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

◆ operator()()

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

Definition at line 29 of file MaxQpsThread.C.

30 {
31  ParallelUniqueId puid;
32  _tid = puid.id;
33 
34  // Not actually using any pre-existing data so it shouldn't matter which assembly we use
35  auto & assem = _fe_problem.assembly(_tid, 0);
36 
37  // For short circuiting reinit. With potential block-specific qrules we
38  // need to track "seen" element types by their subdomains as well.
39  std::set<std::pair<ElemType, SubdomainID>> seen_it;
40 
41  for (const auto & elem : range)
42  {
43  // Only reinit if the element type has not previously been seen
44  if (!seen_it.insert(std::make_pair(elem->type(), elem->subdomain_id())).second)
45  continue;
46 
47  // This ensures we can access the correct qrules if any block-specific
48  // qrules have been created.
49  assem.setCurrentSubdomainID(elem->subdomain_id());
50  assem.setVolumeQRule(elem);
51 
52  auto & qrule = assem.writeableQRule();
53  qrule->init(*elem);
54  if (qrule->n_points() > _max)
55  _max = qrule->n_points();
56 
57  // We used to check side quadrature rules too - badly (assuming
58  // side 0 doesn't have a smaller rule than the others, which is
59  // often untrue on prisms) and generally unnecessarily (a side
60  // rule will always use fewer points than a corresponding interior
61  // rule).
62  //
63  // We should handle the possibility of users manually specifying a
64  // higher order for side than for interior integration. Doing
65  // this efficiently will need to wait for a new libMesh API,
66  // though.
67 
68  // In initial conditions nodes are enumerated as pretend quadrature points
69  // using the _qp index to access coupled variables. In order to be able to
70  // use _zero (resized according to _max_qps) with _qp, we need to count nodes.
71  if (elem->n_nodes() > _max)
72  _max = elem->n_nodes();
73  }
74 
75  // Clear the cached quadrature rules because we may add FE objects in between now and simulation
76  // start and we only ensure we set all the FE quadrature rules if a quadrature rule is different
77  // from the cached quadrature rule
78  assem.clearCachedQRules();
79 }
unsigned int _max
Maximum number of qps encountered.
Definition: MaxQpsThread.h:47
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override
FEProblemBase & _fe_problem
Definition: MaxQpsThread.h:42
void setCurrentSubdomainID(SubdomainID i)
set the current subdomain ID
Definition: Assembly.h:385
THREAD_ID _tid
Definition: MaxQpsThread.h:44

Member Data Documentation

◆ _fe_problem

FEProblemBase& MaxQpsThread::_fe_problem
protected

Definition at line 42 of file MaxQpsThread.h.

Referenced by operator()().

◆ _max

unsigned int MaxQpsThread::_max
protected

Maximum number of qps encountered.

Definition at line 47 of file MaxQpsThread.h.

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

◆ _tid

THREAD_ID MaxQpsThread::_tid
protected

Definition at line 44 of file MaxQpsThread.h.

Referenced by operator()().


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