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

Warehouse for storing scalar initial conditions. More...

#include <ScalarInitialConditionWarehouse.h>

Inheritance diagram for ScalarInitialConditionWarehouse:
[legend]

Public Member Functions

 ScalarInitialConditionWarehouse ()
 
void initialSetup ()
 Initial setup. More...
 
virtual void addObject (std::shared_ptr< ScalarInitialCondition > object, THREAD_ID tid=0, bool recurse=true)
 Adds an object to the storage structure. 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< ScalarInitialCondition > > & 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< ScalarInitialCondition > > > & getBlockObjects (THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< ScalarInitialCondition > > & getBlockObjects (SubdomainID id, THREAD_ID tid=0) const
 
const std::map< BoundaryID, std::vector< std::shared_ptr< ScalarInitialCondition > > > & getBoundaryObjects (THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< ScalarInitialCondition > > & getBoundaryObjects (BoundaryID id, THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< ScalarInitialCondition > > & 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< ScalarInitialCondition > > > & getActiveBlockObjects (THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< ScalarInitialCondition > > & getActiveBlockObjects (SubdomainID id, THREAD_ID tid=0) const
 
const std::map< BoundaryID, std::vector< std::shared_ptr< ScalarInitialCondition > > > & getActiveBoundaryObjects (THREAD_ID tid=0) const
 
const std::vector< std::shared_ptr< ScalarInitialCondition > > & 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< ScalarInitialConditiongetObject (const std::string &name, THREAD_ID tid=0) const
 
std::shared_ptr< ScalarInitialConditiongetActiveObject (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< ScalarInitialCondition >> &active, const std::vector< std::shared_ptr< ScalarInitialCondition >> &all)
 Helper method for updating active vectors. More...
 
static void sortHelper (std::vector< std::shared_ptr< ScalarInitialCondition >> &objects)
 Helper method for sorting vectors of objects. More...
 
static void updateVariableDependencyHelper (std::set< MooseVariableFEBase * > &needed_moose_vars, const std::vector< std::shared_ptr< ScalarInitialCondition >> &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< ScalarInitialCondition >> &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< ScalarInitialCondition > > > _all_objects
 Storage container for the ALL pointers (THREAD_ID on outer vector) More...
 
std::vector< std::vector< std::shared_ptr< ScalarInitialCondition > > > _active_objects
 All active objects (THREAD_ID on outer vector) More...
 
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _all_block_objects
 
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _active_block_objects
 Active block restricted objects (THREAD_ID on outer vector) More...
 
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _all_boundary_objects
 
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _active_boundary_objects
 Active boundary restricted objects (THREAD_ID on outer vector) More...
 

Detailed Description

Warehouse for storing scalar initial conditions.

Definition at line 20 of file ScalarInitialConditionWarehouse.h.

Constructor & Destructor Documentation

◆ ScalarInitialConditionWarehouse()

ScalarInitialConditionWarehouse::ScalarInitialConditionWarehouse ( )

Member Function Documentation

◆ addObject()

void MooseObjectWarehouseBase< ScalarInitialCondition >::addObject ( std::shared_ptr< ScalarInitialCondition object,
THREAD_ID  tid = 0,
bool  recurse = true 
)
virtualinherited

Adds an object to the storage structure.

Parameters
tidThe thread ID (default is 0)
recurseWhether or not to build recusive warehouses (typically for Kernels)

Definition at line 242 of file MooseObjectWarehouseBase.h.

245 {
246  checkThreadID(tid);
247 
248  // Stores object in list of all objects
249  _all_objects[tid].push_back(object);
250 
251  // If enabled, store object in a list of all active
252  bool enabled = object->enabled();
253  if (enabled)
254  _active_objects[tid].push_back(object);
255 
256  // Perform casts to the Block/BoundaryRestrictable
257  std::shared_ptr<BoundaryRestrictable> bnd =
259  std::shared_ptr<BlockRestrictable> blk = std::dynamic_pointer_cast<BlockRestrictable>(object);
260 
261  // Boundary Restricted
262  if (bnd && bnd->boundaryRestricted())
263  {
264  const std::set<BoundaryID> & ids = bnd->boundaryIDs();
265  for (std::set<BoundaryID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
266  {
267  _all_boundary_objects[tid][*it].push_back(object);
268  if (enabled)
269  _active_boundary_objects[tid][*it].push_back(object);
270  }
271  }
272 
273  // Block Restricted
274  else if (blk)
275  {
276  const std::set<SubdomainID> & ids =
277  blk->blockRestricted() ? blk->blockIDs() : blk->meshBlockIDs();
278  for (std::set<SubdomainID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
279  {
280  _all_block_objects[tid][*it].push_back(object);
281  if (enabled)
282  _active_block_objects[tid][*it].push_back(object);
283  }
284 
285  // Check variables
286  std::shared_ptr<Coupleable> c_ptr = std::dynamic_pointer_cast<Coupleable>(object);
287  if (c_ptr)
288  for (MooseVariableFEBase * var : c_ptr->getCoupledMooseVars())
289  blk->checkVariable(*var);
290 
291  const InputParameters & parameters = object->parameters();
292 
293  SubProblem & problem = *parameters.get<SubProblem *>("_subproblem");
294 
295  THREAD_ID tid = parameters.get<THREAD_ID>("_tid");
296 
297  if (parameters.isParamValid("variable"))
298  {
299  // Try the scalar version first
300  std::string variable_name = parameters.getMooseType("variable");
301  if (variable_name == "")
302  // When using vector variables, we are only going to use the first one in the list at the
303  // interface level...
304  variable_name = parameters.getVecMooseType("variable")[0];
305 
306  blk->checkVariable(problem.getVariable(
308  }
309  }
310 }
std::string getMooseType(const std::string &name) const
Utility functions for retrieving one of the MooseTypes variables into the common "string" base class...
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _all_block_objects
std::vector< std::vector< std::shared_ptr< ScalarInitialCondition > > > _all_objects
Storage container for the ALL pointers (THREAD_ID on outer vector)
virtual MooseVariableFEBase & getVariable(THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY)=0
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _active_block_objects
Active block restricted objects (THREAD_ID on outer vector)
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _active_boundary_objects
Active boundary restricted objects (THREAD_ID on outer vector)
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _all_boundary_objects
Interface for objects that needs coupling capabilities.
Definition: Coupleable.h:62
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:59
An interface that restricts an object to subdomains via the &#39;blocks&#39; input parameter.
std::vector< std::vector< std::shared_ptr< ScalarInitialCondition > > > _active_objects
All active objects (THREAD_ID on outer vector)
std::vector< std::string > getVecMooseType(const std::string &name) const
unsigned int THREAD_ID
Definition: MooseTypes.h:161
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.

◆ checkThreadID()

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

Calls assert on thread id.

Definition at line 693 of file MooseObjectWarehouseBase.h.

694 {
695  mooseAssert(tid < _num_threads,
696  "Attempting to access a thread id ("
697  << tid << ") greater than the number allowed by the storage item ("
698  << _num_threads << ")");
699 }
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< ScalarInitialCondition > > > & MooseObjectWarehouseBase< ScalarInitialCondition >::getActiveBlockObjects ( THREAD_ID  tid = 0) const
inlineinherited

Definition at line 387 of file MooseObjectWarehouseBase.h.

388 {
389  checkThreadID(tid);
390  return _active_block_objects[tid];
391 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _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< ScalarInitialCondition > > & MooseObjectWarehouseBase< ScalarInitialCondition >::getActiveBlockObjects ( SubdomainID  id,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 395 of file MooseObjectWarehouseBase.h.

396 {
397  checkThreadID(tid);
398  const auto iter = _active_block_objects[tid].find(id);
399  mooseAssert(iter != _active_block_objects[tid].end(),
400  "Unable to located active block objects for the given id: " << id << ".");
401  return iter->second;
402 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _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< ScalarInitialCondition >::getActiveBlocks ( THREAD_ID  tid = 0) const
inherited

Return a set of active SubdomainsIDs.

Definition at line 495 of file MooseObjectWarehouseBase.h.

496 {
497  checkThreadID(tid);
498  std::set<SubdomainID> ids;
499  for (const auto & object_pair : _active_block_objects[tid])
500  ids.insert(object_pair.first);
501  return ids;
502 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _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< ScalarInitialCondition > > > & MooseObjectWarehouseBase< ScalarInitialCondition >::getActiveBoundaryObjects ( THREAD_ID  tid = 0) const
inlineinherited

Definition at line 368 of file MooseObjectWarehouseBase.h.

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

◆ getActiveBoundaryObjects() [2/2]

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

Definition at line 376 of file MooseObjectWarehouseBase.h.

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

◆ getActiveObject()

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

Definition at line 484 of file MooseObjectWarehouseBase.h.

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

◆ getActiveObjects()

const std::vector< std::shared_ptr< ScalarInitialCondition > > & MooseObjectWarehouseBase< ScalarInitialCondition >::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 360 of file MooseObjectWarehouseBase.h.

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

◆ getBlockObjects() [1/2]

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

Definition at line 341 of file MooseObjectWarehouseBase.h.

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

◆ getBlockObjects() [2/2]

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

Definition at line 349 of file MooseObjectWarehouseBase.h.

350 {
351  checkThreadID(tid);
352  const auto iter = _all_block_objects[tid].find(id);
353  mooseAssert(iter != _all_block_objects[tid].end(),
354  "Unable to located active block objects for the given id: " << id << ".");
355  return iter->second;
356 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _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< ScalarInitialCondition > > > & MooseObjectWarehouseBase< ScalarInitialCondition >::getBoundaryObjects ( THREAD_ID  tid = 0) const
inlineinherited

Definition at line 322 of file MooseObjectWarehouseBase.h.

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

◆ getBoundaryObjects() [2/2]

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

Definition at line 330 of file MooseObjectWarehouseBase.h.

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

◆ getObject()

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

Definition at line 473 of file MooseObjectWarehouseBase.h.

474 {
475  checkThreadID(tid);
476  for (const auto & object : _all_objects[tid])
477  if (object->name() == name)
478  return object;
479  mooseError("Unable to locate object: ", name, ".");
480 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:207
std::vector< std::vector< std::shared_ptr< ScalarInitialCondition > > > _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< ScalarInitialCondition > > & MooseObjectWarehouseBase< ScalarInitialCondition >::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 314 of file MooseObjectWarehouseBase.h.

315 {
316  checkThreadID(tid);
317  return _all_objects[tid];
318 }
std::vector< std::vector< std::shared_ptr< ScalarInitialCondition > > > _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< ScalarInitialCondition >::hasActiveBlockObjects ( THREAD_ID  tid = 0) const
inherited

Definition at line 422 of file MooseObjectWarehouseBase.h.

423 {
424  checkThreadID(tid);
425  bool has_active_block_objects = false;
426  for (const auto & object_pair : _active_block_objects[tid])
427  has_active_block_objects |= !(object_pair.second.empty());
428  return has_active_block_objects;
429 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _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< ScalarInitialCondition >::hasActiveBlockObjects ( SubdomainID  id,
THREAD_ID  tid = 0 
) const
inherited

Definition at line 433 of file MooseObjectWarehouseBase.h.

434 {
435  checkThreadID(tid);
436  const auto iter = _active_block_objects[tid].find(id);
437  return iter != _active_block_objects[tid].end();
438 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _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< ScalarInitialCondition >::hasActiveBoundaryObjects ( THREAD_ID  tid = 0) const
inherited

Definition at line 442 of file MooseObjectWarehouseBase.h.

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

◆ hasActiveBoundaryObjects() [2/2]

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

Definition at line 453 of file MooseObjectWarehouseBase.h.

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

◆ hasActiveObject()

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

Convenience functions for checking/getting specific objects.

Definition at line 462 of file MooseObjectWarehouseBase.h.

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

◆ hasActiveObjects()

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

Definition at line 414 of file MooseObjectWarehouseBase.h.

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

◆ hasObjects()

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

Convenience functions for determining if objects exist.

Definition at line 406 of file MooseObjectWarehouseBase.h.

407 {
408  checkThreadID(tid);
409  return !_all_objects[tid].empty();
410 }
std::vector< std::vector< std::shared_ptr< ScalarInitialCondition > > > _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 ScalarInitialConditionWarehouse::initialSetup ( )

Initial setup.

Definition at line 19 of file ScalarInitialConditionWarehouse.C.

Referenced by FEProblemBase::initialSetup().

20 {
22  for (const auto & ic : _active_objects[0])
23  ic->initialSetup();
24 }
void sort(THREAD_ID tid=0)
Sort the objects using the DependencyResolver.
std::vector< std::vector< std::shared_ptr< ScalarInitialCondition > > > _active_objects
All active objects (THREAD_ID on outer vector)

◆ numThreads()

THREAD_ID MooseObjectWarehouseBase< ScalarInitialCondition >::numThreads ( )
inlineinherited

Return the number of threads.

Definition at line 162 of file MooseObjectWarehouseBase.h.

162 { 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< ScalarInitialCondition >::size ( THREAD_ID  tid = 0)
inherited

Return how many kernels we store in the current warehouse.

Definition at line 234 of file MooseObjectWarehouseBase.h.

235 {
236  checkThreadID(tid);
237  return _all_objects[tid].size();
238 }
std::vector< std::vector< std::shared_ptr< ScalarInitialCondition > > > _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< ScalarInitialCondition >::sort ( THREAD_ID  tid = 0)
inherited

Sort the objects using the DependencyResolver.

Definition at line 535 of file MooseObjectWarehouseBase.h.

536 {
537  checkThreadID(tid);
538 
539  for (auto & object_pair : _all_block_objects[tid])
540  sortHelper(object_pair.second);
541 
542  for (auto & object_pair : _all_boundary_objects[tid])
543  sortHelper(object_pair.second);
544 
545  sortHelper(_all_objects[tid]);
546 
547  // The active lists now must be update to reflect the order changes
548  updateActive(tid);
549 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _all_block_objects
std::vector< std::vector< std::shared_ptr< ScalarInitialCondition > > > _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< ScalarInitialCondition >> &objects)
Helper method for sorting vectors of objects.
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _all_boundary_objects
virtual void updateActive(THREAD_ID tid=0)
Updates the active objects storage.

◆ sortHelper()

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

Helper method for sorting vectors of objects.

Definition at line 673 of file MooseObjectWarehouseBase.h.

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

◆ subdomainsCovered()

void MooseObjectWarehouseBase< ScalarInitialCondition >::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 660 of file MooseObjectWarehouseBase.h.

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

◆ updateActive()

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

Updates the active objects storage.

Definition at line 506 of file MooseObjectWarehouseBase.h.

507 {
508  checkThreadID(tid);
509 
511 
512  for (const auto & object_pair : _all_block_objects[tid])
513  updateActiveHelper(_active_block_objects[tid][object_pair.first], object_pair.second);
514 
515  for (const auto & object_pair : _all_boundary_objects[tid])
516  updateActiveHelper(_active_boundary_objects[tid][object_pair.first], object_pair.second);
517 }
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _all_block_objects
std::vector< std::vector< std::shared_ptr< ScalarInitialCondition > > > _all_objects
Storage container for the ALL pointers (THREAD_ID on outer vector)
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _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< ScalarInitialCondition > > > > _active_boundary_objects
Active boundary restricted objects (THREAD_ID on outer vector)
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _all_boundary_objects
std::vector< std::vector< std::shared_ptr< ScalarInitialCondition > > > _active_objects
All active objects (THREAD_ID on outer vector)
static void updateActiveHelper(std::vector< std::shared_ptr< ScalarInitialCondition >> &active, const std::vector< std::shared_ptr< ScalarInitialCondition >> &all)
Helper method for updating active vectors.

◆ updateActiveHelper()

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

Helper method for updating active vectors.

Definition at line 521 of file MooseObjectWarehouseBase.h.

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

◆ updateBlockMatPropDependency()

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

Definition at line 619 of file MooseObjectWarehouseBase.h.

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

◆ updateBlockVariableDependency()

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

Definition at line 562 of file MooseObjectWarehouseBase.h.

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

◆ updateBoundaryMatPropDependency() [1/2]

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

Definition at line 629 of file MooseObjectWarehouseBase.h.

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

◆ updateBoundaryMatPropDependency() [2/2]

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

Definition at line 639 of file MooseObjectWarehouseBase.h.

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

◆ updateBoundaryVariableDependency() [1/2]

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

Definition at line 573 of file MooseObjectWarehouseBase.h.

575 {
576  if (hasActiveBoundaryObjects(tid))
577  {
578  typename std::map<BoundaryID, std::vector<std::shared_ptr<T>>>::const_iterator it;
579  for (const auto & object_pair : _active_boundary_objects[tid])
580  updateVariableDependencyHelper(needed_moose_vars, object_pair.second);
581  }
582 }
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< ScalarInitialCondition > > > > _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< ScalarInitialCondition >> &objects)
Helper method for updating variable dependency vector.

◆ updateBoundaryVariableDependency() [2/2]

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

Definition at line 586 of file MooseObjectWarehouseBase.h.

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

◆ updateMatPropDependency()

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

Update material property dependency vector.

Definition at line 610 of file MooseObjectWarehouseBase.h.

612 {
613  if (hasActiveObjects(tid))
614  updateMatPropDependencyHelper(needed_mat_props, _all_objects[tid]);
615 }
std::vector< std::vector< std::shared_ptr< ScalarInitialCondition > > > _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< ScalarInitialCondition >> &objects)
Helper method for updating material property dependency vector.

◆ updateMatPropDependencyHelper()

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

Helper method for updating material property dependency vector.

Definition at line 648 of file MooseObjectWarehouseBase.h.

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

◆ updateVariableDependency()

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

Update variable dependency vector.

Definition at line 553 of file MooseObjectWarehouseBase.h.

555 {
556  if (hasActiveObjects(tid))
557  updateVariableDependencyHelper(needed_moose_vars, _all_objects[tid]);
558 }
std::vector< std::vector< std::shared_ptr< ScalarInitialCondition > > > _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< ScalarInitialCondition >> &objects)
Helper method for updating variable dependency vector.

◆ updateVariableDependencyHelper()

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

Helper method for updating variable dependency vector.

Definition at line 597 of file MooseObjectWarehouseBase.h.

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

Member Data Documentation

◆ _active_block_objects

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

Active block restricted objects (THREAD_ID on outer vector)

Definition at line 178 of file MooseObjectWarehouseBase.h.

◆ _active_boundary_objects

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

Active boundary restricted objects (THREAD_ID on outer vector)

Definition at line 184 of file MooseObjectWarehouseBase.h.

◆ _active_objects

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

All active objects (THREAD_ID on outer vector)

Definition at line 172 of file MooseObjectWarehouseBase.h.

Referenced by initialSetup().

◆ _all_block_objects

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

Definition at line 175 of file MooseObjectWarehouseBase.h.

◆ _all_boundary_objects

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

Definition at line 181 of file MooseObjectWarehouseBase.h.

◆ _all_objects

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

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

Definition at line 169 of file MooseObjectWarehouseBase.h.

◆ _num_threads

const THREAD_ID MooseObjectWarehouseBase< ScalarInitialCondition >::_num_threads
protectedinherited

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

Definition at line 166 of file MooseObjectWarehouseBase.h.


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