什么是子循环
What means sub-cycled?
在类Time的方法run()中,在以下代码中使用变量bool subCycling_:
bool Foam::Time::run() const
810 {
811 bool running = value() < (endTime_ - 0.5*deltaT_);
812
813 if (!subCycling_) //bool subCycling_; //- Is the time currently being sub-cycled?
814 {
815 // only execute when the condition is no longer true
816 // ie, when exiting the control loop
817 if (!running && timeIndex_ != startTimeIndex_)
818 {
819 // Note, end() also calls an indirect start() as required
820 functionObjects_.end();
821 }
822 }
823
824 if (running)
825 {
826 if (!subCycling_)
827 {
828 const_cast<Time&>(*this).readModifiedObjects();
829
830 if (timeIndex_ == startTimeIndex_)
831 {
832 functionObjects_.start();
833 }
834 else
835 {
836 functionObjects_.execute();
837 }
838 }
839
840 // Update the "running" status following the
841 // possible side-effects from functionObjects
842 running = value() < (endTime_ - 0.5*deltaT_);
843 }
844
845 return running;
846 }
847
848
849 bool Foam::Time::loop()
850 {
851 bool running = run();
852
853 if (running)
854 {
855 operator++();
856 }
857
858 return running;
859 }
当我把sub-cycled翻译成德语时,我仍然不明白它的意思。那么,什么是子循环[第813行]?举个例子就很好了。
问候streight
您必须询问编写代码的人员。在没有任何上下文的情况下,不可能从这个微小的代码片段中随机分辨出来。在后面的行中可能有一个提示(因为这些行受这个布尔值的影响),但您没有向我们展示这些。
然而,作为线索,一些定时器实现使用"子周期"来描述在主事件循环的每个周期内运行定时器机制的重复迭代。这可以解决由个别等待条件引起的争用:
- http://tams-www.informatik.uni-hamburg.de/applets/hades/webdemos/72-pic/60-swatch/swatch.html
- http://nute.googlecode.com/svn/trunk/Lockets/Tears/tears_fmw/main.cpp
- http://www.google.com/patents/US2530622
它更常见于运行机械设备的代码中。
相关文章:
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 是什么阻止DOMTimerCoordinator::NextID进入无休止的循环
- 我可以使用什么来停止循环而不是"返回 0"?
- 当我们为(;;) 写作时,它做了什么?for 循环中的双分号有什么作用?
- 这个返回元素位置的基于循环的函数有什么问题?
- 我正在尝试使用 while 循环从字符串中删除字母,直到没有字母。我在这里做错了什么?
- 在C++中,建议通过数组循环的方式是什么?
- string1 == string2 和你自己的 for 循环比较有什么区别?
- 编写按初始值循环的循环的更好方法是什么
- 是什么导致我的循环在第一次迭代中运行得更慢
- 什么可以用来替换代码中的循环和 if 语句?
- 从列表/向量制作嵌套 for 循环的最佳方法是什么?
- <<、>>算子在循环中的作用是什么
- 这个 FOR-IF 循环的解释是什么?
- 这个循环是什么意思:for(j,0,np)
- 这个循环测试条件是什么意思?
- 有什么方法可以在 c++ 中组织"cycling"(循环)数字?
- 在基于范围的循环中使用通用参考有什么好处?
- 什么概念允许容器在基于范围的 for 循环中使用?
- while 循环条件 c++ 中的","有什么用?