https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ComputeDiracThread Class Reference

#include <ComputeDiracThread.h>

Inheritance diagram for ComputeDiracThread:
[legend]

Public Member Functions

 ComputeDiracThread (FEProblemBase &feproblem, const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags, Moose::ComputeType compute_type)
 
 ComputeDiracThread (ComputeDiracThread &x, Threads::split)
 
virtual ~ComputeDiracThread ()
 
virtual void subdomainChanged () override
 Called every time the current subdomain changes (i.e.
 
virtual void pre () override
 Called before the element range loop.
 
virtual void onElement (const Elem *elem) override
 Assembly of the element (not including surface assembly)
 
virtual void postElement (const Elem *) override
 Called after the element assembly is done (including surface assembling)
 
virtual void post () override
 Called after the element range loop.
 
void join (const ComputeDiracThread &)
 
virtual void caughtMooseException (MooseException &e) override
 Called if a MooseException is caught anywhere during the computation.
 
virtual bool keepGoing () override
 Whether or not the loop should continue.
 
virtual void preElement (const Elem *elem) override
 Called before the element assembly.
 
virtual void preInternalSide (const Elem *elem, unsigned int side) override
 Called before evaluations on an element internal side.
 
virtual void preBoundary (const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr) override
 Called before the boundary assembly.
 
virtual void neighborSubdomainChanged () override
 Called every time the neighbor subdomain changes (i.e.
 
virtual void operator() (const RangeType &range, bool bypass_threading=false)
 
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 postInternalSide (const Elem *elem, unsigned int side)
 Called after evaluations on an element internal side.
 
virtual void onInternalSide (const Elem *elem, unsigned int side)
 Called when doing internal edge assembling.
 
virtual void onExternalSide (const Elem *elem, unsigned int side)
 Called when iterating over external sides (no side neighbor)
 
virtual void onInterface (const Elem *elem, unsigned int side, BoundaryID bnd_id)
 Called when doing interface assembling.
 

Protected Member Functions

void printGeneralExecutionInformation () const override
 Output a message indicating execution on this execution flag.
 
void printBlockExecutionInformation () const override
 Output the order of execution of objects within the current subdomain.
 
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.
 
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.
 
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.
 

Protected Attributes

Moose::ComputeType _compute_type
 
NonlinearSystemBase_nl
 
const std::set< TagID > & _vector_tags
 
const std::set< TagID > & _matrix_tags
 
MooseObjectTagWarehouse< DiracKernelBase > & _dirac_kernels
 Storage for DiracKernel objects.
 
MooseObjectWarehouse< DiracKernelBase > * _dirac_warehouse
 
FEProblemBase_fe_problem
 
MooseMesh_mesh
 
THREAD_ID _tid
 
SubdomainID _subdomain
 The subdomain for the current element.
 
SubdomainID _old_subdomain
 The subdomain for the last element.
 
SubdomainID _neighbor_subdomain
 The subdomain for the current neighbor.
 
SubdomainID _old_neighbor_subdomain
 The subdomain for the last neighbor.
 
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.
 

Detailed Description

Definition at line 28 of file ComputeDiracThread.h.

Constructor & Destructor Documentation

◆ ComputeDiracThread() [1/2]

ComputeDiracThread::ComputeDiracThread ( FEProblemBase feproblem,
const std::set< TagID > &  vector_tags,
const std::set< TagID > &  matrix_tags,
Moose::ComputeType  compute_type 
)

Definition at line 23 of file ComputeDiracThread.C.

28 _compute_type(compute_type),
29 _nl(feproblem.currentNonlinearSystem()),
30 _vector_tags(vector_tags),
31 _matrix_tags(matrix_tags),
33{
34}
Moose::ComputeType _compute_type
MooseObjectTagWarehouse< DiracKernelBase > & _dirac_kernels
Storage for DiracKernel objects.
const std::set< TagID > & _matrix_tags
NonlinearSystemBase & _nl
const std::set< TagID > & _vector_tags
NonlinearSystemBase & currentNonlinearSystem()
MooseObjectTagWarehouse< DiracKernelBase > & getDiracKernelWarehouse()
Base class for assembly-like calculations.

◆ ComputeDiracThread() [2/2]

ComputeDiracThread::ComputeDiracThread ( ComputeDiracThread x,
Threads::split  split 
)

◆ ~ComputeDiracThread()

ComputeDiracThread::~ComputeDiracThread ( )
virtual

Definition at line 47 of file ComputeDiracThread.C.

47{}

Member Function Documentation

◆ caughtMooseException()

void ThreadedElementLoop< DistElemRange >::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< RangeType >.

Definition at line 43 of file ThreadedElementLoop.h.

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

◆ clearVarsAndMaterials()

void ThreadedElementLoop< DistElemRange >::clearVarsAndMaterials ( )
protectedinherited

Definition at line 60 of file ThreadedElementLoop.h.

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 ComputeDiracThread::join ( const ComputeDiracThread )

Definition at line 185 of file ComputeDiracThread.C.

186{
187}

◆ keepGoing()

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

Whether or not the loop should continue.

Returns
true to keep going, false to stop.

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 45 of file ThreadedElementLoop.h.

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

◆ neighborSubdomainChanged()

void ThreadedElementLoop< DistElemRange >::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< RangeType >.

Definition at line 56 of file ThreadedElementLoop.h.

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

◆ onBoundary()

template<typename RangeType >
void ThreadedElementLoopBase< RangeType >::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 ComputeIndicatorThread, ComputeMarkerThread, ComputeMaterialsObjectThread, ComputeUserObjectsThread, NonlinearThread, and ProjectMaterialProperties.

Definition at line 371 of file ThreadedElementLoopBase.h.

375{
376}

◆ onElement()

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

Assembly of the element (not including surface assembly)

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 99 of file ComputeDiracThread.C.

100{
101 const bool has_dirac_kernels_on_elem = _fe_problem.reinitDirac(elem, _tid);
102 if (!has_dirac_kernels_on_elem)
103 return;
104
105 std::set<MooseVariableFEBase *> needed_moose_vars;
106 const auto & dkernels = _dirac_warehouse->getActiveObjects(_tid);
107
108 // Only call reinitMaterials() if one or more DiracKernels has
109 // actually called getMaterialProperty(). Loop over all the
110 // DiracKernels and check whether this is the case.
111 for (const auto & dirac_kernel : dkernels)
112 {
113 // If any of the DiracKernels have had getMaterialProperty()
114 // called, we need to reinit Materials.
115 if (dirac_kernel->getMaterialPropertyCalled())
116 {
117 _fe_problem.reinitMaterials(_subdomain, _tid, /*swap_stateful=*/false);
118 break;
119 }
120 }
121
122 for (const auto & dirac_kernel : dkernels)
123 {
124 if (!dirac_kernel->hasPointsOnElem(elem))
125 continue;
126
128 {
129 dirac_kernel->computeResidual();
130 continue;
131 }
133 {
134 dirac_kernel->computeResidualAndJacobian();
135 continue;
136 }
137
138 // Get a list of coupled variables from the SubProblem
139 const auto & coupling_entries =
140 dirac_kernel->subProblem().assembly(_tid, _nl.number()).couplingEntries();
141
142 // Loop over the list of coupled variable pairs
143 for (const auto & it : coupling_entries)
144 {
145 const MooseVariableFEBase * const ivariable = it.first;
146 const MooseVariableFEBase * const jvariable = it.second;
147
148 // A variant of the check that is in
149 // ComputeFullJacobianThread::computeJacobian(). We
150 // only want to call computeOffDiagJacobian() if both
151 // variables are active on this subdomain, and the
152 // off-diagonal variable actually has dofs.
153 if (dirac_kernel->variable().number() == ivariable->number() &&
154 ivariable->activeOnSubdomain(_subdomain) && jvariable->activeOnSubdomain(_subdomain) &&
155 (jvariable->numberOfDofs() > 0))
156 {
157 dirac_kernel->prepareShapes(jvariable->number());
158 dirac_kernel->computeOffDiagJacobian(jvariable->number());
159 }
160 }
161 }
162
163 // Note that we do not call swapBackMaterials() here as they were
164 // never swapped in the first place. This avoids messing up
165 // stored values of stateful material properties.
166}
MooseObjectWarehouse< DiracKernelBase > * _dirac_warehouse
virtual bool reinitDirac(const Elem *elem, const THREAD_ID tid) override
Returns true if the Problem has Dirac kernels it needs to compute on elem.
void reinitMaterials(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true)
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread.
virtual unsigned int numberOfDofs() const
Get the number of local DoFs.
unsigned int number() const
Get variable number coming from libMesh.
This class provides an interface for common operations on field variables of both FE and FV types wit...
bool activeOnSubdomain(SubdomainID subdomain) const
Is the variable active on the subdomain?
unsigned int number() const
Gets the number of this system.
SubdomainID _subdomain
The subdomain for the current element.

◆ onExternalSide()

template<typename RangeType >
void ThreadedElementLoopBase< RangeType >::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, and NonlinearThread.

Definition at line 398 of file ThreadedElementLoopBase.h.

399{
400}

◆ onInterface()

template<typename RangeType >
void ThreadedElementLoopBase< RangeType >::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 ComputeMaterialsObjectThread, ComputeUserObjectsThread, and NonlinearThread.

Definition at line 404 of file ThreadedElementLoopBase.h.

407{
408}

◆ onInternalSide()

template<typename RangeType >
void ThreadedElementLoopBase< RangeType >::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 ComputeIndicatorThread, ComputeMarkerThread, ComputeMaterialsObjectThread, ComputeUserObjectsThread, NonlinearThread, and ProjectMaterialProperties.

Definition at line 392 of file ThreadedElementLoopBase.h.

393{
394}

◆ operator()()

template<typename RangeType >
void ThreadedElementLoopBase< RangeType >::operator() ( const RangeType &  range,
bool  bypass_threading = false 
)
virtualinherited

Definition at line 226 of file ThreadedElementLoopBase.h.

227{
228 try
229 {
230 try
231 {
232 ParallelUniqueId puid;
233 _tid = bypass_threading ? 0 : puid.id;
234
235 pre();
237
240 typename RangeType::const_iterator el = range.begin();
241 for (el = range.begin(); el != range.end(); ++el)
242 {
243 if (!keepGoing())
244 break;
245
246 const Elem * elem = *el;
247
248 preElement(elem);
249
251 _subdomain = elem->subdomain_id();
253 {
256 }
257
258 onElement(elem);
259
260 if (_mesh.interiorLowerDBlocks().count(elem->subdomain_id()) > 0 ||
261 _mesh.boundaryLowerDBlocks().count(elem->subdomain_id()) > 0)
262 {
263 postElement(elem);
264 continue;
265 }
266
267 const auto elem_boundary_ids = _mesh.getBoundaryIDs(elem);
268 for (unsigned int side = 0; side < elem->n_sides(); side++)
269 {
270 const auto & boundary_ids = elem_boundary_ids[side];
271 const Elem * lower_d_elem = _mesh.getLowerDElem(elem, side);
272
273 for (const auto bnd_id : boundary_ids)
274 {
275 preBoundary(elem, side, bnd_id, lower_d_elem);
277 onBoundary(elem, side, bnd_id, 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 for (const auto bnd_id : boundary_ids)
294 onInterface(elem, side, bnd_id);
295
296 postInternalSide(elem, side);
297 }
298 else
299 onExternalSide(elem, side);
300 } // sides
301
302 postElement(elem);
303 } // range
304
305 post();
307 }
308 catch (MetaPhysicL::LogicError & e)
309 {
311 }
312 catch (std::exception & e)
313 {
314 // Continue if we find a libMesh degenerate map exception, but
315 // just re-throw for any real error
316 if (!strstr(e.what(), "Jacobian") && !strstr(e.what(), "singular") &&
317 !strstr(e.what(), "det != 0"))
318 throw; // not "throw e;" - that destroys type info!
319
320 mooseException("We caught a libMesh degeneracy exception in ThreadedElementLoopBase:\n",
321 e.what());
322 }
323 }
324 catch (MooseException & e)
325 {
327 }
328}
Provides a way for users to bail out of the current solve.
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:1700
const std::set< SubdomainID > & interiorLowerDBlocks() const
Definition MooseMesh.h:1546
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.
Definition MooseMesh.C:3037
const std::set< SubdomainID > & boundaryLowerDBlocks() const
Definition MooseMesh.h:1550
virtual void onExternalSide(const Elem *elem, unsigned int side)
Called when iterating over external sides (no side neighbor)
virtual void caughtMooseException(MooseException &)
Called if a MooseException is caught anywhere during the computation.
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 printBoundaryExecutionInformation(const unsigned int) const
Print information about the particular ordering of objects on each boundary.
virtual void neighborSubdomainChanged()
Called every time the neighbor subdomain changes (i.e.
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.
virtual bool keepGoing()
Whether or not the loop should continue.
void resetExecPrintedSets() const
Resets the set of blocks and boundaries visited.
SubdomainID _old_subdomain
The subdomain for the last element.
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.
virtual void subdomainChanged()
Called every time the current subdomain changes (i.e.
virtual void onInternalSide(const Elem *elem, unsigned int side)
Called when doing internal edge assembling.
virtual void preBoundary(const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr)
Called before the boundary assembly.
virtual void onElement(const Elem *elem)
Assembly of the element (not including surface assembly)
virtual void postElement(const Elem *elem)
Called after the element assembly is done (including surface assembling)
virtual void preElement(const Elem *elem)
Called before the element assembly.
SubdomainID _old_neighbor_subdomain
The subdomain for the last neighbor.
SubdomainID _neighbor_subdomain
The subdomain for the current neighbor.
virtual void printBlockExecutionInformation() const
Print information about the particular ordering of objects on each block.
virtual void post()
Called after the element range loop.
virtual void pre()
Called before the element range loop.
virtual bool shouldComputeInternalSide(const Elem &elem, const Elem &neighbor) const
Whether to compute the internal side for the provided element-neighbor pair.
const SubdomainID INVALID_BLOCK_ID
Definition MooseTypes.C:20
void translateMetaPhysicLError(const MetaPhysicL::LogicError &)
emit a relatively clear error message when we catch a MetaPhysicL logic error
Definition MooseError.C:155

Referenced by NonlinearThread::operator()().

◆ post()

void ComputeDiracThread::post ( )
overridevirtual

Called after the element range loop.

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 178 of file ComputeDiracThread.C.

◆ postElement()

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

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

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 169 of file ComputeDiracThread.C.

170{
175}
virtual void addResidual(const THREAD_ID tid) override
virtual void addJacobian(const THREAD_ID tid) override

◆ postInternalSide()

template<typename RangeType >
void ThreadedElementLoopBase< RangeType >::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 386 of file ThreadedElementLoopBase.h.

387{
388}

◆ pre()

void ComputeDiracThread::pre ( )
overridevirtual

Called before the element range loop.

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 50 of file ComputeDiracThread.C.

51{
52 // Force TID=0 because we run this object _NON THREADED_
53 // Take this out if we ever get Dirac's working with threads!
54 _tid = 0;
55}

◆ preBoundary()

void ThreadedElementLoop< DistElemRange >::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< RangeType >.

Definition at line 51 of file ThreadedElementLoop.h.

133{
135}
virtual void setCurrentBoundaryID(BoundaryID bid, const THREAD_ID tid) override
sets the current boundary ID in assembly

◆ preElement()

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

Called before the element assembly.

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 47 of file ThreadedElementLoop.h.

116{
118}
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override

◆ preInternalSide()

void ThreadedElementLoop< DistElemRange >::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< RangeType >.

Definition at line 49 of file ThreadedElementLoop.h.

123{
125}
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, const THREAD_ID tid) override

◆ prepareElement()

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

Definition at line 59 of file ThreadedElementLoop.h.

187{
188 _fe_problem.prepare(elem, this->_tid);
189 _fe_problem.reinitElem(elem, this->_tid);
191}
virtual void reinitElem(const Elem *elem, const THREAD_ID tid) override
virtual void prepare(const Elem *elem, const THREAD_ID tid) override

◆ printBlockExecutionInformation()

void ComputeDiracThread::printBlockExecutionInformation ( ) const
overrideprotectedvirtual

Output the order of execution of objects within the current subdomain.

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 200 of file ComputeDiracThread.C.

201{
204 return;
205
206 const auto & dkernels = _dirac_warehouse->getActiveBlockObjects(_subdomain, _tid);
207 const auto & console = _fe_problem.console();
208 console << "[DBG] Ordering of DiracKernels on subdomain " << _subdomain << std::endl;
209 printExecutionOrdering<DiracKernelBase>(dkernels, false);
211}
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
bool hasActiveBlockObjects(THREAD_ID tid=0) const
const ConsoleStream & console() const
Return console handle.
Definition Problem.h:48
std::set< SubdomainID > _blocks_exec_printed
Keep track of which blocks were visited.

◆ printBoundaryExecutionInformation()

template<typename RangeType >
virtual void ThreadedElementLoopBase< RangeType >::printBoundaryExecutionInformation ( const unsigned int  ) const
inlineprotectedvirtualinherited

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

Reimplemented in NonlinearThread.

Definition at line 187 of file ThreadedElementLoopBase.h.

187{}

◆ printExecutionOrdering() [1/2]

void ThreadedElementLoop< DistElemRange >::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 80 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}
const Elem & get(const ElemType type_in)

◆ printExecutionOrdering() [2/2]

void ThreadedElementLoop< DistElemRange >::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 76 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}
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
const std::string & name() const
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
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...
std::string mooseObjectVectorToString(const std::vector< MooseObject * > &objs, const std::string &sep=" ")
Routine to output the name of MooseObjects in a string.
std::string prettyCppType(const std::string &cpp_type)

◆ printGeneralExecutionInformation()

void ComputeDiracThread::printGeneralExecutionInformation ( ) const
overrideprotectedvirtual

Output a message indicating execution on this execution flag.

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 190 of file ComputeDiracThread.C.

191{
193 return;
194 const auto & console = _fe_problem.console();
195 console << "[DBG] Executing Dirac Kernels on " << _fe_problem.getCurrentExecuteOnFlag().name()
196 << std::endl;
197}

◆ resetExecPrintedSets()

template<typename RangeType >
void ThreadedElementLoopBase< RangeType >::resetExecPrintedSets ( ) const
protectedinherited

Resets the set of blocks and boundaries visited.

Definition at line 454 of file ThreadedElementLoopBase.h.

455{
456 _blocks_exec_printed.clear();
458}
std::set< BoundaryID > _boundaries_exec_printed
Keep track of which boundaries were visited.

◆ shouldComputeInternalSide()

template<typename RangeType >
bool ThreadedElementLoopBase< RangeType >::shouldComputeInternalSide ( const Elem &  elem,
const Elem &  neighbor 
) const
protectedvirtualinherited

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 in FlagElementsThread, ProjectMaterialProperties, CacheChangedListsThread, and NonlinearThread.

Definition at line 424 of file ThreadedElementLoopBase.h.

426{
427 // If we're going to compute the internal side with this elem-neighbor pair, then they must both
428 // be active. Note that if elem is an active coarse element at an interface with finer elements,
429 // then its neighbor will be an equal-level inactive element, hence the following
430 // neighbor.active() check. In that case we'll catch current 'elem' when we come around and
431 // examine one of the finer elements as 'elem'
432 mooseAssert(elem.active(), "This method should never be called with an inactive element");
433 if (!neighbor.active())
434 return false;
435
436 //
437 // Define an ordering: first prefer finer by h (higher level()), then prefer finer by p (higher
438 // p_level()), then prefer smaller id()"
439 //
440
441 const auto elem_level = elem.level(), neighbor_level = neighbor.level();
442 if (elem_level != neighbor_level)
443 return elem_level > neighbor_level;
444
445 const auto elem_p_level = elem.p_level(), neighbor_p_level = neighbor.p_level();
446 if (elem_p_level != neighbor_p_level)
447 return elem_p_level > neighbor_p_level;
448
449 return elem.id() < neighbor.id();
450}

Referenced by NonlinearThread::shouldComputeInternalSide().

◆ subdomainChanged()

void ComputeDiracThread::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< RangeType >.

Definition at line 58 of file ComputeDiracThread.C.

59{
61
62 std::set<MooseVariableFEBase *> needed_moose_vars;
64
65 // Update material dependencies
66 std::unordered_set<unsigned int> needed_mat_props;
68
71
72 // The combined path always operates on the full suite of residual and Jacobian tags, so there's
73 // no need for (and no single tag set to do) tag-based warehouse selection
75 {
77 return;
78 }
79
80 const bool is_jacobian = _compute_type == Moose::ComputeType::Jacobian;
81 const std::set<TagID> & tags = is_jacobian ? _matrix_tags : _vector_tags;
82
83 // If users pass a empty vector or a full size of vector,
84 // we take all kernels
85 if (!tags.size() || tags.size() == _fe_problem.numMatrixTags())
87 // If we have one tag only, We call tag based storage
88 else if (tags.size() == 1)
89 _dirac_warehouse = is_jacobian
91 : &(_dirac_kernels.getVectorTagObjectWarehouse(*(tags.begin()), _tid));
92 // This one may be expensive, and hopefully we do not use it so often
93 else
95 : &(_dirac_kernels.getVectorTagsObjectWarehouse(tags, _tid));
96}
void setActiveMaterialProperties(const std::unordered_set< unsigned int > &mat_prop_ids, const THREAD_ID tid)
Record and set the material properties required by the current computing thread.
virtual void setActiveElementalMooseVariables(const std::set< MooseVariableFEBase * > &moose_vars, const THREAD_ID tid) override
Set the MOOSE variables to be reinited on each element.
virtual void subdomainSetup(SubdomainID subdomain, const THREAD_ID tid)
MooseObjectWarehouse< T > & getMatrixTagsObjectWarehouse(const std::set< TagID > &tags, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has one of the given matrix tags.
MooseObjectWarehouse< T > & getMatrixTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given matrix tag.
void updateVariableDependency(std::set< MooseVariableFieldBase * > &needed_moose_vars, THREAD_ID tid=0) const
Update variable dependency vector.
void updateMatPropDependency(std::unordered_set< unsigned int > &needed_mat_props, THREAD_ID tid=0, const bool producer_only=false) const
Update material property dependency vector.
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition SubProblem.h:248

Member Data Documentation

◆ _blocks_exec_printed

template<typename RangeType >
std::set<SubdomainID> ThreadedElementLoopBase< RangeType >::_blocks_exec_printed
mutableprotectedinherited

◆ _boundaries_exec_printed

template<typename RangeType >
std::set<BoundaryID> ThreadedElementLoopBase< RangeType >::_boundaries_exec_printed
mutableprotectedinherited

Keep track of which boundaries were visited.

Definition at line 193 of file ThreadedElementLoopBase.h.

Referenced by NonlinearThread::printBoundaryExecutionInformation().

◆ _compute_type

Moose::ComputeType ComputeDiracThread::_compute_type
protected

Definition at line 56 of file ComputeDiracThread.h.

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

◆ _dirac_kernels

MooseObjectTagWarehouse<DiracKernelBase>& ComputeDiracThread::_dirac_kernels
protected

Storage for DiracKernel objects.

Definition at line 63 of file ComputeDiracThread.h.

Referenced by subdomainChanged().

◆ _dirac_warehouse

MooseObjectWarehouse<DiracKernelBase>* ComputeDiracThread::_dirac_warehouse
protected

◆ _fe_problem

FEProblemBase& ThreadedElementLoop< DistElemRange >::_fe_problem
protectedinherited

Definition at line 62 of file ThreadedElementLoop.h.

◆ _matrix_tags

const std::set<TagID>& ComputeDiracThread::_matrix_tags
protected

Definition at line 60 of file ComputeDiracThread.h.

Referenced by subdomainChanged().

◆ _mesh

template<typename RangeType >
MooseMesh& ThreadedElementLoopBase< RangeType >::_mesh
protectedinherited

◆ _neighbor_subdomain

template<typename RangeType >
SubdomainID ThreadedElementLoopBase< RangeType >::_neighbor_subdomain
protectedinherited

◆ _nl

NonlinearSystemBase& ComputeDiracThread::_nl
protected

Definition at line 57 of file ComputeDiracThread.h.

Referenced by onElement().

◆ _old_neighbor_subdomain

template<typename RangeType >
SubdomainID ThreadedElementLoopBase< RangeType >::_old_neighbor_subdomain
protectedinherited

The subdomain for the last neighbor.

Definition at line 178 of file ThreadedElementLoopBase.h.

◆ _old_subdomain

template<typename RangeType >
SubdomainID ThreadedElementLoopBase< RangeType >::_old_subdomain
protectedinherited

The subdomain for the last element.

Definition at line 172 of file ThreadedElementLoopBase.h.

Referenced by ComputeJacobianForScalingThread::operator()().

◆ _subdomain

template<typename RangeType >
SubdomainID ThreadedElementLoopBase< RangeType >::_subdomain
protectedinherited

The subdomain for the current element.

Definition at line 169 of file ThreadedElementLoopBase.h.

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

◆ _tid

template<typename RangeType >
THREAD_ID ThreadedElementLoopBase< RangeType >::_tid
protectedinherited

Definition at line 166 of file ThreadedElementLoopBase.h.

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

◆ _vector_tags

const std::set<TagID>& ComputeDiracThread::_vector_tags
protected

Definition at line 59 of file ComputeDiracThread.h.

Referenced by subdomainChanged().


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