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

#include <CacheChangedListsThread.h>

Inheritance diagram for CacheChangedListsThread:
[legend]

Public Member Functions

 CacheChangedListsThread (MooseMesh &mesh)
 
 CacheChangedListsThread (CacheChangedListsThread &x, Threads::split split)
 
virtual ~CacheChangedListsThread ()
 
virtual void onElement (const Elem *elem) override
 Assembly of the element (not including surface assembly) More...
 
void join (const CacheChangedListsThread &y)
 
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 preElement (const Elem *elem)
 Called before the element assembly. 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 preInternalSide (const Elem *elem, unsigned int side)
 Called before evaluations on an element internal side. 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...
 
virtual void neighborSubdomainChanged ()
 Called every time the neighbor subdomain changes (i.e. More...
 
virtual void caughtMooseException (MooseException &)
 Called if a MooseException is caught anywhere during the computation. More...
 
virtual bool keepGoing ()
 Whether or not the loop should continue. More...
 

Public Attributes

std::vector< const Elem * > _refined_elements
 The elements that were just refined. More...
 
std::vector< const Elem * > _coarsened_elements
 The elements that were just coarsened. More...
 
std::map< const Elem *, std::vector< const Elem * > > _coarsened_element_children
 Map of Parent elements to children elements for elements that were just coarsened. More...
 

Protected Attributes

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 17 of file CacheChangedListsThread.h.

Constructor & Destructor Documentation

◆ CacheChangedListsThread() [1/2]

CacheChangedListsThread::CacheChangedListsThread ( MooseMesh mesh)

◆ CacheChangedListsThread() [2/2]

CacheChangedListsThread::CacheChangedListsThread ( CacheChangedListsThread x,
Threads::split  split 
)

Definition at line 20 of file CacheChangedListsThread.C.

22 {
23 }
static PetscErrorCode Vec x

◆ ~CacheChangedListsThread()

CacheChangedListsThread::~CacheChangedListsThread ( )
virtual

Definition at line 25 of file CacheChangedListsThread.C.

25 {}

Member Function Documentation

◆ caughtMooseException()

virtual void ThreadedElementLoopBase< ConstElemRange >::caughtMooseException ( MooseException )
inlinevirtualinherited

Called if a MooseException is caught anywhere during the computation.

The single input parameter taken is a MooseException object.

Reimplemented in ThreadedElementLoop< ConstElemRange >.

Definition at line 126 of file ThreadedElementLoopBase.h.

126 {};

◆ join()

void CacheChangedListsThread::join ( const CacheChangedListsThread y)

Definition at line 49 of file CacheChangedListsThread.C.

50 {
51  _refined_elements.insert(
52  _refined_elements.end(), y._refined_elements.begin(), y._refined_elements.end());
53  _coarsened_elements.insert(
57 }
std::map< const Elem *, std::vector< const Elem * > > _coarsened_element_children
Map of Parent elements to children elements for elements that were just coarsened.
std::vector< const Elem * > _refined_elements
The elements that were just refined.
std::vector< const Elem * > _coarsened_elements
The elements that were just coarsened.

◆ keepGoing()

virtual bool ThreadedElementLoopBase< ConstElemRange >::keepGoing ( )
inlinevirtualinherited

Whether or not the loop should continue.

Returns
true to keep going, false to stop.

Reimplemented in ThreadedElementLoop< ConstElemRange >.

Definition at line 133 of file ThreadedElementLoopBase.h.

133 { return true; }

◆ neighborSubdomainChanged()

void ThreadedElementLoopBase< ConstElemRange >::neighborSubdomainChanged ( )
virtualinherited

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 in ThreadedElementLoop< ConstElemRange >.

Definition at line 314 of file ThreadedElementLoopBase.h.

315 {
316 }

◆ onBoundary()

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 ComputeUserObjectsThread, ComputeMaterialsObjectThread, ComputeResidualThread, ComputeIndicatorThread, ComputeJacobianThread, and ComputeMarkerThread.

Definition at line 274 of file ThreadedElementLoopBase.h.

277 {
278 }

◆ onElement()

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

Assembly of the element (not including surface assembly)

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 28 of file CacheChangedListsThread.C.

29 {
30  if (elem->refinement_flag() == Elem::INACTIVE && elem->has_children() &&
31  elem->child_ptr(0)->refinement_flag() == Elem::JUST_REFINED)
32  _refined_elements.push_back(elem);
33 
34  if (elem->refinement_flag() == Elem::JUST_COARSENED)
35  {
36  if (elem->has_children())
37  {
38  _coarsened_elements.push_back(elem);
39 
40  std::vector<const Elem *> & children = _coarsened_element_children[elem];
41 
42  for (unsigned int child = 0; child < elem->n_children(); child++)
43  children.push_back(elem->child_ptr(child));
44  }
45  }
46 }
std::map< const Elem *, std::vector< const Elem * > > _coarsened_element_children
Map of Parent elements to children elements for elements that were just coarsened.
std::vector< const Elem * > _refined_elements
The elements that were just refined.
std::vector< const Elem * > _coarsened_elements
The elements that were just coarsened.

◆ onInterface()

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 ComputeResidualThread, and ComputeJacobianThread.

Definition at line 300 of file ThreadedElementLoopBase.h.

303 {
304 }

◆ onInternalSide()

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 ComputeUserObjectsThread, ComputeMaterialsObjectThread, ComputeResidualThread, ComputeIndicatorThread, ComputeJacobianThread, and ComputeMarkerThread.

Definition at line 294 of file ThreadedElementLoopBase.h.

295 {
296 }

◆ operator()()

void ThreadedElementLoopBase< ConstElemRange >::operator() ( const ConstElemRange &  range,
bool  bypass_threading = false 
)
inherited

Definition at line 171 of file ThreadedElementLoopBase.h.

172 {
173  try
174  {
175  ParallelUniqueId puid;
176  _tid = bypass_threading ? 0 : puid.id;
177 
178  pre();
179 
182  typename RangeType::const_iterator el = range.begin();
183  for (el = range.begin(); el != range.end(); ++el)
184  {
185  if (!keepGoing())
186  break;
187 
188  const Elem * elem = *el;
189 
190  preElement(elem);
191 
193  _subdomain = elem->subdomain_id();
194  if (_subdomain != _old_subdomain)
196 
197  onElement(elem);
198 
199  for (unsigned int side = 0; side < elem->n_sides(); side++)
200  {
201  std::vector<BoundaryID> boundary_ids = _mesh.getBoundaryIDs(elem, side);
202 
203  if (boundary_ids.size() > 0)
204  for (std::vector<BoundaryID>::iterator it = boundary_ids.begin();
205  it != boundary_ids.end();
206  ++it)
207  onBoundary(elem, side, *it);
208 
209  const Elem * neighbor = elem->neighbor_ptr(side);
210  if (neighbor != nullptr)
211  {
212  preInternalSide(elem, side);
213 
215  _neighbor_subdomain = neighbor->subdomain_id();
218 
219  onInternalSide(elem, side);
220 
221  if (boundary_ids.size() > 0)
222  for (std::vector<BoundaryID>::iterator it = boundary_ids.begin();
223  it != boundary_ids.end();
224  ++it)
225  onInterface(elem, side, *it);
226 
227  postInternalSide(elem, side);
228  }
229  } // sides
230  postElement(elem);
231 
232  } // range
233 
234  post();
235  }
236  catch (MooseException & e)
237  {
239  }
240 }
virtual bool keepGoing()
Whether or not the loop should continue.
virtual void onElement(const Elem *elem)
Assembly of the element (not including surface assembly)
virtual void pre()
Called before the element range loop.
virtual void subdomainChanged()
Called every time the current subdomain changes (i.e.
virtual void neighborSubdomainChanged()
Called every time the neighbor subdomain changes (i.e.
virtual void preInternalSide(const Elem *elem, unsigned int side)
Called before evaluations on an element internal side.
virtual void postInternalSide(const Elem *elem, unsigned int side)
Called after evaluations on an element internal side.
const SubdomainID INVALID_BLOCK_ID
Definition: MooseTypes.h:320
virtual void postElement(const Elem *elem)
Called after the element assembly is done (including surface assembling)
virtual void onInterface(const Elem *elem, unsigned int side, BoundaryID bnd_id)
Called when doing interface assembling.
SubdomainID _old_neighbor_subdomain
The subdomain for the last neighbor.
virtual void onInternalSide(const Elem *elem, unsigned int side)
Called when doing internal edge assembling.
Provides a way for users to bail out of the current solve.
virtual void caughtMooseException(MooseException &)
Called if a MooseException is caught anywhere during the computation.
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
Returns a vector of boundary IDs for the requested element on the requested side. ...
Definition: MooseMesh.C:2105
SubdomainID _subdomain
The subdomain for the current element.
SubdomainID _old_subdomain
The subdomain for the last element.
virtual void post()
Called after the element range loop.
virtual void preElement(const Elem *elem)
Called before the element assembly.
SubdomainID _neighbor_subdomain
The subdomain for the current neighbor.
virtual void onBoundary(const Elem *elem, unsigned int side, BoundaryID bnd_id)
Called when doing boundary assembling.

◆ post()

void ThreadedElementLoopBase< ConstElemRange >::post ( )
virtualinherited

◆ postElement()

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, ComputeResidualThread, ComputeIndicatorThread, ComputeJacobianThread, and ComputeMarkerThread.

Definition at line 268 of file ThreadedElementLoopBase.h.

269 {
270 }

◆ postInternalSide()

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'

Definition at line 288 of file ThreadedElementLoopBase.h.

289 {
290 }

◆ pre()

void ThreadedElementLoopBase< ConstElemRange >::pre ( )
virtualinherited

Called before the element range loop.

Definition at line 244 of file ThreadedElementLoopBase.h.

245 {
246 }

◆ preElement()

void ThreadedElementLoopBase< ConstElemRange >::preElement ( const Elem *  elem)
virtualinherited

Called before the element assembly.

Parameters
elem- active element

Reimplemented in ThreadedElementLoop< ConstElemRange >.

Definition at line 262 of file ThreadedElementLoopBase.h.

263 {
264 }

◆ preInternalSide()

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

Called before evaluations on an element internal side.

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

Reimplemented in ThreadedElementLoop< ConstElemRange >.

Definition at line 282 of file ThreadedElementLoopBase.h.

283 {
284 }

◆ subdomainChanged()

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, ComputeResidualThread, ComputeIndicatorThread, ComputeJacobianThread, ComputeElemAuxVarsThread, and ComputeMarkerThread.

Definition at line 308 of file ThreadedElementLoopBase.h.

309 {
310 }

Member Data Documentation

◆ _coarsened_element_children

std::map<const Elem *, std::vector<const Elem *> > CacheChangedListsThread::_coarsened_element_children

Map of Parent elements to children elements for elements that were just coarsened.

Definition at line 35 of file CacheChangedListsThread.h.

Referenced by MooseMesh::cacheChangedLists(), join(), and onElement().

◆ _coarsened_elements

std::vector<const Elem *> CacheChangedListsThread::_coarsened_elements

The elements that were just coarsened.

Definition at line 32 of file CacheChangedListsThread.h.

Referenced by MooseMesh::cacheChangedLists(), join(), and onElement().

◆ _mesh

MooseMesh& ThreadedElementLoopBase< ConstElemRange >::_mesh
protectedinherited

Definition at line 136 of file ThreadedElementLoopBase.h.

◆ _neighbor_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_neighbor_subdomain
protectedinherited

The subdomain for the current neighbor.

Definition at line 146 of file ThreadedElementLoopBase.h.

◆ _old_neighbor_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_old_neighbor_subdomain
protectedinherited

The subdomain for the last neighbor.

Definition at line 149 of file ThreadedElementLoopBase.h.

◆ _old_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_old_subdomain
protectedinherited

The subdomain for the last element.

Definition at line 143 of file ThreadedElementLoopBase.h.

◆ _refined_elements

std::vector<const Elem *> CacheChangedListsThread::_refined_elements

The elements that were just refined.

Definition at line 29 of file CacheChangedListsThread.h.

Referenced by MooseMesh::cacheChangedLists(), join(), and onElement().

◆ _subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_subdomain
protectedinherited

◆ _tid

THREAD_ID ThreadedElementLoopBase< ConstElemRange >::_tid
protectedinherited

Definition at line 137 of file ThreadedElementLoopBase.h.

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


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