Control Model ************* The FleCSI control model allows users to define the high-level structure of an application using a control-flow graph (CFG) of `control points`, under each of which a directed acyclic graph (DAG) of `actions` can be defined. Actions in turn launch `tasks` to operate on distributed data. .. sidebar:: Control-model concepts **Control Points** are the logical steps in a control-flow graph. These are not actual execution units. However, they define named anchors where actions can be registered that will be executed when the control-flow graph reaches that control point. **Actions** are C++ functions that are executed under a control point. **Tasks** are C++ functions launched by an action and that access distributed data. For FleCSI developers, the control model replaces the normal hard-coded execution structure of an application, instead providing a well-defined, extensible mechanism which can easily be verified and visualized. Consider the following example of a traditional *implicit* control model: .. code-block:: cpp int main(int argc, char ** argv) { int step{0}, steps{0}; // initialization stage initialize(steps); while(step action_n; const auto dep_na = action_n.add(action_a); const auto dep_bn = action_b.add(action_n); That's it! This will insert a new action that depends on action *A* and which is depended upon by action *B* (:numref:`extension`). Because of FleCSI's data model, any data dependencies will automatically be honored by the runtime. For example, if action *N* modifies a pressure field that is used by action *B*, the underlying runtime will recognize this dependency and the data will be consistent. This code can also be in its own source file, which means that the original package does not need to be modified. Of course, the core application developers need to document the control point identifiers and actions so that our advanced user knows the correct names to use. However, this is a small cost to allow easy experimentation and extension of the application. .. _extension: .. figure:: images/extension.svg :align: center Control Model After Extension.