Commit 89ab8a31 authored by Ken Edmundson's avatar Ken Edmundson
Browse files

Added private method setFrameType to set the frame type. It also loads the...

Added private method setFrameType to set the frame type.  It also loads the planetary constants for a PCK type

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@6566 41f8697f-d340-4b68-9986-7bafba869bb8
parent 206d5972
Loading
Loading
Loading
Loading
+60 −18
Original line number Diff line number Diff line
@@ -330,9 +330,10 @@ namespace Isis {
    // Make sure the constant frame is loaded.  This method also does the frame trace.
    if (p_timeFrames.size() == 0) InitConstantRotation(startTime);

    // Load the PCK information while it is available and set member values
    if (p_source == Spice) 
      loadPCFromSpice();
    // Set the frame type.  If the frame class is PCK, load the constants.
    if (p_source == Spice) {
      setFrameType();
    }

    LoadTimeCache();
    int cacheSize = p_cacheTime.size();
@@ -772,27 +773,17 @@ namespace Isis {
   * Retrieve planetary orientation constants from a Spice PCK and store them in the class.
   *
   */
  void SpiceRotation::loadPCFromSpice() {
  void SpiceRotation::loadPCFromSpice(int centerBody) {
    NaifStatus::CheckErrors();
    SpiceInt centerBodyCode = (SpiceInt) centerBody;

    SpiceInt frameCode = p_constantFrames[0];
    SpiceBoolean found;
    SpiceInt centerBodyCode;
    SpiceInt frameClass;
    SpiceInt classId;

    // Retrieve the frame type from Naif.  We distinguish PCK types into text PCK,
    // Retrieve the frame class from Naif.  We distinguish PCK types into text PCK,
    // binary PCK, and PCK not referenced to J2000.  Isis binary PCK can
    // not be used to solve for target body orientation because of the variety and 
    // complexity models used with binary PCK.  Currently ISIS does not solve for
    // target body orientation on bodies not referenced to J2000, but it could be
    // changed to handle that case.
    frinfo_c(frameCode, &centerBodyCode, &frameClass, &classId, &found);

    if (found  &&  (frameClass == 2 || centerBodyCode > 0)) {      // Frame type is PCK
      m_frameType = PCK;
    checkForBinaryPck();
    }
    
    if (m_frameType == PCK) {
      // Make sure the reference frame is J2000.  We will need to modify FrameTrace and
@@ -805,6 +796,7 @@ namespace Isis {
      SpiceInt numReturned;
      SpiceChar naifType;
      SpiceDouble relativeFrameCode = 0;
      SpiceBoolean found;
      dtpool_c(naifKeyword.toAscii().data(), &found, &numExpected, &naifType);

      if (found) {
@@ -2254,7 +2246,7 @@ namespace Isis {
//      double DIRSIZ = 100;

      SpiceChar file[FILESIZ];
      SpiceChar filtyp[TYPESIZ];
      SpiceChar filtyp[TYPESIZ];  // kernel type (ck, ek, etc.)
      SpiceChar source[SOURCESIZ];

      SpiceBoolean found;
@@ -2816,7 +2808,6 @@ namespace Isis {
   }



   /** Check loaded pck to see if any are binary and set frame type to indicate binary pck.
    *
    * This is strictly a local method to be called only when the source is Spice.  Its purpose is
@@ -2854,6 +2845,57 @@ namespace Isis {
  }
  

   /** Set the frame type (m_frameType).
    *
    * This is strictly a local method to be called only when the source is Spice.  Its purpose is
    * to determine the frame type.  If the frame type is PCK, this method also loads the
    * planetary constants.  See SpiceRotation.h to see the valid frame types.
    *
    */
  void SpiceRotation::setFrameType() {
    SpiceInt frameCode = p_constantFrames[0];
    SpiceBoolean found;
    SpiceInt centerBodyCode;
    SpiceInt frameClass;
    SpiceInt classId;
    frinfo_c(frameCode, &centerBodyCode, &frameClass, &classId, &found);

    if (found) {
      if (frameClass == 2  ||  centerBodyCode > 0) {
        m_frameType = PCK;
        // Load the PC information while it is available and set member values
        loadPCFromSpice(centerBodyCode);
      }
      else if (p_constantFrames.size() > 1) {
        for (std::vector<int>::size_type idx = 1; idx < p_constantFrames.size(); idx++) {
          frameCode = p_constantFrames[idx];
          frinfo_c(frameCode, &centerBodyCode, &frameClass, &classId, &found);
          if (frameClass == 3) m_frameType = CK;
        }
      }
      else {
        switch (frameClass) {
        case 1:
          m_frameType = INERTL;
          break;
          // case 2:  handled in first if block
        case 3:
          m_frameType = CK;
          break;
        case 4:
          m_frameType = TK;
          break;
        case 5:
          m_frameType = DYN;
          break;
        default:
          m_frameType = UNKNOWN;
        }
      }
    }      
  }


void SpiceRotation::setEphemerisTimeMemcache() {
    // If the cache has only one rotation, set it
    NaifStatus::CheckErrors();
+16 −14
Original line number Diff line number Diff line
@@ -185,9 +185,10 @@ namespace Isis {
   *   @history 2014-03-11 Stuart Sides - Programmers notes - Fixed a bug in the copy constructor
   *                           that was going out of array bounds.
   *   @history 2015-02-20 Jeannie Backer - Improved error messages.
   *   @history 2015-07-21 Kristin Berry - Added additional NaifStatus::CheckErrors() calls to see
   *                           if any NAIF errors were signaled. References #2248.
   *   @history 2015-08-05 Debbie A. Cook - Programmer notes - Modified LoadCache, and ComputeAv.
   *   @history 2015-07-21 Kristin Berry - Added additional NaifStatus::CheckErrors() calls to see if
   *                           any NAIF errors were signaled. References #2248.
   *   @history 2015-08-05 Debbie A. Cook - Programmer notes - Modified LoadCache, 
   *                           and ComputeAv.
   *                           Added new methods 
   *                           loadPCFromSpice, loadPCFromTable, toJ2000Partial, poleRaCoefs,
   *                           poleDecCoefs, pmCoefs, poleRaNutPrecCoefs, poleDecNutPrecCoefs, 
@@ -196,9 +197,14 @@ namespace Isis {
   *                           getPckPolynomial, setEphemerisTimePckPolyFunction, getFrameType
   *                           and members m_frameType, m_tOrientationAvailable, 
   *                           m_raPole, m_decPole, m_pm, m_raNutPrec, m_decNutPrec, m_pmNutPrec,
   *                           m_sysNutPrec0, m_sysNutPrec1, m_dscale, m_Tscale  to support request
   *                           for solving for target body parameters. Also added a new enumerated
   *                           value for Source, PckPolyFunction, and PartialType, WRT_RotationRate.
   *                           m_sysNutPrec0, m_sysNutPrec1, m_dscale, m_Tscale  to support request for 
   *                           solving for target body parameters.
   *                           Also added a new enumerated value for Source, PckPolyFunction, 
   *                            and 
   *                           PartialType, WRT_RotationRate.
   *   @history 2016-02-15 Debbie A. Cook - Programmer notes - Added private method
   *                           setFrameType to set the frame type.  It also loads the planetary 
   *                           constants for a PCK type. 
   *
   *  @todo Downsize using Hermite cubic spline and allow Nadir tables to be downsized again.
   *  @todo Consider making this a base class with child classes based on frame type or 
@@ -248,7 +254,6 @@ namespace Isis {
                                                        //   linear trignometric terms
                  };            


      /** 
       * This enumeration indicates whether the partial derivative is taken with 
       * respect to Right Ascension, Declination, or Twist (or Rotation). 
@@ -258,7 +263,6 @@ namespace Isis {
                         WRT_Twist          //!< With respect to Twist or Prime Meridian Rotation
                       };


      /** 
       *  
       */ 
@@ -267,7 +271,6 @@ namespace Isis {
                            No    //!< 
                          };


      /** 
       *  
       */ 
@@ -321,7 +324,7 @@ namespace Isis {

      std::vector<double> EvaluatePolyFunction();

      void loadPCFromSpice();
      void loadPCFromSpice(int CenterBodyCode);
      void loadPCFromTable(const PvlObject &Label);

      void MinimizeCache(DownsizeStatus status);
@@ -423,6 +426,8 @@ namespace Isis {
      int p_axis3;                      //!< Axis of rotation for angle 3 of rotation

    private:
      // method
      void setFrameType();
      std::vector<int> p_constantFrames;  /**< Chain of Naif frame codes in constant 
                                               rotation TC. The first entry will always 
                                               be the target frame code*/
@@ -439,10 +444,7 @@ namespace Isis {
      bool m_tOrientationAvailable;  //!< Target orientation constants are available
 

      FrameType m_frameType;              
      //! 
      //! 
      //!< The type of rotation frame
      FrameType m_frameType;  //!< The type of rotation frame
      Source p_source;                    //!< The source of the rotation data
      int p_axisP;                        /**< The axis defined by the spacecraft
                                               vector for defining a nadir rotation*/