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

Holds kernels and provides some services. More...

#include <KernelWarehouse.h>

Inheritance diagram for KernelWarehouse:
[legend]

Public Member Functions

 KernelWarehouse ()
 
void addObject (std::shared_ptr< KernelBase > object, THREAD_ID tid=0) override
 Add Kernel to the storage structure. More...
 
virtual void updateActive (THREAD_ID tid=0) override
 Update the active status of Kernels. More...
 
std::set< SubdomainIDgetActiveBlocks (THREAD_ID tid=0) const
 Return a set of active SubdomainsIDs. More...
 
void sort (THREAD_ID tid=0)
 Sort the objects using the DependencyResolver. More...
 
void subdomainsCovered (std::set< SubdomainID > &subdomains_covered, std::set< std::string > &unique_variables, THREAD_ID tid=0) const
 Populates a set of covered subdomains and the associated variable names. More...
 
bool hasActiveVariableBlockObjects (unsigned int variable_id, SubdomainID block_id, THREAD_ID tid=0) const
 Methods for checking/getting variable kernels for a variable and SubdomainID. More...
 
const std::vector< std::shared_ptr< KernelBase > > & getActiveVariableBlockObjects (unsigned int variable_id, SubdomainID block_id, THREAD_ID tid=0) const
 
virtual void initialSetup (THREAD_ID tid=0) const
 Convenience methods for calling object setup methods. More...
 
virtual void timestepSetup (THREAD_ID tid=0) const
 
virtual void subdomainSetup (THREAD_ID tid=0) const
 
virtual void subdomainSetup (SubdomainID id, THREAD_ID tid=0) const
 
virtual void jacobianSetup (THREAD_ID tid=0) const
 
virtual void residualSetup (THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< KernelBase > > & getObjects (THREAD_ID tid=0) const
 Retrieve complete vector to the all/block/boundary restricted objects for a given thread. More...
 
const std::map< SubdomainID, std::vector< std::shared_ptr< KernelBase > > > & getBlockObjects (THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< KernelBase > > & getBlockObjects (SubdomainID id, THREAD_ID tid=0) const
 
const std::map< BoundaryID, std::vector< std::shared_ptr< KernelBase > > > & getBoundaryObjects (THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< KernelBase > > & getBoundaryObjects (BoundaryID id, THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< KernelBase > > & getActiveObjects (THREAD_ID tid=0) const
 Retrieve complete vector to the active all/block/boundary restricted objects for a given thread. More...
 
const std::map< SubdomainID, std::vector< std::shared_ptr< KernelBase > > > & getActiveBlockObjects (THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< KernelBase > > & getActiveBlockObjects (SubdomainID id, THREAD_ID tid=0) const
 
const std::map< BoundaryID, std::vector< std::shared_ptr< KernelBase > > > & getActiveBoundaryObjects (THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< KernelBase > > & getActiveBoundaryObjects (BoundaryID id, THREAD_ID tid=0) const
 
bool hasActiveObjects (THREAD_ID tid=0) const
 Convenience functions for determining if objects exist. More...
 
bool hasActiveBlockObjects (THREAD_ID tid=0) const
 
bool hasActiveBlockObjects (SubdomainID id, THREAD_ID tid=0) const
 
bool hasActiveBoundaryObjects (THREAD_ID tid=0) const
 
bool hasActiveBoundaryObjects (BoundaryID id, THREAD_ID tid=0) const
 
bool hasActiveObject (const std::string &name, THREAD_ID tid=0) const
 Convenience functions for checking/getting specific objects. More...
 
std::shared_ptr< KernelBasegetActiveObject (const std::string &name, THREAD_ID tid=0) const
 
void updateVariableDependency (std::set< MooseVariable * > &needed_moose_vars, THREAD_ID tid=0) const
 Update variable dependency vector. More...
 
void updateBlockVariableDependency (SubdomainID id, std::set< MooseVariable * > &needed_moose_vars, THREAD_ID tid=0) const
 
void updateBoundaryVariableDependency (std::set< MooseVariable * > &needed_moose_vars, THREAD_ID tid=0) const
 
void updateBoundaryVariableDependency (BoundaryID id, std::set< MooseVariable * > &needed_moose_vars, THREAD_ID tid=0) const
 
void updateMatPropDependency (std::set< unsigned int > &needed_mat_props, THREAD_ID tid=0) const
 Update material property dependency vector. More...
 
void updateBlockMatPropDependency (SubdomainID id, std::set< unsigned int > &needed_mat_props, THREAD_ID tid=0) const
 
void updateBoundaryMatPropDependency (std::set< unsigned int > &needed_mat_props, THREAD_ID tid=0) const
 
void updateBoundaryMatPropDependency (BoundaryID id, std::set< unsigned int > &needed_mat_props, THREAD_ID tid=0) const
 

Protected Member Functions

void checkThreadID (THREAD_ID tid) const
 Calls assert on thread id. More...
 

Static Protected Member Functions

static void updateActiveHelper (std::vector< std::shared_ptr< KernelBase >> &active, const std::vector< std::shared_ptr< KernelBase >> &all)
 Helper method for updating active vectors. More...
 
static void sortHelper (std::vector< std::shared_ptr< KernelBase >> &objects)
 Helper method for sorting vectors of objects. More...
 
static void updateVariableDependencyHelper (std::set< MooseVariable * > &needed_moose_vars, const std::vector< std::shared_ptr< KernelBase >> &objects)
 Helper method for updating variable dependency vector. More...
 
static void updateMatPropDependencyHelper (std::set< unsigned int > &needed_mat_props, const std::vector< std::shared_ptr< KernelBase >> &objects)
 Helper method for updating material property dependency vector. More...
 

Protected Attributes

std::map< unsigned int, MooseObjectWarehouse< KernelBase > > _variable_kernel_storage
 Variable based storage. More...
 
const THREAD_ID _num_threads
 Convenience member storing the number of threads used for storage (1 or libMesh::n_threads) More...
 
std::vector< std::vector< std::shared_ptr< KernelBase > > > _all_objects
 Storage container for the ALL pointers (THREAD_ID on outer vector) More...
 
std::vector< std::vector< std::shared_ptr< KernelBase > > > _active_objects
 All active objects (THREAD_ID on outer vector) More...
 
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< KernelBase > > > > _all_block_objects
 
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< KernelBase > > > > _active_block_objects
 Active block restricted objects (THREAD_ID on outer vector) More...
 
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< KernelBase > > > > _all_boundary_objects
 
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< KernelBase > > > > _active_boundary_objects
 Active boundary restricted objects (THREAD_ID on outer vector) More...
 

Detailed Description

Holds kernels and provides some services.

Definition at line 31 of file KernelWarehouse.h.

Constructor & Destructor Documentation

KernelWarehouse::KernelWarehouse ( )

Member Function Documentation

void KernelWarehouse::addObject ( std::shared_ptr< KernelBase object,
THREAD_ID  tid = 0 
)
overridevirtual

Add Kernel to the storage structure.

Reimplemented from MooseObjectWarehouseBase< KernelBase >.

Definition at line 26 of file KernelWarehouse.C.

Referenced by NonlinearEigenSystem::addEigenKernels(), MooseEigenSystem::addKernel(), and NonlinearSystemBase::addKernel().

27 {
28  // Add object to the general storage
30 
31  // Add object to the variable based storage
32  _variable_kernel_storage[object->variable().number()].addObject(object, tid);
33 }
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0)
Adds an object to the storage structure.
std::map< unsigned int, MooseObjectWarehouse< KernelBase > > _variable_kernel_storage
Variable based storage.
void MooseObjectWarehouseBase< KernelBase >::checkThreadID ( THREAD_ID  tid) const
protectedinherited

Calls assert on thread id.

Referenced by getActiveVariableBlockObjects(), and hasActiveVariableBlockObjects().

const std::map<SubdomainID, std::vector<std::shared_ptr<KernelBase > > >& MooseObjectWarehouseBase< KernelBase >::getActiveBlockObjects ( THREAD_ID  tid = 0) const
inherited
const std::vector<std::shared_ptr<KernelBase > >& MooseObjectWarehouseBase< KernelBase >::getActiveBlockObjects ( SubdomainID  id,
THREAD_ID  tid = 0 
) const
inherited
std::set<SubdomainID> MooseObjectWarehouseBase< KernelBase >::getActiveBlocks ( THREAD_ID  tid = 0) const
inherited

Return a set of active SubdomainsIDs.

const std::map<BoundaryID, std::vector<std::shared_ptr<KernelBase > > >& MooseObjectWarehouseBase< KernelBase >::getActiveBoundaryObjects ( THREAD_ID  tid = 0) const
inherited
const std::vector<std::shared_ptr<KernelBase > >& MooseObjectWarehouseBase< KernelBase >::getActiveBoundaryObjects ( BoundaryID  id,
THREAD_ID  tid = 0 
) const
inherited
std::shared_ptr<KernelBase > MooseObjectWarehouseBase< KernelBase >::getActiveObject ( const std::string &  name,
THREAD_ID  tid = 0 
) const
inherited
const std::vector<std::shared_ptr<KernelBase > >& MooseObjectWarehouseBase< KernelBase >::getActiveObjects ( THREAD_ID  tid = 0) const
inherited

Retrieve complete vector to the active all/block/boundary restricted objects for a given thread.

Parameters
tidThe thread id to retrieve objects from
const std::vector< std::shared_ptr< KernelBase > > & KernelWarehouse::getActiveVariableBlockObjects ( unsigned int  variable_id,
SubdomainID  block_id,
THREAD_ID  tid = 0 
) const

Definition at line 48 of file KernelWarehouse.C.

Referenced by ComputeFullJacobianThread::computeJacobian(), and DOFMapOutput::output().

51 {
52  checkThreadID(tid);
53  const auto iter = _variable_kernel_storage.find(variable_id);
54  mooseAssert(iter != _variable_kernel_storage.end(),
55  "Unable to located variable kernels for the given variable id: " << variable_id
56  << ".");
57  return iter->second.getActiveBlockObjects(block_id, tid);
58 }
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
std::map< unsigned int, MooseObjectWarehouse< KernelBase > > _variable_kernel_storage
Variable based storage.
const std::map<SubdomainID, std::vector<std::shared_ptr<KernelBase > > >& MooseObjectWarehouseBase< KernelBase >::getBlockObjects ( THREAD_ID  tid = 0) const
inherited
const std::vector<std::shared_ptr<KernelBase > >& MooseObjectWarehouseBase< KernelBase >::getBlockObjects ( SubdomainID  id,
THREAD_ID  tid = 0 
) const
inherited
const std::map<BoundaryID, std::vector<std::shared_ptr<KernelBase > > >& MooseObjectWarehouseBase< KernelBase >::getBoundaryObjects ( THREAD_ID  tid = 0) const
inherited
const std::vector<std::shared_ptr<KernelBase > >& MooseObjectWarehouseBase< KernelBase >::getBoundaryObjects ( BoundaryID  id,
THREAD_ID  tid = 0 
) const
inherited
const std::vector<std::shared_ptr<KernelBase > >& MooseObjectWarehouseBase< KernelBase >::getObjects ( THREAD_ID  tid = 0) const
inherited

Retrieve complete vector to the all/block/boundary restricted objects for a given thread.

Parameters
tidThe thread id to retrieve objects from
bool MooseObjectWarehouseBase< KernelBase >::hasActiveBlockObjects ( THREAD_ID  tid = 0) const
inherited
bool MooseObjectWarehouseBase< KernelBase >::hasActiveBlockObjects ( SubdomainID  id,
THREAD_ID  tid = 0 
) const
inherited
bool MooseObjectWarehouseBase< KernelBase >::hasActiveBoundaryObjects ( THREAD_ID  tid = 0) const
inherited
bool MooseObjectWarehouseBase< KernelBase >::hasActiveBoundaryObjects ( BoundaryID  id,
THREAD_ID  tid = 0 
) const
inherited
bool MooseObjectWarehouseBase< KernelBase >::hasActiveObject ( const std::string &  name,
THREAD_ID  tid = 0 
) const
inherited

Convenience functions for checking/getting specific objects.

bool MooseObjectWarehouseBase< KernelBase >::hasActiveObjects ( THREAD_ID  tid = 0) const
inherited

Convenience functions for determining if objects exist.

bool KernelWarehouse::hasActiveVariableBlockObjects ( unsigned int  variable_id,
SubdomainID  block_id,
THREAD_ID  tid = 0 
) const

Methods for checking/getting variable kernels for a variable and SubdomainID.

Definition at line 36 of file KernelWarehouse.C.

Referenced by ComputeFullJacobianThread::computeJacobian(), and DOFMapOutput::output().

39 {
40  checkThreadID(tid);
41  std::map<unsigned int, MooseObjectWarehouse<KernelBase>>::const_iterator iter =
42  _variable_kernel_storage.find(variable_id);
43  return (iter != _variable_kernel_storage.end() &&
44  iter->second.hasActiveBlockObjects(block_id, tid));
45 }
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
std::map< unsigned int, MooseObjectWarehouse< KernelBase > > _variable_kernel_storage
Variable based storage.
virtual void MooseObjectWarehouse< KernelBase >::initialSetup ( THREAD_ID  tid = 0) const
virtualinherited

Convenience methods for calling object setup methods.

virtual void MooseObjectWarehouse< KernelBase >::jacobianSetup ( THREAD_ID  tid = 0) const
virtualinherited
virtual void MooseObjectWarehouse< KernelBase >::residualSetup ( THREAD_ID  tid = 0) const
virtualinherited
void MooseObjectWarehouseBase< KernelBase >::sort ( THREAD_ID  tid = 0)
inherited

Sort the objects using the DependencyResolver.

static void MooseObjectWarehouseBase< KernelBase >::sortHelper ( std::vector< std::shared_ptr< KernelBase >> &  objects)
staticprotectedinherited

Helper method for sorting vectors of objects.

void MooseObjectWarehouseBase< KernelBase >::subdomainsCovered ( std::set< SubdomainID > &  subdomains_covered,
std::set< std::string > &  unique_variables,
THREAD_ID  tid = 0 
) const
inherited

Populates a set of covered subdomains and the associated variable names.

virtual void MooseObjectWarehouse< KernelBase >::subdomainSetup ( THREAD_ID  tid = 0) const
virtualinherited
virtual void MooseObjectWarehouse< KernelBase >::subdomainSetup ( SubdomainID  id,
THREAD_ID  tid = 0 
) const
virtualinherited
virtual void MooseObjectWarehouse< KernelBase >::timestepSetup ( THREAD_ID  tid = 0) const
virtualinherited
void KernelWarehouse::updateActive ( THREAD_ID  tid = 0)
overridevirtual

Update the active status of Kernels.

Reimplemented from MooseObjectWarehouseBase< KernelBase >.

Definition at line 61 of file KernelWarehouse.C.

Referenced by NonlinearSystemBase::updateActive().

62 {
64 
65  for (auto & it : _variable_kernel_storage)
66  it.second.updateActive(tid);
67 }
virtual void updateActive(THREAD_ID tid=0)
Updates the active objects storage.
std::map< unsigned int, MooseObjectWarehouse< KernelBase > > _variable_kernel_storage
Variable based storage.
static void MooseObjectWarehouseBase< KernelBase >::updateActiveHelper ( std::vector< std::shared_ptr< KernelBase >> &  active,
const std::vector< std::shared_ptr< KernelBase >> &  all 
)
staticprotectedinherited

Helper method for updating active vectors.

void MooseObjectWarehouseBase< KernelBase >::updateBlockMatPropDependency ( SubdomainID  id,
std::set< unsigned int > &  needed_mat_props,
THREAD_ID  tid = 0 
) const
inherited
void MooseObjectWarehouseBase< KernelBase >::updateBlockVariableDependency ( SubdomainID  id,
std::set< MooseVariable * > &  needed_moose_vars,
THREAD_ID  tid = 0 
) const
inherited
void MooseObjectWarehouseBase< KernelBase >::updateBoundaryMatPropDependency ( std::set< unsigned int > &  needed_mat_props,
THREAD_ID  tid = 0 
) const
inherited
void MooseObjectWarehouseBase< KernelBase >::updateBoundaryMatPropDependency ( BoundaryID  id,
std::set< unsigned int > &  needed_mat_props,
THREAD_ID  tid = 0 
) const
inherited
void MooseObjectWarehouseBase< KernelBase >::updateBoundaryVariableDependency ( std::set< MooseVariable * > &  needed_moose_vars,
THREAD_ID  tid = 0 
) const
inherited
void MooseObjectWarehouseBase< KernelBase >::updateBoundaryVariableDependency ( BoundaryID  id,
std::set< MooseVariable * > &  needed_moose_vars,
THREAD_ID  tid = 0 
) const
inherited
void MooseObjectWarehouseBase< KernelBase >::updateMatPropDependency ( std::set< unsigned int > &  needed_mat_props,
THREAD_ID  tid = 0 
) const
inherited

Update material property dependency vector.

static void MooseObjectWarehouseBase< KernelBase >::updateMatPropDependencyHelper ( std::set< unsigned int > &  needed_mat_props,
const std::vector< std::shared_ptr< KernelBase >> &  objects 
)
staticprotectedinherited

Helper method for updating material property dependency vector.

void MooseObjectWarehouseBase< KernelBase >::updateVariableDependency ( std::set< MooseVariable * > &  needed_moose_vars,
THREAD_ID  tid = 0 
) const
inherited

Update variable dependency vector.

static void MooseObjectWarehouseBase< KernelBase >::updateVariableDependencyHelper ( std::set< MooseVariable * > &  needed_moose_vars,
const std::vector< std::shared_ptr< KernelBase >> &  objects 
)
staticprotectedinherited

Helper method for updating variable dependency vector.

Member Data Documentation

std::vector<std::map<SubdomainID, std::vector<std::shared_ptr<KernelBase > > > > MooseObjectWarehouseBase< KernelBase >::_active_block_objects
protectedinherited

Active block restricted objects (THREAD_ID on outer vector)

Definition at line 171 of file MooseObjectWarehouseBase.h.

std::vector<std::map<BoundaryID, std::vector<std::shared_ptr<KernelBase > > > > MooseObjectWarehouseBase< KernelBase >::_active_boundary_objects
protectedinherited

Active boundary restricted objects (THREAD_ID on outer vector)

Definition at line 177 of file MooseObjectWarehouseBase.h.

std::vector<std::vector<std::shared_ptr<KernelBase > > > MooseObjectWarehouseBase< KernelBase >::_active_objects
protectedinherited

All active objects (THREAD_ID on outer vector)

Definition at line 165 of file MooseObjectWarehouseBase.h.

std::vector<std::map<SubdomainID, std::vector<std::shared_ptr<KernelBase > > > > MooseObjectWarehouseBase< KernelBase >::_all_block_objects
protectedinherited

Definition at line 168 of file MooseObjectWarehouseBase.h.

std::vector<std::map<BoundaryID, std::vector<std::shared_ptr<KernelBase > > > > MooseObjectWarehouseBase< KernelBase >::_all_boundary_objects
protectedinherited

Definition at line 174 of file MooseObjectWarehouseBase.h.

std::vector<std::vector<std::shared_ptr<KernelBase > > > MooseObjectWarehouseBase< KernelBase >::_all_objects
protectedinherited

Storage container for the ALL pointers (THREAD_ID on outer vector)

Definition at line 162 of file MooseObjectWarehouseBase.h.

const THREAD_ID MooseObjectWarehouseBase< KernelBase >::_num_threads
protectedinherited

Convenience member storing the number of threads used for storage (1 or libMesh::n_threads)

Definition at line 159 of file MooseObjectWarehouseBase.h.

std::map<unsigned int, MooseObjectWarehouse<KernelBase> > KernelWarehouse::_variable_kernel_storage
protected

Variable based storage.

Definition at line 59 of file KernelWarehouse.h.

Referenced by addObject(), getActiveVariableBlockObjects(), hasActiveVariableBlockObjects(), and updateActive().


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