130 lines
5.0 KiB
TeX
130 lines
5.0 KiB
TeX
% http://www.texample.net/tikz/examples/flexible-flow-chart/
|
|
\documentclass{standalone}
|
|
\usepackage{tikz}
|
|
\usetikzlibrary{shapes,arrows,chains}
|
|
\begin{document}
|
|
% -------------------------------------------------
|
|
% Color definition
|
|
\definecolor{myblue}{HTML}{2B86C0}
|
|
\definecolor{myred}{HTML}{C14400}
|
|
\definecolor{myyellow}{HTML}{FFD700}
|
|
\definecolor{mygreen}{HTML}{3F681C}
|
|
|
|
%https://www.schemecolor.com/cute-lights.php
|
|
\definecolor{startstopcolor}{HTML}{FF555E}
|
|
\definecolor{testcolor}{HTML}{FFE981}
|
|
\definecolor{proccolor}{HTML}{83B2FF}
|
|
% -------------------------------------------------
|
|
% Debugging Layer
|
|
% top
|
|
\pgfdeclarelayer{marx}
|
|
\pgfsetlayers{main,marx}
|
|
% A macro for marking coordinates (specific to the coordinate naming
|
|
% scheme used here). Swap the following 2 definitions to deactivate
|
|
% marks.
|
|
\providecommand{\cmark}[2][]{\relax}
|
|
\providecommand{\cmark}[2][]{%
|
|
\begin{pgfonlayer}{marx}
|
|
\node [nmark] at (c#2#1) {#2};
|
|
\end{pgfonlayer}{marx}
|
|
}
|
|
|
|
% -------------------------------------------------
|
|
% Start the picture
|
|
\begin{tikzpicture}[%
|
|
>=triangle 60, % Nice arrows; your taste may be different
|
|
start chain=going below, % General flow is top-to-bottom
|
|
node distance=6mm and 60mm, % Global setup of box spacing
|
|
every join/.style={arrow}, % Default linetype for connecting boxes
|
|
]
|
|
% -------------------------------------------------
|
|
% Box styles
|
|
\tikzset{
|
|
base/.style={draw, on chain, on grid, align=center, minimum height=4ex, font=\sffamily, draw=none},
|
|
proc/.style={base, rectangle, text width=10em, fill=proccolor},
|
|
test/.style={base, diamond, aspect=3, text width=5em, fill=testcolor},
|
|
startstop/.style={proc, minimum height=6ex, fill=startstopcolor},
|
|
%base/.style={draw, on chain, on grid, align=center, minimum height=4ex, font=\sffamily},
|
|
%proc/.style={base, rectangle, text width=10em},
|
|
%test/.style={base, diamond, aspect=3, text width=5em},
|
|
%startstop/.style={proc, minimum height=6ex},
|
|
% Debug styles
|
|
coord/.style={coordinate, on chain, on grid, node distance=6mm and 25mm},
|
|
nmark/.style={draw, cyan, circle, font={\sffamily}},
|
|
% Line styles
|
|
arrow/.style={->, draw, black},
|
|
slabel/.style={near start, xshift=1em, font=\sffamily},
|
|
welabel/.style={near start, yshift=-0.8em, font=\sffamily},
|
|
}
|
|
% -------------------------------------------------
|
|
% Nodes
|
|
\node [startstop] (start) {Start of Processing};
|
|
\node [proc, join] (injection) {Injection to PQ};
|
|
\node [proc, join] (extract) {Extract PQ[0] $\rightarrow$ CP};
|
|
\node [test] (empty) {PQ empty?};
|
|
\node [test] (target) {Target decays?};
|
|
\node [startstop] (end) {End of Processing};
|
|
|
|
|
|
\node [test, right=of start] (terminate) {Termination?};
|
|
\node [proc, join] (move) {Move by MFP\\
|
|
$\rightarrow$ Update densities \\
|
|
$\rightarrow$ Log to file };
|
|
\node [test, join] (wall) {Wallhit?};
|
|
\node [proc] (interaction) {Do Interaction \\
|
|
$\rightarrow$ Update densities \\
|
|
$\rightarrow$ Update queue };
|
|
\node [test, join] (disint) {Loss Channel?};
|
|
% -------------------------------------------------
|
|
% Coordinate markers
|
|
\node [coord, right=of extract] (c0) {}; \cmark{0}
|
|
\node [coord, above=of terminate, yshift = 1em] (c1) {}; \cmark{1}
|
|
\node [coord, left=of empty] (c2) {}; \cmark{2}
|
|
\node [coord, left=of target, xshift = -2.5em] (c3) {}; \cmark{3}
|
|
|
|
\node [coord, left=of terminate] (c4) {}; \cmark{4}
|
|
\node [coord, left=of wall, xshift=-0.5em] (c5) {}; \cmark{5}
|
|
\node [coord, left=of disint] (c6) {}; \cmark{6}
|
|
\node [coord, right=of empty] (c7) {}; \cmark{7}
|
|
|
|
\node [coord, right=of disint, xshift=0.5em] (c8) {}; \cmark{8}
|
|
% -------------------------------------------------
|
|
% Annotations
|
|
%\node [above=0mm of p4, it] {(Queue was empty)};
|
|
%\node [above=0mm of p8, it] {(Queue was not empty)};
|
|
% -------------------------------------------------
|
|
% North south connectors
|
|
\path (empty.south) to node [slabel] {yes} (target);
|
|
\draw [arrow] (empty.south) -- (target);
|
|
\path (target.south) to node [slabel] {yes} (end);
|
|
\draw [arrow] (target.south) -- (end);
|
|
\path (terminate.south) to node [slabel] {no} (move);
|
|
\draw [arrow] (terminate.south) -- (move);
|
|
\path (wall.south) to node [slabel] {no} (interaction);
|
|
\draw [arrow] (wall.south) -- (interaction);
|
|
% -------------------------------------------------
|
|
% Complicated connectors
|
|
\draw [arrow] (extract.east) -- (c0) |- (c1) -- (terminate.north);
|
|
|
|
\path (empty.west) to node [welabel] {no} (c2);
|
|
\draw [arrow] (empty.west) -- (c2) |- (extract.west);
|
|
\path (target.west) to node [welabel] {no} (c3);
|
|
\draw [arrow] (target.west) -- (c3) |- (injection.west);
|
|
|
|
\path (wall.west) to node [welabel] {yes} (c5);
|
|
\draw [arrow] (wall.west) -| (c7) -- (empty);
|
|
\path (disint.west) to node [welabel] {yes} (c6);
|
|
\draw [arrow] (disint.west) -- (c6) -| (c5);
|
|
\path (terminate.west) to node [welabel] {yes} (c4);
|
|
\draw [arrow] (terminate.west) --(c4) -| (c5);
|
|
|
|
\path (disint.east) to node [welabel] {no} (c8);
|
|
\draw [arrow] (disint.east) -- (c8) |- (terminate.east);
|
|
|
|
% Box
|
|
\draw[dotted] (3,1.2) rectangle (9,-9.5);
|
|
\node at (6,1.4) {CP processing};
|
|
\node [anchor=west] at (-3.5, 1.4) {PQ: particle queue};
|
|
\node [anchor=west] at (-3.5, 1) {CP: current particle};
|
|
\end{tikzpicture}
|
|
\end{document} |