61 const std::map<SubdomainID, std::vector<std::shared_ptr<T>>> &
64 const std::map<BoundaryID, std::vector<std::shared_ptr<T>>> &
77 const std::map<SubdomainID, std::vector<std::shared_ptr<T>>> &
81 const std::map<BoundaryID, std::vector<std::shared_ptr<T>>> &
109 const std::set<SubdomainID> &
blocks,
110 std::set<SubdomainID> & blocks_covered,
150 std::set<MooseVariableFieldBase *> & needed_moose_vars,
155 std::set<MooseVariableFieldBase *> & needed_moose_vars,
167 std::set<TagID> & needed_fe_var_vector_tags,
180 const bool producer_only =
false)
const;
182 std::unordered_set<unsigned int> & needed_mat_props,
184 const bool producer_only =
false)
const;
187 const bool producer_only =
false)
const;
189 std::unordered_set<unsigned int> & needed_mat_props,
191 const bool producer_only =
false)
const;
198 std::set<std::string> & unique_variables,
212 const std::string & prefix =
"[DBG]")
const;
243 const std::vector<std::shared_ptr<T>> & all);
248 static void sortHelper(std::vector<std::shared_ptr<T>> & objects);
254 const std::vector<std::shared_ptr<T>> & objects);
261 const std::vector<std::shared_ptr<T>> & objects);
267 const std::vector<std::shared_ptr<T>> & objects,
268 const bool producer_only)
const;
279 const std::vector<std::map<
BoundaryID, std::vector<std::shared_ptr<T>>>> & boundary_objects,
323 bool enabled =
object->enabled();
328 std::shared_ptr<BoundaryRestrictable> bnd =
329 std::dynamic_pointer_cast<BoundaryRestrictable>(
object);
330 std::shared_ptr<BlockRestrictable> blk = std::dynamic_pointer_cast<BlockRestrictable>(
object);
333 if (bnd && bnd->boundaryRestricted())
335 const std::set<BoundaryID> & ids = bnd->boundaryIDs();
336 for (std::set<BoundaryID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
347 const std::set<SubdomainID> & ids =
348 blk->blockRestricted() ? blk->blockIDs() : blk->meshBlockIDs();
349 for (std::set<SubdomainID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
357 std::shared_ptr<Coupleable> c_ptr = std::dynamic_pointer_cast<Coupleable>(
object);
360 blk->checkVariable(*var);
371 std::string variable_name = parameters.
getMooseType(
"variable");
372 if (variable_name ==
"")
386inline const std::vector<std::shared_ptr<T>> &
394inline const std::map<BoundaryID, std::vector<std::shared_ptr<T>>> &
410const std::vector<std::shared_ptr<T>> &
416 "Unable to located active boundary objects for the given id: " <<
id <<
".");
421inline const std::map<SubdomainID, std::vector<std::shared_ptr<T>>> &
429const std::vector<std::shared_ptr<T>> &
435 "Unable to located active block objects for the given id: " <<
id <<
".");
440inline const std::vector<std::shared_ptr<T>> &
448inline const std::map<BoundaryID, std::vector<std::shared_ptr<T>>> &
456const std::vector<std::shared_ptr<T>> &
462 "Unable to located active boundary objects for the given id: " <<
id <<
".");
467inline const std::map<SubdomainID, std::vector<std::shared_ptr<T>>> &
475const std::vector<std::shared_ptr<T>> &
481 "Unable to located active block objects for the given id: " <<
id <<
".");
513 const std::set<SubdomainID> &
blocks,
514 std::set<SubdomainID> & blocks_covered,
518 blocks_covered.clear();
525 std::shared_ptr<BlockRestrictable> blk = std::dynamic_pointer_cast<BlockRestrictable>(
object);
526 if (blk && blk->hasBlocks(
blocks))
536 std::shared_ptr<BlockRestrictable> blk = std::dynamic_pointer_cast<BlockRestrictable>(
object);
538 for (
const auto & block :
blocks)
539 if (blk->hasBlocks(block))
540 blocks_covered.insert(block);
543 if (blocks_covered.empty())
546 return (
blocks == blocks_covered);
554 bool has_active_block_objects =
false;
556 has_active_block_objects |= !(object_pair.second.empty());
557 return has_active_block_objects;
572 const std::vector<std::map<
BoundaryID, std::vector<std::shared_ptr<T>>>> & boundary_objects,
576 bool has_boundary_objects =
false;
577 for (
const auto & object_pair : boundary_objects[tid])
578 has_boundary_objects |= !(object_pair.second.empty());
579 return has_boundary_objects;
611 if (object->name() == name)
622 if (object->name() == name)
624 mooseError(
"Unable to locate object: ", name,
".");
633 if (object->name() == name)
635 mooseError(
"Unable to locate active object: ", name,
".");
639const std::vector<std::shared_ptr<T>> &
651 std::set<SubdomainID> ids;
653 ids.insert(object_pair.first);
675 const std::vector<std::shared_ptr<T>> & all)
680 std::copy_if(all.begin(),
682 std::back_inserter(active),
683 [](
const std::shared_ptr<T> &
object) { return object->enabled(); });
707 std::set<MooseVariableFieldBase *> & needed_moose_vars,
THREAD_ID tid )
const
717 std::set<MooseVariableFieldBase *> & needed_moose_vars,
727 std::set<MooseVariableFieldBase *> & needed_moose_vars,
THREAD_ID tid )
const
731 typename std::map<BoundaryID, std::vector<std::shared_ptr<T>>>::const_iterator it;
741 std::set<MooseVariableFieldBase *> & needed_moose_vars,
751 std::set<MooseVariableFieldBase *> & needed_moose_vars,
752 const std::vector<std::shared_ptr<T>> & objects)
754 for (
const auto &
object : objects)
760 needed_moose_vars.insert(mv_deps.begin(), mv_deps.end());
768 std::set<TagID> & needed_fe_var_vector_tags,
THREAD_ID tid )
const
798 std::set<TagID> & needed_fe_var_vector_tags,
const std::vector<std::shared_ptr<T>> & objects)
800 for (
const auto &
object : objects)
802 auto c =
dynamic_cast<const Coupleable *
>(
object.get());
806 needed_fe_var_vector_tags.insert(tag_deps.begin(), tag_deps.end());
814 std::unordered_set<unsigned int> & needed_mat_props,
816 const bool producer_only )
const
826 std::unordered_set<unsigned int> & needed_mat_props,
828 const bool producer_only )
const
837 std::unordered_set<unsigned int> & needed_mat_props,
839 const bool producer_only )
const
850 std::unordered_set<unsigned int> & needed_mat_props,
852 const bool producer_only )
const
862 std::unordered_set<unsigned int> & needed_mat_props,
863 const std::vector<std::shared_ptr<T>> & objects,
866 for (
auto &
object : objects)
872 needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
880 std::set<std::string> & unique_variables,
885 unique_variables.insert(object->variable().name());
886 const auto additional_variables_covered =
object->additionalROVariables();
887 unique_variables.insert(additional_variables_covered.begin(),
888 additional_variables_covered.end());
892 subdomains_covered.insert(object_pair.first);
898 const THREAD_ID tid ,
const std::string & prefix )
const
900 std::vector<std::string> output;
902 output.push_back(object->name());
917 DependencyResolverInterface::sort<std::shared_ptr<T>>(objects);
921 DependencyResolverInterface::cyclicDependencyError<std::shared_ptr<T>>(
922 e,
"Cyclic dependency detected in object ordering");
931 "Attempting to access a thread id ("
932 << tid <<
") greater than the number allowed by the storage item ("
boundary_id_type BoundaryID
subdomain_id_type SubdomainID
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Interface for objects that needs coupling capabilities.
std::set< TagID > & getFEVariableCoupleableVectorTags()
An interface for accessing Materials.
virtual const std::unordered_set< unsigned int > & getMatPropDependencies() const
Retrieve the set of material properties that this object depends on.
MaterialBase objects are special in that they have additional objects created automatically (see FEPr...
virtual void updateMatPropDependencyHelper(std::unordered_set< unsigned int > &needed_mat_props, const std::vector< std::shared_ptr< MaterialBase > > &objects, const bool producer_only) const override
Helper method for updating material property dependency vector.
virtual void updateActive(THREAD_ID tid=0) override
Update the active status of Kernels.
A base storage container for MooseObjects.
const std::vector< std::shared_ptr< T > > & getObjectsForVariable(const VariableName &var_name, THREAD_ID tid) const
Getter for objects that have the 'variable' set to a particular variable Note that users should check...
void updateVariableDependency(std::set< MooseVariableFieldBase * > &needed_moose_vars, THREAD_ID tid=0) const
Update variable dependency vector.
static void sortHelper(std::vector< std::shared_ptr< T > > &objects)
Helper method for sorting vectors of objects.
bool hasActiveBoundaryObjects(BoundaryID id, THREAD_ID tid=0) const
std::vector< std::vector< std::shared_ptr< T > > > _all_objects
Storage container for the ALL pointers (THREAD_ID on outer vector)
unsigned int size(THREAD_ID tid=0) const
Return how many kernels we store in the current warehouse.
void updateBoundaryMatPropDependency(BoundaryID id, std::unordered_set< unsigned int > &needed_mat_props, THREAD_ID tid=0, const bool producer_only=false) const
std::string activeObjectsToFormattedString(THREAD_ID tid=0, const std::string &prefix="[DBG]") const
Output the active content of the warehouse to a string, meant to be output to the console.
static void updateVariableDependencyHelper(std::set< MooseVariableFieldBase * > &needed_moose_vars, const std::vector< std::shared_ptr< T > > &objects)
Helper method for updating variable dependency vector.
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getBlockObjects(THREAD_ID tid=0) const
const std::vector< std::shared_ptr< T > > & getBoundaryObjects(BoundaryID id, THREAD_ID tid=0) const
std::shared_ptr< T > getActiveObject(const std::string &name, THREAD_ID tid=0) const
bool hasObjectsForVariableAndBlocks(const VariableName &var_name, const std::set< SubdomainID > &blocks, std::set< SubdomainID > &blocks_covered, THREAD_ID tid) const
Whether there are objects for this variable and the set of blocks passed.
virtual ~MooseObjectWarehouseBase()
Destructor.
bool hasBoundaryObjects(THREAD_ID tid=0) const
std::set< SubdomainID > getActiveBlocks(THREAD_ID tid=0) const
Return a set of active SubdomainsIDs.
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
std::vector< std::vector< std::shared_ptr< T > > > _active_objects
All active objects (THREAD_ID on outer vector)
const std::vector< std::shared_ptr< T > > & getObjects(THREAD_ID tid=0) const
Retrieve complete vector to the all/block/boundary restricted objects for a given thread.
void updateBoundaryVariableDependency(BoundaryID id, std::set< MooseVariableFieldBase * > &needed_moose_vars, THREAD_ID tid=0) const
virtual void updateActive(THREAD_ID tid=0)
Updates the active objects storage.
std::vector< std::map< VariableName, std::vector< std::shared_ptr< T > > > > _all_variable_objects
All objects with a certain variable selected, as the 'variable' parameter.
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< T > > > > _all_boundary_objects
bool hasActiveObject(const std::string &name, THREAD_ID tid=0) const
Convenience functions for checking/getting specific objects.
bool hasBoundaryObjectsHelper(const std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< T > > > > &boundary_objects, const THREAD_ID tid=0) const
Helper for determining whether we have boundary objects.
const std::vector< std::shared_ptr< T > > & getActiveBoundaryObjects(BoundaryID id, THREAD_ID tid=0) const
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< T > > > > _active_block_objects
Active block restricted objects (THREAD_ID on outer vector)
void updateFEVariableCoupledVectorTagDependency(std::set< TagID > &needed_fe_var_vector_tags, THREAD_ID tid=0) const
Update FE variable coupleable vector tag vector for all objects, block-restricted objects,...
bool hasActiveBlockObjects(SubdomainID id, THREAD_ID tid=0) const
void updateMatPropDependency(std::unordered_set< unsigned int > &needed_mat_props, THREAD_ID tid=0, const bool producer_only=false) const
Update material property dependency vector.
MooseObjectWarehouseBase(THREAD_ID num_threads=libMesh::n_threads())
Constructor.
void sort(THREAD_ID tid=0)
Sort the objects using the DependencyResolver.
void updateBoundaryFEVariableCoupledVectorTagDependency(BoundaryID id, std::set< TagID > &needed_fe_var_vector_tags, THREAD_ID tid=0) const
void updateBlockMatPropDependency(SubdomainID id, std::unordered_set< unsigned int > &needed_mat_props, THREAD_ID tid=0, const bool producer_only=false) const
std::vector< std::map< BoundaryID, std::vector< std::shared_ptr< T > > > > _active_boundary_objects
Active boundary restricted objects (THREAD_ID on outer vector)
const THREAD_ID _num_threads
Convenience member storing the number of threads used for storage (1 or libMesh::n_threads)
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true)
Adds an object to the storage structure.
void updateBlockFEVariableCoupledVectorTagDependency(SubdomainID id, std::set< TagID > &needed_fe_var_vector_tags, THREAD_ID tid=0) const
virtual void updateMatPropDependencyHelper(std::unordered_set< unsigned int > &needed_mat_props, const std::vector< std::shared_ptr< T > > &objects, const bool producer_only) const
Helper method for updating material property dependency vector.
void updateBoundaryVariableDependency(std::set< MooseVariableFieldBase * > &needed_moose_vars, THREAD_ID tid=0) const
void updateBlockVariableDependency(SubdomainID id, std::set< MooseVariableFieldBase * > &needed_moose_vars, THREAD_ID tid=0) const
bool hasActiveObjects(THREAD_ID tid=0) const
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
bool hasActiveBlockObjects(THREAD_ID tid=0) const
std::vector< std::map< SubdomainID, std::vector< std::shared_ptr< T > > > > _all_block_objects
void updateBoundaryMatPropDependency(std::unordered_set< unsigned int > &needed_mat_props, THREAD_ID tid=0, const bool producer_only=false) const
THREAD_ID numThreads() const
Return the number of threads.
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
static void updateActiveHelper(std::vector< std::shared_ptr< T > > &active, const std::vector< std::shared_ptr< T > > &all)
Helper method for updating active vectors.
bool hasBoundaryObjects(BoundaryID id, THREAD_ID tid=0) const
bool hasObjects(THREAD_ID tid=0) const
Convenience functions for determining if objects exist.
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread.
std::shared_ptr< T > getObject(const std::string &name, THREAD_ID tid=0) const
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getBoundaryObjects(THREAD_ID tid=0) const
const std::vector< std::shared_ptr< T > > & getActiveBlockObjects(SubdomainID id, THREAD_ID tid=0) const
bool hasObjectsForVariable(const VariableName &var_name, THREAD_ID tid) const
const std::vector< std::shared_ptr< T > > & getBlockObjects(SubdomainID id, THREAD_ID tid=0) const
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.
static void updateFEVariableCoupledVectorTagDependencyHelper(std::set< TagID > &needed_fe_var_vector_tags, const std::vector< std::shared_ptr< T > > &objects)
Helper method for updating FE variable coupleable vector tag vector.
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
const std::set< MooseVariableFieldBase * > & getMooseVariableDependencies() const
Retrieve the set of MooseVariableFieldBase that this object depends on.
This class provides an interface for common operations on field variables of both FE and FV types wit...
Generic class for solving transient nonlinear problems.
virtual const MooseVariableFieldBase & getVariable(const 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) const =0
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
std::string formatString(std::string message, const std::string &prefix)
Add new lines and prefixes to a string for pretty display in output NOTE: This makes a copy of the st...