jplus-0.4.7
yacts.h
Go to the documentation of this file.
1/* -*- mode: c++; indent-tabs-mode:nil -*- */
2#ifndef YACTS_H
3#define YACTS_H
4
5#include <istream>
6#include <fstream>
7#include <string>
8#include "jplus.h"
9#include "trjfile.h"
10
15class yacts : public jplus, protected trjfile {
16public:
19
28 bool init(std::istream &script);
29
32
34 virtual void libInit();
35
39 bool setOut(std::string newOut);
40
43 int REPL();
44
50 std::string getTrajectoryFilenameBase(std::string prefix);
51
56 bool initTrajectory(std::string prefix);
57
60 int size();
61
65 bool setFrame(int iframe);
66
71
75 bool nextFrame();
76
79 std::string process();
80
81 friend int runTests(); // testsuite is also our friend :-)
82
83private:
84 void *sunctxptr; // pointer to allocates SUNDIALS context
85 void *cvode_mem; // memory, allocated by sundials CVODE solver
86 void *nvs; // current state
87 std::string outName; // out variable name
88
90 bool loadFrame();
92 bool saveFrame();
93
94};
95
96#endif
A J+ script.
Definition jplus.h:15
bool set(std::string name, jarray data)
Set value of the specified variable inside J+ environment, mark all dependent variables "dirty".
YACTS trajectory file.
Definition trjfile.h:6
YACTS – yet another continuous time simulator.
Definition yacts.h:15
int REPL()
Enters read(stdin)-eval-print(stdout) loop until the end of stdin.
bool initTrajectory(std::string prefix)
Initializes ODE solver and the state either from the start of the problem or from the last saved traj...
yacts()
Initializes YACTS.
friend int runTests()
bool init(std::istream &script)
Load YACTS script.
~yacts()
Frees YACTS memory.
bool setOut(std::string newOut)
Sets the name of output variable.
bool hasNextFrameStored()
Returns true if the next frame is already in the trajectory file and does not have to be (and will no...
std::string process()
Computes and returns the "OUT" variable, corresponding to the current frame.
std::string getTrajectoryFilenameBase(std::string prefix)
Computes trajectory filename base, using hash of "important" parts of yacts script.
bool nextFrame()
Advances to the next trajectory frame by computing it (if necessary) and saving (if computed).
int size()
Returns the number of computed frames in the current trajectory file.
bool setFrame(int iframe)
Sets specified frame as "current", loads it.
virtual void libInit()
Initializes YACTS library functions and makes them avaliable to J.