12 #ifndef CD_RtLayoutImplem_H
13 #define CD_RtLayoutImplem_H
21 #include <CD_NamespaceHeader.H>
26 CH_TIME(
"RtLayout<T>::RtLayout(Vector)");
30 m_species = a_RtSpecies;
37 CH_TIME(
"RtLayout<T>::~RtLayout");
60 for (
auto solver_it = this->iterator(); solver_it.ok(); ++solver_it) {
61 solver_it()->setRealm(m_realm);
69 m_solvers.push_back(a_solver);
76 CH_TIME(
"RtLayout<T>::parseOptions");
77 if (m_verbosity > 6) {
78 pout() <<
"RtLayout<T>::parseOptions" << endl;
81 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
82 RefCountedPtr<T>& solver = solver_it();
83 solver->parseOptions();
91 CH_TIME(
"RtLayout<T>::parseRuntimeOptions");
92 if (m_verbosity > 6) {
93 pout() <<
"RtLayout<T>::parseRuntimeOptions" << endl;
96 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
97 RefCountedPtr<T>& solver = solver_it();
98 solver->parseRuntimeOptions();
106 CH_TIME(
"RtLayout<T>::allocate");
107 if (m_verbosity > 6) {
108 pout() <<
"RtLayout<T>::allocate" << endl;
111 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
112 RefCountedPtr<T>& solver = solver_it();
121 CH_TIME(
"RtLayout<T>::preRegrid");
122 if (m_verbosity > 6) {
123 pout() <<
"RtLayout<T>::preRegrid" << endl;
126 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
127 RefCountedPtr<T>& solver = solver_it();
128 solver->preRegrid(a_base, a_finestLevel);
136 CH_TIME(
"RtLayout<T>::deallocate");
137 if (m_verbosity > 6) {
138 pout() <<
"RtLayout<T>::deallocate" << endl;
141 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
142 RefCountedPtr<T>& solver = solver_it();
143 solver->deallocate();
151 CH_TIME(
"RtLayout<T>::setAmr");
152 if (m_verbosity > 5) {
153 pout() <<
"RtLayout<T>::setAmr" << endl;
156 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
157 RefCountedPtr<T>& solver = solver_it();
158 solver->setAmr(a_amr);
166 CH_TIME(
"RtLayout<T>::setComputationalGeometry");
167 if (m_verbosity > 5) {
168 pout() <<
"RtLayout<T>::setComputationalGeometry" << endl;
171 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
172 RefCountedPtr<T>& solver = solver_it();
173 solver->setComputationalGeometry(a_computationalGeometry);
181 CH_TIME(
"RtLayout<T>::setPhase");
182 if (m_verbosity > 5) {
183 pout() <<
"RtLayout<T>::setPhase" << endl;
188 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
189 RefCountedPtr<T>& solver = solver_it();
190 solver->setPhase(a_phase);
198 CH_TIME(
"RtLayout<T>::setVerbosity");
200 m_verbosity = a_verbosity;
201 if (m_verbosity > 5) {
202 pout() <<
"RtLayout<T>::setVerbosity" << endl;
205 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
206 RefCountedPtr<T>& solver = solver_it();
207 solver->setVerbosity(a_verbosity);
215 CH_TIME(
"RtLayout<T>::sanityCheck");
216 if (m_verbosity > 5) {
217 pout() <<
"RtLayout<T>::sanityCheck" << endl;
220 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
221 RefCountedPtr<T>& solver = solver_it();
222 solver->sanityCheck();
230 CH_TIME(
"RtLayout<T>::setTime");
231 if (m_verbosity > 5) {
232 pout() <<
"RtLayout<T>::setTime" << endl;
235 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
236 RefCountedPtr<T>& solver = solver_it();
237 solver->setTime(a_step, a_time, a_dt);
245 CH_TIME(
"RtLayout<T>::regrid");
246 if (m_verbosity > 5) {
247 pout() <<
"RtLayout<T>::regrid" << endl;
250 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
251 RefCountedPtr<T>& solver = solver_it();
252 solver->regrid(a_lmin, a_oldFinestLevel, a_newFinestLevel);
260 CH_TIME(
"RtLayout<T>::registerOperators");
261 if (m_verbosity > 5) {
262 pout() <<
"RtLayout<T>::registerOperators" << endl;
265 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
266 RefCountedPtr<T>& solver = solver_it();
267 solver->registerOperators();
275 CH_TIME(
"RtLayout<T>::setSource(ebamrcell)");
276 if (m_verbosity > 5) {
277 pout() <<
"RtLayout<T>::setSource(ebamrcell)" << endl;
280 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
281 RefCountedPtr<T>& solver = solver_it();
282 solver->setSource(a_source);
290 CH_TIME(
"RtLayout<T>::setSource(constant)");
291 if (m_verbosity > 5) {
292 pout() <<
"RtLayout<T>::setSource(constant)" << endl;
295 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
296 RefCountedPtr<T>& solver = solver_it();
297 solver->setSource(a_source);
305 CH_TIME(
"RtLayout<T>::setStationary");
306 if (m_verbosity > 5) {
307 pout() <<
"RtLayout<T>::setStationary" << endl;
310 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
311 RefCountedPtr<T>& solver = solver_it();
312 solver->setStationary(a_stationary);
320 CH_TIME(
"RtLayout<T>::writePlotFile");
321 if (m_verbosity > 5) {
322 pout() <<
"RtLayout<T>::writePlotFile" << endl;
325 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
326 RefCountedPtr<T>& solver = solver_it();
327 solver->writePlotFile();
335 CH_TIME(
"RtLayout<T>::advance");
336 if (m_verbosity > 6) {
337 pout() <<
"RtLayout<T>::advance" << endl;
340 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
341 RefCountedPtr<T>& solver = solver_it();
342 solver->advance(a_dt, solver->getPhi(), solver->getSource());
350 CH_TIME(
"RtLayout<T>::initialData");
351 if (m_verbosity > 6) {
352 pout() <<
"RtLayout<T>::initialData" << endl;
355 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
356 RefCountedPtr<T>& solver = solver_it();
357 solver->initialData();
365 CH_TIME(
"RtLayout<T>::isStationary");
366 if (m_verbosity > 5) {
367 pout() <<
"RtLayout<T>::isStationary" << endl;
370 bool stationary =
true;
372 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
373 RefCountedPtr<T>& solver = solver_it();
375 if (solver->isStationary() ==
false) {
387 CH_TIME(
"RtLayout<T>::getPhase");
388 if (m_verbosity > 5) {
389 pout() <<
"RtLayout<T>::getPhase" << endl;
396 Vector<RefCountedPtr<T>>&
403 Vector<RefCountedPtr<RtSpecies>>&
410 Vector<EBAMRCellData*>
413 CH_TIME(
"RtLayout<T>::getSources");
414 if (m_verbosity > 5) {
415 pout() <<
"RtLayout<T>::getSources" << endl;
418 Vector<EBAMRCellData*> sources;
420 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
421 RefCountedPtr<T>& solver = solver_it();
422 sources.push_back(&(solver->getSource()));
429 Vector<EBAMRCellData*>
432 CH_TIME(
"RtLayout<T>::getPhis");
433 if (m_verbosity > 5) {
434 pout() <<
"RtLayout<T>::getPhis" << endl;
437 Vector<EBAMRCellData*> states;
439 for (
RtIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
440 RefCountedPtr<T>& solver = solver_it();
441 states.push_back(&(solver->getPhi()));
447 template <
class T,
class S>
451 template <
class T,
class S>
455 template <
class T,
class S>
456 RefCountedPtr<RtLayout<T>>
460 auto rte = RefCountedPtr<RtLayout<T>>(
new RtLayout<T>(a_species));
461 auto spe = a_species;
464 for (
int i = 0; i < a_species.size(); i++) {
465 auto solver = RefCountedPtr<T>(
static_cast<T*
>(
new S()));
466 solver->setRtSpecies(spe[i]);
467 solver->setPhase(phase::gas);
468 solver->setVerbosity(-1);
469 rte->addSolver(solver);
475 #include <CD_NamespaceFooter.H>
Iterator class for RtLayout.
Declaration of a class that holds a set of RtSolvers.
~RtFactory()
Destructor (does nothing)
Definition: CD_RtLayoutImplem.H:452
RtFactory()
Constructor (does nothing)
Definition: CD_RtLayoutImplem.H:448
RefCountedPtr< RtLayout< T > > newLayout(const Vector< RefCountedPtr< RtSpecies >> &a_species) const
Get a new Layout. This will cast S to a specific class (T)
Definition: CD_RtLayoutImplem.H:457
Iterator class for RtLayout.
Definition: CD_RtIterator.H:24
virtual bool ok()
Check if we can cycle further through the solvers.
Definition: CD_RtIteratorImplem.H:63
Class for holding a set of RtSolvers. T must derive from RtSolver.
Definition: CD_RtLayout.H:27
virtual void setVerbosity(const int a_verbosity)
Set verbosity.
Definition: CD_RtLayoutImplem.H:196
virtual void setComputationalGeometry(const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry)
Set the computational geometry.
Definition: CD_RtLayoutImplem.H:164
virtual const std::string getRealm() const
Get realm where the solvers are allocated.
Definition: CD_RtLayoutImplem.H:49
virtual Vector< RefCountedPtr< T > > & getSolvers()
Get solvers.
Definition: CD_RtLayoutImplem.H:397
virtual void parseOptions()
Parse options.
Definition: CD_RtLayoutImplem.H:74
virtual void setStationary(const bool a_stationary)
Turn on/off stationary.
Definition: CD_RtLayoutImplem.H:303
virtual void sanityCheck()
Do a sanity check.
Definition: CD_RtLayoutImplem.H:213
virtual void setTime(const int a_step, const Real a_time, const Real a_dt)
Set time.
Definition: CD_RtLayoutImplem.H:228
virtual Vector< EBAMRCellData * > getSources()
Get all source terms.
Definition: CD_RtLayoutImplem.H:411
virtual void registerOperators()
Register operators.
Definition: CD_RtLayoutImplem.H:258
virtual void setSource(const EBAMRCellData &a_source)
Convenience function. Set source terms for all species. Mostly used for debugging.
Definition: CD_RtLayoutImplem.H:273
virtual bool isStationary()
Check if solvers are stationary.
Definition: CD_RtLayoutImplem.H:363
virtual Vector< EBAMRCellData * > getPhis()
Get all states.
Definition: CD_RtLayoutImplem.H:430
virtual void deallocate()
Deallocate internal storage for solvers.
Definition: CD_RtLayoutImplem.H:134
virtual void setAmr(const RefCountedPtr< AmrMesh > &a_amr)
Set amr.
Definition: CD_RtLayoutImplem.H:149
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel)
Regrid all solvers.
Definition: CD_RtLayoutImplem.H:243
virtual void addSolver(RefCountedPtr< T > a_solver)
Add a new solver to the solver layout.
Definition: CD_RtLayoutImplem.H:67
virtual void parseRuntimeOptions()
Parse runtime options.
Definition: CD_RtLayoutImplem.H:89
virtual Vector< RefCountedPtr< RtSpecies > > & getSpecies()
Get species.
Definition: CD_RtLayoutImplem.H:404
RtLayout(const Vector< RefCountedPtr< RtSpecies >> &a_RtSpecies)
Full constructor.
Definition: CD_RtLayoutImplem.H:24
virtual RtIterator< T > iterator()
Get iterator.
Definition: CD_RtLayoutImplem.H:42
virtual ~RtLayout()
Destructor (does nothing)
Definition: CD_RtLayoutImplem.H:35
virtual void setRealm(const std::string a_realm)
Set realm for solvers.
Definition: CD_RtLayoutImplem.H:56
virtual void writePlotFile()
Convenience function. All solvers write plot files.
Definition: CD_RtLayoutImplem.H:318
virtual void preRegrid(const int a_base, const int a_oldFinestLevel)
Pre regrid stuff.
Definition: CD_RtLayoutImplem.H:119
virtual void initialData()
Fill with initial data.
Definition: CD_RtLayoutImplem.H:348
virtual void advance(const Real a_dt)
Convenience function. Call advance method for each solver.
Definition: CD_RtLayoutImplem.H:333
virtual phase::which_phase getPhase()
Get phase.
Definition: CD_RtLayoutImplem.H:385
virtual void allocate()
Allocate internal storage for solvers.
Definition: CD_RtLayoutImplem.H:104
virtual void setPhase(phase::which_phase a_phase=phase::gas)
Set phase.
Definition: CD_RtLayoutImplem.H:179