GeneralConstraint.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: GeneralConstraint.hpp 2607 2011-05-19 05:31:37Z yanweignss $"
00002 
00008 #ifndef GPSTK_GENERALCONSTRAINT_HPP
00009 #define GPSTK_GENERALCONSTRAINT_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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
00028 //
00029 //  Wei Yan - Chinese Academy of Sciences . 2011
00030 //
00031 //============================================================================
00032 
00033 #include <vector>
00034 #include "Vector.hpp"
00035 #include "Matrix.hpp"
00036 #include "ConstraintSystem.hpp"
00037 #include "SolverGeneral.hpp"
00038 #include "GeneralEquations.hpp"
00039 
00040 namespace gpstk
00041 {
00044    NEW_EXCEPTION_CLASS(InvalidConstraint, gpstk::Exception);
00045 
00046 
00050    class GeneralConstraint
00051    {
00052    public:
00053 
00055       GeneralConstraint( SolverGeneral& solverGeneral )
00056          :solver(solverGeneral) {}
00057          
00058 
00060       virtual void process( gnssRinex& gRin,
00061                             GeneralEquations* gEquPtr = 0 );
00062 
00063 
00065       virtual void process( gnssDataMap& gdsMap,
00066                             GeneralEquations* gEquPtr = 0 );
00067 
00068 
00070       virtual ~GeneralConstraint(){}
00071 
00072    protected:
00073 
00075       virtual void constraint( gnssRinex& gRin )
00076          throw(InvalidConstraint);
00077 
00078 
00080       virtual void constraint( gnssDataMap& gdsMap )
00081          throw(InvalidConstraint);
00082       
00083 
00085       virtual void realConstraint(gnssDataMap& gdsMap){}
00086 
00087 
00090       virtual void updateRefSat( const CommonTime& time, 
00091                                  const SatSourceMap& refsatSource,
00092                                  const SourceSatMap& sourceRefsat )
00093       { /* Do nothing by default */ }
00094 
00095 
00097       int constraintToSolver( ConstraintSystem& system, gnssDataMap& gdsMap );
00098       
00099 
00100       Matrix<double> convertMatrix(size_t n, size_t oi, size_t ni);
00101 
00102 
00103       Matrix<double> convertMatrix(size_t n, size_t oi, size_t ni,
00104                                    std::vector<int> iv);
00105 
00106 
00107          // Methods to parsing data from SolverGeneral
00108 
00109       Variable getVariable( const SourceID& source, 
00110                             const SatID& sat, 
00111                             const TypeID& type );
00112 
00113 
00114       VariableSet getVariables()
00115       { return solver.getEquationSystem().getCurrentUnknowns(); }
00116 
00117 
00118       VariableSet getVariables(const SourceID& source);
00119 
00120 
00121       VariableSet getVariables(const SourceID& source,const TypeID& type);
00122 
00123 
00124       VariableSet getVariables( const SourceID& source,
00125                                 const TypeIDSet& typeSet );
00126 
00127 
00128       VariableSet getVariables(const SourceIDSet& sourceSet);
00129 
00130 
00131       VariableSet getVariables( const SourceIDSet& sourceSet,
00132                                 const TypeID& type );
00133 
00134 
00135       VariableSet getVariables( const SourceIDSet& sourceSet,
00136                                 const TypeIDSet& typeSet );
00137 
00138 
00139       VariableSet getVariables(const SatID& sat);
00140 
00141 
00142       VariableSet getVariables(const SatID& sat,const TypeID& type);
00143 
00144 
00145       VariableSet getVariables(const SatID& sat,const TypeIDSet& typeSet);
00146 
00147 
00148       VariableSet getVariables( const SourceID& source, 
00149                                 const SatID& sat, 
00150                                 const TypeID& type );
00151    
00152       VariableSet getVariables( const SourceID& source, 
00153                                 const SatIDSet& satSet, 
00154                                  const TypeID& type );
00155 
00157       SourceIDSet getCurrentSources()
00158       { return solver.getEquationSystem().getCurrentSources();}
00159 
00160 
00162       VariableSet getCurrentUnknowns()
00163       { return solver.getEquationSystem().getCurrentUnknowns();}
00164 
00165 
00167       SatIDSet getCurrentSats()
00168       { return solver.getEquationSystem().getCurrentSats();}
00169 
00170 
00172       Vector<double> getSolution(const VariableSet& varSet);
00173 
00174 
00176       Matrix<double> getCovariance(const VariableSet& varSet);
00177 
00179       GeneralConstraint& setSolution( const Variable& variable,
00180                                       const double& val )
00181       { solver.setSolution(variable,val); return (*this); }
00182 
00183 
00185       GeneralConstraint& setCovariance( const Variable& var1, 
00186                                         const Variable& var2,
00187                                         const double& cov )
00188       { solver.setCovariance(var1,var2,cov); return (*this); }
00189 
00190 
00192       GeneralConstraint& changeState( const VariableList& varList,
00193                                       const Matrix<double>& convertMat );
00194 
00195 
00197       int findIndexOfSat(const SatIDSet& satSet,const SatID& sat);
00198 
00199       
00201       void stackVariables(VariableList& varList,const VariableSet& varSet);
00202 
00203 
00205       VariableSet unionVariables(const VariableSet& vs1,
00206                                  const VariableSet& vs2);
00207 
00208 
00210       VariableSet differenceVariables( const VariableSet& vs1,
00211                                        const VariableSet& vs2 );
00212 
00214       VariableSet intersectionVariables( const VariableSet& vs1,
00215                                          const VariableSet& vs2 );
00216          
00218       bool isRefSat(const SatID& sat);
00219 
00220 
00221    protected:
00222 
00223 
00225       SolverGeneral& solver;
00226 
00228       SatSourceMap refsatSourceMap;
00229 
00231       SourceSatMap sourceRefsatMap;
00232 
00233 
00234    }; // End of class 'GeneralConstraint'
00235 
00236 }  // End of namespace gpstk
00237 
00238 #endif   // GPSTK_GENERALCONSTRAINT_HPP

Generated on Sat May 25 03:31:09 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1