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

#include <BoundaryNodeIntegrityCheckThread.h>

Inheritance diagram for BoundaryNodeIntegrityCheckThread:
[legend]

Public Member Functions

 BoundaryNodeIntegrityCheckThread (FEProblemBase &fe_problem, const TheWarehouse::Query &query)
 
 BoundaryNodeIntegrityCheckThread (BoundaryNodeIntegrityCheckThread &x, Threads::split split)
 
virtual void onNode (ConstBndNodeRange::const_iterator &node_it) override
 
void join (const BoundaryNodeIntegrityCheckThread &)
 
void operator() (const ConstBndNodeRange &range)
 
virtual void pre ()
 Called before the node range loop.
 
virtual void post ()
 Called after the node range loop.
 
virtual void onNode (ConstBndNodeRange::const_iterator &node_it)
 Called for each node.
 
virtual void postNode (ConstBndNodeRange::const_iterator &node_it)
 Called after the node assembly is done (including surface assembling)
 
virtual void caughtMooseException (MooseException &e)
 Called if a MooseException is caught anywhere during the computation.
 
virtual bool keepGoing ()
 Whether or not the loop should continue.
 

Protected Member Functions

virtual void printGeneralExecutionInformation () const
 Print information about the loop, mostly order of execution of objects.
 
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.
 

Protected Attributes

const TheWarehouse::Query & _query
 A warehouse query that we will use to obtain user objects for boundary variable dependency integrity checks.
 
FEProblemBase & _fe_problem
 
THREAD_ID _tid
 

Detailed Description

Definition at line 20 of file BoundaryNodeIntegrityCheckThread.h.

Constructor & Destructor Documentation

◆ BoundaryNodeIntegrityCheckThread() [1/2]

BoundaryNodeIntegrityCheckThread::BoundaryNodeIntegrityCheckThread ( FEProblemBase &  fe_problem,
const TheWarehouse::Query &  query 
)

Definition at line 26 of file BoundaryNodeIntegrityCheckThread.C.

29 _query(query)
30{
31}
const TheWarehouse::Query & _query
A warehouse query that we will use to obtain user objects for boundary variable dependency integrity ...

◆ BoundaryNodeIntegrityCheckThread() [2/2]

BoundaryNodeIntegrityCheckThread::BoundaryNodeIntegrityCheckThread ( BoundaryNodeIntegrityCheckThread &  x,
Threads::split  split 
)

Member Function Documentation

◆ caughtMooseException()

virtual void ThreadedNodeLoop< ConstBndNodeRange , ConstBndNodeRange::const_iterator >::caughtMooseException ( MooseException &  e)
inlinevirtualinherited

Called if a MooseException is caught anywhere during the computation.

The single input parameter taken is a MooseException object.

Definition at line 56 of file ThreadedNodeLoop.h.

57 {
58 Threads::spin_mutex::scoped_lock lock(threaded_node_mutex);
59
60 std::string what(e.what());
62 };
static Threads::spin_mutex threaded_node_mutex
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.

◆ join()

void BoundaryNodeIntegrityCheckThread::join ( const BoundaryNodeIntegrityCheckThread &  )

Definition at line 86 of file BoundaryNodeIntegrityCheckThread.C.

87{
88}

◆ keepGoing()

virtual bool ThreadedNodeLoop< ConstBndNodeRange , ConstBndNodeRange::const_iterator >::keepGoing ( )
inlinevirtualinherited

Whether or not the loop should continue.

Returns
true to keep going, false to stop.

Definition at line 69 of file ThreadedNodeLoop.h.

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

◆ onNode() [1/2]

Called for each node.

Definition at line 43 of file ThreadedNodeLoop.h.

153{
154}

◆ onNode() [2/2]

void BoundaryNodeIntegrityCheckThread::onNode ( ConstBndNodeRange::const_iterator &  node_it)
overridevirtual

Definition at line 42 of file BoundaryNodeIntegrityCheckThread.C.

43{
44 const BndNode * const bnode = *node_it;
45 const auto boundary_id = bnode->_bnd_id;
46 const Node * const node = bnode->_node;
47
48 // We can distribute work just as the actual execution code will
49 if (node->processor_id() != _fe_problem.processor_id())
50 return;
51
52 const auto & bnd_name = _fe_problem.mesh().getBoundaryName(boundary_id);
53
54 // uo check
55 std::vector<NodalUserObject *> objs;
58 .condition<AttribInterfaces>(Interfaces::NodalUserObject)
59 .condition<AttribBoundaries>(boundary_id, true)
60 .queryInto(objs);
61 for (const auto & uo : objs)
62 if (uo->checkVariableBoundaryIntegrity())
63 boundaryIntegrityCheckError(*uo, uo->checkAllVariables(*node), bnd_name);
64
65 // AttribSystem groups AuxKernel/VectorAuxKernel/ArrayAuxKernel under the same "AuxKernel" tag,
66 // so one query into the common AuxKernelBase type covers all three value types. Mortar
67 // AuxKernels are excluded: their boundaryIDs() report the primary/secondary boundaries they
68 // couple across, but their coupled variables are only required to be defined on the mortar
69 // segment mesh, not on every node of those boundaries.
70 std::vector<AuxKernelBase *> auxkernels;
72 .query()
73 .condition<AttribSystem>("AuxKernel")
74 .condition<AttribThread>(_tid)
76 .condition<AttribBoundaries>(boundary_id, true)
77 .queryInto(auxkernels);
78 for (const auto & aux : auxkernels)
79 // Skip if this object uses geometric search because coupled variables may be defined on
80 // paired boundaries instead of the boundary this node is on
81 if (!aux->requiresGeometricSearch() && aux->checkVariableBoundaryIntegrity())
82 boundaryIntegrityCheckError(*aux, aux->checkAllVariables(*node), bnd_name);
83}
@ Nodal
Execution categories.
void boundaryIntegrityCheckError(const MooseObject &object, const std::set< MooseVariableFieldBase * > &variables, const BoundaryName &boundary_name)
Compose boundary restricted error message for the provided object, variables, and boundary_name if th...
if(!dmm->_nl) SETERRQ(PETSC_COMM_WORLD
Tracks the AuxKernelType of an AuxKernel: its value type (Real/Vector/Array) and its execution catego...
Definition Attributes.h:336
AttribBoundaries tracks all boundary IDs associated with an object.
Definition Attributes.h:223
virtual MooseMesh & mesh() override
TheWarehouse & theWarehouse() const
const std::string & getBoundaryName(const BoundaryID boundary_id) const
Return the name of the boundary given the id.
Definition MooseMesh.C:1787
QueryCache & condition(Args &&... args)
Adds a new condition to the query.
QueryCache clone() const
clone creates and returns an independent copy of the query in its current state.
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse.
processor_id_type processor_id() const
BoundaryID _bnd_id
boundary id for the node
Definition BndNode.h:26
libMesh::Node * _node
pointer to the node
Definition BndNode.h:24

◆ operator()()

void ThreadedNodeLoop< ConstBndNodeRange , ConstBndNodeRange::const_iterator >::operator() ( const ConstBndNodeRange &  range)
inherited

Definition at line 28 of file ThreadedNodeLoop.h.

111{
112 try
113 {
114 ParallelUniqueId puid;
115 _tid = puid.id;
116
117 pre();
119
120 for (IteratorType nd = range.begin(); nd != range.end(); ++nd)
121 {
122 if (!keepGoing())
123 break;
124
125 onNode(nd);
126
127 postNode(nd);
128 }
129
130 post();
131 }
132 catch (MooseException & e)
133 {
135 }
136}
Provides a way for users to bail out of the current solve.
virtual void printGeneralExecutionInformation() const
Print information about the loop, mostly order of execution of objects.
virtual void postNode(ConstBndNodeRange::const_iterator &node_it)
Called after the node assembly is done (including surface assembling)
virtual void onNode(ConstBndNodeRange::const_iterator &node_it)
Called for each node.
virtual bool keepGoing()
Whether or not the loop should continue.
virtual void caughtMooseException(MooseException &e)
Called if a MooseException is caught anywhere during the computation.
const_iterator begin() const
const_iterator end() const

◆ post()

Called after the node range loop.

Definition at line 38 of file ThreadedNodeLoop.h.

147{
148}

◆ postNode()

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

Parameters
node- active node

Definition at line 50 of file ThreadedNodeLoop.h.

159{
160}

◆ pre()

Called before the node range loop.

Reimplemented in ComputeNodalKernelBCJacobiansThread, and ComputeNodalKernelBcsThread.

Definition at line 33 of file ThreadedNodeLoop.h.

141{
142}

◆ printExecutionOrdering()

void ThreadedNodeLoop< ConstBndNodeRange , ConstBndNodeRange::const_iterator >::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)
print_headerwhether to print a header about the timing of execution and the type of objects
line_prefixprefix to prepend to each line of the console output

Definition at line 90 of file ThreadedNodeLoop.h.

167{
168 if (!objs.size())
169 return;
170
171 auto & console = _fe_problem.console();
172 const auto objects_type = MooseUtils::prettyCppType(objs[0]);
173 std::vector<MooseObject *> moose_objs;
174 moose_objs.reserve(objs.size());
175 for (auto obj_ptr : objs)
176 moose_objs.push_back(cast_ptr<MooseObject *>(obj_ptr));
177 const auto names = ConsoleUtils::mooseObjectVectorToString(moose_objs);
178
179 // Print string with a DBG prefix and with sufficient line breaks
180 std::string message = print_header ? "Executing " + objects_type + " on " +
182 : "";
183 message += (print_header ? "Order of execution:\n" : "") + names;
184 console << ConsoleUtils::formatString(message, line_prefix) << std::endl;
185}
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
const ConsoleStream & console() const
Return console handle.
Definition Problem.h:48
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)
Tnew cast_ptr(Told *oldvar)

◆ printGeneralExecutionInformation()

virtual void ThreadedNodeLoop< ConstBndNodeRange , ConstBndNodeRange::const_iterator >::printGeneralExecutionInformation ( ) const
inlineprotectedvirtualinherited

Print information about the loop, mostly order of execution of objects.

Reimplemented in ComputeNodalAuxBcsThread< AuxKernelType >, ComputeNodalKernelBCJacobiansThread, and ComputeNodalKernelBcsThread.

Definition at line 76 of file ThreadedNodeLoop.h.

76{}

Member Data Documentation

◆ _fe_problem

Definition at line 72 of file ThreadedNodeLoop.h.

◆ _query

const TheWarehouse::Query& BoundaryNodeIntegrityCheckThread::_query
protected

A warehouse query that we will use to obtain user objects for boundary variable dependency integrity checks.

Definition at line 36 of file BoundaryNodeIntegrityCheckThread.h.

Referenced by onNode().

◆ _tid

Definition at line 73 of file ThreadedNodeLoop.h.


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