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

#include <FlagElementsThread.h>

Inheritance diagram for FlagElementsThread:
[legend]

Public Member Functions

 FlagElementsThread (FEProblemBase &fe_problem, std::vector< Number > &serialized_solution, unsigned int max_h_level, const std::string &marker_name)
 
 FlagElementsThread (FlagElementsThread &x, Threads::split split)
 
virtual void onElement (const Elem *elem) override
 Assembly of the element (not including surface assembly) More...
 
void join (const FlagElementsThread &)
 
virtual void caughtMooseException (MooseException &e) override
 Called if a MooseException is caught anywhere during the computation. More...
 
virtual bool keepGoing () override
 Whether or not the loop should continue. More...
 
virtual void preElement (const Elem *elem) override
 Called before the element assembly. More...
 
virtual void preInternalSide (const Elem *elem, unsigned int side) override
 Called before evaluations on an element internal side. More...
 
virtual void neighborSubdomainChanged () override
 Called every time the neighbor subdomain changes (i.e. More...
 
void operator() (const ConstElemRange &range, bool bypass_threading=false)
 
virtual void pre ()
 Called before the element range loop. More...
 
virtual void post ()
 Called after the element range loop. More...
 
virtual void postElement (const Elem *elem)
 Called after the element assembly is done (including surface assembling) More...
 
virtual void onBoundary (const Elem *elem, unsigned int side, BoundaryID bnd_id)
 Called when doing boundary assembling. More...
 
virtual void postInternalSide (const Elem *elem, unsigned int side)
 Called after evaluations on an element internal side. More...
 
virtual void onInternalSide (const Elem *elem, unsigned int side)
 Called when doing internal edge assembling. More...
 
virtual void onInterface (const Elem *elem, unsigned int side, BoundaryID bnd_id)
 Called when doing interface assembling. More...
 
virtual void subdomainChanged ()
 Called every time the current subdomain changes (i.e. More...
 

Protected Attributes

FEProblemBase_fe_problem
 
std::shared_ptr< DisplacedProblem_displaced_problem
 
AuxiliarySystem_aux_sys
 
unsigned int _system_number
 
Adaptivity_adaptivity
 
MooseVariable_field_var
 
unsigned int _field_var_number
 
std::vector< Number > & _serialized_solution
 
unsigned int _max_h_level
 
MooseMesh_mesh
 
THREAD_ID _tid
 
SubdomainID _subdomain
 The subdomain for the current element. More...
 
SubdomainID _old_subdomain
 The subdomain for the last element. More...
 
SubdomainID _neighbor_subdomain
 The subdomain for the current neighbor. More...
 
SubdomainID _old_neighbor_subdomain
 The subdomain for the last neighbor. More...
 

Detailed Description

Definition at line 26 of file FlagElementsThread.h.

Constructor & Destructor Documentation

FlagElementsThread::FlagElementsThread ( FEProblemBase fe_problem,
std::vector< Number > &  serialized_solution,
unsigned int  max_h_level,
const std::string &  marker_name 
)

Definition at line 29 of file FlagElementsThread.C.

34  _fe_problem(fe_problem),
36  _aux_sys(fe_problem.getAuxiliarySystem()),
39  _field_var(_fe_problem.getVariable(0, marker_name)),
41  _serialized_solution(serialized_solution),
42  _max_h_level(max_h_level)
43 {
44 }
FEProblemBase & _fe_problem
unsigned int _max_h_level
unsigned int _system_number
Adaptivity & _adaptivity
virtual std::shared_ptr< DisplacedProblem > getDisplacedProblem()
AuxiliarySystem & getAuxiliarySystem()
virtual unsigned int number()
Gets the number of this system.
Definition: SystemBase.C:604
unsigned int number() const
Get variable number coming from libMesh.
std::shared_ptr< DisplacedProblem > _displaced_problem
unsigned int _field_var_number
std::vector< Number > & _serialized_solution
AuxiliarySystem & _aux_sys
MooseVariable & _field_var
Adaptivity & adaptivity()
virtual MooseVariable & getVariable(THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested variable which may be in any system. ...
FlagElementsThread::FlagElementsThread ( FlagElementsThread x,
Threads::split  split 
)

Definition at line 47 of file FlagElementsThread.C.

50  _displaced_problem(x._displaced_problem),
51  _aux_sys(x._aux_sys),
52  _system_number(x._system_number),
53  _adaptivity(x._adaptivity),
54  _field_var(x._field_var),
55  _field_var_number(x._field_var_number),
56  _serialized_solution(x._serialized_solution),
57  _max_h_level(x._max_h_level)
58 {
59 }
FEProblemBase & _fe_problem
unsigned int _max_h_level
unsigned int _system_number
FEProblemBase & _fe_problem
static PetscErrorCode Vec x
Adaptivity & _adaptivity
std::shared_ptr< DisplacedProblem > _displaced_problem
unsigned int _field_var_number
std::vector< Number > & _serialized_solution
AuxiliarySystem & _aux_sys
MooseVariable & _field_var

Member Function Documentation

virtual void ThreadedElementLoop< ConstElemRange >::caughtMooseException ( MooseException e)
overridevirtualinherited

Called if a MooseException is caught anywhere during the computation.

The single input parameter taken is a MooseException object.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

void FlagElementsThread::join ( const FlagElementsThread )

Definition at line 97 of file FlagElementsThread.C.

98 {
99 }
virtual bool ThreadedElementLoop< ConstElemRange >::keepGoing ( )
inlineoverridevirtualinherited

Whether or not the loop should continue.

Returns
true to keep going, false to stop.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 50 of file ThreadedElementLoop.h.

50 { return !_fe_problem.hasException(); }
virtual bool hasException()
Whether or not an exception has occurred.
virtual void ThreadedElementLoop< ConstElemRange >::neighborSubdomainChanged ( )
overridevirtualinherited

Called every time the neighbor subdomain changes (i.e.

the subdomain of this neighbor is not the same as the subdomain of the last neighbor). Beware of over-using this! You might think that you can do some expensive stuff in here and get away with it... but there are applications that have TONS of subdomains....

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

virtual void ThreadedElementLoopBase< ConstElemRange >::onBoundary ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id 
)
virtualinherited

Called when doing boundary assembling.

Parameters
elem- The element we are checking is on the boundary.
side- The side of the element in question.
bnd_id- ID of the boundary we are at

Reimplemented in ComputeMaterialsObjectThread, ComputeUserObjectsThread, ComputeIndicatorThread, ComputeJacobianThread, ComputeResidualThread, and ComputeMarkerThread.

void FlagElementsThread::onElement ( const Elem *  elem)
overridevirtual

Assembly of the element (not including surface assembly)

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 62 of file FlagElementsThread.C.

63 {
64  // By default do nothing, and only grab the marker from the solution if the current variable is
65  // active
66  // on the element subdomain.
68  if (_field_var.activeOnSubdomain(elem->subdomain_id()))
69  {
70  dof_id_type dof_number = elem->dof_number(_system_number, _field_var_number, 0);
71 
72  // round() is a C99 function, it is not located in the std:: namespace.
73  marker_value = static_cast<Marker::MarkerValue>(round(_serialized_solution[dof_number]));
74 
75  // Make sure we aren't masking an issue in the Marker system by rounding its values.
76  if (std::abs(marker_value - _serialized_solution[dof_number]) > TOLERANCE * TOLERANCE)
77  mooseError("Invalid Marker value detected: ", _serialized_solution[dof_number]);
78  }
79 
80  // If no Markers cared about what happened to this element let's just leave it alone
81  if (marker_value == Marker::DONT_MARK)
82  marker_value = Marker::DO_NOTHING;
83 
84  // Don't refine past the max level
85  if (_max_h_level && marker_value == Marker::REFINE && elem->level() >= _max_h_level)
86  marker_value = Marker::DO_NOTHING;
87 
88  const_cast<Elem *>(elem)->set_refinement_flag((Elem::RefinementState)marker_value);
89 
91  _displaced_problem->mesh()
92  .elemPtr(elem->id())
93  ->set_refinement_flag((Elem::RefinementState)marker_value);
94 }
unsigned int _max_h_level
unsigned int _system_number
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
MarkerValue
This mirrors the main refinement flag values in libMesh in Elem::RefinementState but adds "dont_mark"...
Definition: Marker.h:58
bool activeOnSubdomain(SubdomainID subdomain) const
Is the variable active on the subdomain?
std::shared_ptr< DisplacedProblem > _displaced_problem
unsigned int _field_var_number
std::vector< Number > & _serialized_solution
MooseVariable & _field_var
virtual void ThreadedElementLoopBase< ConstElemRange >::onInterface ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id 
)
virtualinherited

Called when doing interface assembling.

Parameters
elem- Element we are on
side- local side number of the element 'elem'
bnd_id- ID of the interface we are at

Reimplemented in ComputeJacobianThread, and ComputeResidualThread.

virtual void ThreadedElementLoopBase< ConstElemRange >::onInternalSide ( const Elem *  elem,
unsigned int  side 
)
virtualinherited

Called when doing internal edge assembling.

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented in ComputeMaterialsObjectThread, ComputeUserObjectsThread, ComputeIndicatorThread, ComputeJacobianThread, ComputeResidualThread, and ComputeMarkerThread.

void ThreadedElementLoopBase< ConstElemRange >::operator() ( const ConstElemRange &  range,
bool  bypass_threading = false 
)
inherited
virtual void ThreadedElementLoopBase< ConstElemRange >::post ( )
virtualinherited
virtual void ThreadedElementLoopBase< ConstElemRange >::postElement ( const Elem *  elem)
virtualinherited

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

Parameters
elem- active element

Reimplemented in ComputeJacobianBlocksThread, ComputeJacobianThread, ComputeIndicatorThread, ComputeResidualThread, and ComputeMarkerThread.

virtual void ThreadedElementLoopBase< ConstElemRange >::postInternalSide ( const Elem *  elem,
unsigned int  side 
)
virtualinherited

Called after evaluations on an element internal side.

Parameters
elem- Element we are on
side- local side number of the element 'elem'
virtual void ThreadedElementLoopBase< ConstElemRange >::pre ( )
virtualinherited

Called before the element range loop.

virtual void ThreadedElementLoop< ConstElemRange >::preElement ( const Elem *  elem)
overridevirtualinherited

Called before the element assembly.

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

virtual void ThreadedElementLoop< ConstElemRange >::preInternalSide ( const Elem *  elem,
unsigned int  side 
)
overridevirtualinherited

Called before evaluations on an element internal side.

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

virtual void ThreadedElementLoopBase< ConstElemRange >::subdomainChanged ( )
virtualinherited

Called every time the current subdomain changes (i.e.

the subdomain of this element is not the same as the subdomain of the last element). Beware of over-using this! You might think that you can do some expensive stuff in here and get away with it... but there are applications that have TONS of subdomains....

Reimplemented in ComputeUserObjectsThread, ComputeMaterialsObjectThread, ComputeIndicatorThread, ComputeJacobianThread, ComputeResidualThread, ComputeElemAuxVarsThread, and ComputeMarkerThread.

Member Data Documentation

Adaptivity& FlagElementsThread::_adaptivity
protected

Definition at line 46 of file FlagElementsThread.h.

AuxiliarySystem& FlagElementsThread::_aux_sys
protected

Definition at line 44 of file FlagElementsThread.h.

std::shared_ptr<DisplacedProblem> FlagElementsThread::_displaced_problem
protected

Definition at line 43 of file FlagElementsThread.h.

Referenced by onElement().

FEProblemBase& FlagElementsThread::_fe_problem
protected

Definition at line 42 of file FlagElementsThread.h.

MooseVariable& FlagElementsThread::_field_var
protected

Definition at line 47 of file FlagElementsThread.h.

Referenced by onElement().

unsigned int FlagElementsThread::_field_var_number
protected

Definition at line 48 of file FlagElementsThread.h.

Referenced by onElement().

unsigned int FlagElementsThread::_max_h_level
protected

Definition at line 50 of file FlagElementsThread.h.

Referenced by onElement().

MooseMesh& ThreadedElementLoopBase< ConstElemRange >::_mesh
protectedinherited

Definition at line 141 of file ThreadedElementLoopBase.h.

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_neighbor_subdomain
protectedinherited

The subdomain for the current neighbor.

Definition at line 151 of file ThreadedElementLoopBase.h.

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_old_neighbor_subdomain
protectedinherited

The subdomain for the last neighbor.

Definition at line 154 of file ThreadedElementLoopBase.h.

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_old_subdomain
protectedinherited

The subdomain for the last element.

Definition at line 148 of file ThreadedElementLoopBase.h.

std::vector<Number>& FlagElementsThread::_serialized_solution
protected

Definition at line 49 of file FlagElementsThread.h.

Referenced by onElement().

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_subdomain
protectedinherited
unsigned int FlagElementsThread::_system_number
protected

Definition at line 45 of file FlagElementsThread.h.

Referenced by onElement().

THREAD_ID ThreadedElementLoopBase< ConstElemRange >::_tid
protectedinherited

Definition at line 142 of file ThreadedElementLoopBase.h.

Referenced by ComputeFullJacobianThread::computeFaceJacobian(), ComputeJacobianThread::computeFaceJacobian(), ComputeFullJacobianThread::computeInternalFaceJacobian(), ComputeJacobianThread::computeInternalFaceJacobian(), ComputeFullJacobianThread::computeInternalInterFaceJacobian(), ComputeJacobianThread::computeInternalInterFaceJacobian(), ComputeFullJacobianThread::computeJacobian(), ComputeJacobianThread::computeJacobian(), ComputeResidualThread::onBoundary(), ComputeJacobianThread::onBoundary(), ComputeUserObjectsThread::onBoundary(), ComputeMaterialsObjectThread::onBoundary(), ComputeMarkerThread::onElement(), ComputeElemDampingThread::onElement(), ComputeElemAuxVarsThread::onElement(), ComputeResidualThread::onElement(), ComputeJacobianThread::onElement(), ComputeIndicatorThread::onElement(), ComputeUserObjectsThread::onElement(), ComputeMaterialsObjectThread::onElement(), ComputeResidualThread::onInterface(), ComputeJacobianThread::onInterface(), ComputeJacobianThread::onInternalSide(), ComputeResidualThread::onInternalSide(), ComputeIndicatorThread::onInternalSide(), ComputeMaterialsObjectThread::onInternalSide(), ComputeUserObjectsThread::onInternalSide(), ComputeMarkerThread::post(), ComputeElemAuxVarsThread::post(), ComputeMaterialsObjectThread::post(), ComputeIndicatorThread::post(), ComputeResidualThread::post(), ComputeJacobianThread::post(), ComputeUserObjectsThread::post(), ComputeResidualThread::postElement(), ComputeJacobianThread::postElement(), ComputeJacobianBlocksThread::postElement(), ComputeMarkerThread::subdomainChanged(), ComputeElemAuxVarsThread::subdomainChanged(), ComputeResidualThread::subdomainChanged(), ComputeJacobianThread::subdomainChanged(), ComputeIndicatorThread::subdomainChanged(), ComputeMaterialsObjectThread::subdomainChanged(), and ComputeUserObjectsThread::subdomainChanged().


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