Commit 0bd33179 authored by Jeannie Backer's avatar Jeannie Backer
Browse files

PROG: Improved error message. This change merged from IPCE branch.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@6456 41f8697f-d340-4b68-9986-7bafba869bb8
parent 4330f0a2
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: