ConstraintSystem.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: ConstraintSystem.hpp 2939 2011-10-23 19:55:11Z yanweignss $"
00002 
00008 #ifndef GPSTK_CONSTRAINTSYSTEM_HPP
00009 #define GPSTK_CONSTRAINTSYSTEM_HPP
00010 
00011 //============================================================================
00012 //
00013 //  This file is part of GPSTk, the GPS Toolkit.
00014 //
00015 //  The GPSTk is free software; you can redistribute it and/or modify
00016 //  it under the terms of the GNU Lesser General Public License as published
00017 //  by the Free Software Foundation; either version 2.1 of the License, or
00018 //  any later version.
00019 //
00020 //  The GPSTk is distributed in the hope that it will be useful,
00021 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 //  GNU Lesser General Public License for more details.
00024 //
00025 //  You should have received a copy of the GNU Lesser General Public
00026 //  License along with GPSTk; if not, write to the Free Software Foundation,
00027 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 //
00029 //  Wei Yan - Chinese Academy of Sciences . 2011
00030 //
00031 //============================================================================
00032 
00033 #include "Variable.hpp"
00034 #include "Vector.hpp"
00035 #include "Matrix.hpp"
00036 
00037 
00038 namespace gpstk
00039 {
00041    struct constraintHeader
00042    {
00043       double prefit;
00044       double variance;     // the smaller the tighter constraint
00045 
00046       constraintHeader():prefit(0.0),variance(1e-12){}
00047 
00048       constraintHeader(double meas,double var=1e-12)
00049          : prefit(meas),variance(var){}
00050    };
00051 
00053    struct Constraint : gnssData<constraintHeader,VariableDataMap>
00054    {
00056       Constraint() {};
00057 
00058 
00060       Constraint( const constraintHeader& h)
00061       { header = h; }
00062 
00063 
00065       Constraint( const constraintHeader& h,
00066                   const VariableDataMap& b )
00067       {
00068          header = h;
00069          body   = b;
00070       }
00071 
00073       virtual ~Constraint() {}
00074    };
00075       
00077    typedef std::list<Constraint> ConstraintList;
00078 
00081    NEW_EXCEPTION_CLASS(InvalidConstraintSystem, gpstk::Exception);
00082 
00083    class ConstraintSystem
00084    {
00085    public:
00087       ConstraintSystem(){}
00088 
00089 
00091       ~ConstraintSystem(){}
00092 
00093 
00095       virtual ConstraintSystem& addConstraint(const Constraint& constraint)
00096       { constraintList.push_back(constraint); return (*this); }
00097 
00098 
00100       virtual ConstraintSystem& removeConstraint(const Constraint& constraint);
00101 
00102          
00104       virtual ConstraintSystem& clearConstraint()
00105       { constraintList.clear(); return (*this); }
00106 
00107 
00109       virtual ConstraintSystem& setConstraint(const VariableSet& varSet, 
00110                                               const Vector<double>& prefit);
00111 
00113       virtual ConstraintSystem& setConstraint(const VariableSet& varSet,
00114                                               const Vector<double>& prefit,
00115                                               const Matrix<double>& design);
00116 
00118       virtual ConstraintSystem& constraintMatrix(const VariableSet& allVar,
00119                                                  Vector<double>& prefit,
00120                                                  Matrix<double>& design,
00121                                                  Matrix<double>& covariance)
00122          throw(InvalidConstraintSystem);
00123 
00124    
00126       ConstraintList getCurrentConstraints()
00127       { return constraintList; }
00128 
00129 
00131       int numberOfConstraints()
00132       { return constraintList.size(); }
00133 
00134 
00136       bool hasConstraints()
00137       { return (constraintList.size()>0)?true:false; }
00138 
00139 
00141       virtual ConstraintList getConstraintList() const
00142       { return constraintList; };
00143 
00144          
00146       virtual ConstraintSystem& setConstraintList(
00147                                          const ConstraintList& equationList )
00148       { constraintList = equationList; return (*this); };
00149 
00150 
00152       virtual ConstraintSystem& addConstraintList(
00153                                             const ConstraintList& equationList);
00154 
00155    protected:
00156 
00158       ConstraintList constraintList;
00159 
00160    }; // End of class 'ConstraintSystem'
00161 
00162 
00163 }  // End of namespace gpstk
00164 
00165 #endif   // GPSTK_CONSTRAINTSYSTEM_HPP

Generated on Tue May 22 03:30:57 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1