www.mooseframework.org
MooseObjectWarehouse.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef MOOSEOBJECTWAREHOUSE_H
16 #define MOOSEOBJECTWAREHOUSE_H
17 
18 // MOOSE includes
20 
29 template <typename T>
31 {
32 public:
37 
42  MooseObjectWarehouse(bool threaded = true);
43 
45 
48  virtual void initialSetup(THREAD_ID tid = 0) const;
49  virtual void timestepSetup(THREAD_ID tid = 0) const;
50  virtual void subdomainSetup(THREAD_ID tid = 0) const;
51  virtual void subdomainSetup(SubdomainID id, THREAD_ID tid = 0) const;
52  virtual void jacobianSetup(THREAD_ID tid = 0) const;
53  virtual void residualSetup(THREAD_ID tid = 0) const;
55 };
56 
57 template <typename T>
59  : MooseObjectWarehouseBase<T>(threaded)
60 {
61 }
62 
63 template <typename T>
64 void
66 {
67  checkThreadID(tid);
68  for (const auto & object : _active_objects[tid])
69  object->initialSetup();
70 }
71 
72 template <typename T>
73 void
75 {
76  checkThreadID(tid);
77  for (const auto & object : _active_objects[tid])
78  object->timestepSetup();
79 }
80 
81 template <typename T>
82 void
84 {
85  checkThreadID(tid);
86  if (hasActiveBlockObjects(id, tid))
87  {
88  const auto & objects = getActiveBlockObjects(id, tid);
89  for (const auto & object : objects)
90  object->subdomainSetup();
91  }
92 }
93 
94 template <typename T>
95 void
97 {
98  checkThreadID(tid);
99  for (const auto & object : _active_objects[tid])
100  object->subdomainSetup();
101 }
102 
103 template <typename T>
104 void
106 {
107  checkThreadID(tid);
108  for (const auto & object : _active_objects[tid])
109  object->jacobianSetup();
110 }
111 
112 template <typename T>
113 void
115 {
116  checkThreadID(tid);
117  for (const auto & object : _active_objects[tid])
118  object->residualSetup();
119 }
120 
121 #endif // MOOSEOBJECTWAREHOUSE_H
subdomain_id_type SubdomainID
Definition: MooseTypes.h:77
virtual void subdomainSetup(THREAD_ID tid=0) const
A storage container for MooseObjects that inherit from SetupInterface.
void checkThreadID(THREAD_ID tid) const
Calls assert on thread id.
virtual void timestepSetup(THREAD_ID tid=0) const
virtual void jacobianSetup(THREAD_ID tid=0) const
virtual void initialSetup(THREAD_ID tid=0) const
Convenience methods for calling object setup methods.
virtual void residualSetup(THREAD_ID tid=0) const
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
bool hasActiveBlockObjects(THREAD_ID tid=0) const
MooseObjectWarehouse(bool threaded=true)
Constructor.
std::vector< std::vector< std::shared_ptr< T > > > _active_objects
All active objects (THREAD_ID on outer vector)
A base storage container for MooseObjects.
unsigned int THREAD_ID
Definition: MooseTypes.h:79