86 lines
2.8 KiB
TeX
86 lines
2.8 KiB
TeX
\begin{tikzpicture}
|
|
\input{src/tikz/orchestration}
|
|
|
|
% \def\N{15}
|
|
% \def\T{6}
|
|
|
|
\pgfmathtruncatemacro{\nlasttask}{\N-1}
|
|
\pgfmathtruncatemacro{\nlastthread}{\T-1}
|
|
\pgfmathtruncatemacro{\R}{mod(\N, \T)}
|
|
|
|
\begin{scope}[overlay]
|
|
\node(origin){};
|
|
\node at (origin) (t-\T) {};
|
|
\end{scope}
|
|
|
|
\begin{scope}[node distance=4mm and 4mm]
|
|
\pgfmathtruncatemacro{\nlasttaskA}{\nlasttask-\R}
|
|
|
|
\foreach \task in {0,...,\nlasttaskA} {
|
|
\pgfmathtruncatemacro{\r}{mod(\task, \T)}
|
|
\ifthenelse{\r = 0}{
|
|
\pgfmathtruncatemacro{\uppertask}{\T*(\task/\T-1)}
|
|
\def\reltype{below}
|
|
\def\relnode{t\uppertask}
|
|
}{
|
|
\pgfmathtruncatemacro{\prevtask}{\task-1}
|
|
\def\reltype{right}
|
|
\def\relnode{t\prevtask}
|
|
}
|
|
\node[orch/task=black,\reltype=of \relnode] (t\task) {};
|
|
|
|
\draw[-] (t\task.north)
|
|
-- node[pos=.3,orch/subtask=black] {}
|
|
node[pos=.7,orch/subtask=black] {}
|
|
(t\task.south);
|
|
}
|
|
|
|
\foreach \taskfill in {1,...,\R} {
|
|
\pgfmathtruncatemacro{\task}{\taskfill-1}
|
|
\pgfmathtruncatemacro{\prevtaskl}{\nlasttaskA+\task-\T+\taskfill)}
|
|
\pgfmathtruncatemacro{\prevtaskr}{\prevtaskl+1}
|
|
\path (t\prevtaskl.south) -- coordinate[midway](prevtask\taskfill) (t\prevtaskr.south);
|
|
\node[orch/taskspan=black,below=of prevtask\taskfill] (ts\task) {};
|
|
|
|
\pgfmathtruncatemacro{\taska}{\nlasttaskA+\task*2+1}
|
|
\pgfmathtruncatemacro{\taskb}{\nlasttaskA+\task*2+2}
|
|
|
|
\path (t\prevtaskl.south) |- node[orch/subtask=black] (t\taska) {} (ts\task.west);
|
|
\path (t\prevtaskr.south) |- node[orch/subtask=black] (t\taskb) {} (ts\task.west);
|
|
}
|
|
|
|
\foreach \thread in {0,...,\nlastthread} {
|
|
\node[above=of t\thread] (label\thread) {\en{thread}~\thread};
|
|
\draw[-] (label\thread) -- (t\thread);
|
|
|
|
\pgfmathtruncatemacro{\n}{floor((\N-1)/\T)-1}
|
|
\ifthenelse{\n = -1}{}{% only if N>T
|
|
\foreach \task in {0,...,\n} {
|
|
\pgfmathtruncatemacro{\curtask}{\thread+\task*\T}
|
|
\pgfmathtruncatemacro{\nexttask}{\curtask+\T}
|
|
\draw[-] (t\curtask) -- (t\nexttask);
|
|
}
|
|
}
|
|
|
|
\pgfmathtruncatemacro{\lasttask}{\thread+(\n+1)*\T}
|
|
\draw[-] (t\lasttask) -- (\curcoord |- ts0.south) -- +(0,-4mm);
|
|
}
|
|
\end{scope}
|
|
|
|
\begin{scope}[common/overlay]
|
|
\pgfmathtruncatemacro{\n}{ceil((2*\N-1)/\T)}
|
|
\pgfmathtruncatemacro{\nr}{(\N-1)/\T}
|
|
\pgfmathtruncatemacro{\ftlt}{\nr*\T}
|
|
\node[orch/task=black,draw=none,fill=none](lt) at (t\ftlt) {};
|
|
|
|
\draw[decorate,decoration={brace, amplitude=4pt, raise=9mm, mirror}]
|
|
(t0.north) -- (t0.south) node[left,midway,xshift=-11mm] {$2\,T$};
|
|
|
|
\draw[decorate,decoration={brace, amplitude=4pt, raise=9mm, mirror}]
|
|
(lt.north) -- (lt.south) node[left,midway,xshift=-11mm] {$T$};
|
|
|
|
\draw[decorate,decoration={brace, amplitude=4pt, raise=18mm, mirror}]
|
|
(t0.north) -- (lt.south) node[left,midway,xshift=-20mm] {$\n{}\,T$};
|
|
\end{scope}
|
|
\end{tikzpicture}
|