www.mooseframework.org
Public 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 System &system)
 
 AllNodesSendListThread (AllNodesSendListThread &x, Threads::split split)
 
virtual void onNode (ConstNodeRange::const_iterator &nd) override
 Called for each node. More...
 
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. More...
 
virtual void post ()
 Called after the node range loop. More...
 
virtual void postNode (ConstNodeRange::const_iterator &node_it)
 Called after the node assembly is done (including surface assembling) More...
 
virtual void caughtMooseException (MooseException &e)
 Called if a MooseException is caught anywhere during the computation. More...
 
virtual bool keepGoing ()
 Whether or not the loop should continue. More...
 

Protected Attributes

const MooseMesh_ref_mesh
 
FEProblemBase_fe_problem
 
THREAD_ID _tid
 

Private Attributes

std::vector< unsigned int > _var_nums
 
const 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 29 of file AllNodesSendListThread.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file AllNodesSendListThread.C.

25  _ref_mesh(mesh),
26  _var_nums(var_nums),
27  _system(system),
28  _system_number(_system.number()),
29  _first_dof(_system.get_dof_map().first_dof()),
30  _end_dof(_system.get_dof_map().end_dof()),
31  _send_list()
32 {
33  // We may use the same _var_num multiple times, but it's inefficient
34  // to examine it multiple times.
35  std::sort(this->_var_nums.begin(), this->_var_nums.end());
36 
37  std::vector<unsigned int>::iterator new_end =
38  std::unique(this->_var_nums.begin(), this->_var_nums.end());
39 
40  std::vector<unsigned int>(this->_var_nums.begin(), new_end).swap(this->_var_nums);
41 }
nl system()
X_global swap(X_sys)
std::vector< unsigned int > _var_nums
const unsigned int _system_number
std::vector< dof_id_type > _send_list
AllNodesSendListThread::AllNodesSendListThread ( AllNodesSendListThread x,
Threads::split  split 
)

Definition at line 43 of file AllNodesSendListThread.C.

45  _ref_mesh(x._ref_mesh),
46  _var_nums(x._var_nums),
47  _system(x._system),
48  _system_number(_system.number()),
49  _first_dof(_system.get_dof_map().first_dof()),
50  _end_dof(_system.get_dof_map().end_dof()),
51  _send_list()
52 {
53 }
static PetscErrorCode Vec x
std::vector< unsigned int > _var_nums
const unsigned int _system_number
std::vector< dof_id_type > _send_list

Member Function Documentation

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 60 of file ThreadedNodeLoop.h.

61  {
62  std::string what(e.what());
64  };
virtual void setException(const std::string &message)
Set an exception.
virtual const char * what() const
Get out the error message.
void AllNodesSendListThread::join ( const AllNodesSendListThread y)

Definition at line 72 of file AllNodesSendListThread.C.

73 {
74  // Joining simply requires I add the dof indices from the other object
75  this->_send_list.insert(this->_send_list.end(), y._send_list.begin(), y._send_list.end());
76 }
std::vector< dof_id_type > _send_list
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 71 of file ThreadedNodeLoop.h.

71 { return !_fe_problem.hasException(); }
virtual bool hasException()
Whether or not an exception has occurred.
void AllNodesSendListThread::onNode ( ConstNodeRange::const_iterator &  node_it)
overridevirtual

Called for each node.

Reimplemented from ThreadedNodeLoop< ConstNodeRange, ConstNodeRange::const_iterator >.

Definition at line 56 of file AllNodesSendListThread.C.

57 {
58  const Node & node = *(*nd);
59 
60  for (unsigned int i = 0; i < _var_nums.size(); i++)
61  {
62  if (node.n_dofs(_system_number, _var_nums[i]) > 0)
63  {
64  const dof_id_type id = node.dof_number(_system_number, _var_nums[i], 0);
65  if (id < _first_dof || id >= _end_dof)
66  this->_send_list.push_back(id);
67  }
68  }
69 }
std::vector< unsigned int > _var_nums
const unsigned int _system_number
std::vector< dof_id_type > _send_list
void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::operator() ( const ConstNodeRange &  range)
inherited
virtual void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::post ( )
virtualinherited

Called after the node range loop.

virtual 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
virtual void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::pre ( )
virtualinherited

Called before the node range loop.

Reimplemented in ComputeNodalKernelJacobiansThread, and ComputeNodalKernelsThread.

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

Definition at line 100 of file AllNodesSendListThread.C.

101 {
102  return this->_send_list;
103 }
std::vector< dof_id_type > _send_list
void AllNodesSendListThread::unique ( )

Definition at line 79 of file AllNodesSendListThread.C.

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

Member Data Documentation

const dof_id_type AllNodesSendListThread::_end_dof
private

Definition at line 60 of file AllNodesSendListThread.h.

Referenced by onNode().

FEProblemBase& ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::_fe_problem
protectedinherited
const dof_id_type AllNodesSendListThread::_first_dof
private

Definition at line 60 of file AllNodesSendListThread.h.

const MooseMesh& AllNodesSendListThread::_ref_mesh
protected

Definition at line 51 of file AllNodesSendListThread.h.

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

Definition at line 62 of file AllNodesSendListThread.h.

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

const System& AllNodesSendListThread::_system
private

Definition at line 56 of file AllNodesSendListThread.h.

const unsigned int AllNodesSendListThread::_system_number
private

Definition at line 58 of file AllNodesSendListThread.h.

Referenced by onNode().

THREAD_ID ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::_tid
protectedinherited
std::vector<unsigned int> AllNodesSendListThread::_var_nums
private

Definition at line 54 of file AllNodesSendListThread.h.

Referenced by AllNodesSendListThread(), and onNode().


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