double delta_h; //!< Maximum step interval.
double realtime_scale; //!< Real-time scaling; the value 0 corresponds to no real-time scaling.
double solver; //!< Current numerical solver.
+
+ SimulationConfig() : final_time(100000), absolute_tolerance(1e-6), relative_tolerance(1e-6),
+ time_tolerance(1e-10), delta_t(final_time + 1), delta_h(0), realtime_scale(1), solver(0) {};
+
+ SimulationConfig(const SimulationConfig& p) : final_time(p.final_time), absolute_tolerance(p.absolute_tolerance),
+ relative_tolerance(p.relative_tolerance), time_tolerance(p.time_tolerance), delta_t(p.delta_t),
+ delta_h(p.delta_h), realtime_scale(p.realtime_scale), solver(p.solver) {};
+
+ SimulationConfig(const std::vector<double>& p) : final_time(p[0]), absolute_tolerance(p[1]), relative_tolerance(p[2]),
+ time_tolerance(p[3]), delta_t(p[4]), delta_h(p[5]), realtime_scale(p[6]), solver(p[7]) {};
+
+ void fill(std::vector<double>& p) const
+ {
+ p.resize(8);
+ p[0] = final_time;
+ p[1] = absolute_tolerance;
+ p[2] = relative_tolerance;
+ p[3] = time_tolerance;
+ p[4] = delta_t;
+ p[5] = delta_h;
+ p[6] = realtime_scale;
+ p[7] = solver;
+ }
+ bool operator==(const SimulationConfig& p) const
+ {
+ return final_time == p.final_time && absolute_tolerance == p.absolute_tolerance &&
+ relative_tolerance == p.relative_tolerance && time_tolerance == p.time_tolerance &&
+ delta_t == p.delta_t && delta_h == p.delta_h && realtime_scale == p.realtime_scale && solver == p.solver;
+ }
};
class Diagram: public BaseObject
private:
friend class ::org_scilab_modules_scicos::Model;
- Diagram() : BaseObject(DIAGRAM) {};
- Diagram(const Diagram& o) : BaseObject(DIAGRAM) {};
+ Diagram() : BaseObject(DIAGRAM), title(), path(), properties(), context() {};
+ Diagram(const Diagram& o) : BaseObject(DIAGRAM), title(o.title), path(o.path), properties(o.properties), context(o.context) {};
~Diagram() {}
const std::vector<ScicosID>& getChildren() const
this->children = children;
}
- const std::vector<std::string>& getContext() const
+ void getContext(std::vector<std::string>& data) const
{
- return context;
+ data = context;
}
- void setContext(const std::vector<std::string>& context)
+ update_status_t setContext(const std::vector<std::string>& data)
{
- this->context = context;
+ if (data == context)
+ {
+ return NO_CHANGES;
+ }
+
+ context = data;
+ return SUCCESS;
}
const std::vector<Datatype*>& getDatatypes() const
this->datatypes = datatypes;
}
- const SimulationConfig& getProperties() const
+ void getProperties(std::vector<double>& v) const
{
- return properties;
+ properties.fill(v);
}
- void setProperties(const SimulationConfig& properties)
+ update_status_t setProperties(const std::vector<double>& v)
{
- this->properties = properties;
+ if (v.size() != 8)
+ {
+ return FAIL;
+ }
+
+ SimulationConfig p = SimulationConfig(v);
+ if (p == properties)
+ {
+ return NO_CHANGES;
+ }
+
+ properties = p;
+ return SUCCESS;
}
- const std::string& getTitle() const
+ void getTitle(std::string& data) const
{
- return title;
+ data = title;
}
- void setTitle(const std::string& title)
+ update_status_t setTitle(const std::string& data)
{
- this->title = title;
+ if (data == title)
+ {
+ return NO_CHANGES;
+ }
+
+ title = data;
+ return SUCCESS;
+ }
+
+ void getPath(std::string& data) const
+ {
+ data = path;
+ }
+
+ update_status_t setPath(const std::string& data)
+ {
+ if (data == path)
+ {
+ return NO_CHANGES;
+ }
+
+ path = data;
+ return SUCCESS;
}
const std::string& getVersion() const
private:
std::string title;
+ std::string path;
SimulationConfig properties;
std::vector<std::string> context;