https://mooseframework.inl.gov
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
FlagElementsThread Class Reference

#include <FlagElementsThread.h>

Inheritance diagram for FlagElementsThread:
[legend]

Public Member Functions

 FlagElementsThread (FEProblemBase &fe_problem, std::vector< Number > &serialized_solution, unsigned int max_h_level, const std::string &marker_name, bool is_serialized_solution)
 
 FlagElementsThread (FlagElementsThread &x, Threads::split split)
 
virtual void onElement (const Elem *elem) override
 Assembly of the element (not including surface assembly) More...
 
bool shouldComputeInternalSide (const Elem &, const Elem &) const override
 Whether to compute the internal side for the provided element-neighbor pair. More...
 
void join (const FlagElementsThread &)
 
virtual void caughtMooseException (MooseException &e) override
 Called if a MooseException is caught anywhere during the computation. More...
 
virtual bool keepGoing () override
 Whether or not the loop should continue. More...
 
virtual void preElement (const Elem *elem) override
 Called before the element assembly. More...
 
virtual void preInternalSide (const Elem *elem, unsigned int side) override
 Called before evaluations on an element internal side. More...
 
virtual void preBoundary (const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr) override
 Called before the boundary assembly. More...
 
virtual void neighborSubdomainChanged () override
 Called every time the neighbor subdomain changes (i.e. More...
 
virtual void operator() (const ConstElemRange &range, bool bypass_threading=false)
 
virtual void pre ()
 Called before the element range loop. More...
 
virtual void post ()
 Called after the element range loop. More...
 
virtual void postElement (const Elem *elem)
 Called after the element assembly is done (including surface assembling) More...
 
virtual void onBoundary (const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr)
 Called when doing boundary assembling. More...
 
virtual void postInternalSide (const Elem *elem, unsigned int side)
 Called after evaluations on an element internal side. More...
 
virtual void onInternalSide (const Elem *elem, unsigned int side)
 Called when doing internal edge assembling. More...
 
virtual void onExternalSide (const Elem *elem, unsigned int side)
 Called when iterating over external sides (no side neighbor) More...
 
virtual void onInterface (const Elem *elem, unsigned int side, BoundaryID bnd_id)
 Called when doing interface assembling. More...
 
virtual void subdomainChanged ()
 Called every time the current subdomain changes (i.e. More...
 

Protected Member Functions

void prepareElement (const Elem *elem)
 
void clearVarsAndMaterials ()
 
void printExecutionOrdering (const std::vector< T * > &objs, const bool print_header=true, const std::string &line_prefix="[DBG]") const
 Routine to output the ordering of objects within a vector of pointers to these objects. More...
 
void printExecutionOrdering (const std::vector< std::shared_ptr< T >> &objs_ptrs, const bool print_header=true, const std::string &line_prefix="[DBG]") const
 
virtual void printGeneralExecutionInformation () const
 Print information about the loop ordering. More...
 
virtual void printBlockExecutionInformation () const
 Print information about the particular ordering of objects on each block. More...
 
virtual void printBoundaryExecutionInformation (const unsigned int) const
 Print information about the particular ordering of objects on each boundary. More...
 
void resetExecPrintedSets () const
 Resets the set of blocks and boundaries visited. More...
 

Protected Attributes

FEProblemBase_fe_problem
 
std::shared_ptr< DisplacedProblem_displaced_problem
 
AuxiliarySystem_aux_sys
 
unsigned int _system_number
 
Adaptivity_adaptivity
 
MooseVariableFEBase_field_var
 
unsigned int _field_var_number
 
std::vector< Number > & _serialized_solution
 
unsigned int _max_h_level
 
bool _is_serialized_solution
 
MooseMesh_mesh
 
THREAD_ID _tid
 
SubdomainID _subdomain
 The subdomain for the current element. More...
 
SubdomainID _old_subdomain
 The subdomain for the last element. More...
 
SubdomainID _neighbor_subdomain
 The subdomain for the current neighbor. More...
 
SubdomainID _old_neighbor_subdomain
 The subdomain for the last neighbor. More...
 
std::set< SubdomainID_blocks_exec_printed
 Keep track of which blocks were visited. More...
 
std::set< BoundaryID_boundaries_exec_printed
 Keep track of which boundaries were visited. More...
 

Detailed Description

Definition at line 20 of file FlagElementsThread.h.

Constructor & Destructor Documentation

◆ FlagElementsThread() [1/2]

FlagElementsThread::FlagElementsThread ( FEProblemBase fe_problem,
std::vector< Number > &  serialized_solution,
unsigned int  max_h_level,
const std::string &  marker_name,
bool  is_serialized_solution 
)

Definition at line 25 of file FlagElementsThread.C.

31  _fe_problem(fe_problem),
33  _aux_sys(fe_problem.getAuxiliarySystem()),
39  _serialized_solution(serialized_solution),
40  _max_h_level(max_h_level),
41  _is_serialized_solution(is_serialized_solution)
42 {
43 }
FEProblemBase & _fe_problem
unsigned int _max_h_level
unsigned int _system_number
unsigned int number() const
Get variable number coming from libMesh.
MooseVariableFEBase & _field_var
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
Adaptivity & _adaptivity
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
AuxiliarySystem & getAuxiliarySystem()
std::shared_ptr< DisplacedProblem > _displaced_problem
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
unsigned int _field_var_number
std::vector< Number > & _serialized_solution
AuxiliarySystem & _aux_sys
Adaptivity & adaptivity()

◆ FlagElementsThread() [2/2]

FlagElementsThread::FlagElementsThread ( FlagElementsThread x,
Threads::split  split 
)

Definition at line 46 of file FlagElementsThread.C.

49  _displaced_problem(x._displaced_problem),
50  _aux_sys(x._aux_sys),
51  _system_number(x._system_number),
52  _adaptivity(x._adaptivity),
53  _field_var(x._field_var),
54  _field_var_number(x._field_var_number),
55  _serialized_solution(x._serialized_solution),
56  _max_h_level(x._max_h_level),
57  _is_serialized_solution(x._is_serialized_solution)
58 {
59 }
FEProblemBase & _fe_problem
unsigned int _max_h_level
unsigned int _system_number
FEProblemBase & _fe_problem
MooseVariableFEBase & _field_var
Adaptivity & _adaptivity
tbb::split split
std::shared_ptr< DisplacedProblem > _displaced_problem
unsigned int _field_var_number
std::vector< Number > & _serialized_solution
AuxiliarySystem & _aux_sys

Member Function Documentation

◆ caughtMooseException()

void ThreadedElementLoop< ConstElemRange >::caughtMooseException ( MooseException e)
overridevirtualinherited

Called if a MooseException is caught anywhere during the computation.

The single input parameter taken is a MooseException object.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 105 of file ThreadedElementLoop.h.

Referenced by ComputeJacobianForScalingThread::operator()().

106 {
107  Threads::spin_mutex::scoped_lock lock(threaded_element_mutex);
108 
109  std::string what(e.what());
111 }
virtual const char * what() const
Get out the error message.
virtual void setException(const std::string &message)
Set an exception, which is stored at this point by toggling a member variable in this class...
static Threads::spin_mutex threaded_element_mutex
This mutex is used by all derived classes of the ThreadedElementLoop.

◆ clearVarsAndMaterials()

void ThreadedElementLoop< ConstElemRange >::clearVarsAndMaterials ( )
protectedinherited

Definition at line 195 of file ThreadedElementLoop.h.

Referenced by NonlinearThread::post().

196 {
199 }
void clearActiveMaterialProperties(const THREAD_ID tid)
Clear the active material properties.
virtual void clearActiveElementalMooseVariables(const THREAD_ID tid) override
Clear the active elemental MooseVariableFEBase.

◆ join()

void FlagElementsThread::join ( const FlagElementsThread )

Definition at line 113 of file FlagElementsThread.C.

114 {
115 }

◆ keepGoing()

virtual bool ThreadedElementLoop< ConstElemRange >::keepGoing ( )
inlineoverridevirtualinherited

Whether or not the loop should continue.

Returns
true to keep going, false to stop.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 45 of file ThreadedElementLoop.h.

Referenced by ComputeJacobianForScalingThread::operator()().

45 { return !_fe_problem.hasException(); }
virtual bool hasException()
Whether or not an exception has occurred.

◆ neighborSubdomainChanged()

void ThreadedElementLoop< ConstElemRange >::neighborSubdomainChanged ( )
overridevirtualinherited

Called every time the neighbor subdomain changes (i.e.

the subdomain of this neighbor is not the same as the subdomain of the last neighbor). Beware of over-using this! You might think that you can do some expensive stuff in here and get away with it... but there are applications that have TONS of subdomains....

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 139 of file ThreadedElementLoop.h.

140 {
143 }
Base class for assembly-like calculations.
virtual void neighborSubdomainSetup(SubdomainID subdomain, const THREAD_ID tid)

◆ onBoundary()

void ThreadedElementLoopBase< ConstElemRange >::onBoundary ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id,
const Elem *  lower_d_elem = nullptr 
)
virtualinherited

Called when doing boundary assembling.

Parameters
elem- The element we are checking is on the boundary.
side- The side of the element in question.
bnd_id- ID of the boundary we are at
lower_d_elem- Lower dimensional element (e.g. Mortar)

Reimplemented in ComputeUserObjectsThread, NonlinearThread, ComputeIndicatorThread, ComputeMaterialsObjectThread, and ComputeMarkerThread.

Definition at line 366 of file ThreadedElementLoopBase.h.

370 {
371 }

◆ onElement()

void FlagElementsThread::onElement ( const Elem *  elem)
overridevirtual

Assembly of the element (not including surface assembly)

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 62 of file FlagElementsThread.C.

63 {
64  mooseAssert(elem->active(), "This thread should only act on active elements");
65 
66  // By default do nothing, and only grab the marker from the solution if the current variable is
67  // active
68  // on the element subdomain.
70  if (_field_var.activeOnSubdomain(elem->subdomain_id()))
71  {
72  dof_id_type dof_number = elem->dof_number(_system_number, _field_var_number, 0);
73 
74  Number dof_value = 0.;
75  // If solution is serialized in the caller,
76  // we use the serialized solution
78  dof_value = _serialized_solution[dof_number];
79  else // Otherwise, we look at the ghosted local solution
80  {
81  // Local ghosted solution
82  auto & current_local_solution = *_aux_sys.currentSolution();
83  // Libesh will convert a global dof number to a local one,
84  // then return the corresponding entry value
85  dof_value = current_local_solution(dof_number);
86  }
87 
88  // round() is a C99 function, it is not located in the std:: namespace.
89  marker_value = static_cast<Marker::MarkerValue>(round(dof_value));
90 
91  // Make sure we aren't masking an issue in the Marker system by rounding its values.
92  if (std::abs(marker_value - dof_value) > TOLERANCE * TOLERANCE)
93  mooseError("Invalid Marker value detected: ", dof_value);
94  }
95 
96  // If no Markers cared about what happened to this element let's just leave it alone
97  if (marker_value == Marker::DONT_MARK)
98  marker_value = Marker::DO_NOTHING;
99 
100  // Don't refine past the max level
101  if (_max_h_level && marker_value == Marker::REFINE && elem->level() >= _max_h_level)
102  marker_value = Marker::DO_NOTHING;
103 
104  const_cast<Elem *>(elem)->set_refinement_flag((Elem::RefinementState)marker_value);
105 
106  if (_displaced_problem)
107  _displaced_problem->mesh()
108  .elemPtr(elem->id())
109  ->set_refinement_flag((Elem::RefinementState)marker_value);
110 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:42
unsigned int _max_h_level
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
unsigned int _system_number
MooseVariableFEBase & _field_var
const NumericVector< Number > *const & currentSolution() const override
The solution vector that is currently being operated on.
MarkerValue
This mirrors the main refinement flag values in libMesh in Elem::RefinementState but adds "dont_mark"...
Definition: Marker.h:59
T round(T x)
Definition: MathUtils.h:77
std::shared_ptr< DisplacedProblem > _displaced_problem
unsigned int _field_var_number
std::vector< Number > & _serialized_solution
AuxiliarySystem & _aux_sys
bool activeOnSubdomain(SubdomainID subdomain) const
Is the variable active on the subdomain?
Real Number
uint8_t dof_id_type

◆ onExternalSide()

void ThreadedElementLoopBase< ConstElemRange >::onExternalSide ( const Elem *  elem,
unsigned int  side 
)
virtualinherited

Called when iterating over external sides (no side neighbor)

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented in ComputeUserObjectsThread.

Definition at line 393 of file ThreadedElementLoopBase.h.

394 {
395 }

◆ onInterface()

void ThreadedElementLoopBase< ConstElemRange >::onInterface ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id 
)
virtualinherited

Called when doing interface assembling.

Parameters
elem- Element we are on
side- local side number of the element 'elem'
bnd_id- ID of the interface we are at

Reimplemented in ComputeUserObjectsThread, NonlinearThread, and ComputeMaterialsObjectThread.

Definition at line 399 of file ThreadedElementLoopBase.h.

402 {
403 }

◆ onInternalSide()

void ThreadedElementLoopBase< ConstElemRange >::onInternalSide ( const Elem *  elem,
unsigned int  side 
)
virtualinherited

Called when doing internal edge assembling.

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented in ComputeUserObjectsThread, NonlinearThread, ComputeIndicatorThread, ComputeMaterialsObjectThread, and ComputeMarkerThread.

Definition at line 387 of file ThreadedElementLoopBase.h.

388 {
389 }

◆ operator()()

void ThreadedElementLoopBase< ConstElemRange >::operator() ( const ConstElemRange range,
bool  bypass_threading = false 
)
virtualinherited

Reimplemented in NonlinearThread, and ComputeJacobianForScalingThread.

Definition at line 223 of file ThreadedElementLoopBase.h.

224 {
225  try
226  {
227  try
228  {
229  ParallelUniqueId puid;
230  _tid = bypass_threading ? 0 : puid.id;
231 
232  pre();
234 
237  typename RangeType::const_iterator el = range.begin();
238  for (el = range.begin(); el != range.end(); ++el)
239  {
240  if (!keepGoing())
241  break;
242 
243  const Elem * elem = *el;
244 
245  preElement(elem);
246 
248  _subdomain = elem->subdomain_id();
249  if (_subdomain != _old_subdomain)
250  {
253  }
254 
255  onElement(elem);
256 
257  if (_mesh.interiorLowerDBlocks().count(elem->subdomain_id()) > 0 ||
258  _mesh.boundaryLowerDBlocks().count(elem->subdomain_id()) > 0)
259  {
260  postElement(elem);
261  continue;
262  }
263 
264  for (unsigned int side = 0; side < elem->n_sides(); side++)
265  {
266  std::vector<BoundaryID> boundary_ids = _mesh.getBoundaryIDs(elem, side);
267  const Elem * lower_d_elem = _mesh.getLowerDElem(elem, side);
268 
269  if (boundary_ids.size() > 0)
270  for (std::vector<BoundaryID>::iterator it = boundary_ids.begin();
271  it != boundary_ids.end();
272  ++it)
273  {
274  preBoundary(elem, side, *it, lower_d_elem);
276  onBoundary(elem, side, *it, lower_d_elem);
277  }
278 
279  const Elem * neighbor = elem->neighbor_ptr(side);
280  if (neighbor)
281  {
282  preInternalSide(elem, side);
283 
285  _neighbor_subdomain = neighbor->subdomain_id();
288 
289  if (shouldComputeInternalSide(*elem, *neighbor))
290  onInternalSide(elem, side);
291 
292  if (boundary_ids.size() > 0)
293  for (std::vector<BoundaryID>::iterator it = boundary_ids.begin();
294  it != boundary_ids.end();
295  ++it)
296  onInterface(elem, side, *it);
297 
298  postInternalSide(elem, side);
299  }
300  else
301  onExternalSide(elem, side);
302  } // sides
303 
304  postElement(elem);
305  } // range
306 
307  post();
309  }
310  catch (libMesh::LogicError & e)
311  {
312  mooseException("We caught a libMesh error in ThreadedElementLoopBase:", e.what());
313  }
314  catch (MetaPhysicL::LogicError & e)
315  {
317  }
318  }
319  catch (MooseException & e)
320  {
322  }
323 }
virtual void onExternalSide(const Elem *elem, unsigned int side)
Called when iterating over external sides (no side neighbor)
virtual bool keepGoing()
Whether or not the loop should continue.
void resetExecPrintedSets() const
Resets the set of blocks and boundaries visited.
virtual bool shouldComputeInternalSide(const Elem &elem, const Elem &neighbor) const
Whether to compute the internal side for the provided element-neighbor pair.
virtual void onElement(const Elem *elem)
Assembly of the element (not including surface assembly)
const std::set< SubdomainID > & interiorLowerDBlocks() const
Definition: MooseMesh.h:1403
void translateMetaPhysicLError(const MetaPhysicL::LogicError &)
emit a relatively clear error message when we catch a MetaPhysicL logic error
Definition: MooseError.C:112
virtual void printBoundaryExecutionInformation(const unsigned int) const
Print information about the particular ordering of objects on each boundary.
virtual void pre()
Called before the element range loop.
const Elem * getLowerDElem(const Elem *, unsigned short int) const
Returns a const pointer to a lower dimensional element that corresponds to a side of a higher dimensi...
Definition: MooseMesh.C:1698
virtual void subdomainChanged()
Called every time the current subdomain changes (i.e.
virtual void neighborSubdomainChanged()
Called every time the neighbor subdomain changes (i.e.
virtual void preInternalSide(const Elem *elem, unsigned int side)
Called before evaluations on an element internal side.
virtual void postInternalSide(const Elem *elem, unsigned int side)
Called after evaluations on an element internal side.
const SubdomainID INVALID_BLOCK_ID
Definition: MooseTypes.C:20
virtual void onBoundary(const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr)
Called when doing boundary assembling.
virtual void postElement(const Elem *elem)
Called after the element assembly is done (including surface assembling)
virtual void printGeneralExecutionInformation() const
Print information about the loop ordering.
virtual void onInterface(const Elem *elem, unsigned int side, BoundaryID bnd_id)
Called when doing interface assembling.
SubdomainID _old_neighbor_subdomain
The subdomain for the last neighbor.
const std::set< SubdomainID > & boundaryLowerDBlocks() const
Definition: MooseMesh.h:1407
virtual void onInternalSide(const Elem *elem, unsigned int side)
Called when doing internal edge assembling.
const_iterator end() const
Provides a way for users to bail out of the current solve.
virtual void caughtMooseException(MooseException &)
Called if a MooseException is caught anywhere during the computation.
const_iterator begin() const
SubdomainID _subdomain
The subdomain for the current element.
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
Returns a vector of boundary IDs for the requested element on the requested side. ...
SubdomainID _old_subdomain
The subdomain for the last element.
virtual void post()
Called after the element range loop.
virtual void printBlockExecutionInformation() const
Print information about the particular ordering of objects on each block.
virtual void preElement(const Elem *elem)
Called before the element assembly.
virtual void preBoundary(const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr)
Called before the boundary assembly.
SubdomainID _neighbor_subdomain
The subdomain for the current neighbor.

◆ post()

void ThreadedElementLoopBase< ConstElemRange >::post ( )
virtualinherited

◆ postElement()

void ThreadedElementLoopBase< ConstElemRange >::postElement ( const Elem *  elem)
virtualinherited

Called after the element assembly is done (including surface assembling)

Parameters
elem- active element

Reimplemented in ComputeJacobianBlocksThread, NonlinearThread, ComputeIndicatorThread, ComputeJacobianThread, and ComputeMarkerThread.

Definition at line 351 of file ThreadedElementLoopBase.h.

352 {
353 }

◆ postInternalSide()

void ThreadedElementLoopBase< ConstElemRange >::postInternalSide ( const Elem *  elem,
unsigned int  side 
)
virtualinherited

Called after evaluations on an element internal side.

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented in ComputeJacobianBlocksThread.

Definition at line 381 of file ThreadedElementLoopBase.h.

382 {
383 }

◆ pre()

void ThreadedElementLoopBase< ConstElemRange >::pre ( )
virtualinherited

Called before the element range loop.

Definition at line 327 of file ThreadedElementLoopBase.h.

Referenced by ComputeJacobianForScalingThread::operator()().

328 {
329 }

◆ preBoundary()

void ThreadedElementLoop< ConstElemRange >::preBoundary ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id,
const Elem *  lower_d_elem = nullptr 
)
overridevirtualinherited

Called before the boundary assembly.

Parameters
elem- The element we are checking is on the boundary.
side- The side of the element in question.
bnd_id- ID of the boundary we are at
lower_d_elem- Lower dimensional element (e.g. Mortar)

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 129 of file ThreadedElementLoop.h.

133 {
135 }
virtual void setCurrentBoundaryID(BoundaryID bid, const THREAD_ID tid) override
sets the current boundary ID in assembly
Base class for assembly-like calculations.

◆ preElement()

void ThreadedElementLoop< ConstElemRange >::preElement ( const Elem *  elem)
overridevirtualinherited

Called before the element assembly.

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 115 of file ThreadedElementLoop.h.

Referenced by ComputeJacobianForScalingThread::operator()().

116 {
118 }
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override
Base class for assembly-like calculations.

◆ preInternalSide()

void ThreadedElementLoop< ConstElemRange >::preInternalSide ( const Elem *  elem,
unsigned int  side 
)
overridevirtualinherited

Called before evaluations on an element internal side.

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 122 of file ThreadedElementLoop.h.

123 {
125 }
Base class for assembly-like calculations.
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, const THREAD_ID tid) override

◆ prepareElement()

void ThreadedElementLoop< ConstElemRange >::prepareElement ( const Elem *  elem)
protectedinherited

Definition at line 186 of file ThreadedElementLoop.h.

Referenced by NonlinearThread::onElement().

187 {
188  _fe_problem.prepare(elem, this->_tid);
189  _fe_problem.reinitElem(elem, this->_tid);
191 }
virtual void prepare(const Elem *elem, const THREAD_ID tid) override
virtual void reinitElem(const Elem *elem, const THREAD_ID tid) override
void reinitMaterials(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true)
SubdomainID _subdomain
The subdomain for the current element.

◆ printBlockExecutionInformation()

virtual void ThreadedElementLoopBase< ConstElemRange >::printBlockExecutionInformation ( ) const
inlineprotectedvirtualinherited

Print information about the particular ordering of objects on each block.

Reimplemented in NonlinearThread, ComputeUserObjectsThread, ComputeIndicatorThread, ComputeElemAuxVarsThread< AuxKernelType >, and ComputeMarkerThread.

Definition at line 181 of file ThreadedElementLoopBase.h.

181 {}

◆ printBoundaryExecutionInformation()

virtual void ThreadedElementLoopBase< ConstElemRange >::printBoundaryExecutionInformation ( const unsigned int  ) const
inlineprotectedvirtualinherited

Print information about the particular ordering of objects on each boundary.

Reimplemented in NonlinearThread.

Definition at line 184 of file ThreadedElementLoopBase.h.

184 {}

◆ printExecutionOrdering() [1/2]

void ThreadedElementLoop< ConstElemRange >::printExecutionOrdering ( const std::vector< T *> &  objs,
const bool  print_header = true,
const std::string &  line_prefix = "[DBG]" 
) const
protectedinherited

Routine to output the ordering of objects within a vector of pointers to these objects.

These objects must implement the name() routine, and it must return a string or compatible type.

Template Parameters
Tthe object type
Parameters
objsthe vector with all the objects (should be pointers)
objects_typethe name of the type of objects. Defaults to the CPP object name
print_headerwhether to print a header about the timing of execution and the type of objects

Definition at line 148 of file ThreadedElementLoop.h.

151 {
152  if (!objs.size())
153  return;
154 
155  auto & console = _fe_problem.console();
156  const auto objects_type = MooseUtils::prettyCppType(objs[0]);
157  std::vector<MooseObject *> moose_objs;
158  for (auto obj_ptr : objs)
159  moose_objs.push_back(dynamic_cast<MooseObject *>(obj_ptr));
160  const auto names = ConsoleUtils::mooseObjectVectorToString(moose_objs);
161 
162  // Print string with a DBG prefix and with sufficient line breaks
163  std::string message = print_header ? "Executing " + objects_type + " on " +
165  : "";
166  message += (print_header ? "Order of execution:\n" : "") + names;
167  console << ConsoleUtils::formatString(message, line_prefix) << std::endl;
168 }
std::string mooseObjectVectorToString(const std::vector< MooseObject *> &objs, const std::string &sep=" ")
Routine to output the name of MooseObjects in a string.
Definition: ConsoleUtils.C:598
const std::string & name() const
Definition: MooseEnumItem.h:35
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
std::string formatString(std::string message, const std::string &prefix)
Add new lines and prefixes to a string for pretty display in output NOTE: This makes a copy of the st...
Definition: ConsoleUtils.C:582
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48
std::string prettyCppType(const std::string &cpp_type)
Definition: MooseUtils.C:1246

◆ printExecutionOrdering() [2/2]

void ThreadedElementLoop< ConstElemRange >::printExecutionOrdering ( const std::vector< std::shared_ptr< T >> &  objs_ptrs,
const bool  print_header = true,
const std::string &  line_prefix = "[DBG]" 
) const
protectedinherited

Definition at line 173 of file ThreadedElementLoop.h.

177 {
178  std::vector<T *> regular_ptrs;
179  for (auto shared_ptr : objs_ptrs)
180  regular_ptrs.push_back(shared_ptr.get());
181  printExecutionOrdering<T>(regular_ptrs, print_header, line_prefix);
182 }

◆ printGeneralExecutionInformation()

virtual void ThreadedElementLoopBase< ConstElemRange >::printGeneralExecutionInformation ( ) const
inlineprotectedvirtualinherited

◆ resetExecPrintedSets()

void ThreadedElementLoopBase< ConstElemRange >::resetExecPrintedSets ( ) const
protectedinherited

Resets the set of blocks and boundaries visited.

Definition at line 444 of file ThreadedElementLoopBase.h.

445 {
446  _blocks_exec_printed.clear();
447  _boundaries_exec_printed.clear();
448 }
std::set< SubdomainID > _blocks_exec_printed
Keep track of which blocks were visited.
std::set< BoundaryID > _boundaries_exec_printed
Keep track of which boundaries were visited.

◆ shouldComputeInternalSide()

bool FlagElementsThread::shouldComputeInternalSide ( const Elem &  elem,
const Elem &  neighbor 
) const
inlineoverridevirtual

Whether to compute the internal side for the provided element-neighbor pair.

Typically this will return true if the element id is less than the neighbor id when the elements are equal level, or when the element is more refined than the neighbor, and then false otherwise. One type of loop where the logic will be different is when projecting stateful material properties

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 36 of file FlagElementsThread.h.

36 { return false; }

◆ subdomainChanged()

void ThreadedElementLoopBase< ConstElemRange >::subdomainChanged ( )
virtualinherited

Called every time the current subdomain changes (i.e.

the subdomain of this element is not the same as the subdomain of the last element). Beware of over-using this! You might think that you can do some expensive stuff in here and get away with it... but there are applications that have TONS of subdomains....

Reimplemented in ComputeUserObjectsThread, NonlinearThread, ComputeIndicatorThread, ComputeMaterialsObjectThread, ComputeElemAuxVarsThread< AuxKernelType >, and ComputeMarkerThread.

Definition at line 407 of file ThreadedElementLoopBase.h.

408 {
409 }

Member Data Documentation

◆ _adaptivity

Adaptivity& FlagElementsThread::_adaptivity
protected

Definition at line 45 of file FlagElementsThread.h.

◆ _aux_sys

AuxiliarySystem& FlagElementsThread::_aux_sys
protected

Definition at line 43 of file FlagElementsThread.h.

Referenced by onElement().

◆ _blocks_exec_printed

std::set<SubdomainID> ThreadedElementLoopBase< ConstElemRange >::_blocks_exec_printed
mutableprotectedinherited

◆ _boundaries_exec_printed

std::set<BoundaryID> ThreadedElementLoopBase< ConstElemRange >::_boundaries_exec_printed
mutableprotectedinherited

Keep track of which boundaries were visited.

Definition at line 190 of file ThreadedElementLoopBase.h.

Referenced by NonlinearThread::printBoundaryExecutionInformation().

◆ _displaced_problem

std::shared_ptr<DisplacedProblem> FlagElementsThread::_displaced_problem
protected

Definition at line 42 of file FlagElementsThread.h.

Referenced by onElement().

◆ _fe_problem

FEProblemBase& FlagElementsThread::_fe_problem
protected

Definition at line 41 of file FlagElementsThread.h.

◆ _field_var

MooseVariableFEBase& FlagElementsThread::_field_var
protected

Definition at line 46 of file FlagElementsThread.h.

Referenced by onElement().

◆ _field_var_number

unsigned int FlagElementsThread::_field_var_number
protected

Definition at line 47 of file FlagElementsThread.h.

Referenced by onElement().

◆ _is_serialized_solution

bool FlagElementsThread::_is_serialized_solution
protected

Definition at line 50 of file FlagElementsThread.h.

Referenced by onElement().

◆ _max_h_level

unsigned int FlagElementsThread::_max_h_level
protected

Definition at line 49 of file FlagElementsThread.h.

Referenced by onElement().

◆ _mesh

MooseMesh& ThreadedElementLoopBase< ConstElemRange >::_mesh
protectedinherited

◆ _neighbor_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_neighbor_subdomain
protectedinherited

◆ _old_neighbor_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_old_neighbor_subdomain
protectedinherited

The subdomain for the last neighbor.

Definition at line 175 of file ThreadedElementLoopBase.h.

◆ _old_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_old_subdomain
protectedinherited

The subdomain for the last element.

Definition at line 169 of file ThreadedElementLoopBase.h.

Referenced by ComputeJacobianForScalingThread::operator()().

◆ _serialized_solution

std::vector<Number>& FlagElementsThread::_serialized_solution
protected

Definition at line 48 of file FlagElementsThread.h.

Referenced by onElement().

◆ _subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_subdomain
protectedinherited

The subdomain for the current element.

Definition at line 166 of file ThreadedElementLoopBase.h.

Referenced by ComputeFullJacobianThread::computeOnBoundary(), ComputeFullJacobianThread::computeOnElement(), NonlinearThread::computeOnElement(), ComputeResidualThread::computeOnInternalFace(), ComputeFullJacobianThread::computeOnInternalFace(), ComputeResidualAndJacobianThread::computeOnInternalFace(), ComputeJacobianThread::computeOnInternalFace(), NonlinearThread::computeOnInternalFace(), ComputeResidualThread::determineObjectWarehouses(), ComputeResidualAndJacobianThread::determineObjectWarehouses(), ComputeMaterialsObjectThread::onBoundary(), ComputeUserObjectsThread::onBoundary(), ComputeMarkerThread::onElement(), ComputeIndicatorThread::onElement(), ComputeMaterialsObjectThread::onElement(), ComputeUserObjectsThread::onElement(), ComputeMaterialsObjectThread::onInterface(), ComputeMaterialsObjectThread::onInternalSide(), NonlinearThread::onInternalSide(), ComputeJacobianForScalingThread::operator()(), ComputeJacobianBlocksThread::postInternalSide(), ComputeMarkerThread::printBlockExecutionInformation(), ComputeIndicatorThread::printBlockExecutionInformation(), ComputeUserObjectsThread::printBlockExecutionInformation(), NonlinearThread::printBlockExecutionInformation(), ComputeUserObjectsThread::querySubdomain(), NonlinearThread::shouldComputeInternalSide(), ComputeMarkerThread::subdomainChanged(), ComputeMaterialsObjectThread::subdomainChanged(), ComputeIndicatorThread::subdomainChanged(), NonlinearThread::subdomainChanged(), and ComputeUserObjectsThread::subdomainChanged().

◆ _system_number

unsigned int FlagElementsThread::_system_number
protected

Definition at line 44 of file FlagElementsThread.h.

Referenced by onElement().

◆ _tid

THREAD_ID ThreadedElementLoopBase< ConstElemRange >::_tid
protectedinherited

Definition at line 163 of file ThreadedElementLoopBase.h.

Referenced by ComputeResidualThread::accumulate(), ComputeResidualAndJacobianThread::accumulate(), ComputeResidualThread::accumulateLower(), ComputeResidualAndJacobianThread::accumulateLower(), ComputeJacobianThread::accumulateLower(), ComputeResidualThread::accumulateNeighbor(), ComputeResidualAndJacobianThread::accumulateNeighbor(), ComputeJacobianThread::accumulateNeighbor(), ComputeResidualThread::accumulateNeighborLower(), ComputeResidualAndJacobianThread::accumulateNeighborLower(), ComputeJacobianThread::accumulateNeighborLower(), ComputeFullJacobianThread::computeOnBoundary(), NonlinearThread::computeOnBoundary(), ComputeFullJacobianThread::computeOnElement(), NonlinearThread::computeOnElement(), ComputeFullJacobianThread::computeOnInterface(), NonlinearThread::computeOnInterface(), ComputeResidualThread::computeOnInternalFace(), ComputeFullJacobianThread::computeOnInternalFace(), ComputeResidualAndJacobianThread::computeOnInternalFace(), ComputeJacobianThread::computeOnInternalFace(), NonlinearThread::computeOnInternalFace(), ComputeResidualThread::determineObjectWarehouses(), ComputeJacobianThread::determineObjectWarehouses(), ComputeResidualAndJacobianThread::determineObjectWarehouses(), ComputeMaterialsObjectThread::onBoundary(), NonlinearThread::onBoundary(), ComputeUserObjectsThread::onBoundary(), ComputeMarkerThread::onElement(), ComputeElemDampingThread::onElement(), ComputeIndicatorThread::onElement(), ComputeMaterialsObjectThread::onElement(), NonlinearThread::onElement(), ComputeUserObjectsThread::onElement(), ComputeMaterialsObjectThread::onInterface(), NonlinearThread::onInterface(), ComputeUserObjectsThread::onInterface(), ComputeIndicatorThread::onInternalSide(), ComputeMaterialsObjectThread::onInternalSide(), NonlinearThread::onInternalSide(), ComputeUserObjectsThread::onInternalSide(), ComputeJacobianForScalingThread::operator()(), ComputeMaterialsObjectThread::post(), ComputeMarkerThread::post(), ComputeIndicatorThread::post(), ComputeUserObjectsThread::post(), ComputeJacobianThread::postElement(), ComputeJacobianBlocksThread::postElement(), ComputeJacobianBlocksThread::postInternalSide(), NonlinearThread::prepareFace(), ComputeMarkerThread::printBlockExecutionInformation(), ComputeIndicatorThread::printBlockExecutionInformation(), ComputeUserObjectsThread::printBlockExecutionInformation(), NonlinearThread::printBlockExecutionInformation(), NonlinearThread::printBoundaryExecutionInformation(), ComputeElemDampingThread::printGeneralExecutionInformation(), ComputeMarkerThread::printGeneralExecutionInformation(), ComputeIndicatorThread::printGeneralExecutionInformation(), ComputeUserObjectsThread::printGeneralExecutionInformation(), NonlinearThread::printGeneralExecutionInformation(), ComputeUserObjectsThread::queryBoundary(), ComputeUserObjectsThread::querySubdomain(), NonlinearThread::shouldComputeInternalSide(), ComputeMarkerThread::subdomainChanged(), ComputeIndicatorThread::subdomainChanged(), ComputeMaterialsObjectThread::subdomainChanged(), NonlinearThread::subdomainChanged(), and ComputeUserObjectsThread::subdomainChanged().


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