\documentclass[12pt]{beamer}
\input{BEAMERoptions.tex}

% ----- Packages and libraries ----- %
\usepackage[T1]{fontenc} 				% cut/paste and search with "_"
\usepackage[english]{babel}
\usepackage{graphics}
\usepackage{verbatim}
\usepackage{times}
\usepackage{graphicx}
\usepackage{epsfig}
\usepackage{subfigure}
\usepackage{amssymb}
\usepackage{amsmath, amsfonts}
\usepackage{amsthm}
\usepackage{color}
\usepackage{alltt}
\usepackage{anyfontsize}
\usepackage{tikz}
   \usetikzlibrary{shapes, arrows, shadows}

\newcommand{\Frametitle}[1]{\frametitle{\includegraphics[width=0.25in]{esp_logo.png}
      \hspace{0.05in} #1}}

\newcommand{\FrameTitle}[1]{\frametitle{\includegraphics[width=0.3in]{caps_logo.png}
      \hspace{0.05in} #1}}

\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]
\definecolor{smoothgreen}{RGB}{45,169,45}

%============================
% command to repeate a ~ n-times
%============================
\newcount\myloopcounter

\newcommand{\spaces}[1][10]{%
  \myloopcounter0% initialize the loop counter
  \loop\ifnum\myloopcounter < #1 % Test if the loop counter is < #1
  ~%
  \advance\myloopcounter by 1 %
  \repeat % start again
}
%============================

% ----- Presentation information ----- %
\title[Bounds \& The AIM Discretization Structure]{
\includegraphics[width=1.0in]{caps_logo.png}\\
Computational Aircraft Prototype Syntheses\\
AIM Programming \\
Bounds \& The AIM Discretization Structure\\[0.02in]
For {\tt ESP} Rev 1.28}

\author[Haimes]{
Bob Haimes \\
  {\footnotesize \textcolor{blue}{bob@geocentrictech.com}~~or~~\textcolor{blue}{haimes@mit.edu} \\[-0.03in]
    Geocentric Technologies LLC}
}

\date[July 2025]{}

% ----- Document follows ----- %

\begin{document}

\begin{frame}
  \titlepage
\end{frame}

  \begin{frame}
  \FrameTitle{CAPS Definitions}

  \begin{block}{Bound Object}
\footnotesize
A Bound is a logical grouping of BRep Objects that all represent the same entity in an engineering sense (such as the ``outer surface of the wing'').  A Bound may include BRep entities from multiple Bodies; this enables the passing of information from one Body (for example, the aero OML) to another (the structures Body). This is accomplished either through interpolation or through a scheme that provides conservative transfers.\\[0.125in]

Internally the data to support transfers is held in the CAPS structure {\tt capsDiscr} (one per Analysis instance) -- the VertexSet Object.  This is
manipulated by CAPS proper and the AIM functions documented here.\\[0.125in]

\center {\bf Creating the detailed data associated with a Bound is the focus of this session.}
\end{block}

\end{frame}

\begin{frame}
  \FrameTitle{CAPS Definitions}

\begin{block}{VertexSet Object}
\footnotesize
A VertexSet is a {\it connected} or {\it unconnected} group of locations at which discrete information is defined.  Each {\it connected} VertexSet is associated with one Bound and a single {\it Analysis}. A VertexSet can contain more than one DataSet. A {\it connected} VertexSet can refer to 2 differing sets of locations. This occurs when the solver stores it's data at different locations than the vertices that define the discrete geometry (i.e. cell centered or non-isoparametric FEM discretizations). In these cases the solution data is provided in a different manner than the geometric.
\end{block}

\begin{block}{DataSet Object}
\footnotesize
A DataSet is a set of engineering data associated with a VertexSet. The rank of a DataSet is the (user/pre)-defined number of dependent values associated with each vertex; for example, scalar data (such as {\it pressure}) will have rank of one and vector data (such as {\it displacement}) will have a rank of three.  Values in the DataSet can either be deposited there by an application or can be computed (via evaluations, data transfers or sensitivity calculations).
\end{block}

\end{frame}

\begin{frame}
  \FrameTitle{CAPS Objects}

  \begin{center}
 \def\arraystretch{1.15}
  \begin{tabular}{| l | l | l |}
    \hline
   \bf Object & \bf SubTypes & \bf Parent Object \\
    \hline
        \hline
    capsProblem     & Parametric, Static   &  \\
        \hline
    ~capsValue         &  GeometryIn, GeometryOut, & capsProblem \\
                              &  Parameter, User   &                       \\
                                  \hline
    ~capsAnalysis     &              & capsProblem \\
        \hline
    ~~~capsValue         &    AnalysisIn, AnalysisOut,  & capsAnalysis \\
                                   &         AnalysisDynO        &  \\
                                   \hline
    ~capsBound       &               & capsProblem \\
        \hline
    ~~~capsVertexSet    & Connected, Unconnected & capsBound\\
        \hline
    ~~~~~capsDataSet     & FieldOut, FieldIn\textcolor{red}{*}, User, & capsVertexSet\\
                              & GeomSens, TessSens, Builtin &        \\
    \hline
  \end{tabular}

  \vspace{0.05in}
  Body Objects are EGADS Objects (egos)\\[0.05in]
  \small
  \textcolor{red}{*} A change in a FieldIn DataSet will {\it dirty} the Analysis Instance
\end{center}

 \end{frame}

   \begin{frame}
  \FrameTitle{Bounds -- Analysis Data}

      \begin{block}{DataSet Naming Conventions}
      \begin{itemize}
      \item Multiple DataSets in a Bound can have the same Name
      \item Allows for automatic data transfers
      \item One {\it source} (from either {\it FieldOut} or {\it User} Methods)
      \item Reserved Names:\\
      \vspace{0.05in}
      \footnotesize
        \begin{tabular}{lcll}
    DSet Name & rank & Meaning & Comments \\
    \hline
    xyz   &  3  & {\it Geometry} Positions   &  \\
   xyzd  &  3 & {\it Data} Positions   & Not for vertex-based  \\
               &      &   &  discretizations \\
    param    & 2  &  [u,v] data for {\it Geometry}  &  \\
            &      & Positions   &  \\
    paramd  &  2 & [u,v] for {\it Data} Positions   & Not for vertex-based \\
                &      &   &  discretizations \\
    {\it GeomIn} & 3  &  Sensitivity for the Geometry  & can have {\it [irow, icol]} in \\
                &      &   Input {\it GeomIn}  & name \\
  \end{tabular}\\
      \end{itemize}
      \end{block}
  \end{frame}
  
   \begin{frame}
  \FrameTitle{AIM -- Registration/Initialization}
 \vspace{-0.1in}
%  \setbeamercolor{block title}{bg=red!80}
\begin{block}{Initialization Information for the AIM}
{\scriptsize

{\tt
icode = aimInitialize(\textcolor{magenta}{int} qFlag, \textcolor{magenta}{const char}  *uSys, \textcolor{magenta}{void} *aimInfo, \\
\spaces[22]\textcolor{magenta}{void} **instStore, \textcolor{magenta}{int} *major, \textcolor{magenta}{int} *minor,  \\
\spaces[22]\textcolor{magenta}{int} *nIn, \textcolor{magenta}{int} *nOut, \textcolor{magenta}{int} *nFields, \\
\spaces[22]\textcolor{magenta}{char} ***fnames, \textcolor{magenta}{int} **franks, \textcolor{magenta}{int} **fInOut)}

\begin{description}
\vspace{-0.03in}
\item[qFlag] \textcolor{gray}{$-1$ indicates a query and not a new analysis instance (0 or greater)}
\item[uSys] \textcolor{gray}{a pointer to a character string declaring the unit system -- can be} \textcolor{magenta} {NULL}
\item[aimInfo] \textcolor{gray}{the AIM context} \textcolor{espred}{-- NULL if qFlag == -1}
\item[instStore] \textcolor{gray}{a returned pointer to a block of memory to be associated with this AIM instance}\\
\textcolor{gray}{may be returned as} \textcolor{magenta} {NULL} \textcolor{gray}{if no AIM state data is required}
\item[major] \textcolor{gray}{the returned AIM major version number}
\item[minor] \textcolor{gray}{the returned AIM minor version number}
\item[nIn]  \textcolor{gray}{the returned number of Inputs (minimum of 1)}
\item[nOut]  \textcolor{gray}{the returned number of possible Outputs}
\item[nFields] the returned number of fields to responds to for DataSet filling
\item[fnames] a returned pointer to a list of character strings with the field/DataSet names $\dagger$
\item[franks] a returned pointer to a list of ranks associated with each field $\dagger$
\item[fInOut] a returned pointer to a list of field flags (FIELDIN - input, FIELDOUT - output) $\dagger$
\item[icode] \textcolor{gray}{integer return code}
\end{description}}

\end{block}

\end{frame}

  \begin{frame}
  \FrameTitle{Conservative Data Transfers}

  \vspace{-0.075in}
  \begin{block}{Conservation is a statement of integration}
    \begin{itemize}
    \item Consistency with solvers is difficult (in general)
      \begin{itemize}
       \vspace{-0.02in}
      \item must hold onto the data required to do the integration
       \vspace{-0.02in}
      \item must be able to perform the integration in the same manner as the solver integrates
      \end{itemize}
     \vspace{-0.04in}
    \item How many different solver discretizations are there?
      \begin{itemize}
       \vspace{-0.02in}
      \item finite volume, finite element, ...
       \vspace{-0.02in}
      \item node-based or cell-based data storage
       \vspace{-0.02in}
      \item continuous or discontinuous formulations
       \vspace{-0.02in}
      \item AMR Cartesian
       \vspace{-0.02in}
      \item higher order FEM (e.g., continuous or discontinuous Galerkin)
      \end{itemize}
    \end{itemize}
  \end{block}
  
  \vspace{-0.055in}
      \begin{block}{Interdisciplinary Coupling}
     \begin{itemize}
     \item Traditionally custom pairwise codes are required.
       \vspace{-0.02in}
     \item CAPS goal: let CAPS provide the ability to transfer data internally.
     \end{itemize}
    \end{block}
\end{frame}

\begin{frame}
  \frametitle{\Large Universal View of Solver Spatial Discretizations}
  
   \vspace{-0.075in}
    \begin{block}{Technique Used}
     \begin{itemize}
     \item Gradient-based optimization that balances integrated quantities by adjusting the equivalent of ``interpolation coefficients''
       \vspace{-0.02in}
     \item Needs solver consistent {\it interpolation}, {\it integration} and their duals
     \end{itemize}
    \end{block}

  \vspace{-0.065in}
  \begin{block}{Data required -- take an FEM perspective}
    \begin{itemize}
    \item Element type -- must support heterogeneous discretizations
    \vspace{-0.04in}
    \item Positions within an element are defined by the Barycentric coordinates $(s,t)$
      \begin{itemize}
      \vspace{-0.02in}
      \item geometry positions define the {\it geometry} of the cell
      \item data positions define where {\it dependent variables} are stored
        \begin{itemize}
        \vspace{-0.02in}
        \item needed for cell-based, discontinuous and/or non-isoparametric  discretizations
        \vspace{-0.02in}
        \item by default, the data is stored at the geometry locations
        \end{itemize}
      \end{itemize}
    \vspace{-0.04in}
    \item Data to associate back to the owning geometry (i.e., the Face and\\[-0.02in]
    parametric coordinates $(u,v)$)
    \end{itemize}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{\Large Definition of Element Types}

  \begin{block}{For the element examples that follow:}
    \begin{itemize}
    \item {\bf nRef} is the number of polygonal positions (per element) that the physical ``corners'' of the element are defined
    \item {\bf nData} is the number of positions used to define the data locations in the element -- $0$ indicates that geometric $\equiv$ data positions
%    \item {\bf nSide} the number of sides of the polygon (which also defines the number of neighboring elements)
    \item Higher-order positions (must be nodal, not modal) -- do not contribute to the polygonal shape
      \begin{itemize}
      \item the first positions must be those that define the polygon and should be ordered (using a right-handed traversal)
      \end{itemize}
    \item All are indices into lists of points
      \begin{itemize}
      \item Note: discontinuous discretizations do not share indices at bounds
      \vspace{0.025in}
      \end{itemize}
    \end{itemize}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{\Large Definition of Element Types}

  \begin{block}{Simple continuous linear triangle}
    \setlength{\unitlength}{0.65in}
    \begin{picture}(7.0,4.0)(-0.5,-0.5)
      \put( 0.0, 3.25){\makebox(3,0){nRef = 3, nData = 0}}

      \put(0.2,  0.4){\line( 1,0){2.4}}
      \put(0.3,  0.2){\line( 1,2){1.2}}
      \put(2.5,  0.2){\line(-1,2){1.2}}
      \put(2.4,  0.4){\line( 1,1){0.22}}
      \put(0.4,  0.4){\line(-1,1){0.22}}
      \put(1.2,  2.4){\line( 1,0){0.40}}

      \color{blue}
      \put(0.4, 0.4){\circle{0.20}}
      \put(1.4, 2.4){\circle{0.20}}
      \put(2.4, 0.4){\circle{0.20}}

      \put(1.47,2.20){\makebox(0,0)[r]{2}}
      \put(0.64,0.52){\makebox(0,0)[r]{0}}
      \put(2.29,0.52){\makebox(0,0)[r]{1}}

      \color{smoothgreen}
      \put(0.4, 0.4){\circle*{0.12}}
      \put(1.4, 2.4){\circle*{0.12}}
      \put(2.4, 0.4){\circle*{0.12}}

      \color{black}
      \put(4.0, 2.25){\makebox(2,0){Barycentric Coordinates}}
      \put(3.8,2.1){\makebox(0,0)[tl]{
          \begin{tabular}[tl]{ccc}
            \color{blue}geom\color{black}\&\color{smoothgreen}data & $s$ & $t$ \\
            \color{blue} 0    & 0 & 0 \\
            \color{blue} 1    & 1 & 0 \\
            \color{blue} 2    & 0 & 1
          \end{tabular}}}

    \end{picture}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{\Large Definition of Element Types}

  \begin{block}{Hanging vertex (AMR) quadrilateral}
    \setlength{\unitlength}{0.65in}
    \begin{picture}(7.0,4.25)(-0.5,-0.78)
      \put( 0.0, 3.25){\makebox(3,0){nRef = 5, nData = 0}}

      \put(0.2,  0.3){\line( 1,0){2.4}}
      \put(0.2,  2.3){\line( 1,0){2.4}}
      \put(0.4,  0.1){\line( 0,1){2.4}}
      \put(2.4,  0.1){\line( 0,1){2.4}}
      \put(2.4,  1.3){\line( 1,0){0.25}}

      \color{blue}
      \put(0.4, 0.3){\circle{0.20}}
      \put(2.4, 2.3){\circle{0.20}}
      \put(2.4, 1.3){\circle{0.20}}
      \put(2.4, 0.3){\circle{0.20}}
      \put(0.4, 2.3){\circle{0.20}}

      \put(0.64,2.15){\makebox(0,0)[r]{3}}
      \put(2.29,2.15){\makebox(0,0)[r]{2}}
      \put(0.64,0.42){\makebox(0,0)[r]{0}}
      \put(2.29,0.42){\makebox(0,0)[r]{1}}
      \put(2.29,1.30){\makebox(0,0)[r]{4}}

      \color{smoothgreen}
      \put(0.4, 0.3){\circle*{0.12}}
      \put(2.4, 2.3){\circle*{0.12}}
      \put(2.4, 1.3){\circle*{0.12}}
      \put(2.4, 0.3){\circle*{0.12}}
      \put(0.4, 2.3){\circle*{0.12}}

      \color{black}
      \put(4.0, 2.40){\makebox(2,0){Barycentric Coordinates}}
      \put(3.8,2.25){\makebox(0,0)[tl]{
          \begin{tabular}[tl]{ccc}
            \color{blue}geom\color{black}\&\color{smoothgreen}data & $s$ & $t$ \\
            \color{blue} 0    & 0 & 0 \\
            \color{blue} 1    & 1 & 0 \\
            \color{blue} 2    & 1 & 1 \\
            \color{blue} 3    & 0 & 1 \\
            \color{blue} 4    & 1 &1/2
          \end{tabular}}}

    \end{picture}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{\Large Definition of Element Types}

  \begin{block}{Second order continuous triangle}
    \setlength{\unitlength}{0.65in}
    \begin{picture}(7.0,4.0)(-0.5,-0.5)
      \put( 0.0, 3.25){\makebox(3,0){nRef = 6, nData = 0}}

      \put(0.2,  0.4){\line( 1,0){2.4}}
      \put(0.3,  0.2){\line( 1,2){1.2}}
      \put(2.5,  0.2){\line(-1,2){1.2}}
      \put(2.4,  0.4){\line( 1,1){0.22}}
      \put(0.4,  0.4){\line(-1,1){0.22}}
      \put(1.2,  2.4){\line( 1,0){0.40}}

      \color{blue}
      \put(0.4, 0.4){\circle{0.20}}
      \put(1.4, 2.4){\circle{0.20}}
      \put(2.4, 0.4){\circle{0.20}}
      \put(1.4, 0.4){\circle{0.15}}
      \put(1.9, 1.4){\circle{0.15}}
      \put(0.9, 1.4){\circle{0.15}}

      \put(1.47,2.20){\makebox(0,0)[r]{2}}
      \put(0.64,0.52){\makebox(0,0)[r]{0}}
      \put(2.29,0.52){\makebox(0,0)[r]{1}}
      \put(1.47,0.57){\makebox(0,0)[r]{3}}
      \put(1.83,1.41){\makebox(0,0)[r]{4}}
      \put(1.09,1.41){\makebox(0,0)[r]{5}}

      \color{smoothgreen}
      \put(0.4, 0.4){\circle*{0.12}}
      \put(1.4, 2.4){\circle*{0.12}}
      \put(2.4, 0.4){\circle*{0.12}}
      \put(1.4, 0.4){\circle*{0.07}}
      \put(1.9, 1.4){\circle*{0.07}}
      \put(0.9, 1.4){\circle*{0.07}}

      \color{black}
      \put(4.0, 2.55){\makebox(2,0){Barycentric Coordinates}}
      \put(3.8,2.4){\makebox(0,0)[tl]{
          \begin{tabular}[tl]{ccc}
            \color{blue} geom\color{black}\&\color{smoothgreen}data & $s$ & $t$ \\
            \color{blue} 0    & 0 & 0 \\
            \color{blue} 1    & 1 & 0 \\
            \color{blue} 2    & 0 & 1 \\
            \color{blue} 3    & 1/2 & 0 \\
            \color{blue} 4    & 1/2 & 1/2 \\
            \color{blue} 5    & 1/2 & 0
          \end{tabular}}}

    \end{picture}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{\Large Definition of Element Types}

  \begin{block}{Discontinuous triangle (q=2, p=3)}
    \setlength{\unitlength}{0.65in}
    \begin{picture}(7.0,4.0)(-0.5,-0.5)

      \put(-0.2, 3.10){\makebox(3,0){nRef = 6, nData = 9}}

      \color{black}
      \put(-0.2,  0.2){\line( 1,0){2.4}}
      \put(-0.1,  0.0){\line( 1,2){1.2}}
      \put( 2.1,  0.0){\line(-1,2){1.2}}
      \put( 1.8,  0.0){\line( 1,1){0.40}}
      \put( 0.2,  0.0){\line(-1,1){0.40}}
      \put( 0.8,  2.2){\line( 1,0){0.40}}

      \color{blue}
      \put(0.0, 0.2){\circle{0.15}}
      \put(1.0, 2.2){\circle{0.15}}
      \put(2.0, 0.2){\circle{0.15}}
      \put(1.0, 0.2){\circle{0.10}}
      \put(1.5, 1.2){\circle{0.10}}
      \put(0.5, 1.2){\circle{0.10}}

      \color{smoothgreen}
      \put(1.0, 1.1){\circle*{0.08}}
      \put(0.67, 0.15){\circle*{0.08}}
      \put(0.67, 0.25){\circle*{0.08}}
      \put(1.33, 0.15){\circle*{0.08}}
      \put(1.33, 0.25){\circle*{0.08}}
      \put(1.29, 1.51){\circle*{0.08}}
      \put(1.37, 1.55){\circle*{0.08}}
      \put(1.63, 0.85){\circle*{0.08}}
      \put(1.71, 0.89){\circle*{0.08}}
      \put(0.63, 1.55){\circle*{0.08}}
      \put(0.71, 1.51){\circle*{0.08}}
      \put(0.29, 0.89){\circle*{0.08}}
      \put(0.37, 0.85){\circle*{0.08}}

      \put(1.0, 2.075){\circle*{0.08}}
      \put(1.0, 2.33){\circle*{0.08}}
      \put(1.12, 2.27){\circle*{0.08}}
      \put(1.12, 2.12){\circle*{0.08}}
      \put(0.88, 2.27){\circle*{0.08}}
      \put(0.88, 2.12){\circle*{0.08}}

      \put(0.0, 0.075){\circle*{0.08}}
      \put(0.0, 0.33){\circle*{0.08}}
      \put(0.12, 0.27){\circle*{0.08}}
      \put(0.12, 0.16){\circle*{0.08}}
      \put(-.12, 0.25){\circle*{0.08}}
      \put(-.12, 0.12){\circle*{0.08}}

      \put(1.98, 0.075){\circle*{0.08}}
      \put(2.0, 0.33){\circle*{0.08}}
      \put(2.12, 0.25){\circle*{0.08}}
      \put(2.12, 0.14){\circle*{0.08}}
      \put(1.88, 0.25){\circle*{0.08}}
      \put(1.88, 0.14){\circle*{0.08}}

      \put(0.3,0.33){\makebox(0,0)[r]{0}}
      \put(0.73,0.40){\makebox(0,0)[r]{1}}
      \put(1.39,0.40){\makebox(0,0)[r]{2}}
      \put(1.83,0.33){\makebox(0,0)[r]{3}}
      \put(1.60, 0.85){\makebox(0,0)[r]{4}}
      \put(1.25, 1.52){\makebox(0,0)[r]{5}}
      \put(1.05, 1.91){\makebox(0,0)[r]{6}}
      \put(0.88, 1.52){\makebox(0,0)[r]{7}}
      \put(0.54, 0.85){\makebox(0,0)[r]{8}}
      \put(1.07,0.92){\makebox(0,0)[r]{9}}
      \color{black}

      \put(1.07,2.48){\makebox(0,0)[r]{2}}
      \put(0.05,-.07){\makebox(0,0)[r]{0}}
      \put(2.05,-.07){\makebox(0,0)[r]{1}}
      \put(1.07,0.0){\makebox(0,0)[r]{3}}
      \put(1.73,1.21){\makebox(0,0)[r]{4}}
      \put(0.43,1.21){\makebox(0,0)[r]{5}}

      \begin{small}
        \put(3.8, 3.40){\makebox(2,0){Barycentric Coordinates}}
        \put(4,3.30){\makebox(0,0)[tl]{
            \begin{tabular}[tl]{ccc}
              \color{blue} geom & $s$ & $t$ \\
              \color{blue} 0    & 0 & 0 \\
              \color{blue} 1    & 1 & 0 \\
              \color{blue} 2    & 0 & 1 \\
              \color{blue} 3    & 1/2 & 0 \\
              \color{blue} 4    & 1/2 & 1/2 \\
              \color{blue} 5    & 1/2 & 0 \\
            \end{tabular}}}

        \put(2.75,1.2){\makebox(0,0)[tl]{
            \begin{tabular}[tl]{ccccccc}
              \color{smoothgreen} data & $s$ & $t$  & &
              \color{smoothgreen} data & $s$ & $t$ \\
              \color{smoothgreen} 0    & 0 & 0 & &
              \color{smoothgreen} 5    & 1/3 & 2/3  \\
              \color{smoothgreen} 1    & 1/3  & 0 & &
              \color{smoothgreen} 6    & 0 & 1  \\
              \color{smoothgreen} 2    & 2/3  & 0 & &
              \color{smoothgreen} 7    & 0 & 2/3  \\
              \color{smoothgreen} 3    & 1 & 0  & &
              \color{smoothgreen} 8    & 0 & 1/3  \\
              \color{smoothgreen} 4    & 2/3 &1/3  &  &
              \color{smoothgreen} 9    & 1/3  &1/3
            \end{tabular}}}
      \end{small}
    \end{picture}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{\Large Spatial Discretizations}

  \begin{block}{Additionally needed:}
    \begin{itemize}
    \item Optional positions that support {\it matching} during the optimization.\\
    Required for discontinuous discretizations so that the resultant data at the reference positions are not the same.
      \begin{itemize}
      \item {\bf nMat} is the number of match positions \\ $0$ indicates that reference $\equiv$ match positions
      \end{itemize}
    \item Cutting up the element into triangles which facilitates finding a particular element given a target quilt $(u,v)$
      \begin{itemize}
      \item {\bf nTris} is the number of triangles that best represent the element in a linear sense
      \end{itemize}
    \end{itemize}
  \end{block}

\end{frame}

\begin{frame}
  \frametitle{\Large Extended Definition of Element Types}

  \begin{block}{Second order continuous triangle}
    \setlength{\unitlength}{0.65in}
    \begin{picture}(7.0,4.0)(-0.5,-0.5)

      \put(-0.3, 3.25){\makebox(3,0){nTris = 4,  nRef = 6}}
      \put(-0.3, 2.95){\makebox(3,0){nData = 0, nMat = 0}}

      \put(-0.2,  0.2){\line( 1,0){2.4}}
      \put(-0.1,  0.0){\line( 1,2){1.2}}
      \put( 2.1,  0.0){\line(-1,2){1.2}}
      \put( 2.0,  0.2){\line( 1,1){0.22}}
      \put( 0.0,  0.2){\line(-1,1){0.22}}
      \put( 0.8,  2.2){\line( 1,0){0.40}}

      \color{gray}
      \put(1.0, 0.2){\line( 1,2){0.5}}
      \put(0.5, 1.2){\line( 1,0){1.0}}
      \put(1.0, 0.2){\line(-1,2){0.5}}

      \color{blue}
      \put(0.0, 0.2){\circle{0.20}}
      \put(1.0, 2.2){\circle{0.20}}
      \put(2.0, 0.2){\circle{0.20}}
      \put(1.0, 0.2){\circle{0.15}}
      \put(1.5, 1.2){\circle{0.15}}
      \put(0.5, 1.2){\circle{0.15}}

      \put(1.07,2.00){\makebox(0,0)[r]{2}}
      \put(0.24,0.32){\makebox(0,0)[r]{0}}
      \put(1.89,0.32){\makebox(0,0)[r]{1}}
      \put(1.07,0.00){\makebox(0,0)[r]{3}}
      \put(1.72,1.21){\makebox(0,0)[r]{4}}
      \put(0.42,1.21){\makebox(0,0)[r]{5}}

      \color{smoothgreen}
      \put(0.0, 0.2){\circle*{0.12}}
      \put(1.0, 2.2){\circle*{0.12}}
      \put(2.0, 0.2){\circle*{0.12}}
      \put(1.0, 0.2){\circle*{0.07}}
      \put(1.5, 1.2){\circle*{0.07}}
      \put(0.5, 1.2){\circle*{0.07}}

      \color{red}
      \put(0.0, 0.2){\makebox(0,0){\Large$\color{red} \times$}}
      \put(1.0, 2.2){\makebox(0,0){\Large$\color{red} \times$}}
      \put(2.0, 0.2){\makebox(0,0){\Large$\color{red} \times$}}
      \put(1.0, 0.2){\makebox(0,0){\Large$\color{red} \times$}}
      \put(1.5, 1.2){\makebox(0,0){\Large$\color{red} \times$}}
      \put(0.5, 1.2){\makebox(0,0){\Large$\color{red} \times$}}

      \color{black}
      \put(4.0, 3.35){\makebox(2,0){Barycentric Coordinates}}
      \put(3.8,3.2){\makebox(0,0)[tl]{
          \begin{tabular}[tl]{ccc}
            \color{blue}geom\color{black}\&\color{smoothgreen}data & $s$ & $t$ \\
            \color{blue} 0    & 0 & 0 \\
            \color{blue} 1    & 1 & 0 \\
            \color{blue} 2    & 0 & 1 \\
            \color{blue} 3    & 1/2 & 0 \\
            \color{blue} 4    & 1/2 & 1/2 \\
            \color{blue} 5    & 1/2 & 0
          \end{tabular}}}

      \put(4.1, 0.8){\makebox(2,0){Triangle Indices}}
      \put(4.5,0.7){\makebox(0,0)[tl]{
          \begin{tabular}[tl]{ccc}
            0  &  3 & 5 \\
            3  &  1 & 4 \\
            5  &  4 & 2 \\
            3  &  4 & 5
          \end{tabular}}}
    \end{picture}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{\Large Extended Definition of Element Types}

  \begin{block}{Cell-centered or discontinuous constant triangle}
    \setlength{\unitlength}{0.65in}
    \begin{picture}(7.0,4.0)(-0.5,-0.5)
      \put(0.0, 3.25){\makebox(3,0){nTris = 1,  nRef = 3}}
      \put(0.0, 2.95){\makebox(3,0){nData = 1, nMat = 1}}

      \put(0.3,  0.3){\line( 1,0){2.4}}
      \put(0.4,  0.1){\line( 1,2){1.2}}
      \put(2.6,  0.1){\line(-1,2){1.2}}
      \put(2.5,  0.3){\line( 1,1){0.22}}
      \put(0.5,  0.3){\line(-1,1){0.22}}
      \put(1.3,  2.3){\line( 1,0){0.40}}

      \color{blue}
      \put(0.5, 0.3){\circle{0.20}}
      \put(1.5, 2.3){\circle{0.20}}
      \put(2.5, 0.3){\circle{0.20}}

      \put(1.57,2.10){\makebox(0,0)[r]{2}}
      \put(0.74,0.42){\makebox(0,0)[r]{0}}
      \put(2.39,0.42){\makebox(0,0)[r]{1}}

      \color{smoothgreen}
      \put(1.5, 1.2){\circle*{0.12}}

      \put(1.57,1.44){\makebox(0,0)[r]{0}}

      \color{red}
      \put(1.5, 1.2){\makebox(0,0){\Large$\color{red} \times$}}

      \put(1.57,0.95){\makebox(0,0)[r]{0}}

      \color{black}
      \put(4.0, 3.25){\makebox(2,0){Barycentric Coordinates}}
      \put(4,3.1){\makebox(0,0)[tl]{
          \begin{tabular}[tl]{ccc}
            \color{blue} geom & $s$ & $t$ \\
            \color{blue} 0    & 0 & 0 \\
            \color{blue} 1    & 1 & 0 \\
            \color{blue} 2    & 0 & 1 \\
            \hline
            \color{smoothgreen} data & &   \\
            \color{smoothgreen} 0    & 1/3 & 1/3 \\
            \hline
            \color{red} match & &   \\
            \color{red} 0    & 1/3 & 1/3
          \end{tabular}}}

      \put(4.1, 0.2){\makebox(2,0){Triangle Indices}}
      \put(4.5,0.1){\makebox(0,0)[tl]{
          \begin{tabular}[tl]{ccc}
            0  &  1 & 2
          \end{tabular}}}
    \end{picture}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{\Large Extended Definition of Element Types}

  \begin{block}{Discontinuous bilinear quadrilateral}
    \setlength{\unitlength}{0.65in}
    \begin{picture}(7.0,4.0)(-0.5,-0.5)
      \put(-0.3, 3.25){\makebox(3,0){nTris = 2,  nRef = 4}}
      \put(-0.3, 2.95){\makebox(3,0){nData = 4, nMat = 4}}

      \put(-0.2,  0.2){\line( 1,0){2.4}}
      \put(-0.2,  2.2){\line( 1,0){2.4}}
      \put( 0.0,  0.0){\line( 0,1){2.4}}
      \put( 2.0,  0.0){\line( 0,1){2.4}}
      \color{gray}
      \put(0.0, 0.2){\line( 1,1){2.0}}
      \color{black}

      \color{blue}
      \put(0.0, 0.2){\circle{0.18}}
      \put(2.0, 2.2){\circle{0.18}}
      \put(2.0, 0.2){\circle{0.18}}
      \put(0.0, 2.2){\circle{0.18}}

      \put(0.06,2.52){\makebox(0,0)[r]{3}}
      \put(2.06,2.52){\makebox(0,0)[r]{2}}
      \put(0.06,-.12){\makebox(0,0)[r]{0}}
      \put(2.06,-.12){\makebox(0,0)[r]{1}}

      \color{smoothgreen}
      \put(0.10, 0.30){\circle*{0.08}}
      \put(0.10, 0.10){\circle*{0.08}}
      \put(-.10, 0.30){\circle*{0.08}}
      \put(-.10, 0.10){\circle*{0.08}}

      \put(2.10, 0.30){\circle*{0.08}}
      \put(2.10, 0.10){\circle*{0.08}}
      \put(1.90, 0.30){\circle*{0.08}}
      \put(1.90, 0.10){\circle*{0.08}}

      \put(2.10, 2.30){\circle*{0.08}}
      \put(2.10, 2.10){\circle*{0.08}}
      \put(1.90, 2.30){\circle*{0.08}}
      \put(1.90, 2.10){\circle*{0.08}}

      \put(0.10, 2.30){\circle*{0.08}}
      \put(0.10, 2.10){\circle*{0.08}}
      \put(-.10, 2.30){\circle*{0.08}}
      \put(-.10, 2.10){\circle*{0.08}}

      \color{red}
      \put(0.5, 0.7){\makebox(0,0){\Large$\color{red} \times$}}
      \put(1.5, 1.7){\makebox(0,0){\Large$\color{red} \times$}}
      \put(1.5, 0.7){\makebox(0,0){\Large$\color{red} \times$}}
      \put(0.5, 1.7){\makebox(0,0){\Large$\color{red} \times$}}

      \put(0.56,1.92){\makebox(0,0)[r]{3}}
      \put(1.56,1.92){\makebox(0,0)[r]{2}}
      \put(0.56,0.48){\makebox(0,0)[r]{0}}
      \put(1.56,0.48){\makebox(0,0)[r]{1}}

      \color{black}
      \begin{footnotesize}
        \put(4.0, 3.25){\makebox(2,0){Barycentric Coordinates}}
        \put(3.8,3.1){\makebox(0,0)[tl]{
            \begin{tabular}[tl]{cccc}
              \color{blue} geom & \color{smoothgreen} data & $s$ & $t$ \\
              \color{blue} 0    & \color{smoothgreen} 0  & 0 & 0 \\
              \color{blue} 1    & \color{smoothgreen} 1  & 1 & 0 \\
              \color{blue} 2    & \color{smoothgreen} 2  & 1 & 1 \\
              \color{blue} 3    & \color{smoothgreen} 3  & 0 & 1 \\
              \hline
              \color{red} match & & & \\
              \color{red} 0     & & 1/4 & 1/4 \\
              \color{red} 1     & & 3/4  & 1/4 \\
              \color{red} 2     & & 3/4 & 3/4 \\
              \color{red} 3     & & 1/4 & 3/4
            \end{tabular}}}
      \end{footnotesize}

      \put(4.1, 0.2){\makebox(2,0){Triangle Indices}}
      \put(4.5,0.1){\makebox(0,0)[tl]{
          \begin{tabular}[tl]{ccc}
            0  &  1 & 2 \\
            0  &  2 & 3
          \end{tabular}}}
    \end{picture}
  \end{block}
\end{frame}
  
\begin{frame}[fragile]
  \FrameTitle{AIM -- Discrete Structure 1/6}

\vspace{-0.05in}
 \begin{block}{Discrete Structure -- Used to define a VertexSet}
\footnotesize
The CAPS {\it Discrete} data structure holds the spatial discretization information for a Bound. It defines reference positions for the location of the vertices that support the geometry and optionally the positions for the data locations (if these differ). This structure can contain a homogeneous or heterogeneous collection of element types and optionally specifies match positions for conservative data transfers.\\[0.05in]
Contains enough information so that the Bound data may be visualized.
\end{block}

\vspace{-0.05in}
 \begin{block}{EGADS Tessellation Object}
 \begin{itemize}
 \item Used to specify the discretization of the entire Body
 \item Requires triangles
 \item Can be constructed from an external mesh generator
 \begin{itemize}
 \item Look at~~ {\tt EG\_initTessBody}, ~~{\tt EG\_setTessEdge}, ~~{\tt EG\_setTessFace}~~\& ~~{\tt EG\_statusTessBody}
 \item Set in CAPS by invoking {\tt aim\_newTess}
 \end{itemize}
 \end{itemize}
\end{block}

\end{frame}


\begin{frame}[fragile]
  \FrameTitle{AIM -- Discrete Structure 2/6}

\begin{block}{Structure {\tt capsEleType}}
  {\tiny
\begin{verbatim}
typedef struct {
  int    nref;                  /* number of geometry reference points */
  int    ndata;                 /* number of data ref points -- 0 data at ref */
  int    nmat;                  /* number of match points (0 -- match at
                                   geometry reference points) */
  int    ntri;                  /* number of triangles to represent the elem */
  double *gst;                  /* [s,t] geom reference coordinates in the
                                   element -- 2*nref in length */
  double *dst;                  /* [s,t] data reference coordinates in the
                                   element -- 2*ndata in length */
  double *matst;                /* [s,t] positions for match points - NULL
                                   when using reference points (2*nmat long) */
  int    *tris;                 /* the triangles defined by geom reference indices
                                   (bias 1) -- 3*ntri in length */
  int    nseg;                  /* number of element segments (sides) */
  int    *segs;                 /* the element segments by reference indices
                                   (bias 1) -- 2*nsegs in length */
} capsEleType;
\end{verbatim}
}

\normalsize
\center You will usually have only a small number of element types
\end{block}

\vspace{0.1in}
\normalsize
See {\it AIAApaper2014-0294.pdf} on the website in Publications for a complete write-up

\end{frame}

\begin{frame}[fragile]
  \FrameTitle{AIM -- Discrete Structure 3/6}

\begin{block}{Structure {\tt capsElement} -- a single element}
{\tiny
\begin{verbatim}
typedef struct {
  int   tIndex;                 /* the element type index (bias 1) */
  int   eIndex;                 /* element owning index -- dim 1 Edge, 2 Face */
  int   *gIndices;              /* local indices (bias 1) geom ref positions,
                                   tess index -- 2*nref in length */
  int   *dIndices;              /* the vertex indices (bias 1) for data ref
                                   positions -- ndata in length or NULL */
  union {
    int tq[2];                  /* tri or quad (bias 1) for ntri <= 2 */
    int *poly;                  /* the multiple indices (bias 1) for ntri > 2 */
  } eTris;                      /* triangle indices  that make up the element */
} capsElement;
\end{verbatim}
}
\vspace{0.01in}
\end{block}

\scriptsize
\begin{itemize}
\item {\bf tIndex} -- index into the collected {\tt capsEleType}s of {\tt capsDiscr}
\item {\bf eIndex} -- index into the owning \textcolor{blue}{ego} in the Body
\item {\bf gIndices} -- index in {\tt capsBodyDiscr} member {\tt gIndices} -- [2*{\tt nref} in length]\\
~~~~~~~~~~~~~~~~~~index in {\tt capsDiscr} member {\tt tessGlobal}
\item {\bf dIndices} -- index in {\tt capsBodyDiscr} member {\tt dIndices} -- [{\tt ndata} in length or \textcolor{red}{NULL}]
\item {\bf eTris} -- triangle index/indices from the \textcolor{blue}{ego} of the Body tessellation\\
~~~~~~~~~~~~~{\tt poly} must be allocated in {\tt capsBodyDiscr} -- this is a pointer into that memory block
\end{itemize}


\end{frame}

\begin{frame}[fragile]
  \FrameTitle{AIM -- Discrete Structure 4/6}

\begin{block}{Structure {\tt capsBodyDiscr}}
  {\tiny
\begin{verbatim}
/*
 * defines a discretized collection of Elements for a body
 *
 * specifies the connectivity based on a collection of Element Types and the
 * elements referencing the types.
 *
 */

typedef struct {
  ego         tess;             /* tessellation object associated with the
                                   discretization */
  int         nElems;           /* number of Elements */
  capsElement *elems;           /* the Elements (nElems in length) */
  int         *gIndices;        /* memory storage for elemental gIndices */
  int         *dIndices;        /* memory storage for elemental dIndices */
  int         *poly;            /* memory storage for elemental poly */
  int         globalOffset;     /* tessellation global index offset across bodies */
} capsBodyDiscr;
\end{verbatim}
}
\vspace{0.01in}
\end{block}

\scriptsize
\begin{itemize}
\item {\bf gIndices} -- allocated memory block for the collection of reference positions [length -- $\sum$ 2*{\tt nref}]
\item {\bf dIndices} -- allocated memory block for data indices [$\sum$ {\tt ndata} in length or \textcolor{red}{NULL}]
\item {\bf poly} -- allocated memory block for polygon indices [$\sum$ {\tt ntri} in length or \textcolor{red}{NULL}]
\item {\bf globalOffset} -- an offset into {\tt tessGlobal} that produces a unique index across multiple bodies
\end{itemize}

\end{frame}

\begin{frame}[fragile]
  \FrameTitle{AIM -- Discrete Structure 5/6}

  \vspace{-0.1in}
  {\tiny
\begin{verbatim}
/*
 * defines a discretized collection of Bodies
 *
 * nPoints refers to the number of indices referenced by the geometric positions
 * in the element which may be different from nVerts which is the number of
 * positions used for the data representation in the element. For simple nodal
 * or isoparametric discretizations, nVerts is zero and verts is set to NULL.
 */
typedef struct {
  int           dim;            /* dimensionality [1-3] */
  void          *instStore;     /* analysis instance storage */
  void          *aInfo;         /* AIM info */
                                /* below handled by the AIMs: */
  int           nVerts;         /* number data ref positions or unconnected */
  double        *verts;         /* data ref positions -- NULL if same as geom */
  int           *celem;         /* 2*nVerts (body, element) containing vert or NULL */
  int           nDtris;         /* number of triangles to plot data */
  int           *dtris;         /* NULL for NULL verts -- indices into verts */
  int           nDsegs;         /* number of segs (sides) to plot data mesh */
  int           *dsegs;         /* NULL for NULL verts -- indices into verts */
  int           nPoints;        /* number of entries in the geom positions */
  int           nTypes;         /* number of Element Types */
  capsEleType   *types;         /* the Element Types (nTypes in length) */
  int           nBodys;         /* number of Body discretizations */
  capsBodyDiscr *bodys;         /* the Body discretizations (nBodys in length) */
  int           *tessGlobal;    /* tessellation indices to this local space
                                   2*nPoints in len (bodys index, global tess index) */
  void          *ptrm;          /* pointer for optional AIM use */
} capsDiscr;
 \end{verbatim}
}

%\vspace{0.025in}
\normalsize
\center See {\it \$ESP\_ROOT/doc/capsDiscr.pdf} for a complete description
\end{frame}

\begin{frame}[fragile]
  \FrameTitle{AIM -- Discrete Structure 6/6}

 \begin{itemize}
   {\scriptsize
 
\item The first members ({\tt dim}, {\tt instance} and {\tt ainfo}) are filled by CAPS before calling {\tt aimDiscr}.

\item All physical positions (except for those in {\tt verts}) are found in the associated
Tessellation Object, which may be created in the AIM and set in CAPS by invoking {\tt aim\_setTess}.

\item The number of geometric reference points ({\tt nPoints}) is the total number of vertices that
support the discretization. 

\item The number of elements types is set by the member {\tt nTypes} and the types themselves
are defined by a pointer to the allocated block of memory {\tt types} which contains 
{\tt nTypes} of {\tt capsEleType}.

\item The number of vertices used for the data positions is defined by {\tt nVerts}. If {\tt nVerts} is nonzero:

\begin{itemize}
{\scriptsize
\item {\tt nVerts} entries must be allocated for the member
{\tt verts} and this must be filled with the XYZ positions associated with the appropriate data reference
positions defined as part of the elements. The member {\tt celem} refers to the index of the element
containing the position and must be allocated consistent with {\tt verts}.\\

\item The number of triangles used for plotting data reference information is set by the member {\tt nDtris}. The
actual triangles are defined in {\tt dtris}, which should be 3 times {\tt nDtris} in length. The values stored are the indices
into the {\tt verts} member (bias 1). The number of segments ({\tt nDsegs}) is associated with plotting the data mesh
information, which is defined in {\tt dsegs} (should be 2 times {\tt nDsegs} in length), which contains pairs of  indices
into the {\tt verts} member (bias 1).\\
}
\end{itemize}

\item The association between geometric reference points and the Tessellation Object
is done by the {\tt tessGlobal} member. The first of the pair of integers in an index (bias 1) into the
{\tt bodys} member. The second is the global index (bias 1) in the Tessellation Object.\\
\textcolor{red}{Note: the {\tt tessGlobal} memory block is allocated and populated automatically within CAPS.}

\item The member {\tt ptrm} is set aside for the plugin author and can be used to hold on to any
data needed to communicate with and between the AIM routines.\\
}
\end{itemize}

\end{frame}


\begin{frame}
  \FrameTitle{AIM -- Discrete Support}

  \begin{block}{Fill-in the Discrete data for a Bound Object -- Optional}
{\scriptsize

{\tt
icode = aimDiscr(\textcolor{magenta}{char} *bname, \textcolor{blue}{capsDiscr} *discr)}

\begin{description}
\item[bname]  the Bound name\\
Note: all of the BRep entities are examined for the attribute {\bf capsBound}. Any that match {\tt bname} must be included when filling this {\tt \textcolor{blue}{capsDiscr}}.
\item[discr] the Discrete structure to fill \\
Note: the AIM {\it instance}, AIM {\it info} pointer and the dimensionality have been filled in before this function is invoked.
\item[icode] integer return code
\end{description}}
  \end{block}

% \setbeamercolor{block title}{bg=red!80}
   \begin{block}{Frees up pointer in the Discrete Structure -- Optional}
{\scriptsize

{\tt
\textcolor{magenta}{void} aimFreeDiscrPtr(\textcolor{magenta}{void} *ptrm)}

\begin{description}

\item[ptrm] the optional pointer in the Discrete Structure that needs to be freed\\
                  will not be called if the pointer is already \textcolor{magenta}{NULL}
\end{description}}
  \end{block}

\end{frame}

\begin{frame}
  \FrameTitle{AIM -- Discrete Support}

% \setbeamercolor{block title}{bg=red!80}
  \begin{block}{Return Element in the {\it Mesh} -- Optional}
{\scriptsize

{\tt
icode = aimLocateElement(\textcolor{blue}{capsDiscr} *discr, \textcolor{magenta}{double} *params,  \\
\hspace{1.60in} \textcolor{magenta}{double} *param, \textcolor{magenta}{int} *bIndex, \textcolor{magenta}{int} *eIndex,\\
\hspace{1.60in} \textcolor{magenta}{double} *bary)}

\begin{description}

\item[discr] the input Discrete Structure
\item[params]  the input global {\it parametric} space (at all of the {\it geometry} support positions)\\
rank is the dimensionality ({\it t} for 1D, $[u,v]$ for 2D and $[x,y,z]$ for 3D)
\item[param]  the input requested parametric position in {\tt params} (dimensionality in length)
\item[bIndex] the returned body index in {\tt discr} where the position was found (1 bias)
\item[eIndex] the returned element index in {\tt discr} where the position was found (1 bias)
\item[bary] the resultant Barycentric/reference position in the element {\tt eIndex}
\item[icode] integer return code
\end{description}}
  \end{block}

\end{frame}

\begin{frame}
  \FrameTitle{AIM -- Data Transfers}

%   \setbeamercolor{block title}{bg=espblue}
 \begin{block}{Data Associated with the Discrete Structure -- Optional}
{\scriptsize

{\tt
icode = aimTransfer(\textcolor{blue}{capsDiscr} *discr, \textcolor{magenta}{const char} *fname, \textcolor{magenta}{int} npts, \\
\hspace{1.28in} \textcolor{magenta}{int} rank, \textcolor{magenta}{double} *data, \textcolor{magenta}{char} **units)}

\begin{description}

\item[discr] the input Discrete Structure
\item[fname]  the field name to that corresponds to the fill
\item[npts] the number of points to be filled
\item[rank]    the rank of the data
\item[data]    a pointer associated with the data to be filled ({\tt rank}*{\tt npts} in length)
\item[units] the returned pointer to the string declaring the units $\dagger$\\
 return \textcolor{magenta}{NULL} to indicate unitless values
\item[icode] integer return code
\end{description}}
\vspace{-0.15in}
\center Fills in the DataSet Object
\end{block}

\end{frame}

\begin{frame}
  \FrameTitle{AIM -- Data Transfers}

\vspace{-0.075in}
%  \setbeamercolor{block title}{bg=red!80}
  \begin{block}{Interpolation on the Bound -- Optional}
{\scriptsize

{\tt
icode = aimInterpolation(\textcolor{blue}{capsDiscr} *discr, \textcolor{magenta}{const char} *name, \\
\hspace{1.60in} \textcolor{magenta}{int} bIndex, \textcolor{magenta}{int} eIndex, \textcolor{magenta}{double} *bary, \\
\hspace{1.60in} \textcolor{magenta}{int} rank, \textcolor{magenta}{double} *data, \textcolor{magenta}{double} *result)\\
icode = aimInterpolateBar(\textcolor{blue}{capsDiscr} *discr, \textcolor{magenta}{const char} *name, \\
\hspace{1.66in} \textcolor{magenta}{int} bIndex, \textcolor{magenta}{int} eIndex, \textcolor{magenta}{double} *bary, \\
\hspace{1.66in} \textcolor{magenta}{int} rank, \textcolor{magenta}{double} *r\_bar, \textcolor{magenta}{double} *d\_bar)}

\begin{description}

\item[discr] the input Discrete Structure
\vspace{-0.0075in}
\item[name] a pointer to the input DataSet name string
\vspace{-0.0075in}
\item[bIndex] the input target body index (1 bias) in the Discrete Structure
\vspace{-0.0075in}
\item[eIndex] the input target element index (1 bias) in the Discrete Structure
\vspace{-0.0075in}
\item[bary] the input Barycentric/reference position in the element {\tt eIndex}
\vspace{-0.0075in}
\item[rank] the input rank of the data
\item[data] values at the data (or geometry) positions
\vspace{-0.0075in}
\item[result] the filled in results ({\tt rank} in length)
\item[r\_bar] input d(objective)/d(result)
\vspace{-0.0075in}
\item[d\_bar] returned d(objective)/d(data)
\item[icode] integer return code
\end{description}}
  \end{block}
\vspace{-0.125in}
\begin{center}
Forward and {\it reverse differentiated} functions
\end{center}
\end{frame}

\begin{frame}
  \FrameTitle{AIM -- Data Transfers}

%  \setbeamercolor{block title}{bg=red!80}
  \begin{block}{Element Integration on the Bound -- Optional}
{\scriptsize

{\tt
icode = aimIntegration(\textcolor{blue}{capsDiscr} *discr, \textcolor{magenta}{const char} *name, \\
\hspace{1.47in} \textcolor{magenta}{int} bIndex, \textcolor{magenta}{int} eIndex, \textcolor{magenta}{int} rank, \\
\hspace{1.47in} \textcolor{magenta}{double} *data, \textcolor{magenta}{double} *result)\\
icode = aimIntegrateBar(\textcolor{blue}{capsDiscr} *discr, \textcolor{magenta}{const char} *name, \\
\hspace{1.53in} \textcolor{magenta}{int} bIndex, \textcolor{magenta}{int} eIndex, \textcolor{magenta}{int} rank, \\
\hspace{1.53in} \textcolor{magenta}{double} *r\_bar, \textcolor{magenta}{double} *d\_bar)}

\begin{description}
\item[discr] the input Discrete Structure
\vspace{-0.0075in}
\item[name] a pointer to the input DataSet name string
\vspace{-0.0075in}
\item[bIndex] the input target body index (1 bias) in {\tt discr}
\vspace{-0.0075in}
\item[eIndex] the input target element index (1 bias) in {\tt discr}
\vspace{-0.0075in}
\item[rank] the input rank of the data
\item[data] values at the data (or geometry) positions -- \textcolor{magenta}{NULL}  length/area/volume of element
\vspace{-0.0075in}
\item[result] the filled in results ({\tt rank} in length)
\item[r\_bar] input d(objective)/d(result)
\vspace{-0.0075in}
\item[d\_bar] returned d(objective)/d(data)
\item[icode] integer return code
\end{description}}
  \end{block}

\vspace{-0.1in}
\begin{center}
Forward and {\it reverse differentiated} functions
\end{center}
\end{frame}


\begin{frame}

 \center
 {\LARGE AIM Helper Functions}\\[0.05in]
{\large Discretization Structure}

 \vspace{0.4in}
   \begin{itemize}
  \item provides useful functions for the AIM programmer
  \item gives access to CAPS Object data
  \item note that all function names begin with {\tt aim\_}
  \item if any of these functions are used, then the library must be included (libaimUtil.a/aimUtil.lib) in the AIM so/DLL build
  \end{itemize}

\end{frame}

\begin{frame}
  \FrameTitle{AIM Utility Library}

\vspace{-0.1in}
 \begin{block}{Get Discretization Structure}
{\scriptsize

{\tt \fontsize{7.75}{5}\selectfont
icode = aim\_getDiscr(\textcolor{magenta}{void} *aimInfo, \textcolor{magenta}{const char} *bname, \textcolor{blue}{capsDiscr} **discr)}

\begin{description}

\item[aimInfo] the AIM context
\vspace{-0.025in}
\item[bname]  the Bound name
\vspace{-0.025in}
\item[discr] pointer to the returned Discrete structure
\vspace{-0.025in}
\item[icode] integer return code
\end{description}}
\end{block}

\vspace{-0.075in}
%  \setbeamercolor{block title}{bg=red!80}
 \begin{block}{Get Data from Existing DataSet}
{\scriptsize

{\tt
icode = aim\_getDataSet(\textcolor{blue}{capsDiscr} *discr, \textcolor{magenta}{const char} *dname, \\
\hspace{1.46in} \textcolor{magenta}{enum} \textcolor{blue}{capsdMethod} *method, \textcolor{magenta}{int} *npts,\\
\hspace{1.46in} \textcolor{magenta}{int} *rank, \textcolor{magenta}{double} **data, \textcolor{magenta}{char} **units)}
\begin{description}

\item[discr] the input Discrete Structure
\vspace{-0.025in}
\item[dname]  the requested DataSet name
\vspace{-0.025in}
\item[method] the returned method used for data transfers
\vspace{-0.025in}
\item[npts]    the returned number of points in the DataSet
\vspace{-0.025in}
\item[rank]  the returned rank of the DataSet
\vspace{-0.025in}
\item[data]    a returned pointer to the data within the DataSet
\vspace{-0.025in}
\item[units]  the unit string associated with the data within the DataSet
\vspace{-0.025in}
\item[icode] integer return code
\end{description}}
\scriptsize
Note: may only be called from aimPreAnalysis
\end{block}

\end{frame}


\begin{frame}
  \FrameTitle{AIM Utility Library -- Data Transfers}

 \begin{block}{Initialize {\tt capsBodyDiscr} Pointer}
{\scriptsize

{\tt
\textcolor{magenta}{void} aim\_initBodyDiscr(\textcolor{blue}{capsBodyDiscr} *discBody)}

\begin{description}
\item[discBody] pointer to initialize
\end{description}}
\scriptsize
\end{block}

 \begin{block}{Linear Triangle/Quad Element Type with Nodal Data}
{\scriptsize

{\tt
icode = aim\_nodalTriangleType(\textcolor{blue}{capsEleType} *eletype)\\
icode = aim\_nodalQuadType(\textcolor{blue}{capsEleType} *eletype)
}

\begin{description}
\item[eletype] element type pointer to fill
\item[icode] integer return code
\end{description}}
\end{block}

 \begin{block}{Linear Triangle/Quad Element Type with Cell Data}
{\scriptsize

{\tt
icode = aim\_cellTriangleType(\textcolor{blue}{capsEleType} *eletype)\\
icode = aim\_cellQuadType(\textcolor{blue}{capsEleType} *eletype)
}

\begin{description}
\item[eletype] element type pointer to fill
\item[icode] integer return code
\end{description}}
\end{block}

\end{frame}

%------------------------------------------------------------------
\begin{frame}
  \FrameTitle{AIM Utility Library -- Data Transfers}

  \begin{block}{Return Element in a Linear {\it Mesh}}
{\scriptsize

{\tt
icode = aim\_locateElement(\textcolor{blue}{capsDiscr} *discr, \textcolor{magenta}{double} *params,  \\
\hspace{1.66in} \textcolor{magenta}{double} *param, \textcolor{magenta}{int} *eIndex, \textcolor{magenta}{int} *bIndex, \\
\hspace{1.66in} \textcolor{magenta}{double} *bary)}

\begin{description}

\item[discr] the input Discrete Structure
\item[params]  the input global {\it parametric} space (at all of the {\it geometry} support positions)\\
rank is the dimensionality ({\it t} for 1D, $[u,v]$ for 2D and $[x,y,z]$ for 3D)
\item[param]    the input requested parametric position in {\tt params} (dimensionality in length)
\item[bIndex] the returned body index in {\tt discr} where the position was found (1 bias)
\item[eIndex] the returned element index in {\tt discr} where the position was found (1 bias)
\item[bary] the resultant Barycentric/reference position in the element {\tt eIndex}
\item[icode] integer return code
\end{description}}
  \end{block}

\end{frame}

%------------------------------------------------------------------
\begin{frame}
  \FrameTitle{AIM Utility Library -- Data Transfers}

\vspace{-0.075in}
  \begin{block}{Interpolation on the Bound in a Linear {\it Mesh}}
{\scriptsize

{\tt
icode = aim\_interpolation(\textcolor{blue}{capsDiscr} *discr, \textcolor{magenta}{const char} *name, \\
\spaces[26]\textcolor{magenta}{int} bIndex, \textcolor{magenta}{int} eIndex, \textcolor{magenta}{double} *bary,  \\
\spaces[26]\textcolor{magenta}{int} rank, \textcolor{magenta}{double} *data, \textcolor{magenta}{double} *result)\\
icode = aim\_interpolateBar(\textcolor{blue}{capsDiscr} *discr, \textcolor{magenta}{const char} *name, \\
\spaces[27]\textcolor{magenta}{int} bIndex, \textcolor{magenta}{int} eIndex, \textcolor{magenta}{double} *bary, \\
\spaces[27]\textcolor{magenta}{int} rank, \textcolor{magenta}{double} *r\_bar, \textcolor{magenta}{double} *d\_bar)}

\begin{description}
\item[discr] the input Discrete Structure for a Linear {\it Mesh}
\vspace{-0.0075in}
\item[name] a pointer to the input DataSet name string
\vspace{-0.0075in}
\item[bIndex] the input target body index (1 bias) in the Discrete Structure
\vspace{-0.0075in}
\item[eIndex] the input target element index (1 bias) in the Discrete Structure
\vspace{-0.0075in}
\item[bary] the input Barycentric/reference position in the element {\tt eIndex}
\vspace{-0.0075in}
\item[rank] the input rank of the data
\item[data] values at the data (or geometry) positions
\vspace{-0.0075in}
\item[result] the filled in results ({\tt rank} in length)
\item[r\_bar] input d(objective)/d(result)
\vspace{-0.0075in}
\item[d\_bar] returned d(objective)/d(data)
\item[icode] integer return code
\end{description}}
  \end{block}
\vspace{-0.125in}
\begin{center}
Forward and {\it reverse differentiated} functions
\end{center}
\end{frame}

%------------------------------------------------------------------
\begin{frame}
  \FrameTitle{AIM Utility Library -- Data Transfers}

  \begin{block}{Element Integration on the Bound in a Linear {\it Mesh}}
{\scriptsize

{\tt
icode = aim\_integration(\textcolor{blue}{capsDiscr} *discr, \textcolor{magenta}{const char} *name, \\
\spaces[24]\textcolor{magenta}{int} bIndex, \textcolor{magenta}{int} eIndex, \textcolor{magenta}{int} rank, \\
\spaces[24]\textcolor{magenta}{double} *data, \textcolor{magenta}{double} *result)\\
icode = aim\_integrateBar(\textcolor{blue}{capsDiscr} *discr, \textcolor{magenta}{const char} *name, \\
\spaces[25]\textcolor{magenta}{int} bIndex, \textcolor{magenta}{int} eIndex, \textcolor{magenta}{int} rank, \\
\spaces[25]\textcolor{magenta}{double} *r\_bar, \textcolor{magenta}{double} *d\_bar)}

\begin{description}
\item[discr] the input Discrete Structure for a Linear {\it Mesh}
\vspace{-0.0075in}
\item[name] a pointer to the input DataSet name string
\vspace{-0.0075in}
\item[bIndex] the input target body index (1 bias) in {\tt discr}
\vspace{-0.0075in}
\item[eIndex] the input target element index (1 bias) in {\tt discr}
\vspace{-0.0075in}
\item[rank] the input rank of the data
\item[data] values at the data (or geometry) positions -- \textcolor{magenta}{NULL}  length/area/volume of element
\vspace{-0.0075in}
\item[result] the filled in results ({\tt rank} in length)
\item[r\_bar] input d(objective)/d(result)
\vspace{-0.0075in}
\item[d\_bar] returned d(objective)/d(data)
\item[icode] integer return code
\end{description}}
  \end{block}

\vspace{-0.1in}
\begin{center}
Forward and {\it reverse differentiated} functions
\end{center}
\end{frame}

\begin{frame}
\FrameTitle{Exercises}

In {\it exercises/session12}:
\begin{itemize}
\item Examine the differences between {\tt session08.py} and {\tt session12.py} in the functions common to both
\item Examine, build and execute {\tt session12.py} as well as {\tt crossXfer.py}\\
Why the differences? Why turn off {\tt autoExec} for one of the instances?
\item Review the differences between {\tt myAIM.c} from {\it session08} and the source in {\it exercises/session12}.
\vspace{0.075in}
\item Run {\tt sensitivity.py} which uses {\it Bounds} to store (and in this case view) geometric sensitivities.\\
Examine other {\bf CSM} DESPMTR sensitivities.
\end{itemize}
  
 \end{frame}


\end{document}

