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

#include <AllNodesSendListThread.h>

Inheritance diagram for AllNodesSendListThread:
[legend]

Public Member Functions

 AllNodesSendListThread (FEProblemBase &fe_problem, const MooseMesh &mesh, const std::vector< unsigned int > &var_nums, const libMesh::System &system)
 
 AllNodesSendListThread (AllNodesSendListThread &x, Threads::split split)
 
virtual void onNode (ConstNodeRange::const_iterator &nd) override
 
void join (const AllNodesSendListThread &y)
 
void unique ()
 
const std::vector< dof_id_type > & send_list () const
 
void operator() (const ConstNodeRange &range)
 
virtual void pre ()
 Called before the node range loop.
 
virtual void post ()
 Called after the node range loop.
 
virtual void onNode (ConstNodeRange::const_iterator &node_it)
 Called for each node.
 
virtual void postNode (ConstNodeRange::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

const MooseMesh_ref_mesh
 
FEProblemBase_fe_problem
 
THREAD_ID _tid
 

Private Attributes

std::vector< unsigned int_var_nums
 
const libMesh::System_system
 
const unsigned int _system_number
 
const dof_id_type _first_dof
 
const dof_id_type _end_dof
 
std::vector< dof_id_type > _send_list
 

Detailed Description

Definition at line 23 of file AllNodesSendListThread.h.

Constructor & Destructor Documentation

◆ AllNodesSendListThread() [1/2]

AllNodesSendListThread::AllNodesSendListThread ( FEProblemBase fe_problem,
const MooseMesh mesh,
const std::vector< unsigned int > &  var_nums,
const libMesh::System system 
)

Definition at line 15 of file AllNodesSendListThread.C.

20 _ref_mesh(mesh),
21 _var_nums(var_nums),
22 _system(system),
27{
28 // We may use the same _var_num multiple times, but it's inefficient
29 // to examine it multiple times.
30 std::sort(this->_var_nums.begin(), this->_var_nums.end());
31
32 std::vector<unsigned int>::iterator new_end =
33 std::unique(this->_var_nums.begin(), this->_var_nums.end());
34
35 std::vector<unsigned int>(this->_var_nums.begin(), new_end).swap(this->_var_nums);
36}
const libMesh::System & _system
std::vector< unsigned int > _var_nums
const unsigned int _system_number
std::vector< dof_id_type > _send_list
dof_id_type first_dof(const processor_id_type proc) const
dof_id_type end_dof(const processor_id_type proc) const
const DofMap & get_dof_map() const
unsigned int number() const

◆ AllNodesSendListThread() [2/2]

AllNodesSendListThread::AllNodesSendListThread ( AllNodesSendListThread x,
Threads::split  split 
)

Member Function Documentation

◆ caughtMooseException()

virtual void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::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 AllNodesSendListThread::join ( const AllNodesSendListThread y)

Definition at line 67 of file AllNodesSendListThread.C.

68{
69 // Joining simply requires I add the dof indices from the other object
70 this->_send_list.insert(this->_send_list.end(), y._send_list.begin(), y._send_list.end());
71}

◆ keepGoing()

virtual bool ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::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 AllNodesSendListThread::onNode ( ConstNodeRange::const_iterator &  nd)
overridevirtual

Definition at line 51 of file AllNodesSendListThread.C.

52{
53 const Node & node = *(*nd);
54
55 for (unsigned int i = 0; i < _var_nums.size(); i++)
56 {
57 if (node.n_dofs(_system_number, _var_nums[i]) > 0)
58 {
59 const dof_id_type id = node.dof_number(_system_number, _var_nums[i], 0);
60 if (id < _first_dof || id >= _end_dof)
61 this->_send_list.push_back(id);
62 }
63 }
64}
uint8_t dof_id_type

◆ onNode() [2/2]

void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::onNode ( ConstNodeRange::const_iterator &  node_it)
virtualinherited

Called for each node.

Definition at line 43 of file ThreadedNodeLoop.h.

137{
138}

◆ operator()()

void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::operator() ( const ConstNodeRange &  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(ConstNodeRange::const_iterator &node_it)
Called after the node assembly is done (including surface assembling)
virtual void onNode(ConstNodeRange::const_iterator &node_it)
Called for each node.
virtual bool keepGoing()
Whether or not the loop should continue.
virtual void pre()
Called before the node range loop.
virtual void post()
Called after the node range loop.
virtual void caughtMooseException(MooseException &e)
Called if a MooseException is caught anywhere during the computation.

◆ post()

void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::post ( )
virtualinherited

Called after the node range loop.

Reimplemented in ComputeNodalAuxVarsThread< AuxKernelType >.

Definition at line 38 of file ThreadedNodeLoop.h.

131{
132}

◆ postNode()

void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::postNode ( ConstNodeRange::const_iterator &  node_it)
virtualinherited

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

void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::pre ( )
virtualinherited

Called before the node range loop.

Reimplemented in ComputeNodalKernelJacobiansThread, and ComputeNodalKernelsThread.

Definition at line 33 of file ThreadedNodeLoop.h.

125{
126}

◆ printGeneralExecutionInformation()

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

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

Reimplemented in ComputeNodalAuxVarsThread< AuxKernelType >, ComputeNodalDampingThread, ComputeNodalKernelJacobiansThread, ComputeNodalKernelsThread, and ComputeNodalUserObjectsThread.

Definition at line 76 of file ThreadedNodeLoop.h.

76{}

◆ send_list()

const std::vector< dof_id_type > & AllNodesSendListThread::send_list ( ) const

Definition at line 95 of file AllNodesSendListThread.C.

96{
97 return this->_send_list;
98}

Referenced by DisplacedProblem::UpdateDisplacedMeshThread::init().

◆ unique()

void AllNodesSendListThread::unique ( )

Definition at line 74 of file AllNodesSendListThread.C.

75{
76 // Sort the send list. After this duplicated
77 // elements will be adjacent in the vector
78 std::sort(this->_send_list.begin(), this->_send_list.end());
79
80 // Now use std::unique to remove any duplicate entries. There
81 // actually shouldn't be any, since we're hitting each node exactly
82 // once and we pre-uniqued _var_nums.
83 // std::vector<dof_id_type>::iterator new_end =
84 // std::unique (this->_send_list.begin(),
85 // this->_send_list.end());
86
87 // If we *do* need to remove duplicate entries, then afterward we should
88 // remove the end of the send_list, using the "swap trick" from Effective
89 // STL.
90 // std::vector<dof_id_type>
91 // (this->_send_list.begin(), new_end).swap (this->_send_list);
92}

Referenced by DisplacedProblem::UpdateDisplacedMeshThread::init().

Member Data Documentation

◆ _end_dof

const dof_id_type AllNodesSendListThread::_end_dof
private

Definition at line 54 of file AllNodesSendListThread.h.

Referenced by onNode().

◆ _fe_problem

FEProblemBase& ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::_fe_problem
protectedinherited

Definition at line 72 of file ThreadedNodeLoop.h.

◆ _first_dof

const dof_id_type AllNodesSendListThread::_first_dof
private

Definition at line 54 of file AllNodesSendListThread.h.

◆ _ref_mesh

const MooseMesh& AllNodesSendListThread::_ref_mesh
protected

Definition at line 45 of file AllNodesSendListThread.h.

◆ _send_list

std::vector<dof_id_type> AllNodesSendListThread::_send_list
private

Definition at line 56 of file AllNodesSendListThread.h.

Referenced by join(), onNode(), send_list(), and unique().

◆ _system

const libMesh::System& AllNodesSendListThread::_system
private

Definition at line 50 of file AllNodesSendListThread.h.

◆ _system_number

const unsigned int AllNodesSendListThread::_system_number
private

Definition at line 52 of file AllNodesSendListThread.h.

Referenced by onNode().

◆ _tid

THREAD_ID ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::_tid
protectedinherited

Definition at line 73 of file ThreadedNodeLoop.h.

◆ _var_nums

std::vector<unsigned int> AllNodesSendListThread::_var_nums
private

Definition at line 48 of file AllNodesSendListThread.h.

Referenced by AllNodesSendListThread(), and onNode().


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