 # Diff of /trunk/doc/user/escript.tex

revision 2483 by gross, Thu May 14 02:28:58 2009 UTC revision 2484 by gross, Mon Jun 22 04:22:19 2009 UTC
# Line 124  of \Shape $(2,3)$ and rank $2$: Line 124  of \Shape $(2,3)$ and rank $2$:
124  The initial value is the constant $1$ for all \DataSamplePoints and  The initial value is the constant $1$ for all \DataSamplePoints and
125  all components.  all components.
126
127  \Data objects can also be created from any \numarray  \Data objects can also be created from any \numpy
128  array or any object, such as a list of floating point numbers,  array or any object, such as a list of floating point numbers,
129  that can be converted into a \numarrayNA \cite{NUMARRAY}.  that can be converted into a \numpyNDA \cite{NUMPY}.
130  The following two statements  The following two statements
131  create objects which are equivalent to \var{mydat}:  create objects which are equivalent to \var{mydat}:
132  \begin{python}  \begin{python}
133    mydat1=Data(value=numarray.ones((2,3)),what=ContinuousFunction(myDomain))    mydat1=Data(value=numpy.ones((2,3)),what=ContinuousFunction(myDomain))
134    mydat2=Data(value=[[1,1],[1,1],[1,1]],what=ContinuousFunction(myDomain))    mydat2=Data(value=[[1,1],[1,1],[1,1]],what=ContinuousFunction(myDomain))
135  \end{python}  \end{python}
136  In the first case the initial value is \var{numarray.ones((2,3))}  In the first case the initial value is \var{numpy.ones((2,3))}
137  which generates a $2 \times 3$ matrix as a \numarrayNA  which generates a $2 \times 3$ matrix as a \numpyNDA
138  filled with ones. The \Shape of the created \Data object  filled with ones. The \Shape of the created \Data object
139  it taken from the \Shape of the array. In the second  it taken from the \Shape of the array. In the second
140  case, the creator converts the initial value, which is a list of lists,  case, the creator converts the initial value, which is a list of lists,
141  and converts it into a \numarrayNA before creating the actual  and converts it into a \numpyNDA before creating the actual
142  \Data object.        \Data object.
143
144  For convenience \escript provides creators for the most common types  For convenience \escript provides creators for the most common types
# Line 154  eg. a stress field. Line 154  eg. a stress field.
154  \item \var{Tensor4(0,Function(mydomain))} is the same as \var{Data(0,Function(myDomain),(d,d,d,d))}  \item \var{Tensor4(0,Function(mydomain))} is the same as \var{Data(0,Function(myDomain),(d,d,d,d))}
155  eg. a Hook tensor field.    eg. a Hook tensor field.
156  \end{itemize}  \end{itemize}
157  Here the initial value is $0$ but any object that can be converted into a \numarrayNA and whose \Shape  Here the initial value is $0$ but any object that can be converted into a \numpyNDA and whose \Shape
158  is consistent with \Shape of the \Data object to be created can be used as the initial value.  is consistent with \Shape of the \Data object to be created can be used as the initial value.
159
160  \Data objects can be manipulated by applying unary operations (eg. cos, sin, log) point  \Data objects can be manipulated by applying unary operations (eg. cos, sin, log) point
# Line 495  The following table shows arithmetic ope Line 495  The following table shows arithmetic ope
495  \end{tableii}  \end{tableii}
496  At least one of the arguments \var{arg0} or \var{arg1} must be a  At least one of the arguments \var{arg0} or \var{arg1} must be a
497  \Data object.  \Data object.
498  Either of the arguments may be a \Data object, a python number or a numarray object.  Either of the arguments may be a \Data object, a python number or a \numpy object.
499
500  If \var{arg0} or \var{arg1} are  If \var{arg0} or \var{arg1} are
501  not defined on the same \FunctionSpace, then an attempt is made to convert \var{arg0}  not defined on the same \FunctionSpace, then an attempt is made to convert \var{arg0}
# Line 563  the \Data object is represented in expan Line 563  the \Data object is represented in expan
563
564  \begin{classdesc}{Data}{value,what=FunctionSpace(),expand=\False}  \begin{classdesc}{Data}{value,what=FunctionSpace(),expand=\False}
565  creates a \Data object in the \FunctionSpace \var{what}.  creates a \Data object in the \FunctionSpace \var{what}.
566  The value for each \DataSamplePoints is set to \var{value}, which could be a \numarray, \Data object \var{value} or a dictionary of  The value for each \DataSamplePoints is set to \var{value}, which could be a \numpy, \Data object \var{value} or a dictionary of
567  \numarray or floating point numbers. In the latter case the keys must be integers and are used  \numpy or floating point numbers. In the latter case the keys must be integers and are used
568  as tags.  as tags.
569  The \Shape of the returned object is equal to the \Shape of \var{value}. If \var{expanded} is \True  The \Shape of the returned object is equal to the \Shape of \var{value}. If \var{expanded} is \True
570  the \Data object is represented in expanded form.  the \Data object is represented in expanded form.
# Line 642  Note that this is not the same as asking Line 642  Note that this is not the same as asking
642  \begin{methoddesc}[Data]{setTaggedValue}{tag_name,value}  \begin{methoddesc}[Data]{setTaggedValue}{tag_name,value}
643  assigns the \var{value} to all \DataSamplePoints which have the tag  assigns the \var{value} to all \DataSamplePoints which have the tag
644  assigned to \var{tag_name}. \var{value} must be an object of class  assigned to \var{tag_name}. \var{value} must be an object of class
645  \class{numarray.NumArray} or must be convertible into a  \class{numpy.ndarray} or must be convertible into a
646  \class{numarray.NumArray} object. \var{value} (or the corresponding  \class{numpy.ndarray} object. \var{value} (or the corresponding
647  \class{numarray.NumArray} object) must be of rank $0$ or must have the  \class{numpy.ndarray} object) must be of rank $0$ or must have the
648  same rank like the object.  same rank like the object.
649  If a value has already be defined for tag \var{tag_name} within the object  If a value has already be defined for tag \var{tag_name} within the object
650  it is overwritten by the new \var{value}.  If the object is expanded,  it is overwritten by the new \var{value}.  If the object is expanded,
# Line 693  returns a \RankTwo \Data object in \Func Line 693  returns a \RankTwo \Data object in \Func
693  \end{array}  \end{array}
694  \right.  \right.
695  \end{equation}  \end{equation}
696  If \var{d} is an integer a $(d,d)$ \numarray array is returned.  If \var{d} is an integer a $(d,d)$ \numpy array is returned.
697  \end{funcdesc}  \end{funcdesc}
698  \begin{funcdesc}{identityTensor}{d}  \begin{funcdesc}{identityTensor}{d}
699  is a synonym for \code{kronecker} (see above).  is a synonym for \code{kronecker} (see above).
# Line 706  is a synonym for \code{kronecker} (see a Line 706  is a synonym for \code{kronecker} (see a
706  % \end{array}  % \end{array}
707  % \right.  % \right.
708  % \end{equation}  % \end{equation}
709  % If \var{d} is an integer a $(d,d)$ \numarray array is returned.  % If \var{d} is an integer a $(d,d)$ \numpy array is returned.
710  \end{funcdesc}  \end{funcdesc}
711  \begin{funcdesc}{identityTensor4}{d}  \begin{funcdesc}{identityTensor4}{d}
712  returns a \RankFour \Data object in \FunctionSpace \var{d} such that  returns a \RankFour \Data object in \FunctionSpace \var{d} such that
# Line 718  returns a \RankFour \Data object in \Fun Line 718  returns a \RankFour \Data object in \Fun
718  \end{array}  \end{array}
719  \right.  \right.
720  \end{equation}  \end{equation}
721  If \var{d} is an integer a $(d,d,d,d)$ \numarray array is returned.  If \var{d} is an integer a $(d,d,d,d)$ \numpy array is returned.
722  \end{funcdesc}  \end{funcdesc}
723  \begin{funcdesc}{unitVector}{i,d}  \begin{funcdesc}{unitVector}{i,d}
724  returns a \RankOne \Data object in \FunctionSpace \var{d} such that  returns a \RankOne \Data object in \FunctionSpace \var{d} such that
# Line 730  returns a \RankOne \Data object in \Func Line 730  returns a \RankOne \Data object in \Func
730  \end{array}  \end{array}
731  \right.  \right.
732  \end{equation}  \end{equation}
733  If \var{d} is an integer a $(d,)$ \numarray array is returned.  If \var{d} is an integer a $(d,)$ \numpy array is returned.
734
735  \end{funcdesc}  \end{funcdesc}
736

Legend:
 Removed from v.2483 changed lines Added in v.2484