00001 //************************************************************************************// 00002 // Module : apost_rror.hpp 00003 // Date : 6/4/03 (DLR) 00004 // Copyright : 2003-2006 Copyright University Corporation for Atmospheric 00005 // Research 00006 // Description : Encapsulates the methods and data associated with 00007 // the object providing a-posteriori error estimates for 00008 // the state (field). The object uses primarily the methods detailed 00009 // in C. Mavriplis' Ph.D. dissertation. 00010 // Derived From : none. 00011 // Modifications: 00012 //************************************************************************************// 00013 #if !defined(APOST_ERROR) 00014 #define APOST_ERROR 00015 00016 #include "field2d.hpp" 00017 #include "mtk.hpp" 00018 #include "gtbuffer.hpp" 00019 #include "gtmatbuffer.hpp" 00020 00021 class APostError 00022 { 00023 public: 00024 00025 enum GERR_NORM {EN_L2, EN_H1_SEMI}; 00026 enum GEXT_FUNC {FF_EXP, FF_POWER_LAW}; 00027 APostError(GERR_NORM norm, Field2D *fld=NULL); 00028 ~APostError(); 00029 00030 void SetField(Field2D *fld); // Set field whose error is desired 00031 void SetNumFitPoints(GINT idir, GINT num); // Set number of fit points in each dir 00032 void SetNumFitPoints(GINT num); // Set number of fit points in both dirs 00033 void SetExtrapFunc(GEXT_FUNC functype); // Set extrapolation function type 00034 void SetMinNumFitPoints(GINT n); // Set minimum no. of fit points for good fit 00035 void SetTiny(GDOUBLE c); // Set size of smallest significant coeff 00036 GBOOL ComputeErrEst(); // Compute error estimate 00037 GDOUBLE GetErrEst(); // Get total error estimate 00038 GDOUBLE GetErrEst(GINT idir); // Get error estimate for direction idir 00039 GDOUBLE *GetEnergySpectrum(GINT &num); // Get 'Energy' spectrum/repres. of error 00040 GBOOL isDecaying(GINT idir); // Is spectrum decaying? 00041 GDOUBLE GetMaxDecayRate(); // Get max decay rates 00042 GVector *GetDecayRate(); // Get fit params: decay rates 00043 GVector *GetIntercept(); // Get fit params: intercepts 00044 GVector *GetQFit (); // Get fit quality measure 00045 GVector *GetLegendre(GINT icomp) ; // Get Leg. expansion coeffs 00046 GBOOL ComputeLegendreCoeffs(); 00047 GINT NumberNormComps(); // Get # norm comps 00048 00049 00050 private: 00051 // Methods: 00052 GBOOL ComputeTruncError(); 00053 GBOOL DoFit(); 00054 GBOOL ComputeExtrapError(); 00055 // GBOOL FindNonZero(); 00056 void SetParams(); 00057 void LinFit(GDOUBLE &slope, GDOUBLE &intcp, GDOUBLE &qfit, 00058 GDOUBLE x[], GDOUBLE y[], GINT n); 00059 00060 // Member data: 00061 GBOOL bAvg_; 00062 GINT num_fit_pts_[GDIM]; 00063 GINT nfit_min_; 00064 GINT NN_[GDIM]; 00065 GINT itot_; 00066 GINT nCoeffs_; 00067 GBOOL isDecaying_[GDIM]; 00068 GDOUBLE ctiny_; 00069 GDOUBLE error_est_[GDIM]; 00070 GDOUBLE error_trunc_[GDIM]; 00071 GDOUBLE error_extrp_[GDIM]; 00072 GDOUBLE *x_; 00073 GDOUBLE *y_; 00074 GERR_NORM inorm_type_; 00075 GEXT_FUNC ifit_func_; 00076 GEXT_FUNC iext_mthd_; 00077 Field2D *field_; 00078 GNBasis *basis_[GDIM]; 00079 GVector Coeffs_[GDIM][GDIM]; 00080 GVector sigma_[GDIM]; 00081 GVector intcp_[GDIM]; 00082 GVector qfit_[GDIM]; 00083 GVector *du_[GDIM]; 00084 GVector *int_[GDIM]; 00085 GMatrix Lp_[GDIM]; 00086 }; 00087 00088 #endif