\section{Current Flow Preprocessor Lua Command Set}

A number of different commands are available in the preprocessor.
Two naming conventions can be used: one which separates words in
the command names by underscores, and one that eliminates the
underscores.

\subsection{Object Add/Remove Commands}
\begin{itemize}
\item {\tt ci\_addnode(x,y)} Add a new node at x,y

\item {\tt ci\_addsegment(x1,y1,x2,y2)} Add a new line segment from node closest to
(x1,y1) to node closest to (x2,y2)

\item {\tt ci\_addblocklabel(x,y)} Add a new block label at (x,y)

\item {\tt ci\_addarc(x1,y1,x2,y2,angle,maxseg)} Add a new arc segment from the
nearest node to (x1,y1) to the nearest node to (x2,y2) with angle `angle'
divided into `maxseg' segments.

\item {\tt ci\_deleteselected} Delete all selected objects.

\item {\tt ci\_deleteselectednodes} Delete selected nodes.

\item {\tt ci\_deleteselectedlabels} Delete selected block labels.

\item {\tt ci\_deleteselectedsegments} Delete selected segments.

\item {\tt ci\_deleteselectedarcsegments} Delete selects arcs.
\end{itemize}


\subsection{Geometry Selection Commands}

\begin{itemize}
\item {\tt ci\_clearselected()} Clear all selected nodes, blocks, segments and arc
segments.

\item {\tt ci\_selectsegment(x,y)} Select the line segment closest to (x,y)

\item {\tt ci\_selectnode(x,y)} Select the node closest to (x,y).
Returns the coordinates of the selected node.

\item {\tt ci\_selectlabel(x,y)} Select the label closet to (x,y).
Returns the coordinates of the selected label.

\item {\tt ci\_selectarcsegment(x,y)} Select the arc segment closest to (x,y)

\item {\tt ci\_selectgroup(n)} Select the n$^{th}$ group of nodes, segments, arc
segments and block labels. This function will clear all previously selected
elements and leave the edit mode in 4 (group)

\item{\tt ci\_selectcircle(x,y,R,editmode)} selects objects within a circle of radius
R centered at (x,y).  If only x, y, and R paramters are given, the current
edit mode is used.  If the editmode parameter is used, 0 denotes nodes, 2
denotes block labels, 2 denotes segments, 3 denotes arcs, and 4 specifies
that all entity types are to be selected.

\item{\tt ci\_selectrectangle(x1,y1,x2,y2,editmode)} selects objects within a rectangle
defined by points (x1,y1) and (x2,y2). If no editmode parameter is supplied,
the current edit mode is used.  If the editmode parameter is used, 0 denotes
nodes, 2 denotes block labels, 2 denotes segments, 3 denotes arcs, and 4 
specifies that all entity types are to be selected.

\end{itemize}


\subsection{Object Labeling Commands}

\begin{itemize}
\item {\tt ci\_setnodeprop("propname",groupno, "inconductor")} Set the selected
nodes to have the nodal property \texttt{"propname"} and group
number \texttt{groupno}. The \texttt{"inconductor"} string
specifies which conductor the node belongs to. If the node doesn't
belong to a named conductor, this parameter can be set to
\texttt{"<None>"}.

\item {\tt ci\_setblockprop("blockname", automesh, meshsize, group)} Set the
selected block labels to have the properties:

Block property \texttt{"blockname"}.

\texttt{automesh}: 0 = mesher defers to mesh size constraint defined in
\texttt{meshsize}, 1 = mesher automatically chooses the mesh density.

\texttt{meshsize}: size constraint on the mesh in the block marked by this
label.

A member of group number \texttt{group}

\item {\tt ci\_setsegmentprop("propname", elementsize, automesh, hide, group,
"inconductor",)} Set the select segments to have:

Boundary property \texttt{"propname"}

Local element size along segment no greater than
\texttt{elementsize}

\texttt{automesh}: 0 = mesher defers to the element constraint defined by
\texttt{elementsize}, 1 = mesher automatically chooses mesh size along the
selected segments

\texttt{hide}: 0 = not hidden in post-processor, 1 == hidden in post
processor

A member of group number \texttt{group}

A member of the conductor specified by the string
\texttt{"inconductor".} If the segment is not part of a conductor,
this parameter can be specified as
\texttt{"<None>"}.

\item {\tt ci\_setarcsegmentprop(maxsegdeg, "propname", hide, group,
"inconductor")} Set the selected arc segments to:

Meshed with elements that span at most \texttt{maxsegdeg} degrees
per element

Boundary property \texttt{"propname"}

\texttt{hide}: 0 = not hidden in post-processor, 1 == hidden in post
processor

A member of group number \texttt{group}

A member of the conductor specified by the string
\texttt{"inconductor".} If the segment is not part of a conductor,
this parameter can be specified as
\texttt{"<None>"}.

\item{\tt ci\_setgroup(n)} Set the group associated of the selected items to n
\end{itemize}

\subsection{Problem Commands}

\begin{itemize}
\item {\tt ci\_probdef(units,type,frequency,precision,(depth),(minangle))} changes the problem
definition. The \texttt{units} parameter specifies the units used
for measuring length in the problem domain. Valid \texttt{"units"}
entries are
\texttt{"inches"}, \texttt{"millimeters"}, \texttt{"centimeters"},
\texttt{"mils"}, \texttt{"meters}, and \texttt{"micrometers"}. Set
\texttt{problemtype} to \texttt{"planar"} for a 2-D planar problem, or to
\texttt{"axi"} for an axisymmetric problem. The \texttt{frequency} parameter specifies the frequency
in Hz at which the analysis ois to be performed. The \texttt{precision} parameter
dictates the precision required by the solver. For example, entering
\texttt{1.E-8} requires the RMS of the residual to be less than 10$^{ - 8}$.
A fourth parameter, representing the depth of the problem in the
into-the-page direction for 2-D planar problems, can also be specified
for planar problems. A sixth parameter represents the minimum angle constraint sent to the mesh generator.

\item {\tt ci\_analyze(flag)} runs \texttt{belasolv} to solve the problem. The
\texttt{flag} parameter controls whether the Belasolve window is visible or
minimized. For a visible window, either specify no value for
\texttt{flag} or specify 0. For a minimized window, \texttt{flag}
should be set to 1.

\item {\tt ci\_loadsolution()} loads and displays the solution corresponding to the
current geometry.

\item {\tt ci\_setfocus("documentname")} Switches the
electrostatics input file upon which Lua commands are to act. If
more than one electrostatics input file is being edited at a time,
this command can be used to switch between files so that the
mutiple files can be operated upon programmatically via Lua. {\tt
documentname} should contain the name of the desired document as
it appears on the window's title bar.

\item {\tt ci\_saveas("filename")} saves the file with name
\texttt{"filename"}. Note if you use a path you must use two backslashes
{\em e.g.} \verb+c:\\temp\\myfemmfile.fee+

\end{itemize}

\subsection{Mesh Commands}

\begin{itemize}
\item \texttt{ci\_createmesh()} runs triangle to create a mesh. Note that this is not
a necessary precursor of performing an analysis, as
\texttt{ci\_analyze()} will make sure the mesh is up to date before
running an analysis. The number of elements in the mesh is pushed
back onto the lua stack.

\item \texttt{ci\_showmesh()} toggles the flag that shows or hides the mesh.

\item \texttt{ci\_purgemesh()} clears the mesh out of both the screen and memory.
\end{itemize}

\subsection{Editing Commands}
\begin{itemize}

\item \texttt{ci\_copyrotate(bx, by, angle, copies, (editaction) )}

\texttt{bx, by} -- base point for rotation

\texttt{angle} -- angle by which the selected objects are incrementally
shifted to make each copy. \texttt{angle} is measured in degrees.

\texttt{copies} -- number of copies to be produced from the selected
objects.

\texttt{editaction} 0 --nodes, 1 -- lines (segments), 2 --block labels, 3 --
arc segments, 4- group

\item \texttt{ci\_copytranslate(dx, dy, copies, (editaction))}

\texttt{dx,dy} -- distance by which the selected objects are incrementally
shifted.

\texttt{copies} -- number of copies to be produced from the selected
objects.

\texttt{editaction} 0 --nodes, 1 -- lines (segments), 2 --block labels, 3 --
arc segments, 4- group

\item{\tt?mi\_createradius(x,?y,?r)}?turns?a?corner?located?at?{\tt?(x,y)}?into?a?curve?of?radius?{\tt?r}.

\item \texttt{ci\_moverotate(bx,by,shiftangle (editaction))}

\texttt{bx, by} -- base point for rotation

\texttt{shiftangle} -- angle in degrees by which the selected objects are
rotated.

\texttt{editaction} 0 --nodes, 1 -- lines (segments), 2 --block labels, 3 --
arc segments, 4- group

\item \texttt{ci\_movetranslate(dx,dy,(editaction))}

\texttt{dx,dy} -- distance by which the selected objects are shifted.

\texttt{editaction} 0 --nodes, 1 -- lines (segments), 2 --block labels, 3 --
arc segments, 4- group

\item \texttt{ci\_scale(bx,by,scalefactor,(editaction))}

\texttt{bx, by} -- base point for scaling

\texttt{scalefactor} -- a multiplier that determines how much the selected
objects are scaled

\texttt{editaction} 0 --nodes, 1 -- lines (segments), 2 --block labels, 3 --
arc segments, 4- group

\item \texttt{ci\_mirror(x1,y1,x2,y2,(editaction))} mirror the selected objects about
a line passing through the points \texttt{(x1,y1)} and
\texttt{(x2,y2)}. Valid \texttt{editaction} entries are 0 for
nodes, 1 for lines (segments), 2 for block labels, 3 for arc
segments, and 4 for groups.

\item \texttt{ci\_seteditmode(editmode)} Sets the current editmode to:

\texttt{"nodes"} -- nodes

\texttt{"segments"} - line segments

\texttt{"arcsegments"} - arc segments

\texttt{"blocks"} - block labels

\texttt{"group"} - selected group

This command will affect all subsequent uses of the other editing
commands, if they are used WITHOUT the \texttt{editaction}
parameter.
\end{itemize}

\subsection{Zoom Commands}

\begin{itemize}
\item \texttt{ci\_zoomnatural()} zooms to a ``natural'' view with sensible extents.

\item \texttt{ci\_zoomout()} zooms out by a factor of 50{\%}.

\item \texttt{ci\_zoomin()} zoom in by a factor of 200{\%}.

\item \texttt{ci\_zoom(x1,y1,x2,y2)} Set the display area to be from the bottom left
corner specified by \texttt{(x1,y1}) to the top right corner
specified by \texttt{(x2,y2)}.
\end{itemize}

\subsection{View Commands}
\begin{itemize}
\item \texttt{ci\_showgrid()} Show the grid points.

\item \texttt{ci\_hidegrid()} Hide the grid points points.

\item \texttt{ci\_gridsnap("flag")} Setting flag to ''on'' turns on snap to grid,
setting flag to "off"turns off snap to grid.

\item \texttt{ci\_setgrid(density,"type")} Change the grid spacing. The density
parameter specifies the space between grid points, and the type
parameter is set to \texttt{"cart"} for Cartesian coordinates or
\texttt{"polar"} for polar coordinates.

\item \texttt{ci\_refreshview()} Redraws the current view.

\item{\tt ci\_minimize()} minimizes the active magnetics input view.

\item{\tt ci\_maximize()} maximizes the active magnetics input view.

\item{\tt ci\_restore()} restores the active magnetics input view from a
 minimized or maximized state.

\item{\tt ci\_resize(width,height)} resizes the active magnetics input
 window client area to width $\times$ height.

\end{itemize}




\subsection{Object Properties}

\begin{itemize}
\item \texttt{ci\_getmaterial("materialname")} fetches the material specified by \texttt{materialname} 
from the materials library.

\item \texttt{ci\_addmaterial("materialname", ox, oy, ex, ey, ltx, lty)} adds a new material with
called \texttt{"materialname"} with the material properties:

\texttt{ox} Electrical conductivity in the x- or r-direction in units of S/m.

\texttt{oy} Electrical conductivity in the y- or z-direction in units of S/m.

\texttt{ex} Relative permittivity in the x- or r-direction.

\texttt{ey} Relative permittivity in the y- or z-direction.

\texttt{ltx} Dielectric loss tangent in the x- or r-direction.

\texttt{lty} Dielectric loss tangent in the y- or z-direction.

\item \texttt{ci\_addpointprop("pointpropname",Vp,qp)} adds a new point property of
name \texttt{"pointpropname"} with either a specified potential
\texttt{Vp }a point current density \texttt{qp} in units of A/m.

\item \texttt{ci\_addboundprop("boundpropname", Vs, qs, c0, c1, BdryFormat)} adds a
new boundary property with name \texttt{"boundpropname"}

For a ``Fixed Voltage'' type boundary condition, set the
\texttt{Vs} parameter to the desired voltage and all other
parameters to zero.

To obtain a ``Mixed'' type boundary condition, set \texttt{C1} and
\texttt{C0} as required and \texttt{BdryFormat} to 1. Set all other
parameters to zero.

To obtain a prescribes surface current density, set \texttt{qs} to
the desired current density in A/m$^{2}$ and set \texttt{BdryFormat}
to 2.

For a ``Periodic'' boundary condition, set \texttt{BdryFormat} to 3
and set all other parameters to zero.

For an ``Anti-Perodic'' boundary condition, set \texttt{BdryFormat}
to 4 set all other parameters to zero.

\item \texttt{ci\_addconductorprop("conductorname", Vc, qc, conductortype)} adds a new
conductor property with name \texttt{"conductorname"} with either a
prescribed voltage or a prescribed total current. Set the unused
property to zero. The \texttt{conductortype} parameter is 0 for
prescribed current and 1 for prescribed voltage.

\item \texttt{ci\_deletematerial("materialname")} deletes the material named
\texttt{"materialname"}.

\item \texttt{ci\_deleteboundprop("boundpropname")} deletes the boundary property
named \texttt{"boundpropname"}.

\item \texttt{ci\_deleteconductor("conductorname")} deletes the conductor named
\texttt{conductorname}.

\item \texttt{ci\_deletepointprop("pointpropname")} deletes the point property named
\texttt{"pointpropname"}

\item \texttt{ci\_modifymaterial("BlockName",propnum,value)} This function allows for
modification of a material's properties without redefining the
entire material (e.g. so that current can be modified from run to
run). The material to be modified is specified by
\texttt{"BlockName"}. The next parameter is the number of the
property to be set. The last number is the value to be applied to
the specified property. The various properties that can be modified
are listed below:

\begin{tabular}{lll}
propnum & Symbol &  Description \\ \hline
 0 & \texttt{BlockName} & Name of the material \\
 1 & \texttt{ox} & x (or r) direction conductivity \\
 2 & \texttt{oy} & y (or z) direction conductivity \\
 3 & \texttt{ex} & x (or r) direction relative permittivity \\
 4 & \texttt{ey} & y (or z) direction relative permittivity \\
 5 & \texttt{ltx} & x (or r) direction dielectric loss tangent \\
 6 & \texttt{lty} & y (or z) direction dielectric loss tangent \\
\end{tabular}


\item \texttt{ci\_modifyboundprop("BdryName",propnum,value) }This function allows for
modification of a boundary property. The BC to be modified is specified by
\texttt{"BdryName"}. The next parameter is the number of the property to be
set. The last number is the value to be applied to the specified property.
The various properties that can be modified are listed below:

\begin{tabular}{lll}
 \texttt{propnum} & Symbol & Description \\ \hline
 0 & \texttt{BdryName} & Name of boundary property \\
 1 & \texttt{Vs} & Fixed Voltage \\
 2 & \texttt{qs} & Prescribed current density \\
 3 & \texttt{c0} & Mixed BC parameter \\
 4 & \texttt{c1} & Mixed BC parameter \\
 5 & \texttt{BdryFormat} & Type of boundary condition:\\
   &   &
   \begin{tabular}{lll}
   0 & = & Prescribed V \\
   1 & = & Mixed \\
   2 & = & Surface current density \\
   3 & = & Periodic \\
   4 & = & Antiperiodic
   \end{tabular}
\end{tabular}





\item \texttt{ci\_modifypointprop("PointName",propnum,value)} This function allows for
modification of a point property. The point property to be modified
is specified by \texttt{"PointName"}. The next parameter is the
number of the property to be set. The last number is the value to
be applied to the specified property. The various properties that
can be modified are listed below:



\begin{tabular}{lll}
\texttt{propnum} & Symbol & Description \\ \hline
 0 & \texttt{PointName} & Name of the point property \\
 1 & \texttt{Vp} & Prescribed nodal voltage \\
 2 & \texttt{qp} & Point current density in A/m
\end{tabular}

\item \texttt{ci\_modifyconductorprop("ConductorName",propnum,value)} This function
allows for modification of a conductor property. The conductor
property to be modified is specified by \texttt{"ConductorName"}.
The next parameter is the number of the property to be set. The
last number is the value to be applied to the specified property.
The various properties that can be modified are listed below:


\begin{tabular}{lll}
\texttt{propnum} & Symbol & Description \\ \hline
  0 & \texttt{ConductorName} & Name of the conductor property \\
  1 & \texttt{Vc} &  Conductor voltage \\
  2 & \texttt{qc} &  Total conductor current \\
  3 & \texttt{ConductorType} & 0 = Prescribed current, 1 = Prescribed voltage
\end{tabular}

\end{itemize}

\subsection{Miscellaneous}

\begin{itemize}
\item \texttt{ci\_savebitmap("filename")} saves a bitmapped screenshot of the current
view to the file specified by \texttt{"filename"}, subject to the
\texttt{printf}-type formatting explained previously for the
\texttt{ci\_saveas} command.

\item \texttt{ci\_savemetafile("filename")} saves a metafile screenshot of the current
view to the file specified by \texttt{"filename"}, subject to the
\texttt{printf}-type formatting explained previously for the
\texttt{ci\_saveas} command.

\item \texttt{ci\_refreshview()} Redraws the current view.

\item \texttt{ci\_close()} closes the preprocessor window and
destroys the current document.

\item \texttt{ci\_shownames(flag)} This function allow the user to display or hide the
block label names on screen. To hide the block label names,
\texttt{flag} should be 0. To display the names, the parameter
should be set to 1.

\item{\tt ci\_readdxf("filename")} This function imports a dxf file specified by {\tt "filename"}.

\item{\tt ci\_savedxf("filename")} This function saves geometry information in a dxf file specified by {\tt "filename"}.

\item{\tt ci\_defineouterspace(Zo,Ro,Ri)} defines
an axisymmetric external region to be used in conjuction with the
Kelvin Transformation method of modeling unbounded problems.  The
{\tt Zo} parameter is the z-location of the origin of the outer region,
the {\tt Ro} parameter is the radius of the outer region, and the {\tt
Ri} parameter is the radius of the inner region ({\em i.e.} the region of
interest). In the exterior region, the permeability varies as a function of
distance from the origin of the external region.  These parameters
are necessary to define the permeability variation in the external
region.

\item{\tt ci\_attachouterspace()} marks all
selected block labels as members of the external region used for
modeling unbounded axisymmetric problems via the Kelvin
Transformation.

\item{\tt ci\_detachouterspace()} undefines all selected block labels
as members of the external region used for modeling unbounded axisymmetric
problems via the Kelvin Transformation.

\item{\tt ci\_attachdefault()} marks the
selected block label as the default block label.  This block label
is applied to any region that has not been explicitly labeled.

\item{\tt ci\_detachdefault()} undefines the default
attribute for the selected block labels.

\item{\tt ci\_makeABC(n,R,x,y,bc)} creates a series of circular shells that emulate the
impedance of an unbounded domain (i.e. an Inprovised Asymptotic Boundary
Condition).  The {\tt n} parameter contains the number of shells to be used
(should be between 1 and 10), {\tt R} is the radius of the solution domain, and
{\tt (x,y)} denotes the center of the solution domain.  The {\tt bc} parameter should
be specified as 0 for a Dirichlet outer edge or 1 for a Neumann outer edge.
If the function is called without all the parameters, the function makes up
reasonable values for the missing parameters.

\end{itemize}

\section{Current Flow Post Processor Command Set}

There are a number of Lua scripting commands designed to operate in
the postprocessor. As with the preprocessor commands, these
commands can be used with either the underscore naming or with the
no-underscore naming convention.

\subsection{Data Extraction Commands}
\begin{itemize}

\item \texttt{co\_lineintegral(type)} Calculate the line integral for the defined contour

% inttype==0 => E.t 
% inttype==1 => J.n
% inttype==2 => Contour Length
% inttype==3 => Average Voltage
% inttype==4 => Stress Tensor Force
% inttype==5 => Stress Tensor Torque

\begin{tabular}{ll}
\texttt{type} & Integral \\ \hline
 0 & $E \cdot t$ \\
 1 & $J \cdot n$ \\
 2 & Contour length \\
 3 & Average voltage over contour \\
 4 & Force from stress tensor \\
 5 & Torque from stress tensor
\end{tabular}

This integral returns either 1 or 2 values, depending on the
integral type, $e.g.:$

\texttt{Fx, Fy = co\_lineintegral(4)}

\item \texttt{co\_blockintegral(type)} Calculate a block integral for the selected
blocks

\begin{tabular}{ll}
\texttt{type} & Integral \\ \hline
	 0  & Real Power \\
	 1  & Reactive Power \\
	 2  & Apparent Power \\
	 3  & Time-Average Stored Energy \\
	 4  & Block cross-section area \\
	 5  & Block volume \\
	 6  & x (or r) direction Weighted Stress Tensor force, DC component \\
	 7  & y (or z) direction Weighted Stress Tensor force, DC component \\
	 8  & x (or r) direction Weighted Stress Tensor force, 2x frequency component \\
	 9  & y (or z) direction Weighted Stress Tensor force, 2x frequency component \\
	 10 & Weighted Stress Tensor torque, DC component \\
	 11 & Weighted Stress Tensor torque, 2x frequency component
\end{tabular}

Returns a value that can be complex, as necessary.

\item \texttt{co\_getpointvalues(X,Y)} Get the values associated with the point at x,y
The return values, in order, are:

\begin{tabular}{ll}
\texttt{Symbol} &  Definition \\ \hline
\texttt{V} & Voltage \\
\texttt{Jx} & x- or r- direction component of current density \\
\texttt{Jy} & y- or z- direction component of current density \\
\texttt{Kx} & x- or r- direction component of AC conductivity \\
\texttt{Ky} & y- or z- direction component of AC conductivity \\
\texttt{Ex} & x- or r- direction component of electric field intensity \\
\texttt{Ey} & y- or z- direction component of electric field intensity \\
\texttt{ex} & x- or r- direction component of permittivity \\
\texttt{ey} & y- or z- direction component of permittivity \\
\texttt{Jdx} & x- or r- direction component of displacement current density \\
\texttt{Jdy} & y- or z- direction component of displacement current density \\
\texttt{ox} & x- or r- direction component of permittivity \\
\texttt{oy} & y- or z- direction component of permittivity \\
\texttt{Jcx} & x- or r- direction component of conduction current density \\
\texttt{Jcy} & y- or z- direction component of conduction current density \\
\end{tabular}

\item \texttt{co\_makeplot(PlotType,NumPoints,Filename,FileFormat) }Allows Lua access
to the X-Y plot routines. If only PlotType or only PlotType and NumPoints
are specified, the command is interpreted as a request to plot the requested
plot type to the screen. If, in addition, the Filename parameter is
specified, the plot is instead written to disk to the specified file name as
an extended metafile. If the FileFormat parameter is also, the command is
instead interpreted as a command to write the data to disk to the specfied
file name, rather than display it to make a graphical plot. Valid entries
for PlotType are:

\begin{tabular}{ll}
\texttt{PlotType} &  Definition \\ \hline
 0 & \texttt{V (Voltage)} \\
 1 & \texttt{$\vert$J$\vert$ (Magnitude of current density)} \\
 2 & \texttt{J . n (Normal current density)} \\
 3 & \texttt{J . t (Tangential current density)} \\
 4 & \texttt{$\vert$E$\vert$ (Magnitude of field intensity)} \\
 5 & \texttt{E . n (Normal field intensity)} \\
 6 & \texttt{E . t (Tangential field intensity)} \\
 7 & \texttt{$\vert$Jc$\vert$ (Magnitude of conduction current density)} \\
 8 & \texttt{Jc . n (Normal conduction current density)} \\
 9 & \texttt{Jc . t (Tangential conduction current density)} \\
 10 & \texttt{$\vert$Jd$\vert$ (Magnitude of displacement current density)} \\
 11 & \texttt{Jd . n (Normal displacement current density)} \\
 12 & \texttt{Jd . t (Tangential displacement current density)} \\
\end{tabular}

\vspace*{8pt}
Valid file formats are:

\begin{tabular}{ll}
\texttt{FileFormat} &  Definition  \\ \hline
 0 & \texttt{Multi-column text with legend } \\
 1 & \texttt{Multi-column text with no legend } \\
 2 & \texttt{Mathematica-style formatting}
\end{tabular}

For example, if one wanted to plot $V $ to the screen with 200 points evaluated
to make the graph, the command would be: \newline
\texttt{co\_makeplot(0,200) } \newline
If this plot were to be written to disk as a metafile, the command
would be:\texttt{ } \newline
\texttt{co\_makeplot(0,200,"c:temp.emf")} \newline
To write data instead of a plot to disk, the command would be of
the form:\texttt{ } \newline
\texttt{co\_makeplot(0,200,"c:temp.txt",0)} \newline


\item \texttt{co\_getprobleminfo() } 
Returns info on problem description. Returns four values:

\begin{tabular}{ll} \hline
Return value & Definition \\ \hline 
1 &  problem type  \\ 
2 &  frequency in Hz \\ 
3 &  depth assumed for planar problems in meters.\\
4 &  length unit used to draw the problem, represented in meters
\end{tabular}

\item \texttt{co\_getconductorproperties("conductor")} Properties are returned for the
conductor property named "conductor". Two values are returned: The voltage
of the specified conductor, and the current on the specified
conductor.
\end{itemize}

\subsection{Selection Commands}

\begin{itemize}
\item \texttt{co\_seteditmode(mode) }Sets the mode of the postprocessor to point,
contour, or area mode. Valid entries for mode are\texttt{ "point",
"contour", }and\texttt{ "area". }

\item \texttt{co\_selectblock(x,y) }Select the block that contains point\texttt{
(x,y).}

\item \texttt{co\_groupselectblock(n) }Selects all of the blocks that are labeled by
block labels that are members of group n. If no number is specified
({\em i.e.} \texttt{co\_groupselectblock()}), all blocks are selected.

\item \texttt{co\_selectconductor("name")} Selects all nodes, segments, and arc
segments that are part of the conductor specified by the string
\texttt{("name")}. This command is used to select conductors for the
purposes of the ``weighted stress tensor'' force and torque
integrals, where the conductors are points or surfaces, rather than
regions ({\em i.e.} can't be selected with \texttt{co\_selectblock}).

\item \texttt{co\_addcontour(x,y) }Adds a contour point at\texttt{ (x,y). }If this is
the first point then it starts a contour, if there are existing
points the contour runs from the previous point to this point. The
\texttt{co\_addcontour }command has the same functionality as a
right-button-click contour point addition when the program is
running in interactive mode.\texttt{ }

\item \texttt{co\_bendcontour(angle,anglestep)} Replaces the straight line formed by
the last two points in the contour by an arc that spans angle
degrees. The arc is actually composed of many straight lines, each
of which is constrained to span no more than anglestep degrees. The
\texttt{angle} parameter can take on values from -180 to 180
degrees. The \texttt{anglestep} parameter must be greater than
zero. If there are less than two points defined in the contour,
this command is ignored.

\item \texttt{co\_selectpoint(x,y)} Adds a contour point at the closest input point to
\texttt{(x,y).} If the selected point and a previous selected points lie at
the ends of an arcsegment, a contour is added that traces along the
arcsegment. The \texttt{selectpoint} command has the same
functionality as the left-button-click contour point selection when
the program is running in interactive mode.

\item \texttt{co\_clearcontour()} Clear a prevously defined contour

\item \texttt{co\_clearblock()} Clear block selection
\end{itemize}



\subsection{Zoom Commands}

\begin{itemize}
\item \texttt{co\_zoomnatural()} Zoom to the natural boundaries of the geometry.

\item \texttt{co\_zoomin()} Zoom in one level.

\item \texttt{co\_zoomout()} Zoom out one level.

\item \texttt{co\_zoom(x1,y1,x2,y2)} Zoom to the window defined by lower left corner
\texttt{(x1,y1)} and upper right corner\texttt{ (x2,y2).}
\end{itemize}



\subsection{View Commands}

\begin{itemize}
\item \texttt{co\_showmesh()} Show the mesh.

\item \texttt{co\_hidemesh()} Hide the mesh.

\item \texttt{co\_showpoints()} Show the node points from the input geometry.

\item \texttt{co\_hidepoints()} Hide the node points from the input geometry.

\item \texttt{co\_smooth("flag")} This function controls whether or not smoothing is
applied to the $D$ and $E$ fields which are naturally piece-wise
constant over each element. Setting flag equal to \texttt{"on"}
turns on smoothing, and setting flag to \texttt{"off"} turns off
smoothing.

\item \texttt{co\_showgrid()} Show the grid points.

\item \texttt{co\_hidegrid()} Hide the grid points points.

\texttt{co\_gridsnap("flag")} Setting flag to ''on'' turns on snap to grid,
setting flag to "off" turns off snap to grid.

\item \texttt{co\_setgrid(density,"type")} Change the grid spacing. The density
parameter specifies the space between grid points, and the type
parameter is set to \texttt{"cart"} for Cartesian coordinates or
\texttt{"polar"} for polar coordinates.

\item \texttt{co\_hidedensityplot()} hides the current density plot.

\item \texttt{co\_showdensityplot(legend,gscale,type,upper,lower)} Shows the
current density plot with options:

\texttt{legend} Set to 0 to hide the plot legend or 1 to show the plot
legend.

\texttt{gscale} Set to 0 for a colour density plot or 1 for a grey scale
density plot.

\texttt{upper} Sets the upper display limit for the density plot.

\texttt{lower} Sets the lower display limit for the density plot.

\texttt{type} Sets the type of density plot. Specific choices for the type of density plot include:

\begin{tabular}{ll}
\texttt{type} &  Description  \\ \hline
0 & $|V|$		\\
1 & $| \mbox{Re}(V)|$	\\
2 & $| \mbox{Im}(V)|$	\\
3 & $|J|$		\\
4 & $|\mbox{Re}(J)|$	\\
5 & $|\mbox{Im}(J)|$	\\
6 & $|E|$		\\
7 & $|\mbox{Re}(E)|$	\\
8 & $|\mbox{Im}(E)|$
\end{tabular}

\item \texttt{co\_hidecontourplot()} Hides the contour plot.

\item \texttt{co\_showcontourplot(numcontours,lower{\_}V,upper{\_}V),type} shows the
$V$ contour plot with options:

\texttt{numcontours} Number of equipotential lines to be plotted;

\texttt{upper{\_}V} Upper limit for contours;

\texttt{lower{\_}V} Lower limit for contours; 

\texttt{type} the type of contour plot to be rendered.

If \texttt{co\_numcontours} is -1 all parameters are ignored and
default values are used, \\ e.g. \texttt{show{\_}contour{\_}plot(-1)}

The type can take on the values of {\tt "real"}, {\tt "imag"}, or {\tt "both"}, denoting
the real part of voltage, the imaginary part of voltage, or both components of voltage.

\item \texttt{co\_showvectorplot(type,scalefactor)}
controls the display of vectors denoting the field strength and
direction. The \texttt{type} parameter can take on the following values:

\begin{tabular}{ll}
\texttt{type} &  Description  \\ \hline
0 & No vector plot \\
1 & $\mbox{Re}(J)$ \\
2 & $\mbox{Re}(E)$ \\
3 & $\mbox{Im}(J)$ \\
4 & $\mbox{Im}(E)$ \\
5 & $\mbox{Re}(J)$ and $Im(J)$ \\
6 & $\mbox{Re}(E)$ and $Im(E)$
\end{tabular}
The \texttt{scalefactor}
determines the relative length of the vectors. If the scale is set
to 1, the length of the vectors are chosen so that the highest field
magnitude corresponds to a vector that is the same length as the
current grid size setting.

\item{\tt co\_minimize()} minimizes the active magnetics input view.

\item{\tt co\_maximize()} maximizes the active magnetics input view.

\item{\tt co\_restore()} restores the active magnetics input view from a
 minimized or maximized state.

\item{\tt co\_resize(width,height)} resizes the active magnetics input
 window client area to width $\times$ height.

\end{itemize}

\subsection{Miscellaneous}

\begin{itemize}

\item \texttt{co\_close()} close the current postprocessor window.

\item{\tt co\_refreshview()} Redraws the current view.

\item{\tt co\_reload()} Reloads the solution from disk.

\item \texttt{co\_savebitmap("filename")} saves a bitmapped screen shot of the current
view to the file specified by \texttt{"filename"}. Note that if you
use a path you must use two backslashes (e.g.
\texttt{"c:$\backslash \backslash $temp$\backslash \backslash
$myfile.bmp"}). If the file name contains a space (e.g. file
names like c:$\backslash $program files$\backslash $stuff) you must
enclose the file name in (extra) quotes by using a
\texttt{$\backslash $"} sequence. For example:

\texttt{co\_savebitmap("$\backslash $"c:$\backslash \backslash
$temp$\backslash \backslash $screenshot.bmp$\backslash $"")}

\item \texttt{co\_savemetafile("filename")} saves a metafile screenshot of the current
view to the file specified by \texttt{"filename"}, subject to the
printf-type formatting explained previously for the
\texttt{savebitmap} command.

\item \texttt{co\_shownames(flag)} This function allow the user to display or hide the
block label names on screen. To hide the block label names,
\texttt{flag} should be 0. To display the names, the parameter
should be set to 1.


\item{\tt co\_numnodes()} Returns the number of nodes in the in focus current flow output mesh.
\item{\tt co\_numelements()} Returns the number of elements in the in focus current flow output mesh.
\item{\tt co\_getnode(n)} Returns the (x,y) or (r,z) position of the nth mesh node.
\item{\tt co\_getelement(n)} MOGetElement[n] returns the following proprerties for the nth element:
    \begin{enumerate}
        \item Index of first element node
        \item Index of second element node
        \item Index of third element node
        \item x (or r) coordinate of the element centroid
        \item y (or z) coordinate of the element centroid
        \item element area using the length unit defined for the problem
        \item group number associated with the element
    \end{enumerate}

\end{itemize}


