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

Warehouse for storing initial conditions. More...

#include <InitialConditionWarehouse.h>

Inheritance diagram for InitialConditionWarehouse:
[legend]

Public Member Functions

 InitialConditionWarehouse ()
 
void initialSetup (THREAD_ID tid)
 Initial setup. More...
 
void addObject (std::shared_ptr< InitialConditionBase > object, THREAD_ID tid, bool recurse=true)
 Add object to the warehouse. More...
 
std::set< std::string > getDependObjects () const
 Get a list of dependent UserObjects for this exec type. More...
 
unsigned int size (THREAD_ID tid=0)
 Return how many kernels we store in the current warehouse. More...
 
std::set< SubdomainIDgetActiveBlocks (THREAD_ID tid=0) const
 Return a set of active SubdomainsIDs. More...
 
virtual void updateActive (THREAD_ID tid=0)
 Updates the active objects storage. 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...
 
THREAD_ID numThreads ()
 Return the number of threads. More...
 
const std::vector< std::shared_ptr< InitialConditionBase > > & 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< InitialConditionBase > > > & getBlockObjects (THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< InitialConditionBase > > & getBlockObjects (SubdomainID id, THREAD_ID tid=0) const
 
const std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > & getBoundaryObjects (THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< InitialConditionBase > > & getBoundaryObjects (BoundaryID id, THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< InitialConditionBase > > & 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< InitialConditionBase > > > & getActiveBlockObjects (THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< InitialConditionBase > > & getActiveBlockObjects (SubdomainID id, THREAD_ID tid=0) const
 
const std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > & getActiveBoundaryObjects (THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< InitialConditionBase > > & getActiveBoundaryObjects (BoundaryID id, THREAD_ID tid=0) const
 
bool hasObjects (THREAD_ID tid=0) const
 Convenience functions for determining if objects exist. More...
 
bool hasActiveObjects (THREAD_ID tid=0) const
 
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< InitialConditionBasegetObject (const std::string &name, THREAD_ID tid=0) const
 
std::shared_ptr< InitialConditionBasegetActiveObject (const std::string &name, THREAD_ID tid=0) const
 
void updateVariableDependency (std::set< MooseVariableFEBase * > &needed_moose_vars, THREAD_ID tid=0) const
 Update variable dependency vector. More...
 
void updateBlockVariableDependency (SubdomainID id, std::set< MooseVariableFEBase * > &needed_moose_vars, THREAD_ID tid=0) const
 
void updateBoundaryVariableDependency (std::set< MooseVariableFEBase * > &needed_moose_vars, THREAD_ID tid=0) const
 
void updateBoundaryVariableDependency (BoundaryID id, std::set< MooseVariableFEBase * > &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< InitialConditionBase >> &active, const std::vector< std::shared_ptr< InitialConditionBase >> &all)
 Helper method for updating active vectors. More...
 
static void sortHelper (std::vector< std::shared_ptr< InitialConditionBase >> &objects)
 Helper method for sorting vectors of objects. More...
 
static void updateVariableDependencyHelper (std::set< MooseVariableFEBase * > &needed_moose_vars, const std::vector< std::shared_ptr< InitialConditionBase >> &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< InitialConditionBase >> &objects)
 Helper method for updating material property dependency vector. More...
 

Protected Attributes

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< InitialConditionBase > > > _all_objects
 Storage container for the ALL pointers (THREAD_ID on outer vector) More...
 
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _active_objects
 All active objects (THREAD_ID on outer vector) More...
 
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > > _all_block_objects
 
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_block_objects
 Active block restricted objects (THREAD_ID on outer vector) More...
 
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > > _all_boundary_objects
 
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_boundary_objects
 Active boundary restricted objects (THREAD_ID on outer vector) More...
 
std::vector< std::map< std::string, std::set< BoundaryID > > > _boundary_ics
 
std::vector< std::map< std::string, std::set< SubdomainID > > > _block_ics
 

Detailed Description

Warehouse for storing initial conditions.

Definition at line 21 of file InitialConditionWarehouse.h.

Constructor & Destructor Documentation

◆ InitialConditionWarehouse()

InitialConditionWarehouse::InitialConditionWarehouse ( )

Definition at line 16 of file InitialConditionWarehouse.C.

18  _boundary_ics(libMesh::n_threads()),
19  _block_ics(libMesh::n_threads())
20 {
21 }
std::vector< std::map< std::string, std::set< BoundaryID > > > _boundary_ics
std::vector< std::map< std::string, std::set< SubdomainID > > > _block_ics

Member Function Documentation

◆ addObject()

void InitialConditionWarehouse::addObject ( std::shared_ptr< InitialConditionBase object,
THREAD_ID  tid,
bool  recurse = true 
)
virtual

Add object to the warehouse.

Reimplemented from MooseObjectWarehouseBase< InitialConditionBase >.

Definition at line 32 of file InitialConditionWarehouse.C.

Referenced by FEProblemBase::addInitialCondition().

35 {
36  // Check that when object is boundary restricted that the variable is nodal
37  const MooseVariableFEBase & var = object->variable();
38 
39  // Boundary Restricted
40  if (object->boundaryRestricted())
41  {
42  if (!var.isNodal())
43  mooseError("You are trying to set a boundary restricted variable on non-nodal variable. That "
44  "is not allowed.");
45 
46  std::map<std::string, std::set<BoundaryID>>::const_iterator iter =
47  _boundary_ics[tid].find(var.name());
48  if (iter != _boundary_ics[tid].end() && object->hasBoundary(iter->second))
49  mooseError("The initial condition '",
50  object->name(),
51  "' is being defined on a boundary that already has an initial condition defined.");
52  else
53  _boundary_ics[tid][var.name()].insert(object->boundaryIDs().begin(),
54  object->boundaryIDs().end());
55  }
56 
57  // Block Restricted
58  else if (object->blockRestricted())
59  {
60  std::map<std::string, std::set<SubdomainID>>::const_iterator iter =
61  _block_ics[tid].find(var.name());
62  if (iter != _block_ics[tid].end() &&
63  (object->hasBlocks(iter->second) ||
64  (iter->second.find(Moose::ANY_BLOCK_ID) != iter->second.end())))
65  mooseError("The initial condition '",
66  object->name(),
67  "' is being defined on a block that already has an initial condition defined.");
68  else
69  _block_ics[tid][var.name()].insert(object->blockIDs().begin(), object->blockIDs().end());
70  }
71 
72  // Non-restricted
73  else
74  {
75  std::map<std::string, std::set<SubdomainID>>::const_iterator iter =
76  _block_ics[tid].find(var.name());
77  if (iter != _block_ics[tid].end())
78  mooseError("The initial condition '",
79  object->name(),
80  "' is being defined on a block that already has an initial condition defined.");
81  else
82  _block_ics[tid][var.name()].insert(Moose::ANY_BLOCK_ID);
83  }
84 
85  // Add the IC to the storage
87 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
std::vector< std::map< std::string, std::set< BoundaryID > > > _boundary_ics
virtual bool isNodal() const =0
Is this variable nodal.
std::vector< std::map< std::string, std::set< SubdomainID > > > _block_ics
const SubdomainID ANY_BLOCK_ID
Definition: MooseTypes.C:15
const std::string & name() const
Get the variable name.
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true)
Adds an object to the storage structure.

◆ checkThreadID()

void MooseObjectWarehouseBase< InitialConditionBase >::checkThreadID ( THREAD_ID  tid) const
inlineprotectedinherited

Calls assert on thread id.

Definition at line 694 of file MooseObjectWarehouseBase.h.

695 {
696  mooseAssert(tid < _num_threads,
697  "Attempting to access a thread id ("
698  << tid << ") greater than the number allowed by the storage item ("
699  << _num_threads << ")");
700 }
const THREAD_ID _num_threads
Convenience member storing the number of threads used for storage (1 or libMesh::n_threads) ...

◆ getActiveBlockObjects() [1/2]

const std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > & MooseObjectWarehouseBase< InitialConditionBase >::getActiveBlockObjects ( THREAD_ID  tid = 0) const
inlineinherited

Definition at line 388 of file MooseObjectWarehouseBase.h.

389 {
390  checkThreadID(tid);
391  return _active_block_objects[tid];
392 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_block_objects
Active block restricted objects (THREAD_ID on outer vector)
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.

◆ getActiveBlockObjects() [2/2]

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

Definition at line 396 of file MooseObjectWarehouseBase.h.

397 {
398  checkThreadID(tid);
399  const auto iter = _active_block_objects[tid].find(id);
400  mooseAssert(iter != _active_block_objects[tid].end(),
401  "Unable to located active block objects for the given id: " << id << ".");
402  return iter->second;
403 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_block_objects
Active block restricted objects (THREAD_ID on outer vector)
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.

◆ getActiveBlocks()

std::set< SubdomainID > MooseObjectWarehouseBase< InitialConditionBase >::getActiveBlocks ( THREAD_ID  tid = 0) const
inherited

Return a set of active SubdomainsIDs.

Definition at line 496 of file MooseObjectWarehouseBase.h.

497 {
498  checkThreadID(tid);
499  std::set<SubdomainID> ids;
500  for (const auto & object_pair : _active_block_objects[tid])
501  ids.insert(object_pair.first);
502  return ids;
503 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_block_objects
Active block restricted objects (THREAD_ID on outer vector)
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.

◆ getActiveBoundaryObjects() [1/2]

const std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > & MooseObjectWarehouseBase< InitialConditionBase >::getActiveBoundaryObjects ( THREAD_ID  tid = 0) const
inlineinherited

Definition at line 369 of file MooseObjectWarehouseBase.h.

370 {
371  checkThreadID(tid);
372  return _active_boundary_objects[tid];
373 }
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_boundary_objects
Active boundary restricted objects (THREAD_ID on outer vector)

◆ getActiveBoundaryObjects() [2/2]

const std::vector< std::shared_ptr< InitialConditionBase > > & MooseObjectWarehouseBase< InitialConditionBase >::getActiveBoundaryObjects ( BoundaryID  id,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 377 of file MooseObjectWarehouseBase.h.

378 {
379  checkThreadID(tid);
380  const auto iter = _active_boundary_objects[tid].find(id);
381  mooseAssert(iter != _active_boundary_objects[tid].end(),
382  "Unable to located active boundary objects for the given id: " << id << ".");
383  return iter->second;
384 }
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_boundary_objects
Active boundary restricted objects (THREAD_ID on outer vector)

◆ getActiveObject()

std::shared_ptr< InitialConditionBase > MooseObjectWarehouseBase< InitialConditionBase >::getActiveObject ( const std::string &  name,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 485 of file MooseObjectWarehouseBase.h.

486 {
487  checkThreadID(tid);
488  for (const auto & object : _active_objects[tid])
489  if (object->name() == name)
490  return object;
491  mooseError("Unable to locate active object: ", name, ".");
492 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _active_objects
All active objects (THREAD_ID on outer vector)

◆ getActiveObjects()

const std::vector< std::shared_ptr< InitialConditionBase > > & MooseObjectWarehouseBase< InitialConditionBase >::getActiveObjects ( THREAD_ID  tid = 0) const
inlineinherited

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

Parameters
tidThe thread id to retrieve objects from

Definition at line 361 of file MooseObjectWarehouseBase.h.

Referenced by getDependObjects().

362 {
363  checkThreadID(tid);
364  return _active_objects[tid];
365 }
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _active_objects
All active objects (THREAD_ID on outer vector)

◆ getBlockObjects() [1/2]

const std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > & MooseObjectWarehouseBase< InitialConditionBase >::getBlockObjects ( THREAD_ID  tid = 0) const
inlineinherited

Definition at line 342 of file MooseObjectWarehouseBase.h.

343 {
344  checkThreadID(tid);
345  return _all_block_objects[tid];
346 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > > _all_block_objects
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.

◆ getBlockObjects() [2/2]

const std::vector< std::shared_ptr< InitialConditionBase > > & MooseObjectWarehouseBase< InitialConditionBase >::getBlockObjects ( SubdomainID  id,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 350 of file MooseObjectWarehouseBase.h.

351 {
352  checkThreadID(tid);
353  const auto iter = _all_block_objects[tid].find(id);
354  mooseAssert(iter != _all_block_objects[tid].end(),
355  "Unable to located active block objects for the given id: " << id << ".");
356  return iter->second;
357 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > > _all_block_objects
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.

◆ getBoundaryObjects() [1/2]

const std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > & MooseObjectWarehouseBase< InitialConditionBase >::getBoundaryObjects ( THREAD_ID  tid = 0) const
inlineinherited

Definition at line 323 of file MooseObjectWarehouseBase.h.

324 {
325  checkThreadID(tid);
326  return _all_boundary_objects[tid];
327 }
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > > _all_boundary_objects

◆ getBoundaryObjects() [2/2]

const std::vector< std::shared_ptr< InitialConditionBase > > & MooseObjectWarehouseBase< InitialConditionBase >::getBoundaryObjects ( BoundaryID  id,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 331 of file MooseObjectWarehouseBase.h.

332 {
333  checkThreadID(tid);
334  const auto iter = _all_boundary_objects[tid].find(id);
335  mooseAssert(iter != _all_boundary_objects[tid].end(),
336  "Unable to located active boundary objects for the given id: " << id << ".");
337  return iter->second;
338 }
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > > _all_boundary_objects

◆ getDependObjects()

std::set< std::string > InitialConditionWarehouse::getDependObjects ( ) const

Get a list of dependent UserObjects for this exec type.

Returns
a set of dependent user objects

Definition at line 90 of file InitialConditionWarehouse.C.

Referenced by FEProblemBase::initialSetup().

91 {
92  std::set<std::string> depend_objects;
93 
94  const auto & ics = getActiveObjects();
95  for (const auto & ic : ics)
96  {
97  const auto & uo = ic->getDependObjects();
98  depend_objects.insert(uo.begin(), uo.end());
99  }
100 
101  return depend_objects;
102 }
const std::vector< std::shared_ptr< InitialConditionBase > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread...

◆ getObject()

std::shared_ptr< InitialConditionBase > MooseObjectWarehouseBase< InitialConditionBase >::getObject ( const std::string &  name,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 474 of file MooseObjectWarehouseBase.h.

475 {
476  checkThreadID(tid);
477  for (const auto & object : _all_objects[tid])
478  if (object->name() == name)
479  return object;
480  mooseError("Unable to locate object: ", name, ".");
481 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _all_objects
Storage container for the ALL pointers (THREAD_ID on outer vector)
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.

◆ getObjects()

const std::vector< std::shared_ptr< InitialConditionBase > > & MooseObjectWarehouseBase< InitialConditionBase >::getObjects ( THREAD_ID  tid = 0) const
inlineinherited

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

Parameters
tidThe thread id to retrieve objects from

Definition at line 315 of file MooseObjectWarehouseBase.h.

316 {
317  checkThreadID(tid);
318  return _all_objects[tid];
319 }
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _all_objects
Storage container for the ALL pointers (THREAD_ID on outer vector)
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.

◆ hasActiveBlockObjects() [1/2]

bool MooseObjectWarehouseBase< InitialConditionBase >::hasActiveBlockObjects ( THREAD_ID  tid = 0) const
inherited

Definition at line 423 of file MooseObjectWarehouseBase.h.

424 {
425  checkThreadID(tid);
426  bool has_active_block_objects = false;
427  for (const auto & object_pair : _active_block_objects[tid])
428  has_active_block_objects |= !(object_pair.second.empty());
429  return has_active_block_objects;
430 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_block_objects
Active block restricted objects (THREAD_ID on outer vector)
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.

◆ hasActiveBlockObjects() [2/2]

bool MooseObjectWarehouseBase< InitialConditionBase >::hasActiveBlockObjects ( SubdomainID  id,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 434 of file MooseObjectWarehouseBase.h.

435 {
436  checkThreadID(tid);
437  const auto iter = _active_block_objects[tid].find(id);
438  return iter != _active_block_objects[tid].end();
439 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_block_objects
Active block restricted objects (THREAD_ID on outer vector)
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.

◆ hasActiveBoundaryObjects() [1/2]

bool MooseObjectWarehouseBase< InitialConditionBase >::hasActiveBoundaryObjects ( THREAD_ID  tid = 0) const
inherited

Definition at line 443 of file MooseObjectWarehouseBase.h.

444 {
445  checkThreadID(tid);
446  bool has_active_boundary_objects = false;
447  for (const auto & object_pair : _active_boundary_objects[tid])
448  has_active_boundary_objects |= !(object_pair.second.empty());
449  return has_active_boundary_objects;
450 }
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_boundary_objects
Active boundary restricted objects (THREAD_ID on outer vector)

◆ hasActiveBoundaryObjects() [2/2]

bool MooseObjectWarehouseBase< InitialConditionBase >::hasActiveBoundaryObjects ( BoundaryID  id,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 454 of file MooseObjectWarehouseBase.h.

455 {
456  checkThreadID(tid);
457  const auto iter = _active_boundary_objects[tid].find(id);
458  return iter != _active_boundary_objects[tid].end();
459 }
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_boundary_objects
Active boundary restricted objects (THREAD_ID on outer vector)

◆ hasActiveObject()

bool MooseObjectWarehouseBase< InitialConditionBase >::hasActiveObject ( const std::string &  name,
THREAD_ID  tid = 0 
) const
inherited

Convenience functions for checking/getting specific objects.

Definition at line 463 of file MooseObjectWarehouseBase.h.

464 {
465  checkThreadID(tid);
466  for (const auto & object : _active_objects[tid])
467  if (object->name() == name)
468  return true;
469  return false;
470 }
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _active_objects
All active objects (THREAD_ID on outer vector)

◆ hasActiveObjects()

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

Definition at line 415 of file MooseObjectWarehouseBase.h.

416 {
417  checkThreadID(tid);
418  return !_active_objects[tid].empty();
419 }
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _active_objects
All active objects (THREAD_ID on outer vector)

◆ hasObjects()

bool MooseObjectWarehouseBase< InitialConditionBase >::hasObjects ( THREAD_ID  tid = 0) const
inherited

Convenience functions for determining if objects exist.

Definition at line 407 of file MooseObjectWarehouseBase.h.

408 {
409  checkThreadID(tid);
410  return !_all_objects[tid].empty();
411 }
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _all_objects
Storage container for the ALL pointers (THREAD_ID on outer vector)
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.

◆ initialSetup()

void InitialConditionWarehouse::initialSetup ( THREAD_ID  tid)

Initial setup.

Definition at line 24 of file InitialConditionWarehouse.C.

Referenced by FEProblemBase::initialSetup().

25 {
27  for (const auto & ic : _active_objects[tid])
28  ic->initialSetup();
29 }
void sort(THREAD_ID tid=0)
Sort the objects using the DependencyResolver.
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _active_objects
All active objects (THREAD_ID on outer vector)

◆ numThreads()

THREAD_ID MooseObjectWarehouseBase< InitialConditionBase >::numThreads ( )
inlineinherited

Return the number of threads.

Definition at line 163 of file MooseObjectWarehouseBase.h.

163 { return _num_threads; }
const THREAD_ID _num_threads
Convenience member storing the number of threads used for storage (1 or libMesh::n_threads) ...

◆ size()

unsigned int MooseObjectWarehouseBase< InitialConditionBase >::size ( THREAD_ID  tid = 0)
inherited

Return how many kernels we store in the current warehouse.

Definition at line 235 of file MooseObjectWarehouseBase.h.

236 {
237  checkThreadID(tid);
238  return _all_objects[tid].size();
239 }
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _all_objects
Storage container for the ALL pointers (THREAD_ID on outer vector)
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.

◆ sort()

void MooseObjectWarehouseBase< InitialConditionBase >::sort ( THREAD_ID  tid = 0)
inherited

Sort the objects using the DependencyResolver.

Definition at line 536 of file MooseObjectWarehouseBase.h.

537 {
538  checkThreadID(tid);
539 
540  for (auto & object_pair : _all_block_objects[tid])
541  sortHelper(object_pair.second);
542 
543  for (auto & object_pair : _all_boundary_objects[tid])
544  sortHelper(object_pair.second);
545 
546  sortHelper(_all_objects[tid]);
547 
548  // The active lists now must be update to reflect the order changes
549  updateActive(tid);
550 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > > _all_block_objects
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _all_objects
Storage container for the ALL pointers (THREAD_ID on outer vector)
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
static void sortHelper(std::vector< std::shared_ptr< InitialConditionBase >> &objects)
Helper method for sorting vectors of objects.
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > > _all_boundary_objects
virtual void updateActive(THREAD_ID tid=0)
Updates the active objects storage.

◆ sortHelper()

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

Helper method for sorting vectors of objects.

Definition at line 674 of file MooseObjectWarehouseBase.h.

675 {
676  // Do nothing if the vector is empty
677  if (objects.empty())
678  return;
679 
680  try
681  {
682  // Sort based on dependencies
683  DependencyResolverInterface::sort<std::shared_ptr<T>>(objects);
684  }
685  catch (CyclicDependencyException<std::shared_ptr<T>> & e)
686  {
687  DependencyResolverInterface::cyclicDependencyError<std::shared_ptr<T>>(
688  e, "Cyclic dependency detected in object ordering");
689  }
690 }

◆ subdomainsCovered()

void MooseObjectWarehouseBase< InitialConditionBase >::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.

Definition at line 661 of file MooseObjectWarehouseBase.h.

664 {
665  for (const auto & object : _active_objects[tid])
666  unique_variables.insert(object->variable().name());
667 
668  for (const auto & object_pair : _active_block_objects[tid])
669  subdomains_covered.insert(object_pair.first);
670 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_block_objects
Active block restricted objects (THREAD_ID on outer vector)
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _active_objects
All active objects (THREAD_ID on outer vector)

◆ updateActive()

void MooseObjectWarehouseBase< InitialConditionBase >::updateActive ( THREAD_ID  tid = 0)
virtualinherited

Updates the active objects storage.

Definition at line 507 of file MooseObjectWarehouseBase.h.

508 {
509  checkThreadID(tid);
510 
512 
513  for (const auto & object_pair : _all_block_objects[tid])
514  updateActiveHelper(_active_block_objects[tid][object_pair.first], object_pair.second);
515 
516  for (const auto & object_pair : _all_boundary_objects[tid])
517  updateActiveHelper(_active_boundary_objects[tid][object_pair.first], object_pair.second);
518 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > > _all_block_objects
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _all_objects
Storage container for the ALL pointers (THREAD_ID on outer vector)
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_block_objects
Active block restricted objects (THREAD_ID on outer vector)
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_boundary_objects
Active boundary restricted objects (THREAD_ID on outer vector)
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > > _all_boundary_objects
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _active_objects
All active objects (THREAD_ID on outer vector)
static void updateActiveHelper(std::vector< std::shared_ptr< InitialConditionBase >> &active, const std::vector< std::shared_ptr< InitialConditionBase >> &all)
Helper method for updating active vectors.

◆ updateActiveHelper()

void MooseObjectWarehouseBase< InitialConditionBase >::updateActiveHelper ( std::vector< std::shared_ptr< InitialConditionBase >> &  active,
const std::vector< std::shared_ptr< InitialConditionBase >> &  all 
)
staticprotectedinherited

Helper method for updating active vectors.

Definition at line 522 of file MooseObjectWarehouseBase.h.

524 {
525  // Clear the active list
526  active.clear();
527 
528  std::copy_if(all.begin(),
529  all.end(),
530  std::back_inserter(active),
531  [](const std::shared_ptr<T> & object) { return object->enabled(); });
532 }

◆ updateBlockMatPropDependency()

void MooseObjectWarehouseBase< InitialConditionBase >::updateBlockMatPropDependency ( SubdomainID  id,
std::set< unsigned int > &  needed_mat_props,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 620 of file MooseObjectWarehouseBase.h.

623 {
624  if (hasActiveBlockObjects(id, tid))
625  updateMatPropDependencyHelper(needed_mat_props, getActiveBlockObjects(id, tid));
626 }
const std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > & getActiveBlockObjects(THREAD_ID tid=0) const
static void updateMatPropDependencyHelper(std::set< unsigned int > &needed_mat_props, const std::vector< std::shared_ptr< InitialConditionBase >> &objects)
Helper method for updating material property dependency vector.

◆ updateBlockVariableDependency()

void MooseObjectWarehouseBase< InitialConditionBase >::updateBlockVariableDependency ( SubdomainID  id,
std::set< MooseVariableFEBase *> &  needed_moose_vars,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 563 of file MooseObjectWarehouseBase.h.

567 {
568  if (hasActiveBlockObjects(id, tid))
569  updateVariableDependencyHelper(needed_moose_vars, getActiveBlockObjects(id, tid));
570 }
const std::map< SubdomainID, std::vector< std::shared_ptr< InitialConditionBase > > > & getActiveBlockObjects(THREAD_ID tid=0) const
static void updateVariableDependencyHelper(std::set< MooseVariableFEBase * > &needed_moose_vars, const std::vector< std::shared_ptr< InitialConditionBase >> &objects)
Helper method for updating variable dependency vector.

◆ updateBoundaryMatPropDependency() [1/2]

void MooseObjectWarehouseBase< InitialConditionBase >::updateBoundaryMatPropDependency ( std::set< unsigned int > &  needed_mat_props,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 630 of file MooseObjectWarehouseBase.h.

632 {
633  if (hasActiveBoundaryObjects(tid))
634  for (auto & active_bnd_object : _active_boundary_objects[tid])
635  updateMatPropDependencyHelper(needed_mat_props, active_bnd_object.second);
636 }
static void updateMatPropDependencyHelper(std::set< unsigned int > &needed_mat_props, const std::vector< std::shared_ptr< InitialConditionBase >> &objects)
Helper method for updating material property dependency vector.
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_boundary_objects
Active boundary restricted objects (THREAD_ID on outer vector)

◆ updateBoundaryMatPropDependency() [2/2]

void MooseObjectWarehouseBase< InitialConditionBase >::updateBoundaryMatPropDependency ( BoundaryID  id,
std::set< unsigned int > &  needed_mat_props,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 640 of file MooseObjectWarehouseBase.h.

642 {
643  if (hasActiveBoundaryObjects(id, tid))
644  updateMatPropDependencyHelper(needed_mat_props, getActiveBoundaryObjects(id, tid));
645 }
static void updateMatPropDependencyHelper(std::set< unsigned int > &needed_mat_props, const std::vector< std::shared_ptr< InitialConditionBase >> &objects)
Helper method for updating material property dependency vector.
const std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const

◆ updateBoundaryVariableDependency() [1/2]

void MooseObjectWarehouseBase< InitialConditionBase >::updateBoundaryVariableDependency ( std::set< MooseVariableFEBase *> &  needed_moose_vars,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 574 of file MooseObjectWarehouseBase.h.

576 {
577  if (hasActiveBoundaryObjects(tid))
578  {
579  typename std::map<BoundaryID, std::vector<std::shared_ptr<T>>>::const_iterator it;
580  for (const auto & object_pair : _active_boundary_objects[tid])
581  updateVariableDependencyHelper(needed_moose_vars, object_pair.second);
582  }
583 }
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > > _active_boundary_objects
Active boundary restricted objects (THREAD_ID on outer vector)
static void updateVariableDependencyHelper(std::set< MooseVariableFEBase * > &needed_moose_vars, const std::vector< std::shared_ptr< InitialConditionBase >> &objects)
Helper method for updating variable dependency vector.

◆ updateBoundaryVariableDependency() [2/2]

void MooseObjectWarehouseBase< InitialConditionBase >::updateBoundaryVariableDependency ( BoundaryID  id,
std::set< MooseVariableFEBase *> &  needed_moose_vars,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 587 of file MooseObjectWarehouseBase.h.

591 {
592  if (hasActiveBoundaryObjects(id, tid))
593  updateVariableDependencyHelper(needed_moose_vars, getActiveBoundaryObjects(id, tid));
594 }
const std::map< BoundaryID, std::vector< std::shared_ptr< InitialConditionBase > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
static void updateVariableDependencyHelper(std::set< MooseVariableFEBase * > &needed_moose_vars, const std::vector< std::shared_ptr< InitialConditionBase >> &objects)
Helper method for updating variable dependency vector.

◆ updateMatPropDependency()

void MooseObjectWarehouseBase< InitialConditionBase >::updateMatPropDependency ( std::set< unsigned int > &  needed_mat_props,
THREAD_ID  tid = 0 
) const
inherited

Update material property dependency vector.

Definition at line 611 of file MooseObjectWarehouseBase.h.

613 {
614  if (hasActiveObjects(tid))
615  updateMatPropDependencyHelper(needed_mat_props, _all_objects[tid]);
616 }
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _all_objects
Storage container for the ALL pointers (THREAD_ID on outer vector)
static void updateMatPropDependencyHelper(std::set< unsigned int > &needed_mat_props, const std::vector< std::shared_ptr< InitialConditionBase >> &objects)
Helper method for updating material property dependency vector.

◆ updateMatPropDependencyHelper()

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

Helper method for updating material property dependency vector.

Definition at line 649 of file MooseObjectWarehouseBase.h.

651 {
652  for (auto & object : objects)
653  {
654  auto & mp_deps = object->getMatPropDependencies();
655  needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
656  }
657 }

◆ updateVariableDependency()

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

Update variable dependency vector.

Definition at line 554 of file MooseObjectWarehouseBase.h.

556 {
557  if (hasActiveObjects(tid))
558  updateVariableDependencyHelper(needed_moose_vars, _all_objects[tid]);
559 }
std::vector< std::vector< std::shared_ptr< InitialConditionBase > > > _all_objects
Storage container for the ALL pointers (THREAD_ID on outer vector)
static void updateVariableDependencyHelper(std::set< MooseVariableFEBase * > &needed_moose_vars, const std::vector< std::shared_ptr< InitialConditionBase >> &objects)
Helper method for updating variable dependency vector.

◆ updateVariableDependencyHelper()

void MooseObjectWarehouseBase< InitialConditionBase >::updateVariableDependencyHelper ( std::set< MooseVariableFEBase *> &  needed_moose_vars,
const std::vector< std::shared_ptr< InitialConditionBase >> &  objects 
)
staticprotectedinherited

Helper method for updating variable dependency vector.

Definition at line 598 of file MooseObjectWarehouseBase.h.

601 {
602  for (const auto & object : objects)
603  {
604  const auto & mv_deps = object->getMooseVariableDependencies();
605  needed_moose_vars.insert(mv_deps.begin(), mv_deps.end());
606  }
607 }

Member Data Documentation

◆ _active_block_objects

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

Active block restricted objects (THREAD_ID on outer vector)

Definition at line 179 of file MooseObjectWarehouseBase.h.

◆ _active_boundary_objects

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

Active boundary restricted objects (THREAD_ID on outer vector)

Definition at line 185 of file MooseObjectWarehouseBase.h.

◆ _active_objects

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

All active objects (THREAD_ID on outer vector)

Definition at line 173 of file MooseObjectWarehouseBase.h.

Referenced by initialSetup().

◆ _all_block_objects

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

Definition at line 176 of file MooseObjectWarehouseBase.h.

◆ _all_boundary_objects

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

Definition at line 182 of file MooseObjectWarehouseBase.h.

◆ _all_objects

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

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

Definition at line 170 of file MooseObjectWarehouseBase.h.

◆ _block_ics

std::vector<std::map<std::string, std::set<SubdomainID> > > InitialConditionWarehouse::_block_ics
protected

Definition at line 46 of file InitialConditionWarehouse.h.

Referenced by addObject().

◆ _boundary_ics

std::vector<std::map<std::string, std::set<BoundaryID> > > InitialConditionWarehouse::_boundary_ics
protected

Variable name to block/boundary IDs for error checking

Definition at line 45 of file InitialConditionWarehouse.h.

Referenced by addObject().

◆ _num_threads

const THREAD_ID MooseObjectWarehouseBase< InitialConditionBase >::_num_threads
protectedinherited

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

Definition at line 167 of file MooseObjectWarehouseBase.h.


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