Skip to content

Commit

Permalink
Sampler: allow different eps settings
Browse files Browse the repository at this point in the history
  • Loading branch information
aystarik committed Jan 12, 2025
1 parent 833ae09 commit 1ad3ec1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/ascent/timing/Sampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@

namespace asc
{
struct def_eps {
static constexpr double eps = 1e-8;
};
// A Sampler resets the base time step when it goes out of scope. In this manner it can be used as a short-lived object within the simulation loop.
// If the Sampler is to exist long term, then the reset() must be called after time is incremented within the simulation loop.
// Note that keeping the Sampler around longer maintains a consistent base time step.
template <typename T>
template <typename T, class Eps = def_eps>
struct SamplerT
{
SamplerT(T& _t, T& _dt) noexcept : t(_t), dt(_dt), dt_base(dt) {}
Expand Down Expand Up @@ -77,7 +80,7 @@ namespace asc
}

private:
static constexpr T eps = static_cast<T>(1.0e-8);
static constexpr T eps = static_cast<T>(Eps::eps);
T& t;
T& dt;
T dt_base;
Expand Down

0 comments on commit 1ad3ec1

Please sign in to comment.