% -*- latex -*-

% Program listings need to be typeset
\usepackage{color}
\usepackage[final]{listings}

% We have lots of chapters and lots of listings. Thus, the table of listings at the beginning of the book needs more space for the number. This LaTeX magic comes from https://tex.stackexchange.com/questions/107047/lstlistoflistings-doesnt-have-enough-room-between-numbers-and-title
\makeatletter
\def\l@lstlisting#1#2{\@dottedtocline{1}{1.5em}{3em}{#1}{#2}}
\makeatother

\definecolor{vtkmidentifier}{rgb}{0,0,1}
\definecolor{vtkmnamespace}{rgb}{0.5,0,0}
\definecolor{vtkmmacro}{rgb}{0.5,0,0}
\definecolor{vtkmsignature}{rgb}{0,0.5,0}
\definecolor{codebackground}{rgb}{0.95,0.95,0.95}

\lstloadlanguages{C,C++}
%% \lstset{fontadjust=false,basicstyle=\scriptsize\ttfamily}
\lstset{fontadjust=false,basicstyle=\footnotesize\ttfamily,
        xleftmargin=3em, xrightmargin=3em,
        numbers=left, numberstyle=\footnotesize, numbersep=1em,
        belowcaptionskip=0pt,  %Prevents caption from being on different page.
        frame=l, backgroundcolor=\color{codebackground}}
\lstdefinelanguage{VTKm}{
  morekeywords={struct,class,public,typedef,using,typename,void,template,return,operator,const,for,int,float,double},
  morekeywords={[2]Id,Id2,Id3,IdComponent,Vec,
                   Int8,Int16,Int32,Int64,UInt8,UInt16,UInt32,UInt64,
                   Float32,Float64,FloatDefault,
                   make_Id3,make_Vec,
                   Dot,NUM_COMPONENTS,
                   VecC,VecCConst,make_VecC,
                   VecFromPortal,VecFromPortalPermute,
                   VecRectilinearPointCoordinates,
                   VecVariable,
                   Extent,Extent3,Pair,
                   Range,Bounds,
                   Initialize,InitializeResult,InitializeOptions,
                   SetStderrLogLevel,SetLogLevelName,GetLogLevelName,LogLevel,
                   GetStackTrace,GetHumanReadableSize,GetSizeString,
                   TypeToString,SetThreadName,GetThreadName,
                   ExtentPointDimensions,ExtentCellDimensions,
                   ExtentNumberOfPoints,ExtentNumberOfCells,
                   ExtentPointFlatIndexToTopologyIndex,
                   ExtentCellFlatIndexToTopologyIndex,
                   ExtentPointTopologyIndexToFlatIndex,
                   ExtentCellTopologyIndexToFlatIndex,
                   ExtentFirstPointOnCell,
                   ListTagEmpty,
                   ListTagBase,
                   ListTagJoin,
                   ListForEach,
                   TypeListTagId,TypeListTagId2,TypeListTagId3,
                   TypeListTagIndex,
                   TypeListTagFieldScalar,TypeListTagScalarAll,
                   TypeListTagFieldVec2,
                   TypeListTagFieldVec3,
                   TypeListTagFieldVec4,
                   TypeListTagField,
                   TypeListTagVecCommon,TypeListTagVecAll,
                   TypeListTagAll,TypeListTagCommon,
                   IsZeroInitialized,NotZeroInitialized,LogicalNot,
                   Equal,NotEqual,SortLess,SortGreater,LogicalAnd,LogicalOr,
                   Sum,Product,Maximum,Minimum,MinAndMax,
                   BitwiseAnd,BitwiseOr,BitwiseXor,
                   WorkletBase,
                   WorkletMapField,
                   WorkletMapTopology,
                   WorkletMapPointToCell,
                   WorkletMapCellToPoint,
                   WorkletPointNeighborhood,
                   WorkletReduceByKey,
                   DispatcherMapField,
                   DispatcherMapTopology,
                   DispatcherPointNeighborhood,
                   DispatcherReduceByKey,
                   ScatterIdentity,
                   ScatterUniform,
                   ScatterCounting,
                   Keys,
                   ExecutionObjectBase,
                   AverageByKey,
                   TypeTraits,NumericTag,DimensionalityTag,
                   TypeTraitsRealTag,TypeTraitsIntegerTag,
                   TypeTraitsScalarTag,TypeTraitsVectorTag,
                   VecTraits,ComponentType,HasMultipleComponents,
                   IsSizeStatic,VecTraitsTagSizeStatic,VecTraitsTagSizeVariable,
                   VecTraitsTagMultipleComponents,
                   VecTraitsTagSingleComponent,
                   Error,ErrorExecution,
                   ErrorBadAllocation,
                   ErrorBadType,
                   ErrorBadValue,
                   ErrorInternal,
                   DeviceAdapterTagSerial,
                   DeviceAdapterTagCuda,
                   DeviceAdapterTagOpenMP,
                   DeviceAdapterTagTBB,
                   DeviceAdapterTraits,
                   DeviceAdapterId,
                   DeviceAdapterNameType,
                   RuntimeDeviceTracker,GetGlobalRuntimeDeviceTracker,
                   TryExecute,
                   CellDataToPointDataGenerateKeys,
                   CellDataToPointDataReduceKeys,
                   CellGradient,
                   Cosine,Sine,Magnitude,Square,
                   Elevation,
                   FieldToColors,
                   MarchingCubesClassify,MarchingCubesGenerate,
                   PointDataToCellData,
                   SliceClassify,SliceGenerate,
                   Streamline,
                   Tetrahedralize,
                   ThresholdClassify,ThresholdTopology,
                   ClipWithImplicitFunction,ClipWithField,
                   ArrayHandle,make_ArrayHandle,
                   ArrayHandleCast,make_ArrayHandleCast,
                   ArrayHandleCompositeVector,make_ArrayHandleCompositeVector,
                   ArrayHandleCompositeVectorType,
                   ArrayHandleConstant,make_ArrayHandleConstant,
                   ArrayHandleCounting,make_ArrayHandleCounting,
                   ArrayHandleDiscard,
                   ArrayHandleExtractComponent,make_ArrayHandleExtractComponent,
                   ArrayHandleGroupVec,make_ArrayHandleGroupVec,
                   ArrayHandleGroupVecVariable,make_ArrayHandleGroupVecVariable,
                   ConvertNumComponentsToOffsets,
                   ArrayHandleImplicit,make_ArrayHandleImplicit,
                   ArrayHandleIndex,
                   ArrayHandleTransform,make_ArrayHandleTransform,
                   ArrayHandleSwizzle,make_ArrayHandleSwizzle,
                   ArrayHandlePermutation,make_ArrayHandlePermutation,
                   ArrayHandleZip,make_ArrayHandleZip,
                   ArrayHandleUniformPointCoordinates,
                   ArrayHandleCartesianProduct,make_ArrayHandleCartesianProduct,
                   ArrayHandleVirtual,
                   ArrayPortalToIterators,
                   ArrayPortalToIteratorBegin,ArrayPortalToIteratorEnd,
                   ArrayCopy,
                   ArrayRangeCompute,
                   Storage,
                   StorageTagBasic,
                   StorageTagImplicit,
                   ArrayContainerControl,
                   ArrayContainerControlTagBasic,
                   ArrayContainerControlTagImplicit,
                   ArrayTransfer,
                   ArrayManagerExecution,
                   ArrayManagerExecutionShareWithControl,
                   ExecutionPortalFactoryBasic,
                   ExecutionPortalFactoryBasicShareWithControl,
                   ExecutionArrayInterfaceBasic,
                   ExecutionArrayInterfaceBasicBase,
                   ExecutionArrayInterfaceBasicShareWithControl,
                   StorageBasicBase,
                   TypelessExecutionArray,
                   VirtualObjectTransfer,
                   VirtualObjectTransferShareWithControl,
                   VariantArrayHandle,VariantArrayHandleBase,
                   DynamicPointCoordinates,
                   PointCoordinatesArray,PointCoordinatesUniform,
                   PointCoordinatesBase,
                   PointCoordinatesListTagCommon,
                   Timer,
                   DataSet,
                   MultiBlock,
                   BoundsCompute,
                   BoundsGlobalCompute,
                   FieldRangeCompute,
                   FieldRangeGlobalCompute,
                   CellSet,
                   CellSetExplicit,
                   CellSetPermutation,
                   CellSetSingleType,
                   CellSetStructured,
                   DynamicCellSet,
                   Field,
                   CoordinateSystem,
                   DataSetBuilderExplicit,DataSetBuilderExplicitIterative,
                   DataSetBuilderRectilinear,
                   DataSetBuilderUniform,
                   DataSetFieldAdd,
                   CellLocator,CellLocatorGeneral,
                   CellLocatorUniformGrid,CellLocatorRectilinearGrid,
                   CellLocatorUniformBins,CellLocatorBoundingIntervalHierarchy,
                   PointLocator,
                   PointLocatorUniformGrid,
                   FilterCell,
                   FilterDataSet,
                   FilterDataSetWithField,
                   FilterField,
                   FieldMetadata,
                   FilterTraits,
                   FieldSelection,
                   CreateResult,
                   PolicyBase,
                   PolicyDefault,
                   ApplyPolicy,
                   CellAverage,
                   PointAverage,
                   ExternalFaces,
                   MarchingCubes,
                   PointElevation,
                   CleanGrid,
                   Threshold,
                   VertexClustering,
                   Actor,
                   AxisAnnotation, AxisAnnotation2D, AxisAnnotation3D,
                   BitmapFont, BitmapFontFactory,
                   BoundingBoxAnnotation,
                   Camera,
                   Canvas,
                   CanvasGL,
                   CanvasOSMesa,
                   CanvasRayTracer,
                   Color,
                   ColorBarAnnotation,
                   ColorTable,
                   MatrixHelpers,
                   Scene,
                   Mapper,
                   MapperConenctivity,
                   MapperGL,
                   MapperRayTracer,
                   MapperVolume,
                   MapperWireframer,
                   TextAnnotation,
                   Triangulator,
                   View,View1D,View2D,View3D,
                   WorldAnnotator, WorldAnnotatorGL,
                   DeviceAdapterAlgorithm, DeviceAdapterAlgorithmGeneral,
                   Algorithm
                   DeviceAdapterTimerImplementation,
                   IteratorFromArrayPortal,
                   TypeCheck,TypeCheckTagArray,TypeCheckTagExecObject,
                   TypeCheckTagAtomicArray,
                   TypeCheckTagCellSet,TypeCheckTagKeys,
                   Transport,
                   TransportTagArrayIn,TransportTagArrayOut,
                   TransportTagArrayInOut,
                   TransportTagExecObject,
                   TransportTagWholeArrayIn,TransportTagWholeArrayOut,
                   TransportTagWholeArrayInOut,
                   TransportTagAtomicArray,
                   TransportTagCellSetIn,TransportTagTopologyFieldIn,
                   TransportTagKeysIn,
                   TransportTagKeyedValuesIn,TransportTagKeyedValuesOut,
                   TransportTagKeyedValuesInOut,
                   TransportTagReducedValuesIn,
                   Fetch,
                   FetchTagArrayDirectIn,FetchTagArrayDirectOut,
                   FetchTagExecObject,
                   FetchtagCellSetIn,FetchTagArrayTopologyMapIn,
                   AspectTagDefault,
                   AspectTagWorkIndex,AspectTagOutputIndex,
                   AspectTagVisitIndex,
                   AspectTagCellShape,
                   AspectTagFromCount,AspectTagFromIndices,
                   AspectTagValueCount,
                   ControlSignatureTagBase,ExecutionSignatureTagBase,
                   Invocation,
                   FunctionInterface,make_FunctionInterface,
                   FunctionInterfaceReturnContainer,
                   DynamicTransform,
                   CellField, CellVertices,
                   InterpolatedCellPoints,
                   CellTraits,NUM_VERTICES,
                   CellTagHexahedron, CellTagLine, CellTagQuadrilateral,
                   CellTagTetrahedron, CellTagTriangle, CellTagVectex,
                   CellTagVoxel, CellTagWedge,
                   CellTraits,
                   CellTopologicalDimensionsTag,
                   GridTagUniform, GridTagUnstructured,
                   NUM_VERTICES, TOPOLOGICAL_DIMENSIONS,
                   ParametricCoordinates, CellDerivative,
                   SortLess, SortGreater,
                   Max, Min,
                   Cbrt, Exp, Exp10, Exp2, ExpM1, Log, Log10, Log1P, Log2,
                   Pow, RCbrt, RSqrt, Sqrt,
                   Matrix, Matrix2x2, Matrix3x3, Matrix4x4,
                   MatrixColumn, MatrixDeterminant, MatrixIdentity,
                   MatrixInverse, MatrixMultiply, MatrixRow,
                   MatrixSetColumn, MatrixSetRow, MatrixTranspose,
                   SolveLinearSystem,
                   NewtonsMethod,NewtonsMethodResult,
                   Ceil, Epsilon, Floor, FMod, Infinity, IsFinite, IsInf,
                   IsNan, ModF, Nan, NegativeInfinity, Remainder,
                   RemainderQuotient, Round,
                   Abs, CopySign, IsNegative, SignBit,
                   ACos, ACosH, ASin, ASinH, ATan, ATan2, ATanH, Cos, CosH,
                   Pi, Sin, SinH, Tan, TanH,
                   Cross, Magnitude, MagnitudeSquared, Lerp, Normal,
                   Normalize, RMagnitude, TriangleNormal,
                   ImplicitFunction,
                   Box,Cylinder,Frustum,Plane,Sphere,
                   ImplicitFunctionHandle,make_ImplicitFunctionHandle
                   CellShapeTagEmpty,
                   CellShapeTagVertex,
                   CellShapeTagLine,
                   CellShapeTagTriangle,
                   CellShapeTagPolygon,
                   CellShapeTagQuad,
                   CellShapeTagTetra,
                   CellShapeTagHexahedron,
                   CellShapeTagWedge,
                   CellShapeTagPyramid,
                   CellShapeTagGeneric,
                   CellShapeIdToTag,
                   CELL_SHAPE_EMPTY,
                   CELL_SHAPE_VERTEX,
                   CELL_SHAPE_LINE,
                   CELL_SHAPE_TRIANGLE,
                   CELL_SHAPE_POLYGON,
                   CELL_SHAPE_QUAD,
                   CELL_SHAPE_TETRA,
                   CELL_SHAPE_HEXAHEDRON,
                   CELL_SHAPE_WEDGE,
                   CELL_SHAPE_PYRAMID,
                   CellTraits,
                   CellTopologicalDimensionsTag,
                   CellTraitsTagSizeFixed,
                   CellTraitsTagSizeVariable,
                   ParametricCoordinatesToWorldCoordinates,
                   WorldCoordinatesToParametricCoordinates,
                   ParametricCoordinatesCenter,
                   ParametricCoordinatesPoint,
                   CellInterpolate,
                   CellDerivative,
                   CellEdgeNumberOfEdges,CellEdgeLocalIndex,
                   CellEdgeCanonicalId,
                   CellFaceNumberOfFaces,CellFaceNumberOfPoints,
                   CellFaceLocalIndex,CellFaceCanonicalId,
                   Hash,HashType,
                   TransferToOpenGL,
                   TopologyElementTagCell,
                   TopologyElementTagPoint,
                   TopologyElementTagEdge,
                   TopologyElementTagFace,
                   FieldNeighborhood,BoundaryState,
                   VTKDataSetReader,VTKDataSetWriter
                   },
  morekeywords={[3]VTKM_CONT,VTKM_EXEC,VTKM_EXEC_CONT,
                   VTKM_SUPPRESS_EXEC_WARNINGS,
                   VTKM_DEVICE_ADAPTER,
                   VTKM_DEVICE_ADAPTER_SERIAL,
                   VTKM_DEVICE_ADAPTER_CUDA,
                   VTKM_DEVICE_ADAPTER_OPENMP,
                   VTKM_DEVICE_ADAPTER_TBB,
                   VTKM_DEVICE_ADAPTER_ERROR,
                   VTKM_DEFAULT_DEVICE_ADAPTER_TAG,
                   VTKM_STORAGE,
                   VTKM_STORAGE_BASIC,
                   VTKM_STORAGE_ERROR,
                   VTKM_STORAGE_UNDEFINED,
                   VTKM_DEFAULT_STORAGE_TAG,
                   VTKM_ARRAY_HANDLE_SUBCLASS,VTKM_ARRAY_HANDLE_SUBCLASS_NT,
                   VTKM_ASSERT,VTKM_STATIC_ASSERT,
                   VTKM_DEFAULT_TYPE_LIST_TAG,
                   VTKM_DEFAULT_CONTAINER_LIST_TAG,
                   VTKM_DEFAULT_POINT_COORDINATES_LIST_TAG,
                   VTKM_VALID_DEVICE_ADAPTER,
                   VTKM_INVALID_DEVICE_ADAPTER,
                   VTKM_IS_DEVICE_ADAPTER_TAG,
                   VTKM_IS_ARRAY_HANDLE,
                   vtkmGenericCellShapeMacro
                   },
  morekeywords={[4]vtkm,exec,cont,worklet,math,arg,internal,detail,
                   io,reader,writer,
                   filter,
                   rendering,
                   cuda,openmp,tbb},
  morekeywords={[5]ControlSignature,ExecutionSignature,
                   InputDomain,
                   ScatterType,
                   FieldIn,FieldOut,FieldInOut,
                   FieldInTo,FieldInFrom,
                   FieldInPoint,FieldInCell,FieldOutCell,FieldInOutCell,
                   FieldInNeighborhood,
                   Boundary,
                   CellSetIn,
                   KeysIn,
                   ValuesIn,ValuesInOut,ValuesOut,
                   ReducedValuesIn,ReducedValuesInOut,ReducedValuesOut,
                   WholeArrayIn,WholeArrayOut,WholeArrayInOut,
                   AtomicArrayInOut,
                   WholeCellSetIn,
                   ExecObject,
                   WorkIndex,VisitIndex,InputIndex,OutputIndex,ThreadIndices,
                   ThreadIndices,
                   CellShape,
                   FromCount,PointCount,CellCount,
                   FromIndices,PointIndices,CellIndices,
                   OnBoundary,
                   _1,_2,_3,_4,_5,_6,_7,_8,_9
                   }
}
\lstset{language=VTKm}
\lstset{
  keywordstyle=\bfseries,
  keywordstyle=[2]\color{vtkmidentifier},
  keywordstyle=[3]\color{vtkmmacro},
  keywordstyle=[4]\color{vtkmnamespace},
  keywordstyle=[5]\color{vtkmsignature}
}

\renewcommand{\lstlistlistingname}{List of Examples}
\renewcommand{\lstlistingname}{Example}

\newcommand*{\textcode}[1]{\textnormal{\texttt{#1}}}
\newcommand*{\textnamespace}[1]{\textcode{\color{vtkmnamespace}{#1}}}
\newcommand*{\textmacro}[1]{\textcode{\color{vtkmmacro}{#1}}}
\newcommand*{\textidentifier}[1]{\textcode{\color{vtkmidentifier}{#1}}}
\newcommand*{\textmethod}[1]{\textcode{#1}}
\newcommand*{\textsignature}[1]{\textcode{\color{vtkmsignature}{#1}}}

\newcommand*{\vtkmmacro}[1]{\textmacro{#1}\index{#1}}

\newcommand{\vtkmcontmodifier}{\vtkmmacro{VTKM\_CONT}\index{modifier!control}\index{function modifier}\index{method modifier}\xspace}
\newcommand{\vtkmexecmodifier}{\vtkmmacro{VTKM\_EXEC}\index{modifier!execution}\index{function modifier}\index{method modifier}\xspace}
\newcommand{\vtkmexeccontmodifier}{\vtkmmacro{VTKM\_EXEC\_CONT}\index{modifier!control}\index{modifier!execution}\index{function modifier}\index{method modifier}\xspace}

\newcommand{\controlsignature}{\textsignature{ControlSignature}\index{control signature}\index{signature!control}\xspace}
\newcommand{\executionsignature}{\textsignature{ExecutionSignature}\index{execution signature}\index{signature!execution}\xspace}
\newcommand{\inputdomain}{\textsignature{InputDomain}\index{input domain}\xspace}
\newcommand{\scattertype}{\textsignature{ScatterType}\index{scatter type}\xspace}

\newcommand*{\sigtag}[1]{\textsignature{#1}\index{#1}\index{signature tags!#1}}
\newcommand*{\sigtagnum}[1]{\sigtag{\_#1}}
\newcommand*{\sigtagmod}[2]{\sigtag{#1}\textcode{<}\sigtag{#2}\textcode{>}}
\newcommand*{\sigtagmodnum}[2]{\sigtag{#1}\textcode{<}\sigtagnum{#2}\textcode{>}}

\NewDocumentCommand{\WriteNamespace}{ m g g g }{%
  \textnamespace{#1}%
  \IfValueT{#2}{\textcode{:\colonhyp}\textnamespace{#2}}%
  \IfValueT{#3}{\textcode{:\colonhyp}\textnamespace{#3}}%
  \IfValueT{#4}{\textcode{:\colonhyp}\textnamespace{#4}}%
}

\NewDocumentCommand{\IndexNamespace}{ m g g g }{%
  \IfValueTF{#4}{%
    \index{#4 namespace}\index{#1::#2::#3::#4}\index{namespace!#1::#2::#3::#4}%
  }{%
    \IfValueTF{#3}{%
      \index{#3 namespace}\index{#1::#2::#3}\index{namespace!#1::#2::#3}%
    }{%
      \IfValueTF{#2}{%
        \index{#2 namespace}\index{#1::#2}\index{namespace!#1::#2}%
      }{%
        \index{#1 namespace}\index{namespace!#1}%
      }%
    }%
  }%
}

\NewDocumentCommand{\namespace}{ m g g g }{%
  \WriteNamespace{#1}{#2}{#3}{#4}\IndexNamespace{#1}{#2}{#3}{#4}
}

\NewDocumentCommand{\classmember}{ s o o o o m m }{%
  \IfBooleanF{#1}{%
    \IfValueT{#2}{%
      \WriteNamespace{#2}{#3}{#4}{#5}%
      \textcode{:\colonhyp}%
    }%
    \textidentifier{#6}\textcode{:\colonhyp}%
  }%
  \textmethod{#7}%
  \index{#6!#7}%
  \index{#7}%
}

\NewDocumentCommand{\WriteIndexNamespaceIdentifier}{ s m o o o m o }{%
  \WriteNamespace{#2}{#3}{#4}{#5}\textcode{:\colonhyp}\textidentifier{#6}%
  \index{#6}%
  \IfValueT{#7}{%
    \textcode{:\colonhyp}\textmethod{#7}%
    \index{#7}\index{#6!#7}%
  }%
  \IfBooleanT{#1}{%
    \textcode{()}%
  }%
  \xspace%
}

\NewDocumentCommand{\NamespaceImpl}{ m m o o o m o }{%
  \ifthenelse{\equal{#6}{}}{%
    % No classname/identifier given. Just write namespace
    \namespace{#2}{#3}{#4}{#5}%
  }{%
    \IfBooleanTF{#1}{%
      \WriteIndexNamespaceIdentifier*{#2}[#3][#4][#5]{#6}[#7]%
    }{%
      \WriteIndexNamespaceIdentifier{#2}[#3][#4][#5]{#6}[#7]%
    }%
  }%
}


\NewDocumentCommand{\vtkm}{smo}{\NamespaceImpl{#1}{vtkm}{#2}[#3]}
\NewDocumentCommand{\vtkminternal}{smo}{\NamespaceImpl{#1}{vtkm}[internal]{#2}[#3]}

\NewDocumentCommand{\vtkmcont}{smo}{\NamespaceImpl{#1}{vtkm}[cont]{#2}[#3]}
\NewDocumentCommand{\vtkmcontinternal}{smo}{\NamespaceImpl{#1}{vtkm}[cont][internal]{#2}[#3]}
\NewDocumentCommand{\vtkmcontarg}{smo}{\NamespaceImpl{#1}{vtkm}[cont][arg]{#2}[#3]}

\NewDocumentCommand{\vtkmexec}{smo}{\NamespaceImpl{#1}{vtkm}[exec]{#2}[#3]}
\NewDocumentCommand{\vtkmexecarg}{smo}{\NamespaceImpl{#1}{vtkm}[exec][arg]{#2}[#3]}
\NewDocumentCommand{\vtkmexecinternal}{smo}{\NamespaceImpl{#1}{vtkm}[exec][internal]{#2}[#3]}

\NewDocumentCommand{\vtkmworklet}{smo}{\NamespaceImpl{#1}{vtkm}[worklet]{#2}[#3]}
\NewDocumentCommand{\vtkmworkletinternal}{smo}{\NamespaceImpl{#1}{vtkm}[worklet][internal]{#2}[#3]}

\NewDocumentCommand{\vtkmio}{smo}{\NamespaceImpl{#1}{vtkm}[io]{#2}[#3]}
\NewDocumentCommand{\vtkmioreader}{smo}{\NamespaceImpl{#1}{vtkm}[io][reader]{#2}[#3]}
\NewDocumentCommand{\vtkmiowriter}{smo}{\NamespaceImpl{#1}{vtkm}[io][writer]{#2}[#3]}

\NewDocumentCommand{\vtkmfilter}{smo}{\NamespaceImpl{#1}{vtkm}[filter]{#2}[#3]}
\NewDocumentCommand{\vtkmfilterinternal}{smo}{\NamespaceImpl{#1}{vtkm}[filter][internal]{#2}[#3]}

\NewDocumentCommand{\vtkmrendering}{smo}{\NamespaceImpl{#1}{vtkm}[rendering]{#2}[#3]}

\NewDocumentCommand{\vtkmopengl}{smo}{\NamespaceImpl{#1}{vtkm}[opengl]{#2}[#3]}

\NewDocumentCommand{\vtkmcontcuda}{smo}{\NamespaceImpl{#1}{vtkm}[cont][cuda]{#2}[#3]}
\NewDocumentCommand{\vtkmcontopenmp}{smo}{\NamespaceImpl{#1}{vtkm}[cont][openmp]{#2}[#3]}
\NewDocumentCommand{\vtkmcontserial}{smo}{\NamespaceImpl{#1}{vtkm}[cont][serial]{#2}[#3]}
\NewDocumentCommand{\vtkmconttbb}{smo}{\NamespaceImpl{#1}{vtkm}[cont][tbb]{#2}[#3]}

\newcommand*{\tparams}[1]{\textcode{<#1>}}

\newcommand*{\textfilename}[1]{\textsf{#1}}
\newcommand*{\vtkmheader}[2]{%
  \textfilename{#1\fshyp{}#2}\index{#1\fshyp#2}\index{#2}}

\newcommand*{\cmakevar}[1]{%
  \textsf{#1}%
  \index{#1}%
  \index{CMake!configuration!#1}}

\lstnewenvironment{vtkmexample}[2][-*-]{
  \lstset{caption={#2}}
  \ifthenelse{\equal{#1}{-*-}}{}{\lstset{label=#1}}
}{
}

\newcommand*{\vtkmlisting}[3][]{
  \lstinputlisting[language=VTKm, label=#1, caption={#2}]{examples/listing_#3}
}

% This is an ``odd'' identifier that comes up a lot.
\newcommand*{\Veclike}{\textidentifier{Vec}-like\xspace}

% Used for source code, shell, CMake, or other examples that are not worth
% creating a ``language'' for.
\lstnewenvironment{blankexample}[2][-*-]{
  \lstset{language={}}
  \lstset{caption={#2}}
  \ifthenelse{\equal{#1}{-*-}}{}{\lstset{label=#1}}
}{
}
