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

#include <ComputeBoundaryInitialConditionThread.h>

Inheritance diagram for ComputeBoundaryInitialConditionThread:
[legend]

Public Member Functions

 ComputeBoundaryInitialConditionThread (FEProblemBase &fe_problem)
 
 ComputeBoundaryInitialConditionThread (ComputeBoundaryInitialConditionThread &x, Threads::split split)
 
void onNode (ConstBndNodeRange::const_iterator &nd)
 
void join (const ComputeBoundaryInitialConditionThread &)
 
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.
 

Protected Attributes

FEProblemBase_fe_problem
 
THREAD_ID _tid
 

Private Member Functions

 ComputeBoundaryInitialConditionThread (FEProblemBase &fe_problem, const std::set< VariableName > *target_vars)
 Set IC on specific variables.
 

Private Attributes

const std::set< VariableName > * _target_vars = nullptr
 the names of target variables for which the initial conditions are applied
 

Friends

class FEProblemBase
 

Detailed Description

Definition at line 20 of file ComputeBoundaryInitialConditionThread.h.

Constructor & Destructor Documentation

◆ ComputeBoundaryInitialConditionThread() [1/3]

ComputeBoundaryInitialConditionThread::ComputeBoundaryInitialConditionThread ( FEProblemBase fe_problem)

◆ ComputeBoundaryInitialConditionThread() [2/3]

ComputeBoundaryInitialConditionThread::ComputeBoundaryInitialConditionThread ( ComputeBoundaryInitialConditionThread x,
Threads::split  split 
)

Definition at line 24 of file ComputeBoundaryInitialConditionThread.C.

28{
29}
const std::set< VariableName > * _target_vars
the names of target variables for which the initial conditions are applied

◆ ComputeBoundaryInitialConditionThread() [3/3]

ComputeBoundaryInitialConditionThread::ComputeBoundaryInitialConditionThread ( FEProblemBase fe_problem,
const std::set< VariableName > *  target_vars 
)
private

Set IC on specific variables.

Definition at line 31 of file ComputeBoundaryInitialConditionThread.C.

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

Definition at line 68 of file ComputeBoundaryInitialConditionThread.C.

69{
70}

◆ 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]

void ComputeBoundaryInitialConditionThread::onNode ( ConstBndNodeRange::const_iterator nd)

Definition at line 39 of file ComputeBoundaryInitialConditionThread.C.

40{
41 const BndNode * bnode = *nd;
42
43 Node * node = bnode->_node;
44 BoundaryID boundary_id = bnode->_bnd_id;
45
46 for (const auto nl_sys_num : make_range(_fe_problem.numNonlinearSystems()))
47 _fe_problem.assembly(_tid, nl_sys_num).reinit(node);
48
50
51 if (warehouse.hasActiveBoundaryObjects(boundary_id, _tid))
52 {
53 const auto & ics = warehouse.getActiveBoundaryObjects(boundary_id, _tid);
54 for (const auto & ic : ics)
55 {
56 // Skip or include initial conditions based on target variable usage
57 const auto & var_name = ic->variable().name();
58 if (_target_vars && !_target_vars->count(var_name))
59 continue;
60
61 if (node->processor_id() == _fe_problem.processor_id())
62 ic->computeNodal(*node);
63 }
64 }
65}
boundary_id_type BoundaryID
const InitialConditionWarehouse & getInitialConditionWarehouse() const
Return InitialCondition storage.
Warehouse for storing initial conditions.
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
processor_id_type processor_id() const
IntRange< T > make_range(T beg, T end)
BoundaryID _bnd_id
boundary id for the node
Definition BndNode.h:26
libMesh::Node * _node
pointer to the node
Definition BndNode.h:24

◆ onNode() [2/2]

Called for each node.

Definition at line 43 of file ThreadedNodeLoop.h.

137{
138}

◆ operator()()

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

Definition at line 28 of file ThreadedNodeLoop.h.

95{
96 try
97 {
99 _tid = puid.id;
100
101 pre();
103
104 for (IteratorType nd = range.begin(); nd != range.end(); ++nd)
105 {
106 if (!keepGoing())
107 break;
108
109 onNode(nd);
110
111 postNode(nd);
112 }
113
114 post();
115 }
116 catch (MooseException & e)
117 {
119 }
120}
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.

131{
132}

◆ postNode()

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

Parameters
node- active node

Definition at line 50 of file ThreadedNodeLoop.h.

143{
144}

◆ pre()

Called before the node range loop.

Reimplemented in ComputeNodalKernelBCJacobiansThread, and ComputeNodalKernelBcsThread.

Definition at line 33 of file ThreadedNodeLoop.h.

125{
126}

◆ 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{}

Friends And Related Symbol Documentation

◆ FEProblemBase

friend class FEProblemBase
friend

Definition at line 43 of file ComputeBoundaryInitialConditionThread.h.

Member Data Documentation

◆ _fe_problem

Definition at line 72 of file ThreadedNodeLoop.h.

◆ _target_vars

const std::set<VariableName>* ComputeBoundaryInitialConditionThread::_target_vars = nullptr
private

the names of target variables for which the initial conditions are applied

Definition at line 36 of file ComputeBoundaryInitialConditionThread.h.

Referenced by onNode().

◆ _tid

Definition at line 73 of file ThreadedNodeLoop.h.


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