Commit 075caad6 authored by Christopher Subich's avatar Christopher Subich
Browse files

Make default get_dt_max error on invocation

The method get_dt_max inside BaseCase was added in a
previous commit as part of the effort to include the
'default' timestep-checking code inside BaseCase.

The intent is for user code to override this method with a
problem-specific maximum timestep, but if the user code did
not do this the previous implementation would return '0'.

This would cause SPINS to error, as a timestep of <= 0 is
obviously invalid.  However, the error message would be
unintuivie, referring to the <=0 timestep rather than the
root cause of the user not implementing get_dt_max().

This change replaces the previous default method with one
that immediately aborts, with an assertion failure if
assert() is enabled at compile time.
parent 428b5399
......@@ -107,7 +107,6 @@ double BaseCase::get_visco() const { return 0; }
double BaseCase::get_diffusivity(int t) const { return 0; }
double BaseCase::get_rot_f() const { return 0; }
int BaseCase::get_restart_sequence() const { return 0; }
double BaseCase::get_dt_max() const { return 0; }
double BaseCase::get_next_plot() { return 0; }
/* Initialization */
......
......@@ -81,7 +81,9 @@ class BaseCase {
virtual double get_diffusivity(int tracernum) const; // Diffusivity
virtual double get_rot_f() const; // Physical rotation rate
virtual int get_restart_sequence() const; // restart sequence
virtual double get_dt_max() const; // maximum time step
virtual double get_dt_max() const { // maximum time step
assert(0 && "No maximum timestep specified!");
abort();};
virtual double get_next_plot() ; // output number for the next write
/* Initialization */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment