Changeset 2672


Ignore:
Timestamp:
Apr 6, 2006, 3:34:42 PM (18 years ago)
Author:
howard
Message:

Changed some usages of \code{...} to \function{...}, \class{...}, \method{...}, etc in accordance with the Python documentation framework.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentation/user_manual/anuga_user_manual.tex

    r2671 r2672  
    150150\subsection{Overview}
    151151
    152 What follows is a discussion of the structure and operation of the file
    153 \code{bedslopephysical.py}, with just enough detail to allow the reader
    154 to appreciate what's involved in setting up a scenario like the
    155 one it depicts.
     152What follows is a discussion of the structure and operation of the
     153file \file{bedslopephysical.py}, with just enough detail to allow
     154the reader to appreciate what's involved in setting up a scenario
     155like the one it depicts.
    156156
    157157This example carries out the solution of the shallow-water wave
     
    188188\subsection{Outline of the Program}
    189189
    190 In outline, \code{bedslopephysical.py} performs the following steps:
     190In outline, \file{bedslopephysical.py} performs the following steps:
    191191
    192192\begin{enumerate}
     
    213213%This should be used wherever possible
    214214For reference we include below the complete code listing for
    215 \code{bedslopephysical.py}. Subsequent paragraphs provide a `commentary'
    216 that describes each step of the program and explains it significance.
     215\file{bedslopephysical.py}. Subsequent paragraphs provide a
     216`commentary' that describes each step of the program and explains it
     217significance.
    217218
    218219%\verbatiminput{examples/bedslopephysical.py}
     
    228229\end{verbatim}}
    229230
    230 The function \code{rectangular} is imported from a module
    231 \code{mesh\_factory} defined elsewhere. (\anuga also contains
     231The function \function{rectangular} is imported from a module
     232\module{mesh\_factory} defined elsewhere. (\anuga also contains
    232233several other schemes that can be used for setting up meshes, but we
    233234shall not discuss these now.) The above assignment sets up a $10
     
    267268\end{verbatim}}
    268269
    269 This uses a Python class \code{Domain}, imported from
    270 \code{shallow\_water}, which is an extension of a more generic
    271 class of the same name in the module \code{domain}, and inherits
     270This uses a Python class \class{Domain}, imported from
     271\module{shallow\_water}, which is an extension of a more generic
     272class of the same name in the module \module{domain}, and inherits
    272273some methods from the generic class but has others specific to the
    273 shallow-water scenarios in which it is used. Specific options for domain
    274 are set at this point. One of them is to set the basename for the output file:
     274shallow-water scenarios in which it is used. Specific options for
     275domain are set at this point. One of them is to set the basename for
     276the output file:
    275277
    276278{\small \begin{verbatim}
     
    281283\subsection{Specifying the Quantities}
    282284
    283 The next task is to specify a number of quantities that we wish to set
    284 for each mesh point. The class \code{Domain} has a method
    285 \code{set\_quantity}, used to specify these quantities. It is a
    286 particularly flexible method that allows the user to set quantities in
    287 a variety of ways---using constants, functions, numeric arrays or
     285The next task is to specify a number of quantities that we wish to
     286set for each mesh point. The class \class{Domain} has a method
     287\method{set\_quantity}, used to specify these quantities. It is a
     288particularly flexible method that allows the user to set quantities
     289in a variety of ways---using constants, functions, numeric arrays or
    288290expressions involving other quantities, arbitrary data points with
    289291associated values, all of which can be passed as arguments. All
    290 quantities can be initialised using \code{set\_quantity}. For
     292quantities can be initialised using \method{set\_quantity}. For
    291293conserved quantities (\code{stage, xmomentum, ymomentum}) this is
    292 called the \emph{initial condition}, for other quantities that aren't
    293 updated by the equation, the same interface is used to assign their
    294 values. The code in the present example demonstrates a number of forms
    295 in which we can invoke \code{set\_quantity}.
     294called the \emph{initial condition}, for other quantities that
     295aren't updated by the equation, the same interface is used to assign
     296their values. The code in the present example demonstrates a number
     297of forms in which we can invoke \method{set\_quantity}.
    296298
    297299
     
    313315the \code{y} direction.  %[screen shot?]
    314316
    315 Once the function \code{f} is specified, the quantity
     317Once the function \function{f} is specified, the quantity
    316318\code{elevation} is assigned through the simple statement:
    317319
     
    485487\begin{figure}[hbt]
    486488
    487 %  \centerline{ \includegraphics[width=75mm, height=75mm]{examples/bedslopestart.eps}}
     489  \centerline{ \includegraphics[width=75mm, height=75mm]{examples/bedslopestart.eps}}
    488490
    489491  \caption{Bedslope example viewed with Swollen}
     
    495497
    496498  \centerline{
    497 %    \includegraphics[width=75mm, height=75mm]{examples/bedslopeduring.eps}
    498 %    \includegraphics[width=75mm, height=75mm]{examples/bedslopeend.eps}
     499    \includegraphics[width=75mm, height=75mm]{examples/bedslopeduring.eps}
     500    \includegraphics[width=75mm, height=75mm]{examples/bedslopeend.eps}
    499501   }
    500502
     
    864866\end{center}
    865867
     868Each listing details the full set of parameters for the class or
     869function; however, the description is generally limited to the most
     870important parameters and the reader is again referred to the code
     871for more details.
     872
     873The following parameters are common to many functions and classes
     874and are omitted from the descriptions given below:
     875
     876\begin{tabular}{|l|l|}  \hline
     877\textbf{Name } & \textbf{Description}\\
     878\hline
     879\code{usecache} & Specifies whether caching is to be used\\
     880\code{verbose} & If \code{True}, provides detailed terminal output
     881to the user\\   \hline
     882\end{tabular}
     883
    866884
    867885\section{Mesh Generation}
    868 
     886\refmodindex[pmesh.meshinterface]{pmesh.mesh\_interface}
    869887\begin{funcdesc}  {create\_mesh\_from\_regions}{bounding_polygon,
    870888                             boundary_tags,
     
    877895Module: \code{pmesh.mesh\_interface}
    878896
     897
    879898% Translate following into layman's language
    880899This function is used to create a triangular mesh suitable for use with
     
    886905the user specifies a list of boundary tags, one for each edge of the bounding
    887906polygon.
     907
     908This function is used to create a triangular mesh within a specified
     909region, suitable for use with \anuga. The user specifies a polygon
     910(the \code{bounding polygon}) that serves as the boundary for the
     911region as well as an upper bound (\code{maximum\_triangle\_area},
     912also referred to as the \emph{resolution}) for the areas of the
     913inscribed triangles. The function uses a random process to compute a
     914mesh within the bounding polygon and returns a meshfile, in the form
     915of a
    888916\end{funcdesc}
    889917
     
    912940    Module: \code{pyvolution.domain}
    913941
    914     Assigns the name \code{name} to the domain
     942    Assigns the name \code{name} to the domain.
    915943\end{funcdesc}
    916944
     
    925953    Module: \code{pyvolution.domain}
    926954
    927     Sets the directory used for data to the value \code{name}. The default value, before
    928     \code{set\_datadir} is run, is the value \code{default_datadir}
     955    Specifies the directory used for data, assigning it to the pathname \code{name}. The default value, before
     956    \code{set\_datadir} has been run, is the value \code{default_datadir}
    929957    specified in \code{config.py}.
     958
     959    Since different operating systems use different formats for specifying pathnames,
     960    it is necessary to specify path separators using the Python code \code{os.sep}, rather than
     961    the operating-specific ones such as `$\slash$' or `$\backslash$'.
     962    For this to work you will need to include the statement \code{import os}
     963    in your code, before the first appearance of \code{set\_datadir}.
     964
     965    For example, if you wished to set the data directory to a subdirectory
     966    \code{data} of the directory \code{project}, you might use
     967    statements of the following type:
     968
     969    {\small \begin{verbatim}
     970        import os
     971        domain.set_datadir{'project' + os.sep + 'data'}
     972    \end{verbatim}}
    930973\end{funcdesc}
    931974
     
    938981\end{funcdesc}
    939982
    940 \begin{funcdesc} {set_time}{??}
     983\begin{funcdesc} {set_time}{time=0.0}
     984    Module: \code{pyvolution.domain}
     985
     986    Sets the initial time, in seconds, for the simulation. The
     987    default is 0.0.
    941988\end{funcdesc}
    942989
     
    10721119point \code{(x, y)} within a mesh region.
    10731120
    1074 The actual time series at which data is available is specified by means
    1075 of an array \code{time} of monotonically increasing times.
    1076 The quantities containing the values to be interpolated are specified in
    1077 an array---or dictionary of arrays (used in conjunction with the optional argument
    1078 \code{quantitity\_names}) --- called \code{quantities}.
    1079 The optional arguments \code{vertex_coordinates} and \code{triangles} represent
    1080 the spatial mesh associated with the quantity arrays. If omitted the function created
    1081 by \code{Interpolation\_function} will be a function of \code{t} only.
    1082 
    1083 
    1084 Since, in practice, values need to be computed at specified
    1085 points, the syntax allows the user to specify, once and for all, a list
    1086 \code{interpolation\_points} of points at which values are required. In this case,
    1087 the function may be called using the form \code{f(t, id)}, where \code{id} is an
    1088 index identifying a member of \code{interpolation\_points}.
    1089 
    1090 
    1091 
    1092 
     1121The actual time series at which data is available is specified by
     1122means of an array \code{time} of monotonically increasing times. The
     1123quantities containing the values to be interpolated are specified in
     1124an array---or dictionary of arrays (used in conjunction with the
     1125optional argument \code{quantity\_names}) --- called
     1126\code{quantities}. The optional arguments \code{vertex_coordinates}
     1127and \code{triangles} represent the spatial mesh associated with the
     1128quantity arrays. If omitted the function created by
     1129\code{Interpolation\_function} will be a function of \code{t} only.
     1130
     1131Since, in practice, values need to be computed at specified points,
     1132the syntax allows the user to specify, once and for all, a list
     1133\code{interpolation\_points} of points at which values are required.
     1134In this case, the function may be called using the form \code{f(t,
     1135id)}, where \code{id} is an index for the list
     1136\code{interpolation\_points}.
    10931137
    10941138\end{classdesc}
     
    16901734\subsubsection{Can I start the simulation at an arbitrary time?}
    16911735Yes, using \code{domain.set_time()} you can specify an arbitrary starting time.
    1692 This is for example useful in conjunction with a file_boundary, which may start hours before anything hits the model boundary. By assigning a later time for the model to start, computational resources aren't wasted. 
     1736This is for example useful in conjunction with a file_boundary, which may start hours before anything hits the model boundary. By assigning a later time for the model to start, computational resources aren't wasted.
    16931737
    16941738\subsubsection{Why does a file\_function return a list of numbers when evaluated?}
     
    17011745
    17021746\subsubsection{How do I know which boundary tags are available?}
    1703 The method \code{domain.get_boundary_tags()} will return a list of 
     1747The method \code{domain.get_boundary_tags()} will return a list of
    17041748available tags for use with \code{domain.set_boundary_condition()}.
    17051749
Note: See TracChangeset for help on using the changeset viewer.