00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef SEQGRADCHAN_H
00019 #define SEQGRADCHAN_H
00020
00021
00022 #include <odinseq/seqgrad.h>
00023 #include <odinseq/seqdur.h>
00024 #include <odinseq/seqdriver.h>
00025 #include <odinseq/seqvec.h>
00026
00027
00028 #define _GRADROTMATRIX_LIMIT_ 1.0e-5
00029
00030
00040 class SeqGradChanDriver : public SeqDriverBase {
00041
00042 public:
00043 SeqGradChanDriver() {}
00044 virtual ~SeqGradChanDriver() {}
00045
00046 virtual STD_string get_const_program (float strength, float matrixfactor) const = 0;
00047 virtual STD_string get_onepoint_program(float strength, float matrixfactor) const = 0;
00048 virtual STD_string get_delay_program (float strength, float matrixfactor) const = 0;
00049 virtual STD_string get_wave_program (float strength, float matrixfactor) const = 0;
00050 virtual STD_string get_trapez_program (float strength, float matrixfactor) const = 0;
00051 virtual STD_string get_vector_program (float strength, float matrixfactor, int reordercount) const = 0;
00052
00053 virtual svector get_vector_commands(const STD_string& iterator) const = 0;
00054 virtual svector get_reord_commands() const = 0;
00055
00056 virtual bool prep_const(float strength, const fvector& strengthfactor, double gradduration) = 0;
00057
00058 virtual bool prep_onepoint(float strength, const fvector& strengthfactor, double gradduration) = 0;
00059
00060 virtual bool prep_wave(float strength, const fvector& strengthfactor, double gradduration, const fvector& wave) = 0;
00061 virtual void update_wave(const fvector& wave) = 0;
00062
00063 virtual bool prep_vector(float strength, const fvector& strengthfactor, double gradduration,
00064 const fvector& gradvec, const iarray& index_matrix, nestingRelation nr) = 0;
00065 virtual bool prep_vector_iteration(unsigned int count) = 0;
00066
00067 virtual bool prep_trapez(float strength, const fvector& strengthfactor, double ruptime, const fvector& rupshape, double consttime, double rdowntime, const fvector& rdownshape) = 0;
00068
00069
00070 virtual void event(eventContext& context, double starttime) const = 0;
00071
00072 virtual float check_strength(float strength) const = 0;
00073
00074 virtual SeqGradChanDriver* clone_driver() const = 0;
00075 };
00076
00077
00079
00080
00084 class SeqGradChan : public virtual SeqGradInterface, public ListItem<SeqGradChan>, public SeqDur {
00085
00086 public:
00093 SeqGradChan(const STD_string& object_label,direction gradchannel,
00094 float gradstrength, double gradduration);
00095
00099 SeqGradChan(const STD_string& object_label = "unnamedSeqGradChan" );
00100
00104 SeqGradChan(const SeqGradChan& sgc);
00105
00109 virtual ~SeqGradChan() {}
00110
00114 SeqGradChan& operator = (const SeqGradChan& sgc);
00115
00116
00120 virtual direction get_channel() const;
00121
00125 virtual int get_wavesize() const {return 0;}
00126
00130 virtual void resize(unsigned int newsize) {}
00131
00132
00133
00134
00135
00136 SeqGradInterface& set_strength(float gradstrength);
00137 SeqGradInterface& invert_strength();
00138 float get_strength() const;
00139 double get_gradduration() const {return get_duration();}
00140 SeqGradInterface& set_gradrotmatrix(const RotMatrix& matrix);
00141 fvector get_gradintegral() const;
00142
00143
00144 STD_string get_properties() const;
00145 unsigned int event(eventContext& context) const;
00146
00147
00148 STD_string get_grdpart_rot(direction chan) const;
00149
00150 protected:
00151
00155 float get_grdfactor(direction chan) const;
00156
00161 fvector get_grdfactors_norot() const;
00162
00163
00164 mutable SeqDriverInterface<SeqGradChanDriver> graddriver;
00165
00166 private:
00167 friend class SeqGradChanList;
00168 friend class SeqGradChanParallel;
00169
00173 virtual SeqGradChan& get_subchan(double starttime, double endtime) const = 0;
00174
00175
00179 virtual STD_string get_grdpart(float matrixfactor) const = 0;
00180
00184 virtual float get_integral() const = 0;
00185
00186
00187 RotMatrix get_total_rotmat() const;
00188
00189
00190 float strength;
00191 direction channel;
00192 RotMatrix gradrotmatrix;
00193 };
00194
00195
00200 #endif