Debian Codegraph @

texmf-dist/doc/latex/reotex/reotex.tex

raw
1 \documentclass[11pt]{article}
2 \usepackage{reotex}
3 \usepackage{verbatim}
4 \usepackage{pgf}
5 \usepackage{tikz}
6 \usepackage[pdftex]{hyperref}
7 \usepackage{url}
8
9
10 \title{A PGF-based Libary for Reo Circuits}
11 \author{\textbf{Nuno Oliveira}\\[12pt]HASLab/INESC TEC\\Universidade do Minho}
12 \date{\today}
13 \begin{document}
14 \maketitle
15
16
17 \begin{abstract}
18 This article briefly presents the package for Reo Circuits which is an \emph{extension} of the PGF/Tikz package, thoroughly documented in the manual ``Tikz \& PGF Manual for Version~2.10''.
19
20 Herein, the several commands to build a Reo circuit are presented and its \emph{API} explained.
21
22 For a good usage of this package, \LaTeXe{} version is required. Some commands may work as well with \LaTeX{} version, but it is left as your responsibility.
23
24 Moreover, an excellent introduction to Reo can be found in~\cite{arbab04}, and for more information and tools on this theme the following website may be visited:
25 \begin{center}
26 \url{http://reo.project.cwi.nl/}
27 \end{center}
28
29 \end{abstract}
30
31
32 \section{How to Make it Work}
33
34 Ok, say you want to use this package to draw beautiful Reo Circuits.
35 You start by loading your latex template.
36 Then, in your preamble, you need to have the following:
37
38 \begin{itemize}
39 \item \verb+\usepackage{reotex}+
40 \end{itemize}
41
42 Obviously, you need to have \verb+pgf+ and \verb+tikz+ packages installed in your environment, otherwise the commands provided in \verb+reotex+ will not be interpreted.
43
44
45 \section{Drawing a Reo Channel}
46
47 Reo circuits are the composition of several Reo channels.
48 In this package all the channels have the same API, thus it is
49 easy to explain a generic way of drawing such channels.
50
51 \subsection{The Generic Format}\label{sec:genericchannels}
52
53 The following pseudo-code shows how to draw any channel.
54
55 \begin{verbatim}
56 \tikz \<channel_name>{<start>}
57 {<target>}
58 {<labels>} ;
59 \end{verbatim}
60
61 In detail,
62 \begin{itemize}
63
64 \item \verb+\tikz+: refers to the Tikz environment to draw a tikz-based picture. In fact, the \verb+\tikz+ command is to draw an inline picture. If you desire to draw in a more controlled environment you may use:
65 \begin{verbatim}
66 \begin{tikzpicture}
67 <channel name>{<start>}
68 {<target>}
69 {<labels>}
70 \end{tikzpicture}
71 \end{verbatim}
72
73 \item \emph{$<$channel name$>$}: refers to the command (representing the name of a channel) as presented in Section~\ref{sec:channels}.
74
75 \item \emph{$<$start$>$} refers to the coordinates of the starting point of the channel. It may be written either as $(x,y)$ or as a reference for a previous defined node: $(name)$. The second format should only be used in a tikzpicture environment.
76
77 \item \emph{$<$target$>$}: refers to the coordinates of the target point of the channel. It is used as the \emph{$<$start$>$} coordinate.
78
79 \item \emph{$<$labels$>$}: refer to the labels that may be desired to add to the channel. More than one label may be expressed; whenever it happens, a space should separate them. Each label should have the following format:
80
81 \begin{verbatim}
82 node[<options>] {<label>} ...
83 \end{verbatim}
84
85 where
86
87 \begin{itemize}
88 \item \emph{$<$options$>$} are simple coma-separated graphic directives that may be used to transform the label. These directives are those used in normal \verb+pgf+ or \verb+tikz+ pictures: yshift=number, xshift=number, shift=number, color name, above, left, below and right, to list some but a few.
89
90 \item \emph{$<$label$>$} is the text to put on the channel.
91 It may be used both simple text and mathematical text.
92
93 \end{itemize}
94
95 \end{itemize}
96
97
98 \subsection{Reo Channels}\label{sec:channels}
99
100 The following list presents the commands to draw the 22 defined Reo channels.
101
102 \subsubsection{Synchronous Channels}
103
104 \indent
105
106 \begin{minipage}[b]{0.25\linewidth}
107 \verb+\sync+
108 \end{minipage}
109 \begin{minipage}[b]{0.2\linewidth}
110 \tikz \sync{(0,0)}{(1.5,0)}{};
111 \end{minipage}
112 \begin{minipage}[b]{0.6\linewidth}
113 \verb+\sync{(0,0)}{(1.5,0)}{}+
114 \end{minipage}
115
116 \medskip
117
118 \begin{minipage}[b]{0.25\linewidth}
119 \verb+\lossysync+
120 \end{minipage}
121 \begin{minipage}[b]{0.2\linewidth}
122 \tikz \lossysync{(0,0)}{(1.5,0)}{};
123 \end{minipage}
124 \begin{minipage}[b]{0.6\linewidth}
125 \verb+\lossysync{(0,0)}{(1.5,0)}{}+
126 \end{minipage}
127
128 \medskip
129
130 \begin{minipage}[b]{0.25\linewidth}
131 \verb+\syncdrain+
132 \end{minipage}
133 \begin{minipage}[b]{0.2\linewidth}
134 \tikz \syncdrain{(0,0)}{(1.5,0)}{};
135 \end{minipage}
136 \begin{minipage}[b]{0.6\linewidth}
137 \verb+\syncdrain{(0,0)}{(1.5,0)}{}+
138 \end{minipage}
139
140 \medskip
141
142 \begin{minipage}[b]{0.25\linewidth}
143 \verb+\syncspout+
144 \end{minipage}
145 \begin{minipage}[b]{0.2\linewidth}
146 \tikz \syncspout{(0,0)}{(1.5,0)}{};
147 \end{minipage}
148 \begin{minipage}[b]{0.6\linewidth}
149 \verb+\syncspout{(0,0)}{(1.5,0)}{}+
150 \end{minipage}
151
152 \medskip
153
154 \begin{minipage}[b]{0.25\linewidth}
155 \verb+\filter+
156 \end{minipage}
157 \begin{minipage}[b]{0.2\linewidth}
158 \tikz \filter{(0,0)}{(1.5,0)}{};
159 \end{minipage}
160 \begin{minipage}[b]{0.6\linewidth}
161 \verb+\filter{(0,0)}{(1.5,0)}{}+
162 \end{minipage}
163
164
165 \subsubsection{Asynchronous Channels}
166
167 \indent
168
169 \begin{minipage}[b]{0.25\linewidth}
170 \verb+\fifoe+
171 \end{minipage}
172 \begin{minipage}[b]{0.2\linewidth}
173 \tikz \fifoe{(0,0)}{(2,0)}{};
174 \end{minipage}
175 \begin{minipage}[b]{0.6\linewidth}
176 \verb+\fifoe{(0,0)}{(2,0)}{}+
177 \end{minipage}
178
179 \medskip
180
181 \begin{minipage}[b]{0.25\linewidth}
182 \verb+\fifof+
183 \end{minipage}
184 \begin{minipage}[b]{0.2\linewidth}
185 \tikz \fifof{(0,0)}{(2,0)}{};
186 \end{minipage}
187 \begin{minipage}[b]{0.6\linewidth}
188 \verb+\fifof{(0,0)}{(2,0)}{}+
189 \end{minipage}
190
191 \medskip
192
193 \begin{minipage}[b]{0.25\linewidth}
194 \verb+\asyncdrain+
195 \end{minipage}
196 \begin{minipage}[b]{0.2\linewidth}
197 \tikz \asyncdrain{(0,0)}{(2,0)}{};
198 \end{minipage}
199 \begin{minipage}[b]{0.6\linewidth}
200 \verb+\asyncdrain{(0,0)}{(2,0)}{}+
201 \end{minipage}
202
203 \medskip
204
205 \begin{minipage}[b]{0.25\linewidth}
206 \verb+\asyncspout+
207 \end{minipage}
208 \begin{minipage}[b]{0.2\linewidth}
209 \tikz \asyncspout{(0,0)}{(2,0)}{};
210 \end{minipage}
211 \begin{minipage}[b]{0.6\linewidth}
212 \verb+\asynspout{(0,0)}{(2,0)}{}+
213 \end{minipage}
214
215 \medskip
216
217 \begin{minipage}[b]{0.25\linewidth}
218 \verb+\fifon+
219 \end{minipage}
220 \begin{minipage}[b]{0.2\linewidth}
221 \tikz \fifon{(0,0)}{(2,0)}{};
222 \end{minipage}
223 \begin{minipage}[b]{0.6\linewidth}
224 \verb+\fifon{(0,0)}{(2,0)}{}+
225 \end{minipage}
226
227 \medskip
228
229 \begin{minipage}[b]{0.25\linewidth}
230 \verb+\shiftfifon+
231 \end{minipage}
232 \begin{minipage}[b]{0.2\linewidth}
233 \tikz \shiftfifon{(0,0)}{(2,0)}{};
234 \end{minipage}
235 \begin{minipage}[b]{0.6\linewidth}
236 \verb+\shiftfifon{(0,0)}{(2,0)}{}+
237 \end{minipage}
238
239 \medskip
240
241 \begin{minipage}[b]{0.25\linewidth}
242 \verb+\lossyfifon+
243 \end{minipage}
244 \begin{minipage}[b]{0.2\linewidth}
245 \tikz \lossyfifon{(0,0)}{(2,0)}{};
246 \end{minipage}
247 \begin{minipage}[b]{0.6\linewidth}
248 \verb+\lossyfifon{(0,0)}{(2,0)}{}+
249 \end{minipage}
250
251 \medskip
252
253 \begin{minipage}[b]{0.25\linewidth}
254 \verb+\timer+
255 \end{minipage}
256 \begin{minipage}[b]{0.2\linewidth}
257 \tikz \timer{(0,0)}{(2,0)}{};
258 \end{minipage}
259 \begin{minipage}[b]{0.6\linewidth}
260 \verb+\timer{(0,0)}{}{(2,0)}+
261 \end{minipage}
262
263 \medskip
264
265 \begin{minipage}[b]{0.25\linewidth}
266 \verb+\ordered+
267 \end{minipage}
268 \begin{minipage}[b]{0.2\linewidth}
269 \tikz \ordered{(0,0)}{(2,0)}{};
270 \end{minipage}
271 \begin{minipage}[b]{0.6\linewidth}
272 \verb+\ordered{(0,0)}{}{(2,0)}+
273 \end{minipage}
274
275 \medskip
276
277 \begin{minipage}[b]{0.25\linewidth}
278 \verb+\orderedn+
279 \end{minipage}
280 \begin{minipage}[b]{0.2\linewidth}
281 \tikz \orderedn{(0,0)}{(2,0)}{};
282 \end{minipage}
283 \begin{minipage}[b]{0.6\linewidth}
284 \verb+\orderedn{(0,0)}{(2,0)}{}+
285 \end{minipage}
286
287 \medskip
288
289 \begin{minipage}[b]{0.25\linewidth}
290 \verb+\bag+
291 \end{minipage}
292 \begin{minipage}[b]{0.2\linewidth}
293 \tikz \bag{(0,0)}{(2,0)}{};
294 \end{minipage}
295 \begin{minipage}[b]{0.6\linewidth}
296 \verb+\bag{(0,0)}{(2,0)}{}+
297 \end{minipage}
298
299 \medskip
300
301 \begin{minipage}[b]{0.25\linewidth}
302 \verb+\bagn+
303 \end{minipage}
304 \begin{minipage}[b]{0.2\linewidth}
305 \tikz \bagn{(0,0)}{(2,0)}{};
306 \end{minipage}
307 \begin{minipage}[b]{0.6\linewidth}
308 \verb+\bagn{(0,0)}{(2,0)}{}+
309 \end{minipage}
310
311 \medskip
312
313 \begin{minipage}[b]{0.25\linewidth}
314 \verb+\set+
315 \end{minipage}
316 \begin{minipage}[b]{0.2\linewidth}
317 \tikz \set{(0,0)}{(2,0)}{};
318 \end{minipage}
319 \begin{minipage}[b]{0.6\linewidth}
320 \verb+\set{(0,0)}{(2,0)}{}+
321 \end{minipage}
322
323 \medskip
324
325 \begin{minipage}[b]{0.25\linewidth}
326 \verb+\setn+
327 \end{minipage}
328 \begin{minipage}[b]{0.2\linewidth}
329 \tikz \setn{(0,0)}{(2,0)}{};
330 \end{minipage}
331 \begin{minipage}[b]{0.6\linewidth}
332 \verb+\setn{(0,0)}{(2,0)}{}+
333 \end{minipage}
334
335 \medskip
336
337 \begin{minipage}[b]{0.25\linewidth}
338 \verb+\delayset+
339 \end{minipage}
340 \begin{minipage}[b]{0.2\linewidth}
341 \tikz \delayset{(0,0)}{(2,0)}{};
342 \end{minipage}
343 \begin{minipage}[b]{0.6\linewidth}
344 \verb+\delayset{(0,0)}{(2,0)}{}+
345 \end{minipage}
346
347 \medskip
348
349 \begin{minipage}[b]{0.25\linewidth}
350 \verb+\delaysetn+
351 \end{minipage}
352 \begin{minipage}[b]{0.2\linewidth}
353 \tikz \delaysetn{(0,0)}{(2,0)}{};
354 \end{minipage}
355 \begin{minipage}[b]{0.6\linewidth}
356 \verb+\delaysetn{(0,0)}{(2,0)}{}+
357 \end{minipage}
358
359 \medskip
360
361 \begin{minipage}[b]{0.25\linewidth}
362 \verb+\keyedset+
363 \end{minipage}
364 \begin{minipage}[b]{0.2\linewidth}
365 \tikz \keyedset{(0,0)}{(2,0)}{};
366 \end{minipage}
367 \begin{minipage}[b]{0.6\linewidth}
368 \verb+\keyedset{(0,0)}{(2,0)}{}+
369 \end{minipage}
370
371 \medskip
372
373 \begin{minipage}[b]{0.25\linewidth}
374 \verb+\keyedsetn+
375 \end{minipage}
376 \begin{minipage}[b]{0.2\linewidth}
377 \tikz \keyedsetn{(0,0)}{(2,0)}{};
378 \end{minipage}
379 \begin{minipage}[b]{0.6\linewidth}
380 \verb+\keyedsetn{(0,0)}{(2,0)}{}+
381 \end{minipage}
382
383 \bigskip
384
385 \paragraph{Notes:}
386 \begin{itemize}
387 \item The minimum acceptable length (that is, the distance between start and target points) for a channel is 1cm.
388 \item Notice that it is only shown the \LaTeXe{} code used to draw the channel. Obviously, this code should be inside a Tikz environment as referred previously).
389 \item All the commands have a starred version that makes them to lose the arrow: (e.g. this code: \verb+\filter*{(0,0)}{(1.5,0)}{}+ draws: \tikz \filter*{(0,0)}{(1.5,0)}{};)
390
391 This version is, for instance, used internally for channels that need to be represented in L or U format, for instance (code explained in Section~\ref{sec:circuits}):
392
393
394 \begin{minipage}[b]{0.4\linewidth}
395 \begin{center}
396 \begin{tikzpicture}
397
398 \Uchannel{fifof}{(0,0)}{(2,0)}
399 {0.5}{v}{-}{}
400
401 \end{tikzpicture}
402 \end{center}
403 \vspace{0.4cm}
404 \end{minipage}
405 \begin{minipage}[b]{0.58\linewidth}
406 \begin{verbatim}
407 \begin{tikzpicture}
408
409 \Uchannel{fifof}{(0,0)}{(2,0)}
410 {0.5}{v}{-}{}
411
412 \end{tikzpicture}
413 \end{verbatim}
414 \end{minipage}
415
416
417 \end{itemize}
418
419
420
421 \section{Drawing a Node}
422
423 The following code shows how a node is drawn.
424
425 \subsection{The Generic Format}
426
427 There are two sorts of nodes in Reo circuits: the boundary nodes and the mixed nodes. In this package they differ only in their colour, as can be seen in Section~\ref{sec:nodes}. However, the API is the same for both sorts of nodes:
428
429 \begin{verbatim}
430 \tikz \<node name>{<reference>}{point}{<labels>}
431 \end{verbatim}
432
433 In detail,
434
435 \begin{itemize}
436
437 \item \verb+\tikz+ is the Tikz environment. See the details as described in Section~\ref{sec:genericchannels}
438
439 \item \emph{$<$node name$>$} refers to the command (representing the name of the node) as presented in Section~\ref{sec:nodes}.
440
441 \item \emph{$<$reference$>$} refers to an alias to the $x,y$ position of this node. It should be formatted as \verb+(name)+, where name may be composed of more than one word.
442
443 \item \emph{$<$point$>$} refers to the $x$ and $y$ coordinates of the point where the node is to be placed.
444
445 \item \emph{$<$labels$>$} refer to the text that may be added to the node. It follows the same notation as described in Section~\ref{sec:genericchannels}. More that one label may be defined; whenever this happens, a space should separate them.
446 \end{itemize}
447
448
449 \subsection{Nodes}\label{sec:nodes}
450
451 The following list presents the commands to draw the two sorts of Reo nodes. (Notice that it is only shown the \LaTeXe{} code used to draw the node.
452 Obviously, this code should be inside a Tikz environment as referred previously).
453
454
455 \indent
456
457 \begin{minipage}[b]{0.25\linewidth}
458 \verb+\ionode+
459 \end{minipage}
460 \begin{minipage}[b]{0.2\linewidth}
461 \tikz \ionode{(n1)}{(0,0)}{} ;
462 \end{minipage}
463 \begin{minipage}[b]{0.6\linewidth}
464 \verb+\ionode{(n1)}{(0,0)}{}+
465 \end{minipage}
466
467 \medskip
468
469
470 \begin{minipage}[b]{0.25\linewidth}
471 \verb+\mixednode+
472 \end{minipage}
473 \begin{minipage}[b]{0.2\linewidth}
474 \tikz \mixednode{(n2)}{(0,0)}{} ;
475 \end{minipage}
476 \begin{minipage}[b]{0.6\linewidth}
477 \verb+\mixednode{(n2)}{(0,0)}{}+
478 \end{minipage}
479
480 \bigskip
481
482 A third node may be used in Reo Circuits. It is named the Exclusive Router node which is a graphic-alias for the Reo Circuit with the same name. It follows exactly the same notation as the other two nodes previously presented:
483
484 \medskip
485
486 \begin{minipage}[b]{0.25\linewidth}
487 \verb+\xrouter+
488 \end{minipage}
489 \begin{minipage}[b]{0.2\linewidth}
490 \tikz \xrouter{(xr)}{(0,0)}{} ;
491 \end{minipage}
492 \begin{minipage}[b]{0.6\linewidth}
493 \verb+\xrouter{(xr)}{(0,0)}{}+
494 \end{minipage}
495
496
497 \section{Drawing Reo Circuits}\label{sec:circuits}
498
499 It is strongly recommended to use the \verb+tikzpicture+ envitonment when drawing Reo circuits. The use of the inline command (\verb+\tikz+) may deliver unexpected results.
500
501 \subsection{A Basic Circuit}
502
503 So, the main strategy underlying the drawing of Reo Circuits with this package is twofold: first we should place the nodes, so we can name them, and then connect the channels to these nodes, taking advantage of the nodes references.
504
505 \bigskip
506
507 \begin{minipage}[b]{0.5\linewidth}
508 \begin{tikzpicture}
509 \ionode{(io1)}{(0,1)}{}
510 \ionode{(io2)}{(0,3)}{}
511 \ionode{(io3)}{(3,0.5)}{}
512 \ionode{(io4)}{(6,1)}{}
513 \ionode{(io5)}{(6,3)}{}
514 \mixednode{(m1)}{(1,2)}{}
515 \mixednode{(m2)}{(3,2)}{}
516 \mixednode{(m3)}{(5,2)}{}
517
518 \sync{(io1)}{(m1)}{}
519 \sync{(io2)}{(m1)}{}
520 \fifoe{(m1)}{(m2)}{}
521 \syncdrain{(io3)}{(m2)}{}
522 \fifoe{(m2)}{(m3)}{}
523 \sync{(m3)}{(io4)}{}
524 \sync{(m3)}{(io5)}{}
525 \end{tikzpicture}
526
527 \vspace{2cm}
528
529 \end{minipage}
530 \begin{minipage}[b]{0.4\linewidth}
531 \begin{verbatim}
532 \begin{tikzpicture}
533 \ionode{(io1)}{(0,1)}{}
534 \ionode{(io2)}{(0,3)}{}
535 \ionode{(io3)}{(3,0.5)}{}
536 \ionode{(io4)}{(6,1)}{}
537 \ionode{(io5)}{(6,3)}{}
538 \mixednode{(m1)}{(1,2)}{}
539 \mixednode{(m2)}{(3,2)}{}
540 \mixednode{(m3)}{(5,2)}{}
541
542 \sync{(io1)}{(m1)}{}
543 \sync{(io2)}{(m1)}{}
544 \fifoe{(m1)}{(m2)}{}
545 \syncdrain{(io3)}{(m2)}{}
546 \fifoe{(m2)}{(m3)}{}
547 \sync{(m3)}{(io4)}{}
548 \sync{(m3)}{(io5)}{}
549 \end{tikzpicture}
550 \end{verbatim}
551 \end{minipage}
552
553 \bigskip
554
555 If it may become complex to draw the nodes and then understand which node is which, it is strongly recommended to add some labels to the nodes and, afterwards, remove them if they are not desired.
556
557
558 \subsection{Drawing U- and L-shaped Channels}
559
560 \bigskip
561
562 Two new commands (\verb+\Lchannel+ and \verb+\Uchannel+) are added to this package, as utilities, to draw these shapes.
563
564 The \verb+\Lchannel+ command is used to define the L-shaped channels. Its notation is:
565
566 \begin{verbatim}
567 \Lchannel[<dashed>]
568 {<channel name>}
569 {<start>}
570 {<target>}
571 {<length>}
572 {<orientation>}
573 {<polarisation>}
574 {<labels>}
575 \end{verbatim}
576
577 where,
578
579 \begin{itemize}
580 \item \emph{$<$dashed$>$} is an optional argument that determines if the \emph{non-channel} part of the L-shape is dashed. If omitted, the result would be a solid line.
581
582 \item \emph{$<$channel name$>$} is the name of the channel that will be L-shaped. These names are exactly the same as the names of the commands presented in Section~\ref{sec:channels}, but without the '$\backslash $'
583
584 \item \emph{$<$start$>$} and \emph{$<$target$>$} refer to the start and target points of these lines. They may be a reference to a previously defined node or it may be a concrete point. IMPORTANT: \emph{$<$start$>$} is always the initial point of the non-channel part of the L-shape, even if, in fact, it is the target point in the drawn figure.
585
586 \item \emph{$<$length$>$} refers to the length of the non-channel part. A desirable value for this argument would be $0.5$.
587
588 \item \emph{$<$orientation$>$} refers to the orientation of the non-channel part. IMPORTANT: it must be one of $v$ or $h$ for vertical or horizontal orientation, respectively.
589
590 \item \emph{$<$polarization$>$} refers to the side to where the non-channel part will grow $length$ units. IMPORTANT: it must be one of $+$ or $-$.
591 The combination of the following values (respectively the orientation and polarization) mean:
592 \begin{itemize}
593 \item $v$ and $+$ : the non-channel part grows up (positive in the y-axe);
594 \item $v$ and $-$ : the non-channel part grows down (negative in the y-axe);
595 \item $h$ and $+$ : the non-channel part grows to the right (positive in the x-axe);
596 \item $h$ and $-$ : the non-channel part grows to the left (negative in the y-axe);
597 \end{itemize}
598
599 \item \emph{$<$labels$>$} refers to the labels that may be added to the channel. Its notation is exactly the same as presented in Section~\ref{sec:channels}.
600
601 \item This channel has a starred version (\verb+\Lchannel*+) that makes the arrow tip to be placed in the non-channel part of the L-shape. Obviously, the arrow tip, is by default, placed at the channel part of the L-shape.
602
603 \end{itemize}
604
605
606
607 The \verb+\Uchannel+ command is used to define the U-shaped channels. Its notation is:
608
609 \begin{verbatim}
610 \Uchannel[<dashed>]
611 {<channel name>}
612 {<start>}
613 {<target>}
614 {<length>}
615 {<orientation>}
616 {<polarisation>}
617 {<labels>}
618 \end{verbatim}
619
620 where,
621
622 \begin{itemize}
623 \item \emph{$<$dashed$>$} is an optional argument that determines if the \emph{non-channel} parts of the U-shape are dashed. If omitted, the result would be a solid line. IMPORTANT: this option is sensible to the \texttt{lossyfifon} and \texttt{shiftfifon} channels, meaning that it creates a dashed and a solid non-channel part.
624
625 \item \emph{$<$channel name$>$} is the name of the channel that will be L-shaped. These names are exactly the same as the names of the commands presented in Section~\ref{sec:channels}, but without the '$\backslash $'
626
627 \item \emph{$<$start$>$} and \emph{$<$target$>$} refer to the start and target points of these lines. They may be a reference to a previously defined node or it may be a concrete point. IMPORTANT: the \emph{$<$start$>$} point is always the point of the non-channel part which will not have the arrow tip.
628
629 \item \emph{$<$length$>$} refers to the length of the non-channel parts. A desirable value for this argument would be $0.5$.
630
631 \item \emph{$<$orientation$>$} refers to the orientation of the non-channel part. IMPORTANT: it must be one of $v$ or $h$ for vertical or horizontal orientation, respectively.
632
633 \item \emph{$<$polarization$>$} refers to the side to where the non-channel part will grow $length$ units. IMPORTANT: it must be one of $+$ or $-$.
634 The combination of the following values (respectively the orientation and polarization) mean:
635 \begin{itemize}
636 \item $v$ and $+$ : the non-channel part grows up (positive in the y-axe);
637 \item $v$ and $-$ : the non-channel part grows down (negative in the y-axe);
638 \item $h$ and $+$ : the non-channel part grows to the right (positive in the x-axe);
639 \item $h$ and $-$ : the non-channel part grows to the left (negative in the y-axe);
640 \end{itemize}
641
642 \item \emph{$<$labels$>$} refers to the labels that may be added to the channel. Its notation is exactly the same as presented in Section~\ref{sec:channels}.
643
644
645
646 \end{itemize}
647
648
649
650 \begin{minipage}[b]{0.4\linewidth}
651 \begin{center}
652 \begin{tikzpicture}
653
654 \Lchannel{fifoe}{(0,0)}{(2,0.5)}
655 {0.5}{v}{+}{}
656 \Uchannel{fifoe}{(0,-1)}{(2,-1)}
657 {0.5}{v}{+}{}
658 \Lchannel*[dashed]{lossysync}{(0,-1.5)}
659 {(2,-2)}{0.5}{v}{-}{}
660
661 \end{tikzpicture}
662 \end{center}
663 \vspace{0.5mm}
664 \end{minipage}
665 \begin{minipage}[b]{0.58\linewidth}
666 \begin{verbatim}
667 \begin{tikzpicture}
668 \Lchannel{fifoe}{(0,0)}{(2,0.5)}
669 {0.5}{v}{+}{}
670 \Uchannel{fifoe}{(0,-1)}{(2,-1)}
671 {0.5}{v}{+}{}
672 \Lchannel*[dashed]{lossysync}{(0,-1.5)}
673 {(2,-2)}{0.5}{v}{-}{}
674 \end{tikzpicture}
675 \end{verbatim}
676 \end{minipage}
677
678
679
680 \bigskip
681
682 \subsection{Adding Labels to Channels or Nodes in a Circuit}
683
684 Very often it is necessary to add some information to a node or to a channel. In this package, all the channels and nodes allow for this feature. The following examples show how this can be achieved.
685
686 Here is an example that adds some label to some nodes.
687
688 \bigskip
689
690 \begin{minipage}[b]{0.4\linewidth}
691 \begin{center}
692 \begin{tikzpicture}
693
694 \ionode{(io1)}{(0,0)}{node {$a$}}
695 \ionode{(io2)}{(2,0)}{node {$b$}}
696
697 \fifoe{(io1)}{(io2)}{}
698
699 \end{tikzpicture}
700 \end{center}
701 \vspace{0.5cm}
702 \end{minipage}
703 \begin{minipage}[b]{0.58\linewidth}
704 \begin{verbatim}
705 \begin{tikzpicture}
706 \ionode{(io1)}{(0,0)}{node {$a$}}
707 \ionode{(io2)}{(2,0)}{node {$b$}}
708 \fifoe{(io1)}{(io2)}{}
709 \end{tikzpicture}
710 \end{verbatim}
711 \end{minipage}
712
713 \bigskip
714
715 Ups! That is not what we desired!
716
717 In fact, the code \verb+node {<text>}+ creates a label right in the centre of the node to which it will be stick.
718 This would result in almost invisible labels.
719 The solution is to use position options.
720 Such position options are thoroughly documented in the tikz \& pgf manual. Those presented next are easily understandable, and are enough to place the labels in desired positions:
721
722 \begin{itemize}
723 \item yshift or xshift: these options require a dimension $d$ and they make the label to move $d$ units in the vertical or horizontal axes, respectively. They should be used as: \verb+yshift=10pt+, for instance (the same notation is used for for the xshift, as it would be expected.
724
725 \item above, below, left right: these options do not require any value as they actually place the label in the expected positions. It may be, however, needed that these options are used with the y or xshift to place the label in a more suitable position.
726
727 \end{itemize}
728
729 Take a look at the next example to understand how these options are used.
730
731
732 \bigskip
733
734 \begin{minipage}[b]{0.3\linewidth}
735 \begin{center}
736 \begin{tikzpicture}
737
738 \ionode{(io1)}{(0,0)}{node[below, xshift=-5pt] {$a$}}
739 \ionode{(io2)}{(2,0)}{node[yshift=8pt, xshift=5pt] {$b$}}
740
741 \fifoe{(io1)}{(io2)}{}
742
743 \end{tikzpicture}
744 \end{center}
745 \vspace{0.5cm}
746 \end{minipage}
747 \begin{minipage}[b]{0.68\linewidth}
748 \begin{verbatim}
749 \begin{tikzpicture}
750 \ionode{(io1)}{(0,0)}
751 {node[below, xshift=-5pt] {$a$}}
752 \ionode{(io2)}{(2,0)}
753 {node[yshift=8pt, xshift=5pt] {$b$}}
754 \fifoe{(io1)}{(io2)}{}
755 \end{tikzpicture}
756 \end{verbatim}
757 \end{minipage}
758
759 \bigskip
760
761
762 It may be interesting to have some (read: more than one) labels in a node or in a channel. The next example shows how more than one label may be added to a channel, defining the stochastic LossySync channel with the stochastic annotations.
763 \paragraph{Note.} Since nodes and channels use the same notation to define labels, the code (the label parts) shown here may be applied to nodes too.
764
765
766 \bigskip
767
768 \begin{minipage}[b]{0.3\linewidth}
769 \begin{center}
770 \begin{tikzpicture}
771
772 \lossysync{(0,0)}{(2,0)}
773 {node[above]{\tiny$\gamma ab$}
774 node[below]{\tiny$\gamma aL$}
775 node[above, xshift=-30pt]{\tiny$\gamma a$}
776 node[above, xshift=30pt]{\tiny$\gamma b$}
777 }
778
779 \end{tikzpicture}
780 \end{center}
781 \vspace{1.3cm}
782 \end{minipage}
783 \begin{minipage}[b]{0.68\linewidth}
784 \begin{verbatim}
785 \begin{tikzpicture}
786 \lossysync{(0,0)}
787 {(2,0)}
788 {node[above]
789 {\tiny$\gamma ab$}
790 node[below]
791 {\tiny$\gamma aL$}
792 node[above, xshift=-30pt]
793 {\tiny$\gamma a$}
794 node[above, xshift=30pt]
795 {\tiny$\gamma b$}
796 }
797 \end{tikzpicture}
798 \end{verbatim}
799 \end{minipage}
800
801
802 \bigskip
803
804 By the way it is possible to change the colour of the label, by adding to the node options the name of a colour. See how in the next example.
805
806
807 \bigskip
808
809 \begin{minipage}[b]{0.3\linewidth}
810 \begin{center}
811 \begin{tikzpicture}
812
813 \lossysync{(0,0)}{(2,0)}
814 {node[above]{\tiny$\gamma ab$}
815 node[below, red]{\tiny$\gamma aL$}
816 }
817
818 \end{tikzpicture}
819 \end{center}
820 \vspace{0.4cm}
821 \end{minipage}
822 \begin{minipage}[b]{0.68\linewidth}
823 \begin{verbatim}
824 \begin{tikzpicture}
825 \lossysync{(0,0)}{(2,0)}
826 {node[above]{\tiny$\gamma ab$}
827 node[below, red]{\tiny$\gamma aL$}
828 }
829 \end{tikzpicture}
830 \end{verbatim}
831 \end{minipage}
832
833
834 \bigskip
835
836
837
838
839 \section{Summary}
840
841 In this document you learned how to use the reotex package, which allows for the construction of Reo Circuits, using Reo Channels and Nodes.
842
843 All the channels follow the same Channel API: receive a start point or a reference to such a start point (always between parentheses), then they receive a list of space-separated labels, and finally they receive the target point or the reference to that point.
844
845 The channels have a starred version that defines the existence, or not, of an arrow tip.
846
847 The nodes (there are three different) also follow the same Node API: receive a reference name (always between parentheses, composed of one or more words), then they receive the point and finally the list of space-separated labels.
848
849
850 Moreover, there are some special utility commands that allow for the construction of U- and L-shaped Channels.
851
852
853
854 \bibliographystyle{plain}
855 \bibliography{../../../Reports/Reo/reo}
856
857
858 \end{document}
859
860
861
862
863
864
865
866
867