Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ComputeIndicatorThread Class Reference

#include <ComputeIndicatorThread.h>

Inheritance diagram for ComputeIndicatorThread:
[legend]

Public Member Functions

 ComputeIndicatorThread (FEProblemBase &fe_problem, bool finalize=false)
 
 ComputeIndicatorThread (ComputeIndicatorThread &x, Threads::split split)
 
virtual ~ComputeIndicatorThread ()
 
virtual void subdomainChanged () override
 Called every time the current subdomain changes (i.e. More...
 
virtual void onElement (const Elem *elem) override
 Assembly of the element (not including surface assembly) More...
 
virtual void onBoundary (const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr) override
 Called when doing boundary assembling. More...
 
virtual void onInternalSide (const Elem *elem, unsigned int side) override
 Called when doing internal edge assembling. More...
 
virtual void postElement (const Elem *) override
 Called after the element assembly is done (including surface assembling) More...
 
virtual void post () override
 Called after the element range loop. More...
 
void join (const ComputeIndicatorThread &)
 
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 postInternalSide (const Elem *elem, unsigned int side)
 Called after evaluations on an element internal side. 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...
 

Protected Member Functions

void printGeneralExecutionInformation () const override
 Print general information about the loop when it executes. More...
 
void printBlockExecutionInformation () const override
 Print list of specific objects executed and in which order. More...
 
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 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
 
AuxiliarySystem_aux_sys
 
const MooseObjectWarehouse< Indicator > & _indicator_whs
 Indicator Storage. More...
 
const MooseObjectWarehouse< InternalSideIndicator > & _internal_side_indicators
 InternalSideIndicator Storage. More...
 
bool _finalize
 
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 ComputeIndicatorThread.h.

Constructor & Destructor Documentation

◆ ComputeIndicatorThread() [1/2]

ComputeIndicatorThread::ComputeIndicatorThread ( FEProblemBase fe_problem,
bool  finalize = false 
)
Parameters
fe_problemreference to the FEProblemBase we are computing on
sysreference to the AuxSystem we are computing on
indicator_whsWarehouse of Indicator objects.
finalizeWhether or not we are just in the "finalize" stage or not.

Definition at line 26 of file ComputeIndicatorThread.C.

28  _fe_problem(fe_problem),
29  _aux_sys(fe_problem.getAuxiliarySystem()),
32  _finalize(finalize)
33 {
34 }
const MooseObjectWarehouse< InternalSideIndicator > & _internal_side_indicators
InternalSideIndicator Storage.
AuxiliarySystem & getAuxiliarySystem()
const MooseObjectWarehouse< Indicator > & getIndicatorWarehouse()
Return indicator/marker storage.
const MooseObjectWarehouse< Indicator > & _indicator_whs
Indicator Storage.
const MooseObjectWarehouse< InternalSideIndicator > & getInternalSideIndicatorWarehouse()

◆ ComputeIndicatorThread() [2/2]

ComputeIndicatorThread::ComputeIndicatorThread ( ComputeIndicatorThread x,
Threads::split  split 
)

Definition at line 37 of file ComputeIndicatorThread.C.

40  _aux_sys(x._aux_sys),
41  _indicator_whs(x._indicator_whs),
42  _internal_side_indicators(x._internal_side_indicators),
43  _finalize(x._finalize)
44 {
45 }
const MooseObjectWarehouse< InternalSideIndicator > & _internal_side_indicators
InternalSideIndicator Storage.
FEProblemBase & _fe_problem
tbb::split split
const MooseObjectWarehouse< Indicator > & _indicator_whs
Indicator Storage.

◆ ~ComputeIndicatorThread()

ComputeIndicatorThread::~ComputeIndicatorThread ( )
virtual

Definition at line 47 of file ComputeIndicatorThread.C.

47 {}

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 HDGPrimalSolutionUpdateThread::post(), and 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 ComputeIndicatorThread::join ( const ComputeIndicatorThread )

Definition at line 188 of file ComputeIndicatorThread.C.

189 {
190 }

◆ 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 ComputeIndicatorThread::onBoundary ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id,
const Elem *  lower_d_elem = nullptr 
)
overridevirtual

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 from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 135 of file ComputeIndicatorThread.C.

139 {
140 }

◆ onElement()

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

Assembly of the element (not including surface assembly)

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 80 of file ComputeIndicatorThread.C.

81 {
82  for (auto * var : _aux_sys._elem_vars[_tid])
83  var->prepareAux();
84 
85  _fe_problem.prepare(elem, _tid);
87 
88  // Set up Sentinel class so that, even if reinitMaterials() throws, we
89  // still remember to swap back during stack unwinding.
91 
93 
94  // Compute
95  if (!_finalize)
96  {
98  {
99  const std::vector<std::shared_ptr<Indicator>> & indicators =
101  for (const auto & indicator : indicators)
102  indicator->computeIndicator();
103  }
104  }
105 
106  // Finalize
107  else
108  {
110  {
111  const std::vector<std::shared_ptr<Indicator>> & indicators =
113  for (const auto & indicator : indicators)
114  indicator->finalize();
115  }
116 
118  {
119  const std::vector<std::shared_ptr<InternalSideIndicator>> & internal_indicators =
121  for (const auto & internal_indicator : internal_indicators)
122  internal_indicator->finalize();
123  }
124  }
125 
126  if (!_finalize) // During finalize the Indicators should be setting values in the vectors manually
127  {
128  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
129  for (auto * var : _aux_sys._elem_vars[_tid])
130  var->add(_aux_sys.solution());
131  }
132 }
const MooseObjectWarehouse< InternalSideIndicator > & _internal_side_indicators
InternalSideIndicator Storage.
bool hasActiveBlockObjects(THREAD_ID tid=0) const
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
virtual void prepare(const Elem *elem, const THREAD_ID tid) override
NumericVector< Number > & solution()
Definition: SystemBase.h:195
virtual void reinitElem(const Elem *elem, const THREAD_ID tid) override
std::vector< std::vector< MooseVariableFieldBase * > > _elem_vars
Elemental variables.
virtual void swapBackMaterials(const THREAD_ID tid)
void reinitMaterials(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true)
const MooseObjectWarehouse< Indicator > & _indicator_whs
Indicator Storage.
SubdomainID _subdomain
The subdomain for the current element.
The "SwapBackSentinel" class&#39;s destructor guarantees that FEProblemBase::swapBackMaterials{Face,Neighbor}() is called even when an exception is thrown from FEProblemBase::reinitMaterials{Face,Neighbor}.

◆ 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 394 of file ThreadedElementLoopBase.h.

395 {
396 }

◆ 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 400 of file ThreadedElementLoopBase.h.

403 {
404 }

◆ onInternalSide()

void ComputeIndicatorThread::onInternalSide ( const Elem *  elem,
unsigned int  side 
)
overridevirtual

Called when doing internal edge assembling.

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

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 143 of file ComputeIndicatorThread.C.

144 {
145  if (_finalize) // If finalizing we only do something on the elements
146  return;
147 
148  // Pointer to the neighbor we are currently working on.
149  const Elem * neighbor = elem->neighbor_ptr(side);
150 
151  for (auto * var : _aux_sys._elem_vars[_tid])
152  var->prepareAux();
153 
154  SubdomainID block_id = elem->subdomain_id();
156  {
157  _fe_problem.reinitNeighbor(elem, side, _tid);
158 
159  // Set up Sentinels so that, even if one of the reinitMaterialsXXX() calls throws, we
160  // still remember to swap back during stack unwinding.
163 
164  SwapBackSentinel neighbor_sentinel(
166  _fe_problem.reinitMaterialsNeighbor(neighbor->subdomain_id(), _tid);
167 
168  const std::vector<std::shared_ptr<InternalSideIndicator>> & indicators =
170  for (const auto & indicator : indicators)
171  indicator->computeIndicator();
172  }
173 }
const MooseObjectWarehouse< InternalSideIndicator > & _internal_side_indicators
InternalSideIndicator Storage.
bool hasActiveBlockObjects(THREAD_ID tid=0) const
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
void reinitMaterialsFace(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on element faces
virtual void swapBackMaterialsFace(const THREAD_ID tid)
void reinitMaterialsNeighbor(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on the neighboring element face
virtual void swapBackMaterialsNeighbor(const THREAD_ID tid)
std::vector< std::vector< MooseVariableFieldBase * > > _elem_vars
Elemental variables.
virtual void reinitNeighbor(const Elem *elem, unsigned int side, const THREAD_ID tid) override
The "SwapBackSentinel" class&#39;s destructor guarantees that FEProblemBase::swapBackMaterials{Face,Neighbor}() is called even when an exception is thrown from FEProblemBase::reinitMaterials{Face,Neighbor}.

◆ operator()()

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

Reimplemented in NonlinearThread, and ComputeJacobianForScalingThread.

Definition at line 224 of file ThreadedElementLoopBase.h.

225 {
226  try
227  {
228  try
229  {
230  ParallelUniqueId puid;
231  _tid = bypass_threading ? 0 : puid.id;
232 
233  pre();
235 
238  typename RangeType::const_iterator el = range.begin();
239  for (el = range.begin(); el != range.end(); ++el)
240  {
241  if (!keepGoing())
242  break;
243 
244  const Elem * elem = *el;
245 
246  preElement(elem);
247 
249  _subdomain = elem->subdomain_id();
250  if (_subdomain != _old_subdomain)
251  {
254  }
255 
256  onElement(elem);
257 
258  if (_mesh.interiorLowerDBlocks().count(elem->subdomain_id()) > 0 ||
259  _mesh.boundaryLowerDBlocks().count(elem->subdomain_id()) > 0)
260  {
261  postElement(elem);
262  continue;
263  }
264 
265  for (unsigned int side = 0; side < elem->n_sides(); side++)
266  {
267  std::vector<BoundaryID> boundary_ids = _mesh.getBoundaryIDs(elem, side);
268  const Elem * lower_d_elem = _mesh.getLowerDElem(elem, side);
269 
270  if (boundary_ids.size() > 0)
271  for (std::vector<BoundaryID>::iterator it = boundary_ids.begin();
272  it != boundary_ids.end();
273  ++it)
274  {
275  preBoundary(elem, side, *it, lower_d_elem);
277  onBoundary(elem, side, *it, lower_d_elem);
278  }
279 
280  const Elem * neighbor = elem->neighbor_ptr(side);
281  if (neighbor)
282  {
283  preInternalSide(elem, side);
284 
286  _neighbor_subdomain = neighbor->subdomain_id();
289 
290  if (shouldComputeInternalSide(*elem, *neighbor))
291  onInternalSide(elem, side);
292 
293  if (boundary_ids.size() > 0)
294  for (std::vector<BoundaryID>::iterator it = boundary_ids.begin();
295  it != boundary_ids.end();
296  ++it)
297  onInterface(elem, side, *it);
298 
299  postInternalSide(elem, side);
300  }
301  else
302  onExternalSide(elem, side);
303  } // sides
304 
305  postElement(elem);
306  } // range
307 
308  post();
310  }
311  catch (libMesh::LogicError & e)
312  {
313  mooseException("We caught a libMesh error in ThreadedElementLoopBase:", e.what());
314  }
315  catch (MetaPhysicL::LogicError & e)
316  {
318  }
319  }
320  catch (MooseException & e)
321  {
323  }
324 }
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:1388
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:1678
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:1392
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 ComputeIndicatorThread::post ( )
overridevirtual

Called after the element range loop.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 181 of file ComputeIndicatorThread.C.

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

◆ postElement()

void ComputeIndicatorThread::postElement ( const Elem *  elem)
overridevirtual

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

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 176 of file ComputeIndicatorThread.C.

177 {
178 }

◆ 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 382 of file ThreadedElementLoopBase.h.

383 {
384 }

◆ pre()

void ThreadedElementLoopBase< ConstElemRange >::pre ( )
virtualinherited

Called before the element range loop.

Definition at line 328 of file ThreadedElementLoopBase.h.

Referenced by ComputeJacobianForScalingThread::operator()().

329 {
330 }

◆ 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 HDGPrimalSolutionUpdateThread::onElement(), and 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()

void ComputeIndicatorThread::printBlockExecutionInformation ( ) const
overrideprotectedvirtual

Print list of specific objects executed and in which order.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 208 of file ComputeIndicatorThread.C.

209 {
211  return;
212 
213  const auto & console = _fe_problem.console();
215  {
216  const auto & indicators = _indicator_whs.getActiveBlockObjects(_subdomain, _tid);
217  console << "[DBG] Ordering of element indicators on block " << _subdomain << std::endl;
218  printExecutionOrdering<Indicator>(indicators, false);
219  }
221  {
223  console << "[DBG] Ordering of element internal sides indicators on block " << _subdomain
224  << std::endl;
225  printExecutionOrdering<InternalSideIndicator>(indicators, false);
226  }
228 }
const MooseObjectWarehouse< InternalSideIndicator > & _internal_side_indicators
InternalSideIndicator Storage.
bool hasActiveBlockObjects(THREAD_ID tid=0) const
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
std::set< SubdomainID > _blocks_exec_printed
Keep track of which blocks were visited.
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48
const MooseObjectWarehouse< Indicator > & _indicator_whs
Indicator Storage.
SubdomainID _subdomain
The subdomain for the current element.

◆ 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:555
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:539
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48
std::string prettyCppType(const std::string &cpp_type)
Definition: MooseUtils.C:1272

◆ 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()

void ComputeIndicatorThread::printGeneralExecutionInformation ( ) const
overrideprotectedvirtual

Print general information about the loop when it executes.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 193 of file ComputeIndicatorThread.C.

194 {
196  return;
197 
198  const auto & console = _fe_problem.console();
199  const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
200  if (!_finalize)
201  console << "[DBG] Executing indicators on elements then on internal sides on " << execute_on
202  << std::endl;
203  else
204  console << "[DBG] Finalizing indicator loop" << std::endl;
205 }
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48

◆ resetExecPrintedSets()

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

Resets the set of blocks and boundaries visited.

Definition at line 445 of file ThreadedElementLoopBase.h.

446 {
447  _blocks_exec_printed.clear();
448  _boundaries_exec_printed.clear();
449 }
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.

◆ subdomainChanged()

void ComputeIndicatorThread::subdomainChanged ( )
overridevirtual

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 from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 50 of file ComputeIndicatorThread.C.

51 {
53 
56 
57  std::set<MooseVariableFEBase *> needed_moose_vars;
58  _indicator_whs.updateVariableDependency(needed_moose_vars, _tid);
61 
62  // Update variable coupleable vector tags
63  std::set<TagID> needed_var_vector_tags;
65  _subdomain, needed_var_vector_tags, _tid);
67  _subdomain, needed_var_vector_tags, _tid);
69  _subdomain, needed_var_vector_tags, _tid);
71 
72  std::unordered_set<unsigned int> needed_mat_props;
73  _indicator_whs.updateMatPropDependency(needed_mat_props, _tid);
75 
76  _fe_problem.prepareMaterials(needed_mat_props, _subdomain, _tid);
77 }
void updateVariableDependency(std::set< MooseVariableFieldBase *> &needed_moose_vars, THREAD_ID tid=0) const
Update variable dependency vector.
const MooseObjectWarehouse< InternalSideIndicator > & _internal_side_indicators
InternalSideIndicator Storage.
const MaterialWarehouse & getMaterialWarehouse() const
virtual void setActiveElementalMooseVariables(const std::set< MooseVariableFEBase *> &moose_vars, const THREAD_ID tid) override
Set the MOOSE variables to be reinited on each element.
void updateMatPropDependency(std::unordered_set< unsigned int > &needed_mat_props, THREAD_ID tid=0) const
Update material property dependency vector.
void updateBlockFEVariableCoupledVectorTagDependency(SubdomainID id, std::set< TagID > &needed_fe_var_vector_tags, THREAD_ID tid=0) const
Update FE variable coupleable vector tag vector.
virtual void subdomainSetup(SubdomainID subdomain, const THREAD_ID tid)
const MooseObjectWarehouse< Indicator > & _indicator_whs
Indicator Storage.
SubdomainID _subdomain
The subdomain for the current element.
virtual void setActiveFEVariableCoupleableVectorTags(std::set< TagID > &vtags, const THREAD_ID tid) override
void prepareMaterials(const std::unordered_set< unsigned int > &consumer_needed_mat_props, const SubdomainID blk_id, const THREAD_ID tid)
Add the MooseVariables and the material properties that the current materials depend on to the depend...
virtual void subdomainSetup(THREAD_ID tid=0) const

Member Data Documentation

◆ _aux_sys

AuxiliarySystem& ComputeIndicatorThread::_aux_sys
protected

Definition at line 56 of file ComputeIndicatorThread.h.

Referenced by onElement(), and onInternalSide().

◆ _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().

◆ _fe_problem

FEProblemBase& ComputeIndicatorThread::_fe_problem
protected

◆ _finalize

bool ComputeIndicatorThread::_finalize
protected

◆ _indicator_whs

const MooseObjectWarehouse<Indicator>& ComputeIndicatorThread::_indicator_whs
protected

Indicator Storage.

Definition at line 59 of file ComputeIndicatorThread.h.

Referenced by onElement(), printBlockExecutionInformation(), and subdomainChanged().

◆ _internal_side_indicators

const MooseObjectWarehouse<InternalSideIndicator>& ComputeIndicatorThread::_internal_side_indicators
protected

◆ _mesh

MooseMesh& ThreadedElementLoopBase< ConstElemRange >::_mesh
protectedinherited

◆ _neighbor_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_neighbor_subdomain
protectedinherited

The subdomain for the current neighbor.

Definition at line 172 of file ThreadedElementLoopBase.h.

Referenced by ComputeJacobianForScalingThread::operator()().

◆ _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()().

◆ _subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_subdomain
protectedinherited

◆ _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(), ComputeFullJacobianThread::computeOnInternalFace(), NonlinearThread::computeOnInternalFace(), ComputeResidualThread::determineObjectWarehouses(), ComputeJacobianThread::determineObjectWarehouses(), ComputeResidualAndJacobianThread::determineObjectWarehouses(), ComputeMaterialsObjectThread::onBoundary(), NonlinearThread::onBoundary(), ComputeUserObjectsThread::onBoundary(), ComputeMarkerThread::onElement(), ComputeElemDampingThread::onElement(), ComputeMaterialsObjectThread::onElement(), onElement(), HDGPrimalSolutionUpdateThread::onElement(), NonlinearThread::onElement(), ComputeUserObjectsThread::onElement(), ComputeMaterialsObjectThread::onInterface(), NonlinearThread::onInterface(), ComputeUserObjectsThread::onInterface(), onInternalSide(), ComputeMaterialsObjectThread::onInternalSide(), NonlinearThread::onInternalSide(), ComputeUserObjectsThread::onInternalSide(), ComputeJacobianForScalingThread::operator()(), ComputeMaterialsObjectThread::post(), ComputeMarkerThread::post(), post(), ComputeUserObjectsThread::post(), ComputeJacobianThread::postElement(), ComputeJacobianBlocksThread::postElement(), ComputeJacobianBlocksThread::postInternalSide(), ComputeMarkerThread::printBlockExecutionInformation(), printBlockExecutionInformation(), ComputeUserObjectsThread::printBlockExecutionInformation(), NonlinearThread::printBlockExecutionInformation(), NonlinearThread::printBoundaryExecutionInformation(), ComputeElemDampingThread::printGeneralExecutionInformation(), ComputeMarkerThread::printGeneralExecutionInformation(), printGeneralExecutionInformation(), ComputeUserObjectsThread::printGeneralExecutionInformation(), NonlinearThread::printGeneralExecutionInformation(), ComputeUserObjectsThread::queryBoundary(), ComputeUserObjectsThread::querySubdomain(), ComputeMarkerThread::subdomainChanged(), ComputeMaterialsObjectThread::subdomainChanged(), subdomainChanged(), HDGPrimalSolutionUpdateThread::subdomainChanged(), NonlinearThread::subdomainChanged(), and ComputeUserObjectsThread::subdomainChanged().


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