www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
UpdateDisplacedMeshThread Class Reference

#include <UpdateDisplacedMeshThread.h>

Inheritance diagram for UpdateDisplacedMeshThread:
[legend]

Public Member Functions

 UpdateDisplacedMeshThread (FEProblemBase &fe_problem, DisplacedProblem &displaced_problem)
 
 UpdateDisplacedMeshThread (UpdateDisplacedMeshThread &x, Threads::split split)
 
virtual void onNode (NodeRange::const_iterator &nd) override
 Called for each node. More...
 
void join (const UpdateDisplacedMeshThread &)
 
void operator() (const NodeRange &range)
 
virtual void pre ()
 Called before the node range loop. More...
 
virtual void post ()
 Called after the node range loop. More...
 
virtual void postNode (NodeRange::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 Member Functions

void init ()
 

Protected Attributes

DisplacedProblem_displaced_problem
 
MooseMesh_ref_mesh
 
const NumericVector< Number > & _nl_soln
 
const NumericVector< Number > & _aux_soln
 
std::shared_ptr< NumericVector< Number > > _nl_ghosted_soln
 
std::shared_ptr< NumericVector< Number > > _aux_ghosted_soln
 
FEProblemBase_fe_problem
 
THREAD_ID _tid
 

Private Attributes

std::vector< unsigned int > _var_nums
 
std::vector< unsigned int > _var_nums_directions
 
std::vector< unsigned int > _aux_var_nums
 
std::vector< unsigned int > _aux_var_nums_directions
 
unsigned int _num_var_nums
 
unsigned int _num_aux_var_nums
 
unsigned int _nonlinear_system_number
 
unsigned int _aux_system_number
 

Detailed Description

Definition at line 33 of file UpdateDisplacedMeshThread.h.

Constructor & Destructor Documentation

UpdateDisplacedMeshThread::UpdateDisplacedMeshThread ( FEProblemBase fe_problem,
DisplacedProblem displaced_problem 
)

Definition at line 23 of file UpdateDisplacedMeshThread.C.

26  _displaced_problem(displaced_problem),
30  _nl_ghosted_soln(NumericVector<Number>::build(_nl_soln.comm()).release()),
31  _aux_ghosted_soln(NumericVector<Number>::build(_aux_soln.comm()).release()),
32  _var_nums(0),
34  _aux_var_nums(0),
36  _num_var_nums(0),
40 {
41  this->init();
42 }
std::vector< unsigned int > _aux_var_nums_directions
virtual TransientExplicitSystem & sys()
DisplacedSystem _displaced_aux
DisplacedSystem _displaced_nl
const NumericVector< Number > & _nl_soln
std::vector< unsigned int > _var_nums
const NumericVector< Number > & _aux_soln
std::shared_ptr< NumericVector< Number > > _nl_ghosted_soln
const NumericVector< Number > * _aux_solution
std::shared_ptr< NumericVector< Number > > _aux_ghosted_soln
std::vector< unsigned int > _var_nums_directions
std::vector< unsigned int > _aux_var_nums
const NumericVector< Number > * _nl_solution
MooseMesh & refMesh()
UpdateDisplacedMeshThread::UpdateDisplacedMeshThread ( UpdateDisplacedMeshThread x,
Threads::split  split 
)

Definition at line 44 of file UpdateDisplacedMeshThread.C.

47  _displaced_problem(x._displaced_problem),
48  _ref_mesh(x._ref_mesh),
49  _nl_soln(x._nl_soln),
50  _aux_soln(x._aux_soln),
51  _nl_ghosted_soln(x._nl_ghosted_soln),
52  _aux_ghosted_soln(x._aux_ghosted_soln),
53  _var_nums(x._var_nums),
54  _var_nums_directions(x._var_nums_directions),
55  _aux_var_nums(x._aux_var_nums),
56  _aux_var_nums_directions(x._aux_var_nums_directions),
57  _num_var_nums(x._num_var_nums),
58  _num_aux_var_nums(x._num_aux_var_nums),
59  _nonlinear_system_number(x._nonlinear_system_number),
60  _aux_system_number(x._aux_system_number)
61 {
62 }
std::vector< unsigned int > _aux_var_nums_directions
const NumericVector< Number > & _nl_soln
static PetscErrorCode Vec x
std::vector< unsigned int > _var_nums
const NumericVector< Number > & _aux_soln
std::shared_ptr< NumericVector< Number > > _nl_ghosted_soln
std::shared_ptr< NumericVector< Number > > _aux_ghosted_soln
std::vector< unsigned int > _var_nums_directions
std::vector< unsigned int > _aux_var_nums

Member Function Documentation

virtual void ThreadedNodeLoop< NodeRange , NodeRange::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 UpdateDisplacedMeshThread::init ( )
protected

Definition at line 65 of file UpdateDisplacedMeshThread.C.

Referenced by UpdateDisplacedMeshThread().

66 {
67  std::vector<std::string> & displacement_variables = _displaced_problem._displacements;
68  unsigned int num_displacements = displacement_variables.size();
69 
70  _var_nums.clear();
71  _var_nums_directions.clear();
72 
73  _aux_var_nums.clear();
75 
76  for (unsigned int i = 0; i < num_displacements; i++)
77  {
78  std::string displacement_name = displacement_variables[i];
79 
80  if (_displaced_problem._displaced_nl.sys().has_variable(displacement_name))
81  {
82  _var_nums.push_back(
83  _displaced_problem._displaced_nl.sys().variable_number(displacement_name));
84  _var_nums_directions.push_back(i);
85  }
86  else if (_displaced_problem._displaced_aux.sys().has_variable(displacement_name))
87  {
88  _aux_var_nums.push_back(
89  _displaced_problem._displaced_aux.sys().variable_number(displacement_name));
90  _aux_var_nums_directions.push_back(i);
91  }
92  else
93  mooseError("Undefined variable '", displacement_name, "' used for displacements!");
94  }
95 
96  _num_var_nums = _var_nums.size();
98 
99  ConstNodeRange node_range(_ref_mesh.getMesh().nodes_begin(), _ref_mesh.getMesh().nodes_end());
100 
101  {
102  AllNodesSendListThread nl_send_list(
104  Threads::parallel_reduce(node_range, nl_send_list);
105  nl_send_list.unique();
106  _nl_ghosted_soln->init(
107  _nl_soln.size(), _nl_soln.local_size(), nl_send_list.send_list(), GHOSTED);
108  _nl_soln.localize(*_nl_ghosted_soln, nl_send_list.send_list());
109  }
110 
111  {
112  AllNodesSendListThread aux_send_list(
114  Threads::parallel_reduce(node_range, aux_send_list);
115  aux_send_list.unique();
116  _aux_ghosted_soln->init(
117  _aux_soln.size(), _aux_soln.local_size(), aux_send_list.send_list(), GHOSTED);
118  _aux_soln.localize(*_aux_ghosted_soln, aux_send_list.send_list());
119  }
120 }
std::vector< unsigned int > _aux_var_nums_directions
virtual TransientExplicitSystem & sys()
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
DisplacedSystem _displaced_aux
DisplacedSystem _displaced_nl
const NumericVector< Number > & _nl_soln
std::vector< unsigned int > _var_nums
const NumericVector< Number > & _aux_soln
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2408
std::shared_ptr< NumericVector< Number > > _nl_ghosted_soln
std::vector< std::string > _displacements
std::shared_ptr< NumericVector< Number > > _aux_ghosted_soln
std::vector< unsigned int > _var_nums_directions
std::vector< unsigned int > _aux_var_nums
void UpdateDisplacedMeshThread::join ( const UpdateDisplacedMeshThread )

Definition at line 149 of file UpdateDisplacedMeshThread.C.

150 {
151 }
virtual bool ThreadedNodeLoop< NodeRange , NodeRange::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 UpdateDisplacedMeshThread::onNode ( NodeRange::const_iterator &  node_it)
overridevirtual

Called for each node.

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

Definition at line 123 of file UpdateDisplacedMeshThread.C.

124 {
125  Node & displaced_node = *(*nd);
126 
127  Node & reference_node = _ref_mesh.nodeRef(displaced_node.id());
128 
129  for (unsigned int i = 0; i < _num_var_nums; i++)
130  {
131  unsigned int direction = _var_nums_directions[i];
132  if (reference_node.n_dofs(_nonlinear_system_number, _var_nums[i]) > 0)
133  displaced_node(direction) =
134  reference_node(direction) +
135  (*_nl_ghosted_soln)(reference_node.dof_number(_nonlinear_system_number, _var_nums[i], 0));
136  }
137 
138  for (unsigned int i = 0; i < _num_aux_var_nums; i++)
139  {
140  unsigned int direction = _aux_var_nums_directions[i];
141  if (reference_node.n_dofs(_aux_system_number, _aux_var_nums[i]) > 0)
142  displaced_node(direction) =
143  reference_node(direction) +
144  (*_aux_ghosted_soln)(reference_node.dof_number(_aux_system_number, _aux_var_nums[i], 0));
145  }
146 }
std::vector< unsigned int > _aux_var_nums_directions
std::vector< unsigned int > _var_nums
std::vector< unsigned int > _var_nums_directions
std::vector< unsigned int > _aux_var_nums
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:437
void ThreadedNodeLoop< NodeRange , NodeRange::const_iterator >::operator() ( const NodeRange &  range)
inherited
virtual void ThreadedNodeLoop< NodeRange , NodeRange::const_iterator >::post ( )
virtualinherited

Called after the node range loop.

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

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

Parameters
node- active node
virtual void ThreadedNodeLoop< NodeRange , NodeRange::const_iterator >::pre ( )
virtualinherited

Called before the node range loop.

Member Data Documentation

std::shared_ptr<NumericVector<Number> > UpdateDisplacedMeshThread::_aux_ghosted_soln
protected

Definition at line 56 of file UpdateDisplacedMeshThread.h.

Referenced by init().

const NumericVector<Number>& UpdateDisplacedMeshThread::_aux_soln
protected

Definition at line 50 of file UpdateDisplacedMeshThread.h.

Referenced by init().

unsigned int UpdateDisplacedMeshThread::_aux_system_number
private

Definition at line 69 of file UpdateDisplacedMeshThread.h.

Referenced by onNode().

std::vector<unsigned int> UpdateDisplacedMeshThread::_aux_var_nums
private

Definition at line 62 of file UpdateDisplacedMeshThread.h.

Referenced by init(), and onNode().

std::vector<unsigned int> UpdateDisplacedMeshThread::_aux_var_nums_directions
private

Definition at line 63 of file UpdateDisplacedMeshThread.h.

Referenced by init(), and onNode().

DisplacedProblem& UpdateDisplacedMeshThread::_displaced_problem
protected

Definition at line 47 of file UpdateDisplacedMeshThread.h.

Referenced by init().

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

Definition at line 74 of file ThreadedNodeLoop.h.

Referenced by init().

std::shared_ptr<NumericVector<Number> > UpdateDisplacedMeshThread::_nl_ghosted_soln
protected

Definition at line 55 of file UpdateDisplacedMeshThread.h.

Referenced by init().

const NumericVector<Number>& UpdateDisplacedMeshThread::_nl_soln
protected

Definition at line 49 of file UpdateDisplacedMeshThread.h.

Referenced by init().

unsigned int UpdateDisplacedMeshThread::_nonlinear_system_number
private

Definition at line 68 of file UpdateDisplacedMeshThread.h.

Referenced by onNode().

unsigned int UpdateDisplacedMeshThread::_num_aux_var_nums
private

Definition at line 66 of file UpdateDisplacedMeshThread.h.

Referenced by init(), and onNode().

unsigned int UpdateDisplacedMeshThread::_num_var_nums
private

Definition at line 65 of file UpdateDisplacedMeshThread.h.

Referenced by init(), and onNode().

MooseMesh& UpdateDisplacedMeshThread::_ref_mesh
protected

Definition at line 48 of file UpdateDisplacedMeshThread.h.

Referenced by init(), and onNode().

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

Definition at line 75 of file ThreadedNodeLoop.h.

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

Definition at line 59 of file UpdateDisplacedMeshThread.h.

Referenced by init(), and onNode().

std::vector<unsigned int> UpdateDisplacedMeshThread::_var_nums_directions
private

Definition at line 60 of file UpdateDisplacedMeshThread.h.

Referenced by init(), and onNode().


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