Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef AUTOCORRFACTORY_H
00029 #define AUTOCORRFACTORY_H
00030
00031 #include "Dispersion.h"
00032 #include "ModalFactory.h"
00033 #include "AutocorrRing.h"
00034 #include "QGpCoreWaveDLLExport.h"
00035
00036 namespace QGpCoreWave {
00037
00038 class DispersionFactory;
00039
00040 class QGPCOREWAVE_EXPORT AutocorrFactory : public ModalFactory
00041 {
00042 public:
00043 AutocorrFactory(const QVector<AutocorrRing> * rings);
00044 ~AutocorrFactory();
00045
00046 int verticalModeCount() const {return maxModeCount(_vertical);}
00047 int horizontalModeCount() const;
00048
00049 void init();
00050
00051 bool isVertical() const {return _vertical;}
00052 bool isRadial() const {return _radial;}
00053 bool isTransverse() const {return _transverse;}
00054
00055 int ringCount() const {return _rings->count();}
00056 ModalStorage& vertical(int ringIndex) const {return *_vertical[ringIndex];}
00057 ModalStorage& radial(int ringIndex) const {return *_radial[ringIndex];}
00058 ModalStorage& transverse(int ringIndex) const {return *_transverse[ringIndex];}
00059
00060 void calculate(DispersionFactory * disp);
00061 void calculate(double alphaR, DispersionFactory * disp);
00062 void calculateVertical(DispersionFactory * disp);
00063 void calculateHorizontal(double alphaR, DispersionFactory * disp);
00064 void calculateHorizontal(int iOmega, double alphaR, DispersionFactory * disp);
00065
00066
00067
00068 virtual void setMode (const Mode& m);
00069 virtual const RealValue * mode(const Mode& m) const;
00070 virtual int storageCount() const {return _rings->count()*3;}
00071 inline virtual void writeReportHeader(QDataStream& s) const;
00072 inline virtual ModalStorage * storage(int storageIndex) const;
00073
00074 double radialAutocorr(double omega, double r1, double r2, double alpha, double cr, double cl);
00075 double transverseAutocorr(double omega, double r1, double r2, double alpha, double cr, double cl);
00076 protected:
00077 virtual ModalStorage * newStorage(int nModes) {return new ModalStorage (nModes, x());}
00078 ModalStorage ** newHorizontalStorage();
00079 void upgrade ( ModalStorage **& s, int ringIndex, int requestedMode);
00080 private:
00081 int maxModeCount(ModalStorage ** s) const;
00082 void setInvalid(ModalStorage ** s);
00083
00084 const QVector<AutocorrRing> * _rings;
00085 ModalStorage ** _vertical;
00086 ModalStorage ** _radial;
00087 ModalStorage ** _transverse;
00088
00089 int _nVerticalModes;
00090 int _nHorizontalModes;
00091
00092
00093
00094
00095
00096 };
00097
00098 inline void AutocorrFactory::writeReportHeader(QDataStream& s) const
00099 {
00100 TRACE;
00101 s << _rings->count();
00102 }
00103
00104 inline ModalStorage * AutocorrFactory::storage(int storageIndex) const
00105 {
00106 TRACE;
00107 int iRing=storageIndex/3;
00108 int iComponent=storageIndex-iRing*3;
00109 switch (iComponent) {
00110 case 1:
00111 if(_radial) return _radial[iRing]; else return 0;
00112 case 2:
00113 if(_transverse) return _transverse[iRing]; else return 0;
00114 default:
00115 if(_vertical) return _vertical[iRing]; else return 0;
00116 }
00117 }
00118
00119 }
00120
00121 #endif // AUTOCORRFACTORY_H