The arrow connecting the bottom blue rectangle "Update E from H" to the red diamond "Done" has two discontinuities. How can I fix my code below to connect these lines at the empty nodes?
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, shadows}
\begin{document}
\begin{figure}
\begin{center}
\tikzstyle{greenrect} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text justified, draw=black, fill=green!60]
\tikzstyle{bluerect} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text justified, draw=black, fill=blue!50]
\tikzstyle{whiterect} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black]
\tikzstyle{reddiamond} = [diamond, minimum width=1cm, minimum height=1cm, text centered, draw=black, fill=red!80]
\tikzstyle{arrow} = [thick,->,>=stealth, line width=1.5pt]
\tikzstyle{line} = [thick,-,>=stealth, line width=1.5pt]
\begin{tikzpicture}[auto, node distance=2cm,>=latex']
\node(Initialize) [greenrect] {
\begin{tabular}{c}Initialize Fields to Zero\\$\vec{E} = \vec{H} = 0$ \end{tabular}
};
\node (Done) [reddiamond, below of=Initialize] {Done};
\node(E2H) [bluerect, below of=Done, node distance=3cm] {
\begin{tabular}{c}Update H from E\\
$\displaystyle{\vec{H}\Bigr\lvert_{t+\triangle t/2} = \vec{H}\Bigr\lvert_{t-\triangle t/2} - \frac{\triangle t}{\mu} (\nabla \times \vec{E}\Bigr\lvert_{t})}$\\
\end{tabular}
};
\node (H2E) [bluerect, below of=E2H, node distance=2.5cm] {
\begin{tabular}{c} Update E from H \\
$\displaystyle{\vec{E}\Bigr\lvert_{t+\triangle t/2} = \vec{E}\Bigr\lvert_{t-\triangle t/2} - \frac{\triangle t}{\epsilon} (\nabla \times \vec{H}\Bigr\lvert_{t})}$\\
\end{tabular}
};
\node (Finished) [right of=Done, node distance=6cm] {
\begin{tabular}{c}
Finished\\
\end{tabular}
};
\node (Empty1) [below of=H2E, node distance=2cm] {};
\node (Empty2) [left of=Empty1, node distance=5cm] {};
\node (Empty3) [left of=Done, node distance=5cm] {};
\draw [arrow] (Initialize) -- (Done);
\draw [arrow] (Done) -- node[name=no] {No} (E2H);
\draw [arrow] (E2H) -- (H2E);
\draw [arrow] (Done) -- node[name=yes] {Yes} (Finished);
\draw [line] (H2E) -- (Empty1);
\draw [line] (Empty1) -| (Empty2);
\draw [line] (Empty2) |- (Empty3);
\draw [arrow] (Empty3) -- (Done);
\end{tikzpicture}
\end{center}
\caption{Block diagram describing a simple FDTD Algorithm}
\end{figure}
\end{document}
Best Answer
Use
\coordinate
s instead of\node
s:The result:
Remarks:
Instead of the old deprecated
of=
syntax use the positioning library and=of
(see an example in the code I used for palcing the coordinates).Instead of the old
\tikzstyle
use\tikzset
(refer to the package documentation).You can easily draw the arrow using simply