Skip to content

Instantly share code, notes, and snippets.

@TomasDrozdik
Created April 20, 2020 21:22
Show Gist options
  • Save TomasDrozdik/afe7d7f4badf32918c3f7b64558411bf to your computer and use it in GitHub Desktop.
Save TomasDrozdik/afe7d7f4badf32918c3f7b64558411bf to your computer and use it in GitHub Desktop.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes, calc, positioning, fit, topaths}
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
\begin{document}
\begin{tikzpicture} [thick]
\tikzstyle {smallfnt}=[font=\scriptsize\sffamily]
\tikzstyle {medfnt}=[font=\footnotesize\sffamily]
\tikzstyle {class}=[medfnt, draw, ellipse, fill=white, inner sep=5]
\tikzstyle {relation}=[smallfnt, rectangle split, rectangle split parts=2, draw, text width=1.1cm, fill=white]
\tikzstyle {box}=[draw, thick, , rounded corners=5mm]
\tikzstyle {layer1}=[box, fill=black!1]
\tikzstyle {layer2}=[box, fill=black!5]
\tikzstyle {layer3}=[box, fill=black!15]
\tikzstyle {composite_box}=[solid]
\tikzstyle {abstract_box}=[dashed]
\tikzstyle {edge_caption}=[smallfnt, midway, draw, rectangle, fill=white]
\node (simulation) { Simulation };
\node (send_route) [relation, below=of simulation] { Send() \nodepart{two} Route() };
\node (packet) [below=of send_route] { Packet };
\node (sender_address) [class, below=of packet] { SenderAddress };
\node (destination_address) [class, below=of sender_address] { DestinationAddress };
\node (recv_process) [relation, below=of destination_address] { Recv() \nodepart{two} Process() };
\node (network) [left=3cm of send_route] { Network };
\node (node) [below=of network] { Node };
\node (addresses) [class, below=of node] { Address[ ] };
\node (routing) [class, below=of addresses] { Routing };
\node (neighbors) [class, below=of routing] { Neighbors };
\node (schedule) [class, right=2cm of sender_address] { Schedule };
\begin{pgfonlayer}{background}
\node [composite_box, layer1, inner sep=15, fit=(simulation)(schedule)(packet)(network)(node)(routing)(neighbors)] {};
\node (network_box) [composite_box, layer2, inner sep=10, fit=(network)(node)(routing)(neighbors)] {};
\node (node_box) [composite_box, layer3, fit=(node)(routing)(neighbors)] {};
\node (packet_box) [composite_box, layer3, fit=(packet)(sender_address)(destination_address)] {};
\end{pgfonlayer}
\draw [->, thick, out=0, in=90, looseness=1.5] (simulation) to node[edge_caption] {Run()} (schedule);
\draw [->, thick, out=65, in=180] (node_box) to (send_route.text west);
\draw [->, thick, out=45, in=180] (routing) to (send_route.two west);
\draw [->, thick, out=120, in=180] (packet_box) to (send_route);
\draw [->, thick, out=0, in=110] (send_route) to node [edge_caption] {Schedule(RecvEvent)} (schedule);
\draw [->, thick, out=-55, in=180] (node_box) to (recv_process.text west);
\draw [->, thick, out=-45, in=180] (routing) to (recv_process.two west);
\draw [->, thick, out=-120, in=180] (packet_box) to (recv_process);
\draw [->, thick, out=0, in=-110] (recv_process) to node [edge_caption] {Schedule(SendEvent)} (schedule);
\draw [->, thick, out=-68, in=-135, looseness=2.5] (network_box) to node[edge_caption] {UpdateNeighbors()} (neighbors);
\draw [->, thick, out=135, in=-135] (neighbors) to node[edge_caption] {UpdateNeighbors()} (routing);
\draw [<->, thick] (routing) to (addresses);
\draw [->, thick, out=-20, in=-160, looseness=5] (schedule) to node[edge_caption] {Pop() and Execute()} (schedule);
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment