Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
common.hpp
Go to the documentation of this file.
1 // Copyright (c) Lawrence Livermore National Security, LLC and
2 // other Smith Project Developers. See the top-level LICENSE file for
3 // details.
4 //
5 // SPDX-License-Identifier: (BSD-3-Clause)
6 
12 #pragma once
13 #include <utility>
14 
15 namespace smith {
16 
18 struct TimeInfo {
20  enum class EvaluationMode
21  {
22  Regular,
23  CycleZero
24  };
25 
27  TimeInfo(double t, double t_step, size_t c = 0, EvaluationMode mode = EvaluationMode::Regular)
28  : time_(std::make_pair(t, 0.0)), dt_(std::make_pair(t_step, 0.0)), cycle_(c), mode_(mode)
29  {
30  }
31 
33  double time() const { return time_.first + dt_.first; }
34 
36  double dt() const { return dt_.first; }
37 
39  size_t cycle() const { return cycle_; }
40 
42  bool isCycleZeroEvaluation() const { return mode_ == EvaluationMode::CycleZero; }
43 
45  EvaluationMode mode() const { return mode_; }
46 
47  private:
48  std::pair<double, double> time_;
49  std::pair<double, double> dt_;
50  size_t cycle_;
51  EvaluationMode mode_;
52 };
53 
58 template <typename... T>
59 struct Parameters {
60  static constexpr int n = sizeof...(T);
61 };
62 
63 } // namespace smith
Accelerator functionality.
Definition: smith.cpp:36
a struct that is used in the physics modules to clarify which template arguments are user-controlled ...
Definition: common.hpp:59
static constexpr int n
how many parameters were specified
Definition: common.hpp:60
struct storing time and timestep information
Definition: common.hpp:18
bool isCycleZeroEvaluation() const
true when evaluating the startup acceleration solve.
Definition: common.hpp:42
double dt() const
accessor for dt
Definition: common.hpp:36
size_t cycle() const
accessor for cycle
Definition: common.hpp:39
TimeInfo(double t, double t_step, size_t c=0, EvaluationMode mode=EvaluationMode::Regular)
constructor
Definition: common.hpp:27
EvaluationMode
Evaluation mode for the current step.
Definition: common.hpp:21
@ CycleZero
Initialization or cycle zero step.
@ Regular
Normal evaluation step.
double time() const
accessor for the current time
Definition: common.hpp:33
EvaluationMode mode() const
accessor for residual evaluation mode.
Definition: common.hpp:45