00001 #pragma ident "$Id: Equation.cpp 3140 2012-06-18 15:03:02Z susancummins $" 00002 00008 //============================================================================ 00009 // 00010 // This file is part of GPSTk, the GPS Toolkit. 00011 // 00012 // The GPSTk is free software; you can redistribute it and/or modify 00013 // it under the terms of the GNU Lesser General Public License as published 00014 // by the Free Software Foundation; either version 2.1 of the License, or 00015 // any later version. 00016 // 00017 // The GPSTk is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU Lesser General Public License for more details. 00021 // 00022 // You should have received a copy of the GNU Lesser General Public 00023 // License along with GPSTk; if not, write to the Free Software Foundation, 00024 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 00025 // 00026 // Dagoberto Salazar - gAGE ( http://www.gage.es ). 2007, 2008, 2009, 2011 00027 // 00028 //============================================================================ 00029 00030 00031 #include "Equation.hpp" 00032 00033 00034 namespace gpstk 00035 { 00036 00037 00038 // Assignment operator for equationHeader 00039 equationHeader& equationHeader::operator=(const equationHeader& right) 00040 { 00041 00042 if ( this == &right ) 00043 { 00044 return (*this); 00045 } 00046 00047 equationSource = right.equationSource; 00048 equationSat = right.equationSat; 00049 equationSourceSet = right.equationSourceSet; 00050 equationSatSet = right.equationSatSet; 00051 indTerm = right.indTerm; 00052 constWeight = right.constWeight; 00053 00054 return (*this); 00055 00056 } // End of 'equationHeader::operator=' 00057 00058 00059 00060 // Default constructor. 00061 Equation::Equation() 00062 { 00063 00064 header.equationSource = Variable::allSources; 00065 header.equationSat = Variable::allSats; 00066 header.constWeight = 1.0; 00067 00068 } // End of 'Equation::Equation()' 00069 00070 00071 00072 /* Common constructor. It defines an Equation from its independent 00073 * term. You must later use other methods to input the variables. 00074 * 00075 * @param indep Variable object describing the independent term. 00076 */ 00077 Equation::Equation( const Variable& indep ) 00078 { 00079 00080 header.equationSource = Variable::allSources; 00081 header.equationSat = Variable::allSats; 00082 header.indTerm = indep; 00083 header.constWeight = 1.0; 00084 00085 } // End of 'Equation::Equation()' 00086 00087 00088 00089 /* Common constructor. It defines an Equation from its independent 00090 * term. You must later use other methods to input the variables. 00091 * 00092 * @param var TypeID object describing the independent term. 00093 */ 00094 Equation::Equation( const TypeID& type ) 00095 { 00096 00097 header.equationSource = Variable::allSources; 00098 header.equationSat = Variable::allSats; 00099 header.indTerm.setType(type); 00100 header.constWeight = 1.0; 00101 00102 } // End of 'Equation::Equation()' 00103 00104 00105 00106 /* Common constructor. It takes a simple gnssEquationDefinition 00107 * object and creates an Equation. 00108 * 00109 * @param gnssEq gnssEquationDefinition object. 00110 * 00111 */ 00112 Equation::Equation( const gnssEquationDefinition& gnssEq ) 00113 { 00114 00115 header.equationSource = Variable::allSources; 00116 header.equationSat = Variable::allSats; 00117 header.constWeight = 1.0; 00118 00119 // Set the properties of the independent term. Defaults are OK except 00120 // for type 00121 header.indTerm.setType(gnssEq.header); 00122 00123 // Now, get the types of the variables 00124 for( TypeIDSet::const_iterator pos = gnssEq.body.begin(); 00125 pos != gnssEq.body.end(); 00126 ++pos ) 00127 { 00128 00129 // Create a default Variable object with this type 00130 Variable var(*pos); 00131 00132 // Insert this variable in this Equation's 'body' field 00133 body.insert(var); 00134 00135 } // End of 'for( TypeIDSet::const_iterator pos = gnssEq.body.begin();' 00136 00137 } // End of 'Equation::Equation()' 00138 00139 00140 00141 /* Add a variable (unknown) to this Equation 00142 * 00143 * @param type TypeID of variable. 00144 * @param pModel Pointer to StochasticModel associated with 00145 * this variable. By default, it is a white 00146 * noise model. 00147 * @param sourceIndexed Whether this variable is SourceID-indexed 00148 * or not. By default, it IS SourceID-indexed. 00149 * @param satIndexed Whether this variable is SatID-indexed 00150 * or not. By default, it is NOT. 00151 * @param variance Initial variance assigned to this variable. 00152 * @param coef Default coefficient assigned. 00153 */ 00154 Equation& Equation::addVariable( const TypeID& type, 00155 StochasticModel* pModel, 00156 bool sourceIndexed, 00157 bool satIndexed, 00158 double variance, 00159 double coef ) 00160 { 00161 00162 Variable var( type, 00163 pModel, 00164 sourceIndexed, 00165 satIndexed, 00166 variance, 00167 coef ); 00168 00169 return (addVariable(var)); 00170 00171 } // End of method 'Equation::addVariable()' 00172 00173 00174 00175 } // End of namespace gpstk
1.3.9.1