Commit 54fbaa87 authored by Jeannie Backer's avatar Jeannie Backer
Browse files

Improved error messages for BasisFunction, PolynomialUnivariate, SpicePosition, and SpiceRotation.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@6070 41f8697f-d340-4b68-9986-7bafba869bb8
parent 4104d343
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -55,8 +55,9 @@ namespace Isis {
   */
  void BasisFunction::SetCoefficients(const std::vector<double> &coefs) {
    if((int)coefs.size() != p_numCoefs) {
      QString msg = "[coefs] does not match number of coefficients ";
      msg += "in the basis equation";
      QString msg = "Unable to set coefficients vector. The size of the given vector [" 
                    + toString((int)coefs.size()) + "] does not match number of coefficients "
                    "in the basis equation [" + toString(p_numCoefs) + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
    p_coefs = coefs;
@@ -73,15 +74,19 @@ namespace Isis {
   */
  double BasisFunction::Evaluate(const std::vector<double> &vars) {
    if((int)vars.size() != p_numVars) {
      QString msg = "[vars] does not match the number of variables ";
      msg += "in the basis equation";
      QString msg = "Unable to evaluate function for the given vector of values. "
                    "The size of the given vector [" 
                    + toString((int)vars.size()) + "] does not match number of variables "
                    "in the basis equation [" + toString(p_numVars) + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }

    Expand(vars);
    if((int)p_terms.size() != p_numCoefs) {
      QString msg = "Expansion of [terms] does not match number of ";
      msg += "coefficients in the basis equation";
      QString msg = "Unable to evaluate function for the given vector of values. "
                    "The number of terms in the expansion [" 
                    + toString((int)p_terms.size()) + "] does not match number of coefficients "
                    "in the basis equation [" + toString(p_numCoefs) + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }

+3 −2
Original line number Diff line number Diff line
@@ -55,8 +55,9 @@ namespace Isis {
   *
   * @internal
   *   @todo Add coded example
   *   @history 2005-03-16 Leah Dahmer modified file to support Doxygen
   *   documentation.
   *   @history 2005-03-16 Leah Dahmer - modified file to support Doxygen documentation.
   *   @history 2015-02-20 Jeannie Backer - Improved error messages.
   *   
   */
  class BasisFunction {
    public:
+4 −1
Original line number Diff line number Diff line
@@ -99,7 +99,10 @@ namespace Isis {
      derivative = 1;
    }
    else {
      IString msg = "Coeff index, " + Isis::IString(coefIndex) + " exceeds degree of polynomial";
      QString msg = "Unable to evaluate the derivative of the univariate polynomial for the given "
                    "coefficient index [" + toString(coefIndex) + "]. "
                    "Index is negative or exceeds degree of polynomial ["
                    + toString(Coefficients()) + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
    return derivative;
+3 −4
Original line number Diff line number Diff line
@@ -43,10 +43,9 @@ namespace Isis {
   *
   * @internal
   *
   *  @history 2008-01-11 Tracie Sucharski,  Renamed from Poly1D, add derivative
   *           methods.
   *  @history 2008-02-05 Jeannie Walldren,Renamed from
   *           Polynomial1Variable.
   *   @history 2008-01-11 Tracie Sucharski - Renamed from Poly1D, add derivative methods.
   *   @history 2008-02-05 Jeannie Walldren - Renamed from Polynomial1Variable.
   *   @history 2015-02-20 Jeannie Backer - Improved error messages.
   */

  class PolynomialUnivariate : public Isis::Basis1VariableFunction {
+4 −2
Original line number Diff line number Diff line
@@ -1171,8 +1171,10 @@ namespace Isis {
      derivative = 1;
    }
    else {
      Isis::IString msg = "Coeff index, " + Isis::IString(coeffIndex) +
        " exceeds degree of polynomial";
      QString msg = "Unable to evaluate the derivative of the SPICE position fit polynomial for "
                    "the given coefficient index [" + toString(coeffIndex) + "]. "
                    "Index is negative or exceeds degree of polynomial ["
                    + toString(p_degree) + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }

Loading