4 #ifndef CPPQEDCORE_UTILS_TRAJECTORY_H_INCLUDED
5 #define CPPQEDCORE_UTILS_TRAJECTORY_H_INCLUDED
7 #include "TrajectoryFwd.h"
47 const std::string& ofn,
48 const std::string& initialFileName,
51 bool firstStateDisplay,
52 double autoStopEpsilon,
53 unsigned autoStopRepetition,
54 const std::string& parsedCommandLine
73 void run(Trajectory &,
long nDt,
74 double deltaT,
unsigned sdf,
const std::string& ofn,
const std::string& initialFileName,
int precision,
bool displayInfo,
bool firstStateDisplay,
75 double autoStopEpsilon,
unsigned autoStopRepetition,
const std::string& parsedCommandLine);
86 void run(Adaptive<A>&,
double time,
int dc,
87 unsigned sdf,
const std::string& ofn,
const std::string& initialFileName,
int precision,
bool displayInfo,
bool firstStateDisplay,
88 double autoStopEpsilon,
unsigned autoStopRepetition,
const std::string& parsedCommandLine);
100 void run(Trajectory &,
const ParsRun& p);
112 void run(Adaptive<A>&,
const ParsRun&);
124 : protocolVersion(0),
133 std::string trajectoryID;
135 static const std::string UNSPECIFIED;
136 static const std::string ARRAY_ONLY;
139 #ifndef DO_NOT_USE_BOOST_SERIALIZATION
140 friend class boost::serialization::access;
141 template<
class Archive>
142 void serialize(Archive& ar,
const unsigned int) {ar & protocolVersion & rank & typeID & trajectoryID;}
143 #endif // DO_NOT_USE_BOOST_SERIALIZATION
149 void writeViaSStream(
const T&, std::ofstream*);
151 void readViaSStream( T&, std::ifstream&);
183 inline double initialTimeStep(
double highestFrequency) {
return 1./(10.*highestFrequency);}
198 void evolve(
double deltaT) {evolve_v(deltaT);}
201 std::ostream&
display(std::ostream&,
int precision
212 std::ostream&
logOnEnd(std::ostream& os)
const {
return logOnEnd_v(os);}
223 virtual void evolve_v(
double) = 0;
224 virtual double getTime_v()
const = 0;
225 virtual double getDtDid_v()
const = 0;
227 virtual std::ostream& displayParameters_v(std::ostream& )
const = 0;
228 virtual std::ostream& display_v (std::ostream&,
int )
const = 0;
229 virtual std::ostream& displayKey_v (std::ostream&,
size_t&)
const = 0;
234 virtual std::ostream& logOnEnd_v(std::ostream& os)
const {
return os;}
253 typedef typename EvolvedIO::Ptr Ptr;
272 double getTime()
const {
return evolvedIO_->getTime();}
280 const Ptr evolvedIO_;
304 using AdaptiveIO<A>::meta_;
312 typedef typename Evolved::ConstPtr ConstPtr;
313 typedef typename Evolved:: Ptr Ptr;
317 const ConstPtr getEvolved()
const {
return ConstPtr(evolved_);}
318 const Ptr getEvolved() {
return evolved_ ;}
320 double getDtTry()
const {
return evolved_->getDtTry();}
326 std::ostream& displayParameters_v(std::ostream&)
const override;
337 double getDtDid_v() const final {
return evolved_->getDtDid();}
339 void evolve_v(
double deltaT)
final {evolved::evolve<Adaptive>(*
this,deltaT);}
341 double getTime_v() const final {
return evolved_->getTime();}
343 virtual void step_v(
double deltaT) = 0;
345 virtual const std::string trajectoryID_v()
const = 0;
349 const double dtInit_;
357 #endif // CPPQEDCORE_UTILS_TRAJECTORY_H_INCLUDED
The class that is (meant to be, at least) the base of all exceptions in the framework.
Defines i/oarchive types depending on the DO_NOT_USE_BOOST_SERIALIZATION macro.
SerializationMetadata readMeta(std::ifstream &)
Needed separately for the Python i/o.
Corresponds to evolved::EvolvedIO, adding the capability of state serialization involving a Serializa...
Factory class for Evolved types.
const std::string trajectoryID() const
redirected to a pure virtual, this is needed for serialization of trajectory metadata ...
double getDtDid() const
last perfomed timestep
void evolve(double deltaT)
Propagation for a time interval of exactly deltaT.
A common interface for (adaptive stepsize) ODE drivers.
cpputils::oarchive & writeState(cpputils::oarchive &oar) const
write to an archive
Raised when the trajectory type we try to read in from file does not match.
cpputils::oarchive & writeState(cpputils::oarchive &oar) const
Write the EvolvedIO to a cpputils::oarchive.
std::ostream & logOnEnd(std::ostream &os) const
print a log at the end summarizing overall (e.g. time-averaged) physical and numerical data during th...
double getTime() const
actual time instant
Class reporting also the “what-ness” of the exception.
cpputils::iarchive & readState(cpputils::iarchive &iar)
Read in the EvolvedIO from a cpputils::iarchive.
boost::archive::binary_oarchive oarchive
delegated to Boost.Serialization
std::ostream & displayParameters(std::ostream &os) const
print header
Defines class of the same name.
virtual cpputils::oarchive & writeStateMore_v(cpputils::oarchive &oar) const
hook into Trajectory::writeState
std::ostream & display(std::ostream &, int precision) const
Displays a limited set of relevant physical and numerical information about the actual state of Traje...
Class for serialization of Evolved states.
Raised when the rank of a trajectory we try to read in from file does not match.
double initialTimeStep(double highestFrequency)
A heuristic determination of the inital timestep from the highest frequency of a physical system...
Adaptive is basically an evolved::Evolved wrapped into the Trajectory interface.
boost::archive::binary_iarchive iarchive
delegated to Boost.Serialization
double getTime() const
Returns the time of the underlying EvolvedIO.
The base class of the trajectory-bundle condensing the quintessential characteristics of any trajecto...
void step(double deltaT)
corresponding to Evolved::step, it takes a single adaptive step
boost::function< void(double, const A &, A &)> Derivs
the strategy functor to calculate time derivative at a given time (3rd argument for output) ...
Adaptive(A &, typename Evolved::Derivs, double, double, double, const A &, const evolved::Maker< A > &)
Constructor taking the same parameters as needed to operate evolved::Maker.
virtual cpputils::iarchive & readStateMore_v(cpputils::iarchive &iar)
hook into Trajectory::readState
Defines tentative base classes for the exception classes of the framework.
const Ptr getEvolvedIO() const
note: not the same const-correctness as in Adaptive
cpputils::iarchive & readState(cpputils::iarchive &iar)
read from an archive
Raised when the dimensions of a trajectory state we try to read in from file does not match...