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

revision 1043 by gross, Tue Feb 27 08:12:37 2007 UTC revision 1044 by gross, Mon Mar 19 07:29:31 2007 UTC
# Line 224  shows an example. In this case two rock Line 224  shows an example. In this case two rock
224  is subdivided into triangular shaped cells. Each  is subdivided into triangular shaped cells. Each
225  cell has a tag indicating the rock type predominately found in this cell. Here $1$ is used to indicate  cell has a tag indicating the rock type predominately found in this cell. Here $1$ is used to indicate
226  rock type {\it white} and $2$ for rock type {\it gray}. The tags are assigned at the time when the cells are generated  rock type {\it white} and $2$ for rock type {\it gray}. The tags are assigned at the time when the cells are generated
227  and stored in the \Domain class object. The following statements show how for the  and stored in the \Domain class object. To allow easier usage of tags names can be used. These names are typically defined
228    at the time when the geometry is generated.
229
230    The following statements show how for the
231  example of \fig{Figure: tag} and the stress calculation discussed before tagged values are used for  example of \fig{Figure: tag} and the stress calculation discussed before tagged values are used for
232  \var{lam}:  \var{lam}:
233  \begin{python}  \begin{python}
234  lam=Scalar(value=2.,what=Function(mydomain))  lam=Scalar(value=2.,what=Function(mydomain))
235  lam.setTaggedValue(1,30.)  insertTaggedValue(lam,white=30.,gray=5000.)
lam.setTaggedValue(2,5000.)
236  s=getStress(u,lam,2.)  s=getStress(u,lam,2.)
237  \end{python}  \end{python}
238  In this example \var{lam} is set to $30$ for those cells with tag $1$ and to $5000.$ for those cells  In this example \var{lam} is set to $30$ for those cells with tag {\it white} (=$1$) and to $5000.$ for those cells
239  with tag $2$. The initial value $2$ of \var{lam} is used as a default value for the case when a tag  with tag {\it gray} (=$2$_. The initial value $2$ of \var{lam} is used as a default value for the case when a tag
240  is encountered which has not been linked with a value. Note that the \var{getStress} method  is encountered which has not been linked with a value. Note that the \var{getStress} method
241  is called without modification. \escript resolves the tags when \var{lam*trace(g)} is calculated.  is called without modification. \escript resolves the tags when \var{lam*trace(g)} is calculated.
242
# Line 314  returns the surface normals on the bound Line 316  returns the surface normals on the bound
316  returns the local sample size, e.g. the element diameter, as \Data object.  returns the local sample size, e.g. the element diameter, as \Data object.
317  \end{methoddesc}  \end{methoddesc}
318
319    \begin{methoddesc}[Domain]{setTagMap}{tag_name, tag}
320    defines a mapping of the tag name  \var{tag_name} to the \var{tag}.
321    \end{methoddesc}
322    \begin{methoddesc}[Domain]{getTag}{tag_name}
323    returns the tag associated with the tag name \var{tag_name}.
324    \end{methoddesc}
325    \begin{methoddesc}[Domain]{isValidTagName}{tag_name}
326    return \True if \var{tag_name} is a valid tag name.
327    \end{methoddesc}
328
329  \begin{methoddesc}[Domain]{__eq__}{arg}  \begin{methoddesc}[Domain]{__eq__}{arg}
330  returns \True of the \Domain \var{arg} describes the same domain. Otherwise  returns \True of the \Domain \var{arg} describes the same domain. Otherwise
331  \False is returned.  \False is returned.
# Line 335  are instantiated by generator functions. Line 347  are instantiated by generator functions.
347  represented by their values at \DataSamplePoints which are defined by the type and the \Domain of the  represented by their values at \DataSamplePoints which are defined by the type and the \Domain of the
348  \FunctionSpace.  \FunctionSpace.
349  \end{classdesc}  \end{classdesc}
350  The following methds are available:  The following methods are available:
351  \begin{methoddesc}[FunctionSpace]{getDim}{}  \begin{methoddesc}[FunctionSpace]{getDim}{}
352  returns the spatial dimension of the \Domain of the \FunctionSpace.  returns the spatial dimension of the \Domain of the \FunctionSpace.
353  \end{methoddesc}  \end{methoddesc}
354
355
356
357  \begin{methoddesc}[FunctionSpace]{getX}{}  \begin{methoddesc}[FunctionSpace]{getX}{}
358  returns the location of the \DataSamplePoints.  returns the location of the \DataSamplePoints.
359  \end{methoddesc}  \end{methoddesc}
# Line 360  The size may be zero. Line 374  The size may be zero.
374  returns the \Domain of the \FunctionSpace.  returns the \Domain of the \FunctionSpace.
375  \end{methoddesc}  \end{methoddesc}
376
378    assigns a new tag \var{new_tag} to all data sample
379    where \var{mask} is positive for a least one data point.
380    \var{mask} must be defined on the this \FunctionSpace.
381    Use the \var{setTagMap} to assign a tage name to \var{new_tag}.
382    \end{methoddesc}
383
384  \begin{methoddesc}[FunctionSpace]{__eq__}{arg}  \begin{methoddesc}[FunctionSpace]{__eq__}{arg}
385  returns \True of the \Domain \var{arg} describes the same domain. Otherwise  returns \True of the \Domain \var{arg} describes the same domain. Otherwise
386  \False is returned.  \False is returned.
# Line 578  returns \True id the \Data object is the Line 599  returns \True id the \Data object is the
599  Otherwise \False is returned.  Otherwise \False is returned.
600  \end{methoddesc}  \end{methoddesc}
601
602  \begin{methoddesc}[Data]{setTaggedValue}{tag,value}  \begin{methoddesc}[Data]{setTaggedValue}{tag_name,value}
603  assigns the \var{value} to all \DataSamplePoints which have the tag  assigns the \var{value} to all \DataSamplePoints which have the tag
604  \var{tag}. \var{value} must be an object of class  assigned to \var{tag_name}. \var{value} must be an object of class
605  \class{numarray.NumArray} or must be convertible into a  \class{numarray.NumArray} or must be convertible into a
606  \class{numarray.NumArray} object. \var{value} (or the corresponding  \class{numarray.NumArray} object. \var{value} (or the corresponding
607  \class{numarray.NumArray} object) must be of rank $0$ or must have the  \class{numarray.NumArray} object) must be of rank $0$ or must have the
608  same rank like the object.  same rank like the object.
609  If a value has already be defined for tag \var{tag} within the object  If a value has already be defined for tag \var{tag_name} within the object
610  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,
611  the value assigned to \DataSamplePoints with tag \var{tag} is replaced by  the value assigned to \DataSamplePoints with tag \var{tag_name} is replaced by
612  \var{value}.  \var{value}.
613  \end{methoddesc}  \end{methoddesc}
614

Legend:
 Removed from v.1043 changed lines Added in v.1044