ODIN
seqgradchan.h
1 /***************************************************************************
2  seqgradchan.h - description
3  -------------------
4  begin : Mon Aug 19 2002
5  copyright : (C) 2000-2021 by Thies H. Jochimsen
6  email : thies@jochimsen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef SEQGRADCHAN_H
19 #define SEQGRADCHAN_H
20 
21 
22 #include <odinseq/seqgrad.h>
23 #include <odinseq/seqdur.h>
24 #include <odinseq/seqdriver.h>
25 #include <odinseq/seqvec.h>
26 
27 
28 #define _GRADROTMATRIX_LIMIT_ 1.0e-5
29 
30 
40 class SeqGradChanDriver : public SeqDriverBase {
41 
42  public:
44  virtual ~SeqGradChanDriver() {}
45 
46  virtual STD_string get_const_program (float strength, float matrixfactor) const = 0;
47  virtual STD_string get_onepoint_program(float strength, float matrixfactor) const = 0;
48  virtual STD_string get_delay_program (float strength, float matrixfactor) const = 0;
49  virtual STD_string get_wave_program (float strength, float matrixfactor) const = 0;
50  virtual STD_string get_trapez_program (float strength, float matrixfactor) const = 0;
51  virtual STD_string get_vector_program (float strength, float matrixfactor, int reordercount) const = 0;
52 
53  virtual svector get_vector_commands(const STD_string& iterator) const = 0;
54  virtual svector get_reord_commands() const = 0;
55 
56  virtual bool prep_const(float strength, const fvector& strengthfactor, double gradduration) = 0;
57 
58  virtual bool prep_onepoint(float strength, const fvector& strengthfactor, double gradduration) = 0;
59 
60  virtual bool prep_wave(float strength, const fvector& strengthfactor, double gradduration, const fvector& wave) = 0;
61  virtual void update_wave(const fvector& wave) = 0;
62 
63  virtual bool prep_vector(float strength, const fvector& strengthfactor, double gradduration,
64  const fvector& gradvec, const iarray& index_matrix, nestingRelation nr) = 0;
65  virtual bool prep_vector_iteration(unsigned int count) = 0;
66 
67  virtual bool prep_trapez(float strength, const fvector& strengthfactor, double ruptime, const fvector& rupshape, double consttime, double rdowntime, const fvector& rdownshape) = 0;
68 
69 
70  virtual void event(eventContext& context, double starttime) const = 0;
71 
72  virtual float check_strength(float strength) const = 0;
73 
74  virtual SeqGradChanDriver* clone_driver() const = 0;
75 };
76 
77 
79 
80 
84 class SeqGradChan : public virtual SeqGradInterface, public ListItem<SeqGradChan>, public SeqDur {
85 
86  public:
93  SeqGradChan(const STD_string& object_label,direction gradchannel,
94  float gradstrength, double gradduration);
95 
99  SeqGradChan(const STD_string& object_label = "unnamedSeqGradChan" );
100 
105 
109  virtual ~SeqGradChan() {}
110 
115 
116 
120  virtual direction get_channel() const;
121 
125  virtual int get_wavesize() const {return 0;}
126 
130  virtual void resize(unsigned int newsize) {}
131 
132 
133 
134 
135  // overwriting virtual functions from SeqGradInterface
136  SeqGradInterface& set_strength(float gradstrength);
138  float get_strength() const;
139  double get_gradduration() const {return get_duration();}
142 
143  // overwriting virtual functions from SeqTreeObj
144  STD_string get_properties() const;
145  unsigned int event(eventContext& context) const;
146 
147 
148  STD_string get_grdpart_rot(direction chan) const;
149 
150  protected:
151 
155  float get_grdfactor(direction chan) const;
156 
162 
163 
164  mutable SeqDriverInterface<SeqGradChanDriver> graddriver;
165 
166  private:
167  friend class SeqGradChanList;
168  friend class SeqGradChanParallel;
169 
173  virtual SeqGradChan& get_subchan(double starttime, double endtime) const = 0;
174 
175 
179  virtual STD_string get_grdpart(float matrixfactor) const = 0;
180 
184  virtual float get_integral() const = 0;
185 
186 
187  RotMatrix get_total_rotmat() const;
188 
189 
190  float strength;
191  direction channel; // Do not change this once it it is initialised
192  RotMatrix gradrotmatrix;
193 };
194 
195 
200 #endif
Rotation Matrix.
Definition: geometry.h:67
Definition: seqdur.h:38
double get_duration() const
SeqGradChan(const SeqGradChan &sgc)
virtual direction get_channel() const
SeqGradChan(const STD_string &object_label="unnamedSeqGradChan")
float get_strength() const
STD_string get_properties() const
fvector get_gradintegral() const
virtual int get_wavesize() const
Definition: seqgradchan.h:125
SeqGradInterface & set_gradrotmatrix(const RotMatrix &matrix)
SeqGradChan & operator=(const SeqGradChan &sgc)
virtual void resize(unsigned int newsize)
Definition: seqgradchan.h:130
SeqGradInterface & invert_strength()
double get_gradduration() const
Definition: seqgradchan.h:139
SeqGradChan(const STD_string &object_label, direction gradchannel, float gradstrength, double gradduration)
fvector get_grdfactors_norot() const
unsigned int event(eventContext &context) const
SeqGradInterface & set_strength(float gradstrength)
virtual ~SeqGradChan()
Definition: seqgradchan.h:109
float get_grdfactor(direction chan) const
direction
Definition: odinpara.h:41
nestingRelation
Definition: seqvec.h:61