dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #26362
Re: Introduce a global Time class
A single global time class is _not_ the way to go, that's not composable to
multiphysics problems with different timescales, etc etc. It's a very
narrow design for a very particular use case.
However this is designed, it's a necessity that the user creates the "time
object" (whatever that is) and passes it to whatever parts of the code that
should share the same view of the time.
The straightforward way to update time across Expression subclasses in C++
is to make the shared time a member of those classes.
class MyExpr: Expression {
MyExpr(shared_ptr<Time> t)> t(t) {}
void eval(...) { double now = t->get_time(); ... }
}
This requires no library support. You can make a base class for Expressions
with time support in your time solver code.
Martin
Follow ups
References