Canoe
Comprehensive Atmosphere N' Ocean Engine
physics.cpp
Go to the documentation of this file.
1 // C/C++ headers
2 #include <iostream>
3 #include <sstream>
4 #include <stdexcept>
5 
6 // Athena++ headers
7 #include "../task_list/task_manager.hpp"
8 #include "physics.hpp"
9 
10 Physics::~Physics() { delete ptm; }
11 
14  AthenaArray<Real> const &w, Real time,
15  Real dt) {
16  std::stringstream msg;
17  int count = 0;
18  ptm->Reset();
19 
20  while (count < 100) {
21  TaskListStatus status = ptm->DoNextJob(du, w, time, dt, packages_);
22  if (status == TaskListStatus::complete) break;
23  count++;
24  }
25 
26  if (count >= 100) {
27  msg << "### FATAL ERROR in Physics::ApplyPhysicsPackages" << std::endl
28  << "Physics Package stuck." << std::endl;
29  ATHENA_ERROR(msg);
30  }
31 }
32 
34  size_t size = 0;
35  size += hydro_bot_.GetSizeInBytes();
36 
37  return size;
38 }
39 
40 size_t Physics::DumpRestartData(char *pdst) {
41  std::memcpy(pdst, hydro_bot_.data(), hydro_bot_.GetSizeInBytes());
42  return RestartDataSizeInBytes();
43 }
44 
45 size_t Physics::LoadRestartData(char *psrc) {
46  std::memcpy(hydro_bot_.data(), psrc, hydro_bot_.GetSizeInBytes());
47  return RestartDataSizeInBytes();
48 }
~Physics()
Definition: physics.cpp:10
size_t DumpRestartData(char *pdst)
Definition: physics.cpp:40
void ApplyPhysicsPackages(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
Definition: physics.cpp:13
std::vector< PhysicsPackage > packages_
Definition: physics.hpp:64
size_t LoadRestartData(char *psrc)
Definition: physics.cpp:45
AthenaArray< Real > hydro_bot_
Definition: physics.hpp:67
size_t RestartDataSizeInBytes()
Definition: physics.cpp:33
TaskManager< Physics > * ptm
Definition: physics.hpp:25