Beispiel #1
0
//------------------------------------------------------------------------------
bool GravityField::SetStringParameter(const Integer id,
                                      const std::string &value)
{
   if (id == EARTH_TIDE_MODEL)
   {
      if (bodyName == GmatSolarSystemDefaults::EARTH_NAME)
      {
         if ((GmatStringUtil::ToUpper(value) != "NONE") &&      // Currently, these are the only valid strings ...
             (GmatStringUtil::ToUpper(value) != "SOLIDANDPOLE"))
         {
            ODEModelException ome;
            ome.SetDetails(errorMessageFormat.c_str(),
                           value.c_str(), "EarthTideModel", "\'None\' or \'SolidAndPole\'");
            throw ome;
         }
         earthTideModel = value;
      }
      else
      {
         MessageInterface::ShowMessage
            ("*** WARNING *** \"EarthTideModel\" is deprecated for non-Earth primary bodies and will be "
             "removed from a future build.\n");
      }
      return true;
   }
   return HarmonicField::SetStringParameter(id, value);
}
Beispiel #2
0
//------------------------------------------------------------------------------
bool GravityField::SetStringParameter(const Integer id,
                                      const wxString &value)
{
   if (id == EARTH_TIDE_MODEL)
   {
      if ((GmatStringUtil::ToUpper(value) != wxT("NONE")) &&      // Currently, these are the only valid strings ...
          (GmatStringUtil::ToUpper(value) != wxT("SOLIDANDPOLE")))
      {
         ODEModelException ome;
         ome.SetDetails(errorMessageFormat.c_str(),
                        value.c_str(), wxT("EarthTideModel"), wxT("\'None\' or \'SolidAndPole\'"));
         throw ome;
      }
      earthTideModel = value;
      return true;
   }
   return HarmonicField::SetStringParameter(id, value);
}
Beispiel #3
0
//------------------------------------------------------------------------------
bool HarmonicField::SetStringParameter(const Integer id,
                                       const std::string &value)
{
   if (id == FILENAME)
   {
      if (GmatStringUtil::IsBlank(value))
      {
         ODEModelException ome;
         ome.SetDetails(errorMessageFormatUnnamed.c_str(),
                       value.c_str(), "PotentialFile", "non-blank file name");
         throw ome;
      }

      std::string newValue = value;
      // if value has no file extension, add .cof as default (loj: 2008.10.14)
      if (value.find(".") == value.npos)
         newValue = value + ".cof";
      
      return SetFilename(newValue);  
   }
   if (id == INPUT_COORD_SYSTEM)
   {
      #ifdef DEBUG_HARMONIC_FIELD
         char str[1024];
         strcpy(str, value.c_str());
         
         MessageInterface::ShowMessage(
                "Setting input coordinate system name to \"%s\"\n", str);
      #endif
      inputCSName = value;
      
      return true;
   }
   if (id == FIXED_COORD_SYSTEM)
   {
      #ifdef DEBUG_HARMONIC_FIELD
         char str[1024];
         strcpy(str, value.c_str());
         
         MessageInterface::ShowMessage(
                "Setting fixed coordinate system name to \"%s\"\n", str);
      #endif
      fixedCSName = value;
      
      return true;
   }
   if (id == TARGET_COORD_SYSTEM)
   {
      #ifdef DEBUG_HARMONIC_FIELD
         char str[1024];
         strcpy(str, value.c_str());
         
         MessageInterface::ShowMessage(
                "Setting target coordinate system name to \"%s\"\n", str);
      #endif
      targetCSName = value;
      
      return true;
   }
   if (id == BODY_NAME)
   {      
      if (GravityBase::SetStringParameter(id, value))
      {
         // set default potential file path for the body
         FileManager *fm = FileManager::Instance();
         try
         {
            potPath = fm->GetAbsPathname(bodyName + "_POT_PATH");
         }
         catch (BaseException &ex)
         {
//            MessageInterface::ShowMessage("**** WARNING ****: %s\n",
//                  ex.GetFullMessage().c_str());
            ; // ignore this for now - GMT-2873
         }
         
         #ifdef DEBUG_HARMONIC_FIELD
         MessageInterface::ShowMessage
            ("Setting potential file path to \"%s\"\n", potPath.c_str());
         #endif
         
         fixedCSName = value + "Fixed";
         return true;
      }
      return false;
   }
   
   return GravityBase::SetStringParameter(id, value);
}