codac 1.5.6
Loading...
Searching...
No Matches
codac_Trajectory.h
Go to the documentation of this file.
1
12#ifndef __CODAC_TRAJECTORY_H__
13#define __CODAC_TRAJECTORY_H__
14
15#include <map>
16#include <list>
17#include "codac_DynamicalItem.h"
18#include "codac_TFunction.h"
20
21namespace codac
22{
23 class TFunction;
24 class TrajectoryVector;
25
26 enum class TrajDefnType { ANALYTIC_FNC, MAP_OF_VALUES };
27
35 {
36 public:
37
40
47
54 Trajectory(const Interval& tdomain, const TFunction& f);
55
64 Trajectory(const Interval& tdomain, const TFunction& f, double timestep);
65
71 explicit Trajectory(const std::map<double,double>& m_map_values);
72
81 explicit Trajectory(const std::list<double>& list_t, const std::list<double>& list_x);
82
88 Trajectory(const Trajectory& traj);
89
94
102
108 int size() const;
109
115 const Interval tdomain() const;
116
122 TrajDefnType definition_type() const;
123
127
133 const std::map<double,double>& sampled_map() const;
134
140 const TFunction* tfunction() const;
141
147 const Interval codomain() const;
148
160 double operator()(double t) const;
161
168 const Interval operator()(const Interval& t) const;
169
175 double first_value() const;
176
182 double last_value() const;
183
187
194 bool not_defined() const;
195
202 bool operator==(const Trajectory& x) const;
203
210 bool operator!=(const Trajectory& x) const;
211
215
224 void set(double y, double t);
225
235
247
254 bool constant_timestep(double& h) const;
255
265 Trajectory& sample(double timestep);
266
279
293
297
307 const Trajectory primitive(double c = 0.) const;
308
317 const Trajectory primitive(double c, double timestep) const;
318
329 const Trajectory diff() const;
330
344 double finite_diff(double t, double h) const;
345
349
356 const Trajectory& operator+=(double x);
357
365
372 const Trajectory& operator-=(double x);
373
381
388 const Trajectory& operator*=(double x);
389
397
404 const Trajectory& operator/=(double x);
405
413
417
425 const std::string class_name() const { return "Trajectory"; };
426
434 friend std::ostream& operator<<(std::ostream& str, const Trajectory& x);
435
437
438 protected:
439
447 const IntervalVector codomain_box() const;
448
453
454 // Class variables:
455
456 Interval m_tdomain = Interval::EMPTY_SET;
457 Interval m_codomain = Interval::EMPTY_SET;
458
459 // A trajectory is defined either by a TFunction or a map of values
460 TrajDefnType m_traj_def_type = TrajDefnType::MAP_OF_VALUES;
461
462 //union
463 //{
464 TFunction *m_function = nullptr;
465 std::map<double,double> m_map_values;
466 //};
467
468 friend void deserialize_Trajectory(std::ifstream& bin_file, Trajectory *&traj);
469 friend void deserialize_TrajectoryVector(std::ifstream& bin_file, TrajectoryVector *&traj);
470 };
471}
472
473#endif
Abstract class for common properties of Tube, TubeVector, Slice, Trajectory, TrajectoryVector objects...
Definition codac_DynamicalItem.h:26
One dimensional trajectory , defined as a temporal map of values.
Definition codac_Trajectory.h:35
const std::string class_name() const
Returns the name of this class.
Definition codac_Trajectory.h:425
const Trajectory diff() const
Differentiates this trajectory.
const TFunction * tfunction() const
Returns the temporal function, if the object is an analytic trajectory.
bool operator!=(const Trajectory &x) const
Returns true if this trajectory is different from .
Trajectory & sample(double timestep)
Samples the trajectory by adding new points to the map of values.
std::map< double, double > m_map_values
optional map of values <t,y>:
Definition codac_Trajectory.h:465
Trajectory(const Interval &tdomain, const TFunction &f, double timestep)
Creates a scalar trajectory from an analytic expression, and transforms it as a map of values (sampl...
const Trajectory primitive(double c, double timestep) const
Computes an approximative primitive of with some time discretization .
friend std::ostream & operator<<(std::ostream &str, const Trajectory &x)
Displays a synthesis of this trajectory.
double operator()(double t) const
Returns the evaluation of this trajectory at .
const Trajectory & operator*=(double x)
Operates *=.
Trajectory()
Creates an empty scalar trajectory .
TrajDefnType definition_type() const
Returns the definition type of this trajectory.
Interval m_tdomain
temporal domain of the trajectory
Definition codac_Trajectory.h:456
const Trajectory & operator/=(const Trajectory &x)
Operates /=.
const Interval codomain() const
Returns the interval of feasible values.
Interval m_codomain
envelope of the values of the trajectory
Definition codac_Trajectory.h:457
double first_value() const
Returns the value .
TFunction * m_function
optional pointer to the analytic expression of this trajectory
Definition codac_Trajectory.h:464
double finite_diff(double t, double h) const
Computes the finite difference at , with an automatic order of accuracy.
bool not_defined() const
Tests whether this trajectory is defined or not.
const Trajectory & operator-=(const Trajectory &x)
Operates -=.
Trajectory & shift_tdomain(double a)
Shifts the tdomain of .
const Trajectory & operator/=(double x)
Operates /=.
Trajectory(const Trajectory &traj)
Creates a copy of a scalar trajectory .
~Trajectory()
Trajectory destructor.
Trajectory(const Interval &tdomain, const TFunction &f)
Creates a scalar trajectory from an analytic expression.
friend void deserialize_TrajectoryVector(std::ifstream &bin_file, TrajectoryVector *&traj)
Creates a TrajectoryVector object from a binary file.
Trajectory & make_continuous()
Makes a trajectory continuous by avoiding infinite slopes.
const Trajectory & operator+=(double x)
Operates +=.
const Trajectory & operator=(const Trajectory &x)
Returns a copy of a Trajectory.
const Interval tdomain() const
Returns the temporal definition domain of this trajectory.
TrajDefnType m_traj_def_type
definition type
Definition codac_Trajectory.h:460
Trajectory & sample(const Trajectory &x)
Samples this trajectory so that it will share the same sampling of .
const Trajectory primitive(double c=0.) const
Computes an approximative primitive of .
int size() const
Returns the dimension of the scalar trajectory (always 1)
double last_value() const
Returns the value .
const Interval operator()(const Interval &t) const
Returns the interval evaluation of this trajectory over .
const IntervalVector codomain_box() const
Returns the box .
const Trajectory & operator-=(double x)
Operates -=.
Trajectory(const std::list< double > &list_t, const std::list< double > &list_x)
Creates a scalar trajectory from a list of values.
const std::map< double, double > & sampled_map() const
Returns the map of values, if the object is defined as a map.
bool operator==(const Trajectory &x) const
Returns true if this trajectory is equal to .
void compute_codomain()
Computes the envelope of trajectory values.
void set(double y, double t)
Sets a value at : .
Trajectory & truncate_tdomain(const Interval &tdomain)
Truncates the tdomain of .
const Trajectory & operator*=(const Trajectory &x)
Operates *=.
const Trajectory & operator+=(const Trajectory &x)
Operates +=.
bool constant_timestep(double &h) const
Returns true if the same amount of time separates each value.
friend void deserialize_Trajectory(std::ifstream &bin_file, Trajectory *&traj)
Creates a Trajectory object from a binary file.
Trajectory(const std::map< double, double > &m_map_values)
Creates a scalar trajectory from a map of values.
n-dimensional trajectory , defined as a temporal map of vector values
Definition codac_TrajectoryVector.h:38
FixPoint of a separator The fixpoint of a separator is computed by calling the "::"separate function ...
Definition codac_capd_helpers.h:9