File: make_edges_function.rst

package info (click to toggle)
onetbb 2022.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,440 kB
  • sloc: cpp: 129,228; ansic: 9,745; python: 808; xml: 183; objc: 176; makefile: 66; sh: 66; awk: 41; javascript: 37
file content (59 lines) | stat: -rw-r--r-- 1,320 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.. _make_edges:

``make_edges`` function template
================================

.. note::
   To enable this feature, define the ``TBB_PREVIEW_FLOW_GRAPH_FEATURES`` macro to 1.

.. contents::
    :local:
    :depth: 1

Description
***********

The ``make_edges`` function template creates edges between a single node
and each node in a set of nodes.

There are two ways to connect nodes in a set and a single node using
``make_edges``:

.. figure:: ./Resources/make_edges_usage.png
   :align: center

API
***

Header
------

.. code:: cpp

    #include <oneapi/tbb/flow_graph.h>

Syntax
------

.. code:: cpp

    // node_set is an exposition-only name for the type returned from make_node_set function

    template <typename NodeType, typename Node, typename... Nodes>
    void make_edges(node_set<Node, Nodes...>& set, NodeType& node);

    template <typename NodeType, typename Node, typename... Nodes>
    void make_edges(NodeType& node, node_set<Node, Nodes...>& set);

Example
-------

The example implements the graph structure in the picture below.

.. figure:: ./Resources/make_edges_example.png
    :align: center

.. literalinclude:: ./examples/make_edges_function_example.cpp
    :language: c++
    :start-after: /*begin_make_edges_function_example*/
    :end-before: /*end_make_edges_function_example*/