当前位置: 首页>>代码示例>>C++>>正文


C++ GmatCommand::Execute方法代码示例

本文整理汇总了C++中GmatCommand::Execute方法的典型用法代码示例。如果您正苦于以下问题:C++ GmatCommand::Execute方法的具体用法?C++ GmatCommand::Execute怎么用?C++ GmatCommand::Execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GmatCommand的用法示例。


在下文中一共展示了GmatCommand::Execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

//------------------------------------------------------------------------------
PropSetup *GetFirstPropagator(GmatCommand *cmd)
{
   static PropSetup *retval = NULL;
   GmatCommand *current = cmd;

   #ifdef DEBUG_ODE_SEARCH
      extraMsg = "Commands checked:\n";
   #endif
   while (current != NULL)
   {
      #ifdef DEBUG_ODE_SEARCH
            extraMsg += "   '" + current->GetTypeName() + "'\n";
      #endif
      if (current->GetTypeName() == "Propagate")
      {
         try
         {
            // Set all of the internal connections
//               current->TakeAction("PrepareToPropagate");
            current->Execute();
         }
         catch (BaseException &ex)
         {
            lastMsg = ex.GetFullMessage();
         }
         #ifdef DEBUG_ODE_SEARCH
            extraMsg += "      Checking in this command\n";
         #endif
         GmatBase *obj = current->GetRefObject(Gmat::PROP_SETUP, "", 0);

         #ifdef DEBUG_ODE_SEARCH
            if (obj != NULL)
               extraMsg += "      Found an object of type PROPSETUP\n";
            else
               extraMsg += "      Propagate command returns NULL PROPSETUP\n";
         #endif

         if (obj->IsOfType("PropSetup"))
         {
            retval = (PropSetup*)(obj);
            break;
         }
      }

      current = current->GetNext();
   }

   return retval;
}
开发者ID:,项目名称:,代码行数:50,代码来源:

示例2: Execute

//------------------------------------------------------------------------------
bool Target::Execute()
{
#ifdef DEBUG_TARGET_EXEC
    MessageInterface::ShowMessage
    (wxT("Target::Execute() entered, theSolver=<%p>'%s'\n"), (GmatBase*)theSolver,
     theSolver->GetName().c_str());
    MessageInterface::ShowMessage
    (wxT("maxIter=%d\n"),
     theSolver->GetIntegerParameter(theSolver->GetParameterID(wxT("MaximumIterations"))));
    MessageInterface::ShowMessage
    (wxT("currentFunction=<%p>'%s'\n"),
     currentFunction, currentFunction ? ((GmatBase*)currentFunction)->GetName().c_str() : wxT("NULL"));
#endif

    // If targeting inside a function, we need to reinitialize since the local solver is
    // cloned in Initialize(). All objects including solvers are initialized in
    // assignment command which happens after Target::Initialize(). (LOJ: 2009.03.17)
    if (currentFunction != NULL && !targeterInFunctionInitialized)
    {
        Initialize();
        targeterInFunctionInitialized = true;
    }

    bool retval = true;

    // Drive through the state machine.
    Solver::SolverState state = theSolver->GetState();

#ifdef DEBUG_TARGET_COMMANDS
    MessageInterface::ShowMessage(wxT("TargetExecute(%c%c%c%d)\n"),
                                  (commandExecuting?wxT('Y'):wxT('N')),
                                  (commandComplete?wxT('Y'):wxT('N')),
                                  (branchExecuting?wxT('Y'):wxT('N')),
                                  state);
    MessageInterface::ShowMessage(wxT("   targeterConverged=%d\n"),
                                  targeterConverged);
#endif

    // Attempt to reset if recalled
    if (commandComplete)
    {
        commandComplete = false;
        commandExecuting = false;
        specialState = Solver::INITIALIZING;
    }

    if (!commandExecuting)
    {
#ifdef DEBUG_TARGET_COMMANDS
        MessageInterface::ShowMessage(
            wxT("Entered Targeter while command is not executing\n"));
#endif

        FreeLoopData();
        StoreLoopData();


        retval = SolverBranchCommand::Execute();

#ifdef DEBUG_TARGETER
        MessageInterface::ShowMessage(wxT("Resetting the Differential Corrector\n"));
#endif

        theSolver->TakeAction(wxT("Reset"));
        state = theSolver->GetState();
    }

    if (branchExecuting)
    {
        retval = ExecuteBranch();
        if (!branchExecuting)
        {
            if ((state == Solver::FINISHED) || (specialState == Solver::FINISHED))
            {
                PenDownSubscribers();
                LightenSubscribers(1);
                commandComplete = true;
            }
            else
            {
                PenUpSubscribers();
            }
        }
    }
    else
    {
        GmatCommand *currentCmd;

        publisher->SetRunState(Gmat::SOLVING);

        switch (startMode)
        {
        case RUN_INITIAL_GUESS:
#ifdef DEBUG_START_MODE
            MessageInterface::ShowMessage(
                wxT("Running as RUN_INITIAL_GUESS, specialState = %d, currentState = %d\n"),
                specialState, theSolver->GetState());
#endif
            switch (specialState)
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的GmatCommand::Execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。