62 const std::map<SubdomainID, std::vector<std::shared_ptr<T>>> &
65 const std::map<BoundaryID, std::vector<std::shared_ptr<T>>> &
78 const std::map<SubdomainID, std::vector<std::shared_ptr<T>>> &
82 const std::map<BoundaryID, std::vector<std::shared_ptr<T>>> &
110 const std::set<SubdomainID> &
blocks,
111 std::set<SubdomainID> & blocks_covered,
151 std::set<MooseVariableFieldBase *> & needed_moose_vars,
156 std::set<MooseVariableFieldBase *> & needed_moose_vars,
168 std::set<TagID> & needed_fe_var_vector_tags,
181 const bool producer_only =
false)
const;
183 std::unordered_set<unsigned int> & needed_mat_props,
185 const bool producer_only =
false)
const;
188 const bool producer_only =
false)
const;
190 std::unordered_set<unsigned int> & needed_mat_props,
192 const bool producer_only =
false)
const;
199 std::set<std::string> & unique_variables,
213 const std::string & prefix =
"[DBG]")
const;
244 const std::vector<std::shared_ptr<T>> & all);
249 static void sortHelper(std::vector<std::shared_ptr<T>> & objects);
255 const std::vector<std::shared_ptr<T>> & objects);
262 const std::vector<std::shared_ptr<T>> & objects);
268 const std::vector<std::shared_ptr<T>> & objects,
269 const bool producer_only)
const;
280 const std::vector<std::map<
BoundaryID, std::vector<std::shared_ptr<T>>>> & boundary_objects,
324 bool enabled =
object->enabled();
329 std::shared_ptr<BoundaryRestrictable> bnd =
330 std::dynamic_pointer_cast<BoundaryRestrictable>(
object);
331 std::shared_ptr<BlockRestrictable> blk = std::dynamic_pointer_cast<BlockRestrictable>(
object);
334 if (bnd && bnd->boundaryRestricted())
336 const std::set<BoundaryID> & ids = bnd->boundaryIDs();
337 for (std::set<BoundaryID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
348 const std::set<SubdomainID> & ids =
349 blk->blockRestricted() ? blk->blockIDs() : blk->meshBlockIDs();
350 for (std::set<SubdomainID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
358 std::shared_ptr<Coupleable> c_ptr = std::dynamic_pointer_cast<Coupleable>(
object);
361 blk->checkVariable(*var);
372 std::string variable_name = parameters.
getMooseType(
"variable");
373 if (variable_name ==
"")
387inline const std::vector<std::shared_ptr<T>> &
395inline const std::map<BoundaryID, std::vector<std::shared_ptr<T>>> &
411const std::vector<std::shared_ptr<T>> &
417 "Unable to located active boundary objects for the given id: " <<
id <<
".");
422inline const std::map<SubdomainID, std::vector<std::shared_ptr<T>>> &
430const std::vector<std::shared_ptr<T>> &
436 "Unable to located active block objects for the given id: " <<
id <<
".");
441inline const std::vector<std::shared_ptr<T>> &
449inline const std::map<BoundaryID, std::vector<std::shared_ptr<T>>> &
457const std::vector<std::shared_ptr<T>> &
463 "Unable to located active boundary objects for the given id: " <<
id <<
".");
468inline const std::map<SubdomainID, std::vector<std::shared_ptr<T>>> &
476const std::vector<std::shared_ptr<T>> &
482 "Unable to located active block objects for the given id: " <<
id <<
".");
514 const std::set<SubdomainID> &
blocks,
515 std::set<SubdomainID> & blocks_covered,
519 blocks_covered.clear();
526 std::shared_ptr<BlockRestrictable> blk = std::dynamic_pointer_cast<BlockRestrictable>(
object);
527 if (blk && blk->hasBlocks(
blocks))
537 std::shared_ptr<BlockRestrictable> blk = std::dynamic_pointer_cast<BlockRestrictable>(
object);
539 for (
const auto & block :
blocks)
540 if (blk->hasBlocks(block))
541 blocks_covered.insert(block);
544 if (blocks_covered.empty())
547 return (
blocks == blocks_covered);
555 bool has_active_block_objects =
false;
557 has_active_block_objects |= !(object_pair.second.empty());
558 return has_active_block_objects;
573 const std::vector<std::map<
BoundaryID, std::vector<std::shared_ptr<T>>>> & boundary_objects,
577 bool has_boundary_objects =
false;
578 for (
const auto & object_pair : boundary_objects[tid])
579 has_boundary_objects |= !(object_pair.second.empty());
580 return has_boundary_objects;
612 if (object->name() == name)
623 if (object->name() == name)
625 mooseError(
"Unable to locate object: ", name,
".");
634 if (object->name() == name)
636 mooseError(
"Unable to locate active object: ", name,
".");
640const std::vector<std::shared_ptr<T>> &
652 std::set<SubdomainID> ids;
654 ids.insert(object_pair.first);
676 const std::vector<std::shared_ptr<T>> & all)
681 std::copy_if(all.begin(),
683 std::back_inserter(active),
684 [](
const std::shared_ptr<T> &
object) { return object->enabled(); });
708 std::set<MooseVariableFieldBase *> & needed_moose_vars,
THREAD_ID tid )
const
718 std::set<MooseVariableFieldBase *> & needed_moose_vars,
728 std::set<MooseVariableFieldBase *> & needed_moose_vars,
THREAD_ID tid )
const
732 typename std::map<BoundaryID, std::vector<std::shared_ptr<T>>>::const_iterator it;
742 std::set<MooseVariableFieldBase *> & needed_moose_vars,
752 std::set<MooseVariableFieldBase *> & needed_moose_vars,
753 const std::vector<std::shared_ptr<T>> & objects)
755 for (
const auto &
object : objects)
761 needed_moose_vars.insert(mv_deps.begin(), mv_deps.end());
769 std::set<TagID> & needed_fe_var_vector_tags,
THREAD_ID tid )
const
799 std::set<TagID> & needed_fe_var_vector_tags,
const std::vector<std::shared_ptr<T>> & objects)
801 for (
const auto &
object : objects)
803 auto c =
dynamic_cast<const Coupleable *
>(
object.get());
807 needed_fe_var_vector_tags.insert(tag_deps.begin(), tag_deps.end());
815 std::unordered_set<unsigned int> & needed_mat_props,
817 const bool producer_only )
const
827 std::unordered_set<unsigned int> & needed_mat_props,
829 const bool producer_only )
const
838 std::unordered_set<unsigned int> & needed_mat_props,
840 const bool producer_only )
const
851 std::unordered_set<unsigned int> & needed_mat_props,
853 const bool producer_only )
const
863 std::unordered_set<unsigned int> & needed_mat_props,
864 const std::vector<std::shared_ptr<T>> & objects,
867 for (
auto &
object : objects)
873 needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
881 std::set<std::string> & unique_variables,
886 unique_variables.insert(object->variable().name());
887 const auto additional_variables_covered =
object->additionalROVariables();
888 unique_variables.insert(additional_variables_covered.begin(),
889 additional_variables_covered.end());
893 subdomains_covered.insert(object_pair.first);
899 const THREAD_ID tid ,
const std::string & prefix )
const
901 std::vector<std::string> output;
903 output.push_back(object->name());
918 DependencyResolverInterface::sort<std::shared_ptr<T>>(objects);
922 DependencyResolverInterface::cyclicDependencyError<std::shared_ptr<T>>(
923 e,
"Cyclic dependency detected in object ordering");
932 "Attempting to access a thread id ("
933 << tid <<
") greater than the number allowed by the storage item ("
boundary_id_type BoundaryID
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.
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
MooseObjectWarehouseBase(bool threaded=true)
Constructor.
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...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...