<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.9.1" xml:lang="en-US">
  <compounddef id="classtf_1_1GuidedPartitioner" kind="class" language="C++" prot="public">
    <compoundname>tf::GuidedPartitioner</compoundname>
    <basecompoundref refid="classtf_1_1PartitionerBase" prot="public" virt="non-virtual">tf::PartitionerBase&lt; DefaultClosureWrapper &gt;</basecompoundref>
    <includes refid="partitioner_8hpp" local="no">taskflow/algorithm/partitioner.hpp</includes>
    <templateparamlist>
      <param>
        <type>typename C</type>
        <defval><ref refid="structtf_1_1DefaultClosureWrapper" kindref="compound">DefaultClosureWrapper</ref></defval>
      </param>
    </templateparamlist>
      <sectiondef kind="public-static-func">
      <memberdef kind="function" id="classtf_1_1GuidedPartitioner_1ae414688ae5ece94e8b2c108dee4266e2" prot="public" static="yes" constexpr="yes" const="no" explicit="no" inline="yes" virt="non-virtual">
        <type>constexpr <ref refid="namespacetf_1a32d51425fa23cd0dc3518c16cf3bb6c0" kindref="member">PartitionerType</ref></type>
        <definition>static constexpr PartitionerType tf::GuidedPartitioner&lt; C &gt;::type</definition>
        <argsstring>()</argsstring>
        <name>type</name>
        <briefdescription>
<para>queries the partition type (dynamic) </para>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="taskflow/algorithm/partitioner.hpp" line="266" column="36" bodyfile="taskflow/algorithm/partitioner.hpp" bodystart="266" bodyend="266"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="public-func">
      <memberdef kind="function" id="classtf_1_1GuidedPartitioner_1ad922cf64fc355513c756247d4e2b69d3" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type></type>
        <definition>tf::GuidedPartitioner&lt; C &gt;::GuidedPartitioner</definition>
        <argsstring>()=default</argsstring>
        <name>GuidedPartitioner</name>
        <briefdescription>
<para>default constructor </para>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="taskflow/algorithm/partitioner.hpp" line="271" column="3"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1GuidedPartitioner_1ab5540d5761ed6dbaf037cd431367b9f2" prot="public" static="no" const="no" explicit="yes" inline="yes" virt="non-virtual">
        <type></type>
        <definition>tf::GuidedPartitioner&lt; C &gt;::GuidedPartitioner</definition>
        <argsstring>(size_t sz)</argsstring>
        <name>GuidedPartitioner</name>
        <param>
          <type>size_t</type>
          <declname>sz</declname>
        </param>
        <briefdescription>
<para>construct a guided partitioner with the given chunk size </para>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="taskflow/algorithm/partitioner.hpp" line="277" column="12" bodyfile="taskflow/algorithm/partitioner.hpp" bodystart="277" bodyend="277"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1GuidedPartitioner_1a6a42cf5071fc665671345fefde2c5ec0" prot="public" static="no" const="no" explicit="yes" inline="yes" virt="non-virtual">
        <type></type>
        <definition>tf::GuidedPartitioner&lt; C &gt;::GuidedPartitioner</definition>
        <argsstring>(size_t sz, C &amp;&amp;closure)</argsstring>
        <name>GuidedPartitioner</name>
        <param>
          <type>size_t</type>
          <declname>sz</declname>
        </param>
        <param>
          <type>C &amp;&amp;</type>
          <declname>closure</declname>
        </param>
        <briefdescription>
<para>construct a guided partitioner with the given chunk size and the closure </para>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="taskflow/algorithm/partitioner.hpp" line="282" column="12" bodyfile="taskflow/algorithm/partitioner.hpp" bodystart="282" bodyend="284"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="private-func">
      <memberdef kind="function" id="classtf_1_1GuidedPartitioner_1ab1c854d9d6059ef5c8014afcdec8b026" prot="private" static="no" const="yes" explicit="no" inline="yes" virt="non-virtual">
        <templateparamlist>
          <param>
            <type>typename F</type>
          </param>
          <param>
            <type>std::enable_if_t&lt; std::is_invocable_r_v&lt; void, F, size_t, size_t &gt;, void &gt; *</type>
            <defval>nullptr</defval>
          </param>
        </templateparamlist>
        <type>void</type>
        <definition>void tf::GuidedPartitioner&lt; C &gt;::loop</definition>
        <argsstring>(size_t N, size_t W, std::atomic&lt; size_t &gt; &amp;next, F &amp;&amp;func) const</argsstring>
        <name>loop</name>
        <param>
          <type>size_t</type>
          <declname>N</declname>
        </param>
        <param>
          <type>size_t</type>
          <declname>W</declname>
        </param>
        <param>
          <type><ref refid="cpp/atomic/atomic" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::atomic</ref>&lt; size_t &gt; &amp;</type>
          <declname>next</declname>
        </param>
        <param>
          <type>F &amp;&amp;</type>
          <declname>func</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="taskflow/algorithm/partitioner.hpp" line="296" column="8" bodyfile="taskflow/algorithm/partitioner.hpp" bodystart="296" bodyend="336"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1GuidedPartitioner_1a40dced9465b64dbc65018a9de64b39fd" prot="private" static="no" const="yes" explicit="no" inline="yes" virt="non-virtual">
        <templateparamlist>
          <param>
            <type>typename F</type>
          </param>
          <param>
            <type>std::enable_if_t&lt; std::is_invocable_r_v&lt; bool, F, size_t, size_t &gt;, void &gt; *</type>
            <defval>nullptr</defval>
          </param>
        </templateparamlist>
        <type>void</type>
        <definition>void tf::GuidedPartitioner&lt; C &gt;::loop_until</definition>
        <argsstring>(size_t N, size_t W, std::atomic&lt; size_t &gt; &amp;next, F &amp;&amp;func) const</argsstring>
        <name>loop_until</name>
        <param>
          <type>size_t</type>
          <declname>N</declname>
        </param>
        <param>
          <type>size_t</type>
          <declname>W</declname>
        </param>
        <param>
          <type><ref refid="cpp/atomic/atomic" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::atomic</ref>&lt; size_t &gt; &amp;</type>
          <declname>next</declname>
        </param>
        <param>
          <type>F &amp;&amp;</type>
          <declname>func</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="taskflow/algorithm/partitioner.hpp" line="344" column="8" bodyfile="taskflow/algorithm/partitioner.hpp" bodystart="344" bodyend="388"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
<para>class to construct a guided partitioner for scheduling parallel algorithms </para>
    </briefdescription>
    <detaileddescription>
<para><parameterlist kind="templateparam"><parameteritem>
<parameternamelist>
<parametername>C</parametername>
</parameternamelist>
<parameterdescription>
<para>closure wrapper type (default <ref refid="structtf_1_1DefaultClosureWrapper" kindref="compound">tf::DefaultClosureWrapper</ref>)</para>
</parameterdescription>
</parameteritem>
</parameterlist>
The size of a partition is proportional to the number of unassigned iterations divided by the number of workers, and the size will gradually decrease to the given chunk size. The last partition may be smaller than the chunk size.</para>
<para>In addition to partition size, the application can specify a closure wrapper for a guided partitioner. A closure wrapper allows the application to wrapper a partitioned task (i.e., closure) with a custom function object that performs additional tasks. For example:</para>
<para><programlisting filename=".cpp"><codeline><highlight class="normal"><ref refid="cpp/atomic/atomic" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::atomic&lt;int&gt;</ref><sp/><ref refid="cpp/algorithm/count" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">count</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline><highlight class="normal"><ref refid="classtf_1_1Taskflow" kindref="compound">tf::Taskflow</ref><sp/>taskflow;</highlight></codeline>
<codeline><highlight class="normal">taskflow.<ref refid="classtf_1_1FlowBuilder_1a3b132bd902331a11b04b4ad66cf8bf77" kindref="member">for_each_index</ref>(0,<sp/>100,<sp/>1,<sp/></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>[](){<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="cpp/io/c/fprintf" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">printf</ref>(</highlight><highlight class="stringliteral">&quot;%d\n&quot;</highlight><highlight class="normal">,<sp/>i);<sp/></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>},</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><ref refid="classtf_1_1GuidedPartitioner" kindref="compound">tf::GuidedPartitioner</ref>(0,<sp/>[](</highlight><highlight class="keyword">auto</highlight><highlight class="normal">&amp;&amp;<sp/>closure){</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>do<sp/>something<sp/>before<sp/>invoking<sp/>the<sp/>partitioned<sp/>task</highlight><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>...</highlight><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>invoke<sp/>the<sp/>partitioned<sp/>task</highlight><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/>closure();</highlight></codeline>
<codeline><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>do<sp/>something<sp/>else<sp/>after<sp/>invoking<sp/>the<sp/>partitioned<sp/>task</highlight><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>...</highlight><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline><highlight class="normal">);</highlight></codeline>
<codeline><highlight class="normal">executor.run(taskflow).wait();</highlight></codeline>
</programlisting> </para>
    </detaileddescription>
    <inheritancegraph>
      <node id="3">
        <label>tf::IsPartitioner</label>
      </node>
      <node id="1">
        <label>tf::GuidedPartitioner&lt; C &gt;</label>
        <link refid="classtf_1_1GuidedPartitioner"/>
        <childnode refid="2" relation="public-inheritance">
        </childnode>
      </node>
      <node id="2">
        <label>tf::PartitionerBase&lt; DefaultClosureWrapper &gt;</label>
        <link refid="classtf_1_1PartitionerBase"/>
        <childnode refid="3" relation="public-inheritance">
        </childnode>
      </node>
    </inheritancegraph>
    <collaborationgraph>
      <node id="3">
        <label>tf::IsPartitioner</label>
      </node>
      <node id="1">
        <label>tf::GuidedPartitioner&lt; C &gt;</label>
        <link refid="classtf_1_1GuidedPartitioner"/>
        <childnode refid="2" relation="public-inheritance">
        </childnode>
      </node>
      <node id="2">
        <label>tf::PartitionerBase&lt; DefaultClosureWrapper &gt;</label>
        <link refid="classtf_1_1PartitionerBase"/>
        <childnode refid="3" relation="public-inheritance">
        </childnode>
      </node>
    </collaborationgraph>
    <location file="taskflow/algorithm/partitioner.hpp" line="259" column="1" bodyfile="taskflow/algorithm/partitioner.hpp" bodystart="259" bodyend="390"/>
    <listofallmembers>
      <member refid="classtf_1_1PartitionerBase_1a9ff56f7150ee4ff42b5006942f9c4b52" prot="protected" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>_chunk_size</name></member>
      <member refid="classtf_1_1PartitionerBase_1a9c5a8d350a913bea4c63d350e2bc9d1b" prot="protected" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>_closure_wrapper</name></member>
      <member refid="classtf_1_1PartitionerBase_1afa34299dea355738efa5684024d08215" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>chunk_size</name></member>
      <member refid="classtf_1_1PartitionerBase_1a481097aeb7ec62dcc23584eaa48cbce4" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>chunk_size</name></member>
      <member refid="classtf_1_1PartitionerBase_1a929714296243b2c63e4f2baa2025d380" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>closure_wrapper</name></member>
      <member refid="classtf_1_1PartitionerBase_1a55a519288850c6cca366d1020bb22efe" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>closure_wrapper</name></member>
      <member refid="classtf_1_1PartitionerBase_1a99e23ce7c0faf3a932ab2b7ac51e58f4" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>closure_wrapper</name></member>
      <member refid="classtf_1_1PartitionerBase_1a2b6152f24c2a3d6e750349d02ecb4595" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>closure_wrapper_type</name></member>
      <member refid="classtf_1_1GuidedPartitioner_1ad922cf64fc355513c756247d4e2b69d3" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>GuidedPartitioner</name></member>
      <member refid="classtf_1_1GuidedPartitioner_1ab5540d5761ed6dbaf037cd431367b9f2" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>GuidedPartitioner</name></member>
      <member refid="classtf_1_1GuidedPartitioner_1a6a42cf5071fc665671345fefde2c5ec0" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>GuidedPartitioner</name></member>
      <member refid="classtf_1_1PartitionerBase_1ae70ae77c8d774ffd661924f425bcd6bf" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>is_default_wrapper_v</name></member>
      <member refid="classtf_1_1GuidedPartitioner_1ab1c854d9d6059ef5c8014afcdec8b026" prot="private" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>loop</name></member>
      <member refid="classtf_1_1GuidedPartitioner_1a40dced9465b64dbc65018a9de64b39fd" prot="private" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>loop_until</name></member>
      <member refid="classtf_1_1PartitionerBase_1a3edb7ab5e21326d2ba78680aeb965a83" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>operator()</name></member>
      <member refid="classtf_1_1PartitionerBase_1ad0037e70726a054527a923821ec2d95a" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>PartitionerBase</name></member>
      <member refid="classtf_1_1PartitionerBase_1a099464a339e09d9f6e4a59bec425c53a" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>PartitionerBase</name></member>
      <member refid="classtf_1_1PartitionerBase_1a9cf9f5400992c6d9bd4131b5af2b9e8e" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>PartitionerBase</name></member>
      <member refid="classtf_1_1GuidedPartitioner_1ae414688ae5ece94e8b2c108dee4266e2" prot="public" virt="non-virtual"><scope>tf::GuidedPartitioner</scope><name>type</name></member>
    </listofallmembers>
  </compounddef>
</doxygen>
