Exemple #1
0
//------------------------------------------------------------------------------
bool EstimationStateManager::MapObjectsToSTM()
{
   bool retval = true;

   // Fill in the STM based on the objects that comprise the state vector
   GmatBase* obj;
   Integer elementId; //, elementLength;
   for (UnsignedInt h = 0; h < stateMap.size(); ++h)
   {
      obj = stateMap[h]->object;
      if (stateMap[h]->subelement == 1)
      {
         elementId = stateMap[h]->parameterID;
//         elementLength = stateMap[h]->length;

         bool hasDstm = obj->HasDynamicParameterSTM(elementId);

         #ifdef DEBUG_STM_MAPPING
            MessageInterface::ShowMessage("Prepping for STM; element %s for "
                  "object %s has ID %d and length %d, and %s a dynamic STM "
                  "contribution\n", stateMap[h]->elementName.c_str(),
                  obj->GetName().c_str(), elementId, elementLength,
                  (hasDstm ? "has" : "does not have"));
         #endif

         if (hasDstm)
         {
            const Rmatrix* dstm = obj->GetParameterSTM(elementId);
            Integer stmSize = dstm->GetNumRows();
            // Fill in the master stm with the current data
            for (Integer i = 0; i < stmSize; ++i)
               for (Integer j = 0; j < stmSize; ++j)
                  stm(h+i, h+j) = (*dstm)(i,j);
         }

      }
   }

   #ifdef DEBUG_STM_MAPPING
      MessageInterface::ShowMessage("Loaded object STM's; esm STM now contains\n");
      for (Integer i = 0; i < stateSize; ++i)
      {
         for (Integer j = 0; j < stateSize; ++j)
            MessageInterface::ShowMessage("   %.12lf", stm(i,j));
         MessageInterface::ShowMessage("\n");
      }
      MessageInterface::ShowMessage("\n");
   #endif

   return retval;
}
Exemple #2
0
//------------------------------------------------------------------------------
bool EstimationStateManager::MapSTMToObjects()
{
   bool retval = true;

   #ifdef DEBUG_STM_MAPPING
      MessageInterface::ShowMessage("Setting object STM's to\n");
      for (Integer i = 0; i < stateSize; ++i)
      {
         for (Integer j = 0; j < stateSize; ++j)
            MessageInterface::ShowMessage("   %.12lf", stm(i,j));
         MessageInterface::ShowMessage("\n");
      }
      MessageInterface::ShowMessage("\n");
   #endif

   // Fill in the STM based on the objects that comprise the state vector
   GmatBase* obj;
   Integer elementId; //, elementLength;
   for (UnsignedInt h = 0; h < stateMap.size(); ++h)
   {
      obj = stateMap[h]->object;
      if (stateMap[h]->subelement == 1)
      {
         elementId = stateMap[h]->parameterID;
//         elementLength = stateMap[h]->length;

         bool hasDstm = obj->HasDynamicParameterSTM(elementId);

         if (hasDstm)
         {
            Rmatrix* dstm = obj->GetParameterSTM(elementId);
            Integer stmSize = dstm->GetNumRows();
            // Fill in the object stm's from the master stm
            for (Integer i = 0; i < stmSize; ++i)
               for (Integer j = 0; j < stmSize; ++j)
                  (*dstm)(i,j) = stm(h+i, h+j);
         }

      }
   }

   return retval;
}