% -*- latex -*-

\documentclass[@GLOBAL_OPTIONS@]{book}

\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{fancyvrb}
\usepackage{graphicx}
\usepackage{ifthen}
\usepackage{multicol}
\usepackage{needspace}
\usepackage{picins}
\usepackage{tabularx}
\usepackage{url}
\usepackage{xspace}

\usepackage{makeidx}
\makeindex

\usepackage{color}
\definecolor{yellow}{rgb}{1,1,0}
\definecolor{black}{rgb}{0,0,0}
\definecolor{ltcyan}{rgb}{.75,1,1}
\definecolor{red}{rgb}{1,0,0}

% This package enables us to create the list of exercises.
\usepackage[titles]{tocloft}

% This wonderful package allows hyphenation in tt fonts and hyphenation of
% words with underscores in them.
\usepackage[htt]{hyphenat}

\usepackage{hyperref}
\hypersetup{pdftitle={@SHORT_TITLE@}}
\hypersetup{pdfauthor={Kenneth Moreland}}
% \hypersetup{colorlinks}
% \hypersetup{linkcolor=blue}
% \hypersetup{linkcolor=blue}
\hypersetup{pdfborder={0 0 0}}
\hypersetup{breaklinks}
\hypersetup{pagebackref}
\hypersetup{pdfstartpage=3}
% These should fix a problem with indices pointing to frontmatter instead
% of mainmatter.
\hypersetup{plainpages=false,pdfpagelabels=true}

% -----------------------------------------------------------------------------
%
% Set the title, author, and date
%
% Commented out because I am now making my own title page.

%%% \newcommand{\authorinfo}[3]{#1\thanks{\href{mailto:#2}{#2}} \\ #3}

%%% \title{@LONG_TITLE@}
%%% \author{%
%%%   \authorinfo{Kenneth~Moreland}{kmorel@sandia.gov}{Sandia~National~Laboratories}
%%%   %\and
%%%   %\authorinfo{John~Doe}{john.doe@kitware.com}{Kitware~inc.}
%%%   }

%%% \date{}

%-----------------------------------------------------------------------------
% Set up boolean that handles the ``save trees'' mode which crams more
% stuff on each page.  This is to help keep the cost down of printing the
% document.
\newboolean{savetrees}
\setboolean{savetrees}{@SAVE_TREES_FLAG@}

\ifthenelse{\boolean{savetrees}}{
  \usepackage[normalsections]{savetrees}
}{}

%-----------------------------------------------------------------------------
% Set up headers and footers with the fancyhdr package.
\pagestyle{fancy}
\fancyhead{} % clear header/footer fields
\fancyfoot{}
\fancyhead[EL]{\thepage}
\fancyhead[ER]{\leftmark}
\fancyhead[OL]{\rightmark}
\fancyhead[OR]{\thepage}
\renewcommand\headrulewidth{0.25pt}
\setlength{\headheight}{14.5pt}

%-----------------------------------------------------------------------------
% Sizes
% The width to use for screen captures (Screen Capture Width)
\newlength{\scw}
% The scaling to use for images with boundaries scaled for inclusing in
% single column mode.
%\newlength{\bbscale}

\ifthenelse{\boolean{savetrees}}{
  \setlength{\scw}{2in}
  \newcommand{\bbscale}{0.6}
}{
  \setlength{\scw}{3in}
  \newcommand{\bbscale}{1}
}

% -----------------------------------------------------------------------------
% Environment, text types, and other common formatting for this document.

% Use in place of the version to have it update to what is defined in
% CMakeLists.txt
\newcommand{\pvversion}{@PARAVIEW_VERSION@\xspace}

% This defines \exercise, which is a special version of the section command
% that defines a section with an exercise.
\newcommand{\listexercisename}{List of Exercises}
\newlistof[chapter]{exercise}{loe}{\listexercisename}
% Note, the above [chapter] resets the counter each chapter.  Do we want that?
%\setlength{\cftexercisenumwidth}{\cftsectionnumwidth}
\settowidth{\cftexercisenumwidth}{X.XX}

% An environment for defining an exercise.  It is best if there is _not_ a
% paragraph between either the \begin or \end and the text (that is, no
% blank line after \begin{exercise} or before \end{exercise}).
\newenvironment{exercise}[1]{%
  \refstepcounter{exercise}
  \vspace{3.25ex}
  \Needspace*{4\baselineskip}
  \noindent\textbf{\large{}Exercise \theexercise: #1}
  \addcontentsline{loe}{exercise}{\protect\numberline{\theexercise}#1}
  \addcontentsline{toc}{subsection}{Exercise \theexercise: #1}
  \vspace{1.5ex}
  %\par\noindent
  %\par\hspace*{-\parindent}
  \hspace*{\fill}\\*%
}{%
  \hspace*{\fill}$\blacklozenge$
  \vspace{1.5ex}
}

% An environment for our figures, which we want to keep inline with the
% text.  The nopagebreak option tries to avoid adding a page break (which
% can add a lot of space on the previous page).  The raggedbottom option
% says that if a page break is absolutely necessary, do not try to make the
% bottom of the previous page to the bottom of the page; it will add a
% bunch of space in the middle that will look bad.  The flush bottom option
% restores normal page flush operation.
\newenvironment{inlinefig}%
               {\raggedbottom\begin{center}}%
               {\end{center}\nopagebreak[3]\flushbottom}

% An environment for listing reference materials.
%%% \newenvironment{reflist}%
%%%		   {\begin{quote}\begin{description}}%
%%%		   {\end{description}\end{quote}}
\newenvironment{reflist}%
	       {\begin{description}}%
	       {\end{description}}

% Font for text taken from the GUI
\newcommand*{\gui}[1]{\textsf{#1}}

% Right arrow (used frequently to show sequence of clicks).
\newcommand{\ra}{\ensuremath{\rightarrow}\xspace}

% Font for a keyterm
\newcommand*{\keyterm}[1]{\index{#1}\textbf{#1}}

% Font for programs and command line execution.
\newcommand{\commandline}[1]{\texttt{#1}}
\newcommand{\progname}[1]{\commandline{#1}\index{#1}}

% Font for things intered in python.
\newcommand*{\textpy}[1]{\texttt{#1}}

% Add a Python function or attribute to the index.  This is helpful to
% announce functions that are in a Python script but might not be mentioned
% elsewhere in the text.
\newcommand*{\pyfuncindex}[1]{\index{#1}}
\newcommand*{\pyattribindex}[1]{\index{#1}}

% Placeholder for a Python function or attribute.  Sets the right font and
% creates an index entry.
\newcommand*{\pyfunc}[1]{\pyfuncindex{#1}\textpy{#1}}
\newcommand*{\pyattrib}[1]{\pyattribindex{#1}\textpy{#1}}

% Set up environment for python scripts.
\ifthenelse{\boolean{savetrees}}{
  \CustomVerbatimEnvironment{python}{Verbatim}
                            {fontsize=\small}
  \CustomVerbatimEnvironment{pythonpluscommands}{Verbatim}
                            {fontsize=\small,commandchars=\\\{\}}
}{
  \CustomVerbatimEnvironment{python}{Verbatim}{}
  \CustomVerbatimEnvironment{pythonpluscommands}{Verbatim}
                            {commandchars=\\\{\}}
}

% Used to insert a placeholder for something in a Python script that the
% user replaces with a system-specific value.
\newcommand*{\argdesc}[1]{\textrm{$\langle$\emph{#1}$\rangle$}}

% Insert an icon image.
\newlength{\fontdrop}		% Set length to drop below baseline so that
\settodepth{\fontdrop}{()}	% we can drop the image to fill the actual line
\newcommand*{\includeinlinegraphics}[1]{%
  \raisebox{-\fontdrop}{\includegraphics[height=\baselineskip]{#1}}%
}
\newcommand*{\icon}[1]{\includeinlinegraphics{images/icons/#1}}

% Common images for the object inspector buttons.
\newcommand{\apply}{\includeinlinegraphics{images/Apply}\xspace}
\newcommand{\reset}{\includeinlinegraphics{images/Reset}\xspace}
\newcommand{\delete}{\includeinlinegraphics{images/Delete}\xspace}

\newcommand*{\sourceindex}[1]{\index{#1}\index{source!#1}}
\newcommand*{\filterindex}[1]{\index{#1}\index{filter!#1}}

% Icons for common filters.
\newcommand{\calculator}{\filterindex{calculator}\icon{pqCalculator24}\xspace}
\newcommand{\contour}{\filterindex{contour}\icon{pqIsosurface24}\xspace}
\newcommand{\clip}{\filterindex{clip}\icon{pqClip24}\xspace}
\newcommand{\slice}{\filterindex{slice}\icon{pqSlice24}\xspace}
\newcommand{\threshold}{\filterindex{threshold}\icon{pqThreshold24}\xspace}
\newcommand{\extractSubset}{\filterindex{extract subset}\icon{pqExtractGrid24}\xspace}
\newcommand{\glyph}{\filterindex{glyph}\icon{pqGlyph24}\xspace}
\newcommand{\streamTracer}{\filterindex{stream tracer}\icon{pqStreamTracer24}\xspace}
\newcommand{\warp}{\filterindex{warp!vector}\icon{pqWarp24}\xspace}
\newcommand{\group}{\filterindex{group}\icon{pqGroup24}\xspace}
\newcommand{\extractGroup}{\filterindex{extract group}\icon{pqGroupExtract24}\xspace}

% Icons for data analysis filters.
\newcommand{\extractSelection}{\filterindex{extract selection}\icon{pqExtractSelection24}\xspace}
\newcommand{\plotGlobal}{\filterindex{plot global variables over time}\icon{pqPlotGlobalOverTime24}\xspace}
\newcommand{\plotOverLine}{\filterindex{plot over line}\icon{pqPlotOverLine24}\xspace}
\newcommand{\plotSelectionOverTime}{\filterindex{plot selection over time}\icon{pqPlotSelectionOverTime24}\xspace}
\newcommand{\probe}{\filterindex{probe location}\icon{pqProbeLocation24}\xspace}
\newcommand{\histogram}{\filterindex{histogram}\icon{pqHistogram24}\xspace}

% Find Data icon
\newcommand{\findData}{\index{find data}\icon{pqFindData32}\xspace}

% Camera view icons
\newcommand{\xPlus}{\icon{pqXPlus24}\xspace}
\newcommand{\xMinus}{\icon{pqXMinus24}\xspace}
\newcommand{\yPlus}{\icon{pqYPlus24}\xspace}
\newcommand{\yMinus}{\icon{pqYMinus24}\xspace}
\newcommand{\zPlus}{\icon{pqZPlus24}\xspace}
\newcommand{\zMinus}{\icon{pqZMinus24}\xspace}
\newcommand{\resetCamera}{\icon{pqResetCamera24}\xspace}

% Animation buttons
\newcommand{\vcrPlay}{\icon{pqVcrPlay32}\xspace}
\newcommand{\vcrPause}{\icon{pqVcrPause32}\xspace}
\newcommand{\vcrLoop}{\icon{pqVcrLoop24}\xspace}
\newcommand{\vcrFirst}{\icon{pqVcrFirst32}\xspace}
\newcommand{\vcrLast}{\icon{pqVcrLast32}\xspace}
\newcommand{\vcrForward}{\icon{pqVcrForward32}\xspace}
\newcommand{\vcrBack}{\icon{pqVcrBack32}\xspace}

% Multiview icons
\newcommand{\splitViewH}{\includegraphics[height=.75\baselineskip]{images/icons/pqSplitViewH12}\xspace}
\newcommand{\splitViewV}{\includegraphics[height=.75\baselineskip]{images/icons/pqSplitViewV12}\xspace}
\newcommand{\deleteView}{\icon{DeleteView}\xspace}
\newcommand{\maximizeView}{\icon{MaximizeView}\xspace}
\newcommand{\restoreView}{\icon{RestoreView}\xspace}

% Selection icons
\newcommand{\selectCellsOn}{\index{select!cells~on~surface}\icon{pqSurfaceSelectionCell24}\xspace}
\newcommand{\selectPointsOn}{\index{select!points~on~surface}\icon{pqSurfaceSelectionPoint24}\xspace}
\newcommand{\selectCellsThrough}{\index{select!frustum}\index{select!cells~through}\icon{pqFrustumSelectionCell24}\xspace}
\newcommand{\selectPointsThrough}{\index{select!frustum}\index{select!points~through}\icon{pqFrustumSelectionPoint24}\xspace}
\newcommand{\selectCellsPolygon}{\index{select!polygon}\index{select!cells~with~polygon}\icon{pqPolygonSelectSurfaceCell24}\xspace}
\newcommand{\selectPointsPolygon}{\index{select!polygon}\index{select!points~with~polygon}\icon{pqPolygonSelectSurfacePoint24}\xspace}
\newcommand{\selectBlocks}{\index{select!block}\icon{pqSelectBlock24}\xspace}

% Other common icons
\newcommand{\eyeball}{\icon{pqEyeball16}\xspace}
\newcommand{\eyeballg}{\icon{pqEyeballd16}\xspace}

\newcommand{\connect}{\icon{pqConnect32}\xspace}
\newcommand{\disconnect}{\icon{pqDisconnect32}\xspace}

% Used for saving enumeration numbers
\newcounter{saveenumi}
\newcommand{\savecounter}{\setcounter{saveenumi}{\theenumi}}
\newcommand{\restorecounter}{\setcounter{enumi}{\thesaveenumi}}

% Used for adding notes about things to fix later.
\newcommand{\fix}[1]{{\color{red}\textbf{\textsc{[#1]}}}}
%\newcommand{\fix}[1]{}

% Hyphenation of words that do not follow standard English rules.
\hyphenation{Para-View}


% -----------------------------------------------------------------------------
\begin{document}

\frontmatter

\sloppy

\begin{titlepage}
  %\sffamily

  \vspace*{\stretch{1}}

  \noindent\rule{\linewidth}{1.5pt}
  \begin{centering}
    \Huge \bfseries
    @LONG_TITLE@

  \end{centering}
  \noindent\rule{\linewidth}{1.5pt}

  \vspace*{\stretch{1}}

  \begin{centering}
    \Large
    Kenneth~Moreland \\
    \small
    Sandia National Laboratories \\
    \href{mailto:kmorel@sandia.gov}{kmorel@sandia.gov} \\
  \end{centering}

  \vspace*{\stretch{6}}

  \begin{centering}
    \rmfamily\tiny

    Sandia National Laboratories is a multi-program laboratory managed and
    operated by Sandia Corporation, a wholly owned subsidiary of Lockheed
    Martin Corporation, for the U.S. Department of Energy's National
    Nuclear Security Administration under contract DE-AC04-94AL85000.

    SAND 2013-9578P \\
  \end{centering}
  \noindent
  \includegraphics[height=.35in]{images/snllineblk}
  \hfill
  \includegraphics[height=.35in]{images/DOEbwlogo}
\end{titlepage}

% I probably don't really need this.  If I want to bring it back, I should
% still disable it from the savetrees mode.  It wastes space and looks
% funny.
%%% \chapter*{Abstract}

%%% ParaView is a powerful open-source turnkey application for analyzing and
%%% visualizing large data sets in parallel.  ParaView is regularly used by
%%% Sandia National Laboratories analysts to visualize simulations run on the
%%% Red Storm and ASC Purple supercomputers and by thousands of other users in
%%% worldwide.  Designed to be configurable, extendible, and scalable, ParaView
%%% is built upon the Visualization Toolkit (VTK) to allow rapid deployment of
%%% visualization components.  This tutorial presents the architecture of
%%% ParaView and the fundamentals of parallel visualization.  Attendees will
%%% learn the basics of using ParaView for scientific visualization with
%%% hands-on lessons.  The tutorial features detailed guidance in visualizing
%%% the massive simulations run on today's supercomputers and an introduction
%%% to scripting and extending ParaView.

\tableofcontents

\listofexercise

\mainmatter

\input{Introduction.tex}

\input{BasicUsage.tex}

\input{VisualizingLargeModels.tex}

\input{BatchPythonScripting.tex}

\input{FurtherReading.tex}

\backmatter

\chapter{Acknowledgements}

Thanks to Amy Squillacote, David DeMarle, and W. Alan Scott for
contributing material to the tutorial.  And, of course, thanks to everyone
at Kitware, Sandia National Laboratories, Los Alamos National Laboratory,
and all other contributing organizations for their hard work in making
ParaView what it is today.

This work was supported by the Director, Office of Advanced Scientific
Computing Research, Office of Science, of the U.S. Department of Energy
under Contract No. 12-015215, through the Scientific Discovery through
Advanced Computing (SciDAC) Institute of Scalable Data Management,
Analysis and Visualization.

Sandia National Laboratories is a multi-program laboratory managed and
operated by Sandia Corporation, a wholly owned subsidiary of Lockheed
Martin Corporation, for the U.S. Department of Energy's National Nuclear
Security Administration under contract DE-AC04-94AL85000.

\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{Index}
\printindex

\end{document}
