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

Revision 593 - (hide annotations)
Tue Mar 14 02:50:27 2006 UTC (14 years, 2 months ago) by gross
File MIME type: application/x-tex
File size: 45112 byte(s)
updates on escript documentation (unfinished)

 1 jgs 107 2 jgs 82 % $Id$ 3 4 \chapter{The module \escript} 5 6 jgs 102 \declaremodule{extension}{escript} 7 \modulesynopsis{Data manipulation} 8 jgs 82 9 jgs 102 \begin{figure} 10 \includegraphics[width=\textwidth]{EscriptDiagram1.eps} 11 \caption{\label{ESCRIPT DEP}Dependency of Function Spaces. An arrow indicates that a function in the 12 function space at the starting point can be interpreted as a function in the function space of the arrow target.} 13 \end{figure} 14 jgs 82 15 jgs 102 \escript is an extension of Python to handle functions represented by their values on 16 jgs 107 \DataSamplePoints for the geometrical region on which 17 jgs 102 the function is defined. The region as well as the method which is used 18 to interpolate value on the \DataSamplePoints is defined by 19 \Domain class objects. For instance when using 20 the finite element method (FEM) \index{finite element method} 21 \Domain object holds the information about the FEM mesh, eg. 22 a table of nodes and a table of elements. Although \Domain contains 23 the discretization method to be used \escript does not use this information directly. 24 \Domain objects are created from a module which want to make use 25 \escript, e.g. \finley. 26 jgs 82 27 jgs 102 The solution of a PDE is a function of its location in the domain of interest $\Omega$. 28 When solving a partial differential equation \index{partial differential equation} (PDE) using FEM 29 the solution is (piecewise) differentiable but, in general, its gradient 30 is discontinuous. To reflect these different degrees of smoothness different 31 representations of the functions are used. For instance; in FEM 32 the displacement field is represented by its values at the nodes of the mesh, while the 33 strain, which is the symmetric part of the gradient of the displacement field, is stored on the 34 element centers. To be able to classify functions with respect to their smoothness, \escript has the 35 concept of the "function space". A function space is described by a \FunctionSpace object. 36 The following statement generates the object \var{solution_space} which is 37 a \FunctionSpace object and provides access to the function space of 38 PDE solutions on the \Domain \var{mydomain}: 39 \begin{python} 40 solution_space=Solution(mydomain) 41 \end{python} 42 jgs 107 The following generators for function spaces on a \Domain \var{mydomain} are available: 43 jgs 102 \begin{itemize} 44 \item \var{Solution(mydomain)}: solutions of a PDE. 45 \item \var{ContinuousFunction(mydomain)}: continuous functions, eg. a temperature distribution. 46 \item \var{Function(mydomain)}: general functions which are not necessarily continuous, eg. a stress field. 47 \item \var{FunctionOnBoundary(mydomain)}: functions on the boundary of the domain, eg. a surface pressure. 48 \item \var{FunctionOnContact0(mydomain)}: functions on side $0$ of the discontinuity. 49 \item \var{FunctionOnContact1(mydomain)}: functions on side $1$ of the discontinuity. 50 \end{itemize} 51 A discontinuity \index{discontinuity} is a region within the domain across which functions may be discontinuous. 52 The location of discontinuity is defined in the \Domain object. 53 \fig{ESCRIPT DEP} shows the dependency between the types of function spaces. 54 The solution of a PDE is a continuous function. Any continuous function can be seen as a general function 55 on the domain and can be restricted to the boundary as well as to any side of the 56 discontinuity (the result will be different depending on 57 which side is chosen). Functions on any side of the 58 discontinuity can be seen as a function on the corresponding other side. 59 A function on the boundary or on one side of 60 the discontinuity cannot be seen as a general function on the domain as there are no values 61 defined for the interior. For most PDE solver libraries 62 the space of the solution and continuous functions is identical, however in some cases, eg. 63 when periodic boundary conditions are used in \finley, a solution 64 fulfils periodic boundary conditions while a continuous function does not have to be periodic. 65 66 The concept of function spaces describes the properties of 67 functions and allows abstraction from the actual representation 68 of the function in the context of a particular application. For instance, 69 in the FEM context a 70 function in the \Function function space 71 is typically represented by its values at the element center, 72 but in a finite difference scheme the edge midpoint of cells is preferred. 73 Using the concept of function spaces 74 allows the user to run the same script on different 75 PDE solver libraries by just changing the creator of the \Domain object. 76 Changing the function space of a particular function 77 will typically lead to a change of its representation. 78 So, when seen as a general function, 79 a continuous function which is typically represented by its values 80 on the node of the FEM mesh or finite difference grid 81 jgs 107 must be interpolated to the element centers or the cell edges, 82 jgs 102 respectively. 83 jgs 82 84 jgs 102 \Data class objects store functions of the location in a domain. 85 The function is represented through its values on \DataSamplePoints where 86 the \DataSamplePoints are chosen according to the function space 87 of the function. 88 \Data class objects are used to define the coefficients 89 of the PDEs to be solved by a PDE solver library 90 and to store the returned solutions. 91 jgs 82 92 jgs 102 The values of the function have a rank which gives the 93 jgs 107 number of indices, and a \Shape defining the range of each index. 94 jgs 102 The rank in \escript is limited to the range $0$ through $4$ and 95 it is assumed that the rank and \Shape is the same for all \DataSamplePoints. 96 The \Shape of a \Data object is a tuple \var{s} of integers. The length 97 of \var{s} is the rank of the \Data object and \var{s[i]} is the maximum 98 value for the \var{i}-th index. 99 For instance, a stress field has rank $2$ and 100 \Shape $(d,d)$ where $d$ is the spatial dimension. 101 The following statement creates the \Data object 102 \var{mydat} representing a 103 continuous function with values 104 of \Shape $(2,3)$ and rank $2$: 105 \begin{python} 106 mydat=Data(value=1,what=ContinuousFunction(myDomain),shape=(2,3)) 107 \end{python} 108 The initial value is the constant $1$ for all \DataSamplePoints and 109 all components. 110 jgs 82 111 jgs 102 \Data objects can also be created from any \numarray 112 array or any object, such as a list of floating point numbers, 113 gross 593 that can be converted into a \numarray.NumArray \Ref{NUMARRAY}. 114 jgs 102 The following two statements 115 create objects which are equivalent to \var{mydat}: 116 \begin{python} 117 mydat1=Data(value=numarray.ones((2,3)),what=ContinuousFunction(myDomain)) 118 mydat2=Data(value=[[1,1],[1,1],[1,1]],what=ContinuousFunction(myDomain)) 119 \end{python} 120 In the first case the initial value is \var{numarray.ones((2,3))} 121 gross 593 which generates a $2 \times 3$ matrix as a \numarray.NumArray 122 jgs 102 filled with ones. The \Shape of the created \Data object 123 it taken from the \Shape of the array. In the second 124 case, the creator converts the initial value, which is a list of lists, 125 gross 593 and converts it into a \numarray.NumArray before creating the actual 126 jgs 102 \Data object. 127 jgs 82 128 jgs 102 For convenience \escript provides creators for the most common types 129 of \Data objects in the following forms (\var{d} defines the 130 spatial dimension): 131 \begin{itemize} 132 \item \var{Scalar(0,Function(mydomain))} is the same as \var{Data(0,Function(myDomain),(,))}, 133 e.g a temperature field. 134 \item \var{Vector(0,Function(mydomain))}is the same as \var{Data(0,Function(myDomain),(d))}, e.g 135 a velocity field. 136 \item \var{Tensor(0,Function(mydomain))} is the same as \var{Data(0,Function(myDomain),(d,d))}, 137 eg. a stress field. 138 \item \var{Tensor4(0,Function(mydomain))} is the same as \var{Data(0,Function(myDomain),(d,d,d,d))} 139 eg. a Hook tensor field. 140 \end{itemize} 141 gross 593 Here the initial value is $0$ but any object that can be converted into a \numarray.NumArray and whose \Shape 142 jgs 102 is consistent with \Shape of the \Data object to be created can be used as the initial value. 143 jgs 82 144 jgs 102 \Data objects can be manipulated by applying unitary operations (eg. cos, sin, log) 145 jgs 107 and can be combined by applying binary operations (eg. +, - ,* , /). 146 It is to be emphasized that \escript itself does not handle any spatial dependencies as 147 jgs 102 it does not know how values are interpreted by the processing PDE solver library. 148 However \escript invokes interpolation if this is needed during data manipulations. 149 Typically, this occurs in binary operation when both arguments belong to different 150 function spaces or when data are handed over to a PDE solver library 151 which requires functions to be represented in a particular way. 152 jgs 82 153 jgs 102 The following example shows the usage of {\tt Data} objects: Assume we have a 154 displacement field $u$ and we want to calculate the corresponding stress field 155 $\sigma$ using the linear--elastic isotropic material model 156 \begin{eqnarray}\label{eq: linear elastic stress} 157 \sigma\hackscore {ij}=\lambda u\hackscore {k,k} \delta\hackscore {ij} + \mu ( u\hackscore {i,j} + u\hackscore {j,i}) 158 \end{eqnarray} 159 where $\delta\hackscore {ij}$ is the Kronecker symbol and 160 $\lambda$ and $\mu$ are the Lame coefficients. The following function 161 takes the displacement {\tt u} and the Lame coefficients 162 \var{lam} and \var{mu} as arguments and returns the corresponding stress: 163 \begin{python} 164 import numarray 165 def getStress(u,lam,mu): 166 d=u.getDomain().getDim() 167 g=grad(u) 168 stress=lam*trace(g)*numarray.identity(d)+ \ 169 mu*(g+transpose(g)) 170 return stress 171 \end{python} 172 The variable 173 \var{d} gives the spatial dimension of the 174 domain on which the displacements are defined. 175 \var{identity} is a \numarray function which returns the Kronecker symbol with indexes 176 $i$ and $j$ running from $0$ to \var{d}-1. The call \var{grad(u)} requires 177 the displacement field \var{u} to be in the \var{Solution} or \ContinuousFunction 178 function space. The result \var{g} as well as the returned stress will be in the \Function function space. 179 If \var{u} is available, eg. by solving a PDE, \var{getStress} might be called 180 in the following way: 181 \begin{python} 182 s=getStress(u,1.,2.) 183 \end{python} 184 However \var{getStress} can also be called with \Data objects as values for 185 \var{lam} and \var{mu} which, 186 for instance in the case of a temperature dependency, are calculated by an expression. 187 The following call is equivalent to the previous example: 188 \begin{python} 189 lam=Scalar(1.,ContinuousFunction(mydomain)) 190 mu=Scalar(2.,Function(mydomain)) 191 s=getStress(u,lam,mu) 192 \end{python} 193 The function \var{lam} belongs to the \ContinuousFunction function space 194 but with \var{g} the function \var{trace(g)} is in the \Function function space. 195 Therefore the evaluation of the product \var{lam*trace(g)} in the stress calculation 196 produces a problem, as both functions are represented differently, eg. in FEM 197 \var{lam} by its values on the node, and in \var{trace(g)} by its values at the element centers. 198 In the case of inconsistent function spaces of arguments in a binary operation, \escript 199 interprets the arguments in the appropriate function space according to the inclusion 200 defined in Table~\ref{ESCRIPT DEP}. In this example that means 201 \escript sees \var{lam} as a function of the \Function function space. 202 In the context of FEM this means the nodal values of 203 \var{lam} are interpolated to the element centers. Behind the scenes 204 \escript calls the appropriate function from the PDE solver library. 205 jgs 82 206 jgs 102 \begin{figure} 207 \includegraphics[width=\textwidth]{EscriptDiagram2.eps} 208 \caption{\label{Figure: tag}Element Tagging. A rectangular mesh over a region with two rock types {\it white} and {\it gray}. 209 The number in each cell refers to the major rock type present in the cell ($1$ for {\it white} and $2$ for {\it gray}). 210 } 211 \end{figure} 212 jgs 82 213 jgs 102 Material parameters such as the Lame coefficients are typically dependent on rock types present in the 214 area of interest. A common technique to handle these kinds of material parameters is "tagging". \fig{Figure: tag} 215 shows an example. In this case two rock types {\it white} and {\it gray} can be found in the domain. The domain 216 is subdivided into rectangular shaped cells (which is not necessarily the best subdivision for this case). Each 217 cell has a tag indicating the rock type predominately found in this cell. Here $1$ is used to indicate 218 rock type {\it white} and $2$ for rock type {\it gray}. The tags are assigned at the time when the cells are generated 219 (\escript provides tools to manipulate tags at a later stage) 220 and stored in the \Domain class object. The following statements show how for the 221 example of \fig{Figure: tag} and the stress calculation discussed before tagged values are used for 222 \var{lam}: 223 \begin{python} 224 lam=Scalar(value=2.,what=Function(mydomain)) 225 lam.setTaggedValue(1,30.) 226 lam.setTaggedValue(2,5000.) 227 s=getStress(u,lam,2.) 228 \end{python} 229 In this example \var{lam} is set to $30$ for those cells with tag $1$ and to $5000.$ for those cells 230 with tag $2$. The initial value $2$ of \var{lam} is used as a default value for the case when a tag 231 is encountered which has not been linked with a value. Note that the \var{getStress} method 232 is called without modification. \escript resolves the tags when \var{lam*trace(g)} is calculated. 233 jgs 82 234 jgs 102 The \Data class provides a transparent interface to various data representations and the 235 translations between them. As shown in the example of stress calculation, this allows the user to 236 develop and test algorithms for a simple case (for instance with the Lame coefficients as constants) 237 and then without further modifications of the program code to apply the algorithm in a 238 more complex application (for instance a definition of the Lame coefficients using tags). 239 As described here, there are three ways in which \Data objects are represented internally, constant, tagged, and expanded (other representions will become available in later versions of \escript): 240 In the constant case, if the same value is used at each sample point a single value is stored to save memory and compute time. 241 Any operation on this constant data will only be performed on the single value. 242 In the expanded case, each sample point has an individual value, eg. the solution of a PDE, 243 and the values are stored as a complete array. The tagged case has already been discussed above. 244 245 Values are accessed through a sample reference number. Operations on expanded \Data 246 objects have to be performed for each sample point individually. If tagged values are used values are 247 held in a dictionary. Operations on tagged data require processing the set of tagged values only, rather than 248 processing the value for each individual sample point. 249 \escript allows use of constant, tagged and expanded data in a single expression. 250 jgs 82 251 252 jgs 102 253 \section{\Domain class} 254 \begin{classdesc}{Domain}{} 255 jgs 107 A \Domain object is used to describe a geometrical region together with 256 jgs 102 a way of representing functions over this region. 257 The \Domain class provides an abstract access to the domain of \FunctionSpace and \Data objects. 258 \Domain itself has no initialization but implementations of \Domain are 259 instantiated by numerical libraries making use of \Data objects. 260 jgs 82 \end{classdesc} 261 gross 593 The following methds are available: 262 jgs 102 \begin{methoddesc}[Domain]{getDim}{} 263 returns the spatial dimension of the \Domain. 264 \end{methoddesc} 265 266 \begin{methoddesc}[Domain]{getX}{} 267 returns the locations in the \Domain. The \FunctionSpace of the returned 268 \Data object is chosen by the \Domain implementation. Typically it will be 269 in the \Function. 270 \end{methoddesc} 271 272 \begin{methoddesc}[Domain]{setX}{newX} 273 assigns a new location to the \Domain. \var{newX} has to have \Shape $(d,)$ 274 where $d$ is the spatial dimension of the domain. Typically \var{newX} must be 275 in the \ContinuousFunction but the space actually to be used depends on the \Domain implementation. 276 \end{methoddesc} 277 278 \begin{methoddesc}[Domain]{getNormal}{} 279 returns the surface normals on the boundary of the \Domain as \Data object. 280 \end{methoddesc} 281 282 \begin{methoddesc}[Domain]{getSize}{} 283 returns the local sample size, e.g. the element diameter, as \Data object. 284 \end{methoddesc} 285 286 \begin{methoddesc}[Domain]{__eq__}{arg} 287 returns \True of the \Domain \var{arg} describes the same domain. Otherwise 288 \False is returned. 289 \end{methoddesc} 290 291 \begin{methoddesc}[Domain]{__ne__}{arg} 292 returns \True of the \Domain \var{arg} does not describe the same domain. 293 Otherwise \False is returned. 294 \end{methoddesc} 295 296 gross 593 \begin{methoddesc}[Domain]{__str__}{g} 297 returns string represention of the \Domain. 298 \end{methoddesc} 299 300 jgs 102 \section{\Domain class} 301 \begin{classdesc}{FunctionSpace}{} 302 \FunctionSpace objects are used to define properties of \Data objects, such as continuity. \FunctionSpace objects 303 are instantiated by generator functions. \Data objects in particular \FunctionSpace are 304 represented by their values at \DataSamplePoints which are defined by the type and the \Domain of the 305 \FunctionSpace. 306 jgs 82 \end{classdesc} 307 gross 593 The following methds are available: 308 jgs 102 \begin{methoddesc}[FunctionSpace]{getDim}{} 309 returns the spatial dimension of the \Domain of the \FunctionSpace. 310 \end{methoddesc} 311 jgs 82 312 jgs 102 \begin{methoddesc}[FunctionSpace]{getX}{} 313 returns the location of the \DataSamplePoints. 314 \end{methoddesc} 315 jgs 82 316 jgs 102 \begin{methoddesc}[FunctionSpace]{getNormal}{} 317 If the domain of functions in the \FunctionSpace 318 is a hypermanifold (e.g. the boundary of a domain) 319 the method returns the outer normal at each of the 320 \DataSamplePoints. Otherwise an exception is raised. 321 \end{methoddesc} 322 jgs 82 323 jgs 102 \begin{methoddesc}[FunctionSpace]{getSize}{} 324 returns a \Data objects measuring the spacing of the \DataSamplePoints. 325 The size may be zero. 326 \end{methoddesc} 327 jgs 82 328 jgs 102 \begin{methoddesc}[FunctionSpace]{getDomain}{} 329 returns the \Domain of the \FunctionSpace. 330 \end{methoddesc} 331 jgs 82 332 jgs 102 \begin{methoddesc}[FunctionSpace]{__eq__}{arg} 333 returns \True of the \Domain \var{arg} describes the same domain. Otherwise 334 \False is returned. 335 \end{methoddesc} 336 jgs 82 337 jgs 102 \begin{methoddesc}[FunctionSpace]{__ne__}{arg} 338 returns \True of the \Domain \var{arg} describes the note same domain. 339 Otherwise \False is returned. 340 \end{methoddesc} 341 jgs 82 342 gross 593 \begin{methoddesc}[Domain]{__str__}{g} 343 returns string represention of the \Domain. 344 \end{methoddesc} 345 346 jgs 102 The following function provide generators for \FunctionSpace objects: 347 \begin{funcdesc}{Function}{domain} 348 returns the \Function on the \Domain \var{domain}. \Data objects in this type of \Function 349 are defined over the whole geometrical region defined by \var{domain}. 350 jgs 82 \end{funcdesc} 351 352 jgs 102 \begin{funcdesc}{ContinuousFunction}{domain} 353 returns the \ContinuousFunction on the \Domain domain. \Data objects in this type of \Function 354 are defined over the whole geometrical region defined by \var{domain} and assumed to represent 355 a continuous function. 356 jgs 82 \end{funcdesc} 357 358 jgs 102 \begin{funcdesc}{FunctionOnBoundary}{domain} 359 returns the \ContinuousFunction on the \Domain domain. \Data objects in this type of \Function 360 are defined on the boundary of the geometrical region defined by \var{domain}. 361 jgs 82 \end{funcdesc} 362 363 jgs 102 \begin{funcdesc}{FunctionOnContactZero}{domain} 364 returns the \FunctionOnContactZero the \Domain domain. \Data objects in this type of \Function 365 are defined on side 0 of a discontinutiy within the geometrical region defined by \var{domain}. 366 The discontinutiy is defined when \var{domain} is instantiated. 367 jgs 82 \end{funcdesc} 368 369 jgs 102 \begin{funcdesc}{FunctionOnContactOne}{domain} 370 returns the \FunctionOnContactOne on the \Domain domain. 371 \Data objects in this type of \Function 372 are defined on side 1 of a discontinutiy within the geometrical region defined by \var{domain}. 373 The discontinutiy is defined when \var{domain} is instantiated. 374 jgs 82 \end{funcdesc} 375 376 jgs 102 \begin{funcdesc}{Solution}{domain} 377 returns the \SolutionFS on the \Domain domain. \Data objects in this type of \Function 378 are defined on geometrical region defined by \var{domain} and are solutions of 379 partial differential equations \index{partial differential equation}. 380 jgs 82 \end{funcdesc} 381 382 jgs 102 \begin{funcdesc}{ReducedSolution}{domain} 383 returns the \ReducedSolutionFS on the \Domain domain. \Data objects in this type of \Function 384 are defined on geometrical region defined by \var{domain} and are solutions of 385 partial differential equations \index{partial differential equation} with a reduced smoothness 386 for the solution approximation. 387 jgs 82 \end{funcdesc} 388 389 jgs 102 \section{\Data Class} 390 jgs 107 \label{SEC ESCRIPT DATA} 391 jgs 82 392 jgs 102 The following table shows binary and unitary operations that can be applied to 393 \Data objects: 394 \begin{tableii}{l|l}{textrm}{expression}{Description} 395 \lineii{+\var{arg1}} {just \var{arg} \index{+}} 396 \lineii{-\var{arg1}} {swapping the sign\index{-}} 397 \lineii{\var{arg1}+\var{arg2}} {adds \var{arg1} and \var{arg2} \index{+}} 398 \lineii{\var{arg1}*\var{arg2}} {multiplies \var{arg1} and \var{arg2} \index{*}} 399 \lineii{\var{arg1}-\var{arg2}} {difference \var{arg2} from\var{arg2} \index{-}} 400 \lineii{\var{arg1}/\var{arg2}} {ratio \var{arg1} by \var{arg2} \index{/}} 401 \lineii{\var{arg1}**\var{arg2}} {raises \var{arg1} to the power of \var{arg2} \index{**}} 402 \end{tableii} 403 jgs 107 At least one of the arguments \var{arg1} or \var{arg2} must be a 404 jgs 102 \Data object. One of the arguments may be an object that can be 405 converted into a \Data object. If \var{arg1} or \var{arg2} are 406 jgs 107 defined on different \FunctionSpace an attempt is made to embed \var{arg1} 407 jgs 102 into the \FunctionSpace of \var{arg2} or to embed \var{arg2} into 408 the \FunctionSpace of \var{arg1}. Boths arguments must have the same 409 \Shape or one of the arguments my be of rank 0 or \Shape (1,). In the 410 latter case it is assumed that the particular argument is of the same 411 jgs 107 \Shape as the other argument but constant over all components. 412 jgs 82 413 jgs 102 The returned \Data object has the same \Shape and is defined on 414 jgs 107 the \DataSamplePoints as \var{arg1} or \var{arg2}. 415 jgs 82 416 jgs 102 The following table shows the update operations that can be applied to 417 \Data objects: 418 \begin{tableii}{l|l}{textrm}{expression}{Description} 419 \lineii{\var{arg1}+=\var{arg2}} {adds \var{arg1} to \var{arg2} \index{+}} 420 \lineii{\var{arg1}*=\var{arg2}} {multiplies \var{arg1} with \var{arg2} \index{*}} 421 \lineii{\var{arg1}-=\var{arg2}} {subtracts \var{arg2} from\var{arg2} \index{-}} 422 \lineii{\var{arg1}/=\var{arg2}} {divides \var{arg1} by \var{arg2} \index{/}} 423 \end{tableii} 424 \var{arg1} must be a \Data object. \var{arg1} must be a 425 \Data object or an object that can be converted into a 426 \Data object. \var{arg1} must have the same \Shape like 427 \var{arg1} or has rank 0 or \Shape (1,). In the latter case it is 428 assumed that the values of \var{arg1} are constant for all 429 jgs 107 components. \var{arg2} must be defined on the same \DataSamplePoints as 430 jgs 102 \var{arg1} or it must be possible to interpolate \var{arg2} onto the 431 jgs 107 \DataSamplePoints where \var{arg1} is held. 432 jgs 82 433 jgs 102 The \Data class supports getting slices as well as assigning new values to components in an existing 434 jgs 107 \Data object. \index{slicing} 435 jgs 102 The following expression for getting (expression on the right hand side of the 436 equal sign) and setting slices (expression on the left hand side of the 437 equal sign) are valid: 438 \begin{tableiii}{l|ll}{textrm}{rank of \var{arg}}{slicing expression}{\Shape of returned and assigned object} 439 \lineiii{0}{ no slicing } {-} 440 \lineiii{1}{\var{arg[l0:u0]}} {(\var{u0}-\var{l0},)} 441 \lineiii{2}{\var{arg[l0:u0,l1:u1]}} {(\var{u0}-\var{l0},\var{u1}-\var{l1})} 442 \lineiii{3}{\var{arg[l0:u0,l1:u1,l2:u2]} } {(\var{u0}-\var{l0},\var{u1}-\var{l1},\var{u2}-\var{l2})} 443 \lineiii{4}{\var{arg[l0:u0,l1:u1,l2:u2,l3:u3]}} {(\var{u0}-\var{l0},\var{u1}-\var{l1},\var{u2}-\var{l2},\var{u3}-\var{l3})} 444 \end{tableiii} 445 where 446 $0 \le \var{l0} \le \var{u0} \le \var{s[0]}$, 447 $0 \le \var{l1} \le \var{u1} \le \var{s[1]}$, 448 $0 \le \var{l2} \le \var{u2} \le \var{s[2]}$, 449 $0 \le \var{l3} \le \var{u3} \le \var{s[3]}$ and \var{s} the \Shape if \var{arg}. 450 Any of the lower indexes \var{l0}, \var{l1}, \var{l2} and \var{l3} may not be present in which case 451 $0$ is assumed. 452 Any of the upper indexes \var{u0}, \var{u1}, \var{u2} and \var{u3} may not be present in which case 453 \var{s} is assumed. The lower and upper index may be identical, in which case the column and the lower or upper 454 index may be dropped. In the returned or in the object assigned to a slice the corresponding component is dropped, 455 i.e. the rank is reduced by one in comparison to \var{arg}. 456 jgs 107 The following examples show slicing usage: 457 jgs 102 \begin{python} 458 gross 593 t=Data(1.,(4,4,6,6),Function(mydomain)) 459 jgs 102 t[1,1,1,0]=9. 460 s=t[:2,:,2:6,5] # s has rank 3 461 s[:,:,1]=1. 462 t[:2,:2,5,5]=s[2:4,1,:2] 463 \end{python} 464 465 gross 593 \subsection{Generation of \Data class objects} 466 \begin{classdesc}{Data}{value=0,shape=(,),what=FunctionSpace(),expand=\False} 467 jgs 102 creates a \Data object with \Shape \var{shape} in the \FunctionSpace \var{what}. 468 The values at all \DataSamplePoints are set to the double value \var{value}. If \var{expanded} is \True 469 the \Data object is represented in expanded from. 470 jgs 82 \end{classdesc} 471 472 gross 593 \begin{classdesc}{Data}{value,what=FunctionSpace(),expand=\False} 473 jgs 102 creates a \Data object in the \FunctionSpace \var{what}. 474 gross 593 The value for each \DataSamplePoints is set to \numarray, \Data object \var{value} or a dictionary of 475 \numarray or floating point numbers. In the latter case the keys muts be integers and are used 476 as tags. 477 jgs 102 The \Shape of the returned object is equal to the \Shape of \var{value}. If \var{expanded} is \True 478 the \Data object is represented in expanded from. 479 \end{classdesc} 480 481 \begin{classdesc}{Data}{} 482 creates an \EmptyData object. The \EmptyData object is used to indicate that an argument is not present 483 where a \Data object is required. 484 \end{classdesc} 485 486 gross 593 \begin{funcdesc}{Scalar}{value=0.,what=escript::FunctionSpace(),expand=\False} 487 returns a \Data object of rank 0 in the \FunctionSpace \var{what}. 488 Values are initialed with the double \var{value}. If \var{expanded} is \True 489 the \Data object is represented in expanded from. 490 \end{funcdesc} 491 492 \begin{funcdesc}{Vector}{value=0.,what=escript::FunctionSpace(),expand=\False} 493 returns a \Data object of \Shape \var{(d,)} in the \FunctionSpace \var{what} 494 where \var{d} is the spatial dimension of the \Domain of \var{what}. 495 Values are initialed with the double \var{value}. If \var{expanded} is \True 496 the \Data object is represented in expanded from. 497 \end{funcdesc} 498 499 \begin{funcdesc}{Tensor}{value=0.,what=escript::FunctionSpace(),expand=\False} 500 returns a \Data object of \Shape \var{(d,d)} in the \FunctionSpace \var{what} 501 where \var{d} is the spatial dimension of the \Domain of \var{what}. 502 Values are initialed with the double \var{value}. If \var{expanded} is \True 503 the \Data object is represented in expanded from. 504 \end{funcdesc} 505 506 \begin{funcdesc}{Tensor3}{value=0.,what=escript::FunctionSpace(),expand=\False} 507 returns a \Data object of \Shape \var{(d,d,d)} in the \FunctionSpace \var{what} 508 where \var{d} is the spatial dimension of the \Domain of \var{what}. 509 Values are initialed with the double \var{value}. If \var{expanded} is \True 510 the \Data object is re\var{arg}presented in expanded from. 511 \end{funcdesc} 512 513 \begin{funcdesc}{Tensor4}{value=0.,what=escript::FunctionSpace(),expand=\False} 514 returns a \Data object of \Shape \var{(d,d,d,d)} in the \FunctionSpace \var{what} 515 where \var{d} is the spatial dimension of the \Domain of \var{what}. 516 Values are initialed with the double \var{value}. If \var{expanded} is \True 517 the \Data object is represented in expanded from. 518 \end{funcdesc} 519 520 \subsection{\Data class methods} 521 This is a list of frequently used methods of the 522 \Data class. A complete list can be fond on \ReferenceGuide. 523 jgs 102 \begin{methoddesc}[Data]{getFunctionSpace}{} 524 returns the \FunctionSpace of the object. 525 jgs 82 \end{methoddesc} 526 527 gross 593 \begin{methoddesc}[Data]{getDomain}{} 528 jgs 102 returns the \Domain of the object. 529 \end{methoddesc} 530 531 jgs 82 \begin{methoddesc}[Data]{getShape}{} 532 jgs 102 returns the \Shape of the object as a \class{tuple} of 533 integers. 534 jgs 82 \end{methoddesc} 535 536 \begin{methoddesc}[Data]{getRank}{} 537 returns the rank of the data on each data point. \index{rank} 538 \end{methoddesc} 539 540 jgs 102 \begin{methoddesc}[Data]{isEmpty}{} 541 returns \True id the \Data object is the \EmptyData object. 542 Otherwise \False is returned. 543 jgs 82 \end{methoddesc} 544 545 jgs 102 \begin{methoddesc}[Data]{setTaggedValue}{tag,value} 546 assigns the \var{value} to all \DataSamplePoints which have the tag 547 \var{tag}. \var{value} must be an object of class 548 gross 593 \class{numarray.NumArray} or must be convertible into a 549 \class{numarray.NumArray} object. \var{value} (or the corresponding 550 \class{numarray.NumArray} object) must be of rank $0$ or must have the 551 jgs 102 same rank like the object. 552 If a value has already be defined for tag \var{tag} within the object 553 it is overwritten by the new \var{value}. If the object is expanded, 554 the value assigned to \DataSamplePoints with tag \var{tag} is replaced by 555 \var{value}. 556 jgs 82 \end{methoddesc} 557 558 gross 593 \begin{methoddesc}[Data]{__str__}{} 559 returns a string representation of the object. 560 \end{methoddesc} 561 562 \section{Functions of \Data class objects} 563 This section lists the most important functions for \Data class objects \var{a}. 564 A complete list and a more detailed description of the functionality can be fond on \ReferenceGuide. 565 \begin{funcdesc}{saveVTK}{filename,\optional{domain},**data} 566 writes a 567 \end{funcdesc} 568 \begin{funcdesc}{saveDX}{filename,domain=None,**data} 569 \end{funcdesc} 570 \begin{funcdesc}{kronecker}{d} 571 returns a \RankTwo \Data object \var{o} in \FunctionSpace \var{d} such that 572 \begin{equation} 573 o\left[ i,j\right] = \left\{ 574 \begin{array}{cc} 575 1 & \mbox{ if } i=j \\ 576 0 & \mbox{ otherwise } 577 \end{array} 578 \right. 579 \end{equation} 580 \end{funcdesc} 581 582 \begin{funcdesc}{identityTensor}{d} 583 \end{funcdesc} 584 \begin{funcdesc}{identityTensor4}{d} 585 \end{funcdesc} 586 \begin{funcdesc}{unitVector}{i,d} 587 \end{funcdesc} 588 589 \begin{funcdesc}{Lsup}{a} 590 returns the $L^{sup}$ norm of \var{arg}. This is the maximum of the absolute values 591 over all components and all \DataSamplePoints of \var{a}. 592 \end{funcdesc} 593 594 \begin{funcdesc}{sup}{a} 595 returns the maximum value over all components and all \DataSamplePoints of \var{a}. 596 \end{funcdesc} 597 598 \begin{funcdesc}{inf}{a} 599 returns the minimum value over all components and all \DataSamplePoints of \var{a} 600 \end{funcdesc} 601 602 \begin{funcdesc}{sin}{a} 603 applies sine function to \var{a}. 604 \end{funcdesc} 605 606 \begin{funcdesc}{cos}{a} 607 applies cosine function to \var{a}. 608 \end{funcdesc} 609 610 \begin{funcdesc}{tan}{a} 611 applies tangent function to \var{a}. 612 \end{funcdesc} 613 614 \begin{funcdesc}{asin}{a} 615 applies arc (inverse) sine function to \var{a}. 616 \end{funcdesc} 617 618 \begin{funcdesc}{acos}{a} 619 applies arc (inverse) cosine function to \var{a}. 620 \end{funcdesc} 621 622 \begin{funcdesc}{atan}{a} 623 applies arc (inverse) tangent function to \var{a}. 624 \end{funcdesc} 625 626 \begin{funcdesc}{sinh}{a} 627 applies hyperbolic sine function to \var{a}. 628 \end{funcdesc} 629 630 \begin{funcdesc}{cosh}{a} 631 applies hyperbolic cosine function to \var{a}. 632 \end{funcdesc} 633 634 \begin{funcdesc}{tanh}{a} 635 applies hyperbolic tangent function to \var{a}. 636 \end{funcdesc} 637 638 \begin{funcdesc}{asinh}{a} 639 applies arc (inverse) hyperbolic sine function to \var{a}. 640 \end{funcdesc} 641 642 \begin{funcdesc}{acosh}{a} 643 applies arc (inverse) hyperbolic cosine function to \var{a}. 644 \end{funcdesc} 645 646 \begin{funcdesc}{atanh}{a} 647 applies arc (inverse) hyperbolic tangent function to \var{a}. 648 \end{funcdesc} 649 650 \begin{funcdesc}{exp}{a} 651 applies exponential function to \var{a}. 652 \end{funcdesc} 653 654 \begin{funcdesc}{sqrt}{a} 655 applies square root function to \var{a}. 656 \end{funcdesc} 657 658 \begin{funcdesc}{log}{a} 659 \end{funcdesc} 660 661 \begin{funcdesc}{log10}{a} 662 \end{funcdesc} 663 664 \begin{funcdesc}{sign}{a} 665 \end{funcdesc} 666 667 \begin{funcdesc}{wherePositive}{a} 668 \end{funcdesc} 669 \begin{funcdesc}{whereNegative}{a} 670 \end{funcdesc} 671 \begin{funcdesc}{whereNonNegative}{a} 672 \end{funcdesc} 673 \begin{funcdesc}{whereNonPositive}{a} 674 \end{funcdesc} 675 \begin{funcdesc}{whereZero}{a,tol=0.} 676 \end{funcdesc} 677 \begin{funcdesc}{whereNonZero}{a,tol=0.} 678 \end{funcdesc} 679 \begin{funcdesc}{minval}{a} 680 \end{funcdesc} 681 \begin{funcdesc}{maxval}{a} 682 \end{funcdesc} 683 \begin{funcdesc}{length}{a} 684 \end{funcdesc} 685 \begin{funcdesc}{trace}{a,axis_offset=0} 686 \end{funcdesc} 687 \begin{funcdesc}{transpose}{a,axis_offset=None} 688 \end{funcdesc} 689 \begin{funcdesc}{symmetric}{a} 690 \end{funcdesc} 691 \begin{funcdesc}{nonsymmetric}{a} 692 \end{funcdesc} 693 \begin{funcdesc}{inverse}{a} 694 \end{funcdesc} 695 \begin{funcdesc}{eigenvalues}{a} 696 \end{funcdesc} 697 \begin{funcdesc}{eigenvalues_and_eigenvectors}{a} 698 \end{funcdesc} 699 \begin{funcdesc}{maximum}{a} 700 \end{funcdesc} 701 \begin{funcdesc}{minimum}{a} 702 \end{funcdesc} 703 \begin{funcdesc}{clip}{a,minval=0.,maxval=1.} 704 \end{funcdesc} 705 \begin{funcdesc}{inner}{a0,a1} 706 \end{funcdesc} 707 \begin{funcdesc}{matrixmult}{a0,a1} 708 \end{funcdesc} 709 \begin{funcdesc}{outer}{a0,a1} 710 \end{funcdesc} 711 \begin{funcdesc}{tensormult}{a0,a1} 712 \end{funcdesc} 713 \begin{funcdesc}{grad}{a,where=None} 714 \end{funcdesc} 715 \begin{funcdesc}{integrate}{a,where=None} 716 \end{funcdesc} 717 \begin{funcdesc}{interpolate}{a,where} 718 \end{funcdesc} 719 \begin{funcdesc}{div}{a,where=None} 720 \end{funcdesc} 721 \begin{funcdesc}{jump}{a,domain=None} 722 \end{funcdesc} 723 \begin{funcdesc}{L2}{a} 724 \end{funcdesc} 725 726 ==== 727 728 729 \begin{funcdesc}{wherePositive}{a} 730 jgs 102 returns \Data object which has the same \Shape and is defined on 731 the same \FunctionSpace like the object. The returned values are $1$ 732 where the object is positive and $0$ elsewhere. 733 gross 593 \end{funcdesc} 734 jgs 82 735 gross 593 \begin{funcdesc}{wherePositive}{a} 736 jgs 102 returns \Data object which has the same \Shape and is defined on 737 the same \FunctionSpace like the object. The returned values are $1$ 738 where the object is non-positive and $0$ elsewhere. 739 gross 593 \end{funcdesc} 740 jgs 82 741 gross 593 \begin{funcdesc}{whereNonnegative}{a} 742 jgs 102 returns \Data object which has the same \Shape and is defined on 743 the same \FunctionSpace like the object. The returned values are $1$ 744 where the object is non-negative and $0$ elsewhere. 745 gross 593 \end{funcdesc} 746 jgs 82 747 gross 593 \begin{funcdesc}{whereNegative}{a} 748 jgs 102 returns \Data object which has the same \Shape and is defined on 749 the same \FunctionSpace like the object. The returned values are $1$ 750 where the object is negative and $0$ elsewhere. 751 gross 593 \end{funcdesc} 752 jgs 82 753 gross 593 \begin{funcdesc}{whereZero}{a,tol=1.e-8} 754 jgs 102 returns \Data object which has the same \Shape and is defined on 755 the same \FunctionSpace like the object. The returned values are $1$ 756 where the object is nearly zero, i.e. where the absolute value is less 757 than \var{tolerance}, and $0$ elsewhere. 758 gross 593 \end{funcdesc} 759 jgs 82 760 gross 593 \begin{funcdesc}{whereNonzero}{tolerance=1.e-8} 761 jgs 102 returns \Data object which has the same \Shape and is defined on 762 the same \FunctionSpace like the object. The returned values are $1$ 763 where the object is nearly non-zero, i.e. where the absolute value is 764 greater or equal than \var{tolerance}, and $0$ elsewhere. 765 gross 593 \end{funcdesc} 766 jgs 82 767 gross 593 \begin{funcdesc}{sign}{a} 768 jgs 102 returns \Data object which has the same \Shape and is defined on 769 the same \FunctionSpace like the object. The returned values are $1$ 770 where the object is positive, $-1$ where the value is negative and $0$ elsewhere. 771 gross 593 \end{funcdesc} 772 jgs 82 773 gross 593 \begin{funcdesc}{Lsup}{a} 774 jgs 102 returns the $L^{sup}$-norm of the object. This is maximum absolute values over all components and all \DataSamplePoints. \index{$L^{sup}$-norm}. 775 gross 593 \end{funcdesc} 776 \begin{funcdesc}{Linf}{a} 777 jgs 117 returns the minimum absolute value over all components and all \DataSamplePoints. \index{$L^{inf}$-norm}. 778 gross 593 \end{funcdesc} 779 \begin{funcdesc}{inf}{a} 780 jgs 102 returns the minimum value (infimum) of the object. The minimum is 781 taken over all components and all \DataSamplePoints . \index{infimum} 782 gross 593 \end{funcdesc} 783 jgs 102 784 gross 593 \begin{funcdesc}{sup}{a} 785 jgs 102 returns the maximum value (supremum) of the object. The maximum is 786 taken over all components and all \DataSamplePoints . \index{supremum} 787 gross 593 \end{funcdesc} 788 jgs 102 789 gross 593 \begin{funcdesc}{grad}{a,\optional{where}} 790 jgs 102 returns the gradient of the function represented by the object. 791 \Data object is in \FunctionSpace \var{on} and has rank r+1 where r is the rank of the object. 792 If \var{on} is not present, a suitbale \FunctionSpace is used. 793 jgs 82 \index{gradient} 794 gross 593 \end{funcdesc} 795 jgs 82 796 gross 593 \begin{funcdesc}{integrate}{a,\optional{where}} 797 jgs 102 returns the integral of the function represented by the object. The method returns 798 gross 593 a \class{numarray.NumArray} object of the same \Shape like the object. A 799 jgs 82 component of the returned object is the integral of the corresponding 800 jgs 102 component of the object. \index{integral} 801 gross 593 \end{funcdesc} 802 jgs 82 803 gross 593 \begin{funcdesc}{interpolate}{a,where} 804 jgs 102 interpolates 805 the function represented by the object 806 gross 593 into the \FunctionSpace\var{where}. 807 jgs 82 \index{interpolation} 808 gross 593 \end{funcdesc} 809 jgs 82 810 gross 593 \begin{funcdesc}{abs}{a} 811 jgs 102 applies the absolute value function to the object. The 812 return \Data object has the same \Shape and is in the same 813 \FunctionSpace like the object. For all \DataSamplePoints and all 814 components the value is calculated by applying the exponential 815 function. \index{function!absolute value} 816 gross 593 \end{funcdesc} 817 jgs 82 818 gross 593 \begin{funcdesc}{exp}{a} 819 jgs 102 applies the exponential function to the object. The 820 return \Data object has the same \Shape and is in the same 821 \FunctionSpace like the object. For all \DataSamplePoints and all 822 components the value is calculated by applying the exponential 823 function. \index{function!exponential} 824 gross 593 \end{funcdesc} 825 jgs 82 826 gross 593 \begin{funcdesc}{sqrt}{a} 827 jgs 102 applies the square root function to the object. The 828 return \Data object has the same \Shape and is in the same 829 \FunctionSpace like the object. For all \DataSamplePoints and all 830 components the value is calculated by applying the square root function. 831 An exception is 832 raised if the value is negative. \index{function!square root} 833 gross 593 \end{funcdesc} 834 jgs 82 835 gross 593 \begin{funcdesc}{sin}{a} 836 jgs 102 applies the sine function to the object. The 837 return \Data object has the same \Shape and is in the same 838 \FunctionSpace like the object. For all \DataSamplePoints and all 839 components the value is calculated by applying the sine function. \index{function!sine} 840 gross 593 \end{funcdesc} 841 jgs 82 842 gross 593 \begin{funcdesc}{cos}{a} 843 jgs 102 applies the cosine function to the object. The 844 return \Data object has the same \Shape and is in the same 845 \FunctionSpace like the object. For all \DataSamplePoints and all 846 components the value is calculated by applying the cosine function. \index{function!cosine} 847 gross 593 \end{funcdesc} 848 jgs 82 849 gross 593 \begin{funcdesc}{tan}{a} 850 jgs 102 applies the tangent function to the object. The 851 return \Data object has the same \Shape and is in the same 852 \FunctionSpace like the object. For all \DataSamplePoints and all 853 components the value is calculated by applying the tangent function. \index{function!tangent} 854 gross 593 \end{funcdesc} 855 jgs 82 856 gross 593 \begin{funcdesc}{log}{a} 857 jgs 102 applies the logarithmic function to the object. The 858 return \Data object has the same \Shape and is in the same 859 \FunctionSpace like the object. For all \DataSamplePoints and all 860 components the value is calculated by applying the logarithmic function. An exception is 861 raised if the value is negative.\index{function!logarithmic} 862 gross 593 \end{funcdesc} 863 jgs 82 864 gross 593 \begin{funcdesc}{maxval}{} 865 jgs 102 returns the maximum value over all components. The 866 return value is a \Data object of rank 0 867 and is in the same 868 \FunctionSpace like the object. For all \DataSamplePoints 869 the value is calculated as the maximum value over all components. \index{function!maximum} 870 gross 593 \end{funcdesc} 871 jgs 82 872 gross 593 \begin{funcdesc}{minval}{} 873 jgs 102 returns the minimum value over all components. The 874 return value is a \Data object of rank 0 875 and is in the same 876 \FunctionSpace like the object. For all \DataSamplePoints 877 the value is calculated as the minimum value over all components. \index{function!minimum} 878 gross 593 \end{funcdesc} 879 jgs 82 880 gross 593 \begin{funcdesc}{length}{} 881 jgs 102 returns the Euclidean length at all \DataSamplePoints. The 882 return value is a \Data object of rank 0 883 and is in the same 884 \FunctionSpace like the object. For all \DataSamplePoints 885 the value is calculated as the square root of the sum of the square over all over all components. \index{function!length} 886 gross 593 \end{funcdesc} 887 \begin{funcdesc}{transpose}{axis} 888 jgs 102 returns the transpose of the object around \var{axis}. \var{axis} is a non-negative integer 889 which is less the rank $r$ of the object. Transpose swaps the indexes $0$ to \var{axis} 890 with the indexes \var{axis}+1 to $r$. If the \var{d} is \RankFour one has 891 \begin{python} 892 d[i,j,k,l]=d.transpose(0)[i,j,k,l] 893 d[i,j,k,l]=d.transpose(1)[j,k,l,i] 894 d[i,j,k,l]=d.transpose(2)[k,l,i,j] 895 d[i,j,k,l]=d.transpose(3)[l,i,j,k] 896 \end{python} 897 \index{function!transpose} 898 gross 593 \end{funcdesc} 899 jgs 82 900 gross 593 \begin{funcdesc}{trace}{} 901 jgs 102 returns sum of the components with identical indexes. 902 The 903 return value is a \Data object of rank 0 904 and is in the same 905 \FunctionSpace like the object. 906 \index{function!trace} 907 gross 593 \end{funcdesc} 908 \begin{funcdesc}{saveDX}{fileName} 909 jgs 102 saves the object to an openDX format file of name \var{fileName}, see 910 \ulink{www.opendx.org}{\url{www.opendx.org}}. \index{openDX} 911 \end{funcdesc} 912 913 914 \begin{funcdesc}{abs}{arg} 915 returns the absolute value of \var{arg} where \var{arg} 916 can be double, a \Data object or an \numarray object. 917 \end{funcdesc} 918 919 \begin{funcdesc}{sin}{arg} 920 returns the sine of \var{arg} where \var{arg} 921 can be double, a \Data object or an \numarray object. 922 \end{funcdesc} 923 924 \begin{funcdesc}{cos}{arg} 925 returns the cosine of \var{arg} where \var{arg} 926 can be double, a \Data object or an \numarray object. 927 \end{funcdesc} 928 929 \begin{funcdesc}{exp}{arg} 930 returns the value of the exponential function for \var{arg} where \var{arg} 931 can be double, a \Data object or an \numarray object. 932 \end{funcdesc} 933 934 \begin{funcdesc}{sqrt}{arg} 935 returns the square root of \var{arg} where \var{arg} 936 can be double, a \Data object or an \numarray object. 937 \end{funcdesc} 938 939 \begin{funcdesc}{maxval}{arg} 940 returns the maximum value over all component of \var{arg} where \var{arg} 941 can be double, a \Data object or an \numarray object. 942 \end{funcdesc} 943 944 \begin{funcdesc}{minval}{arg} 945 returns the minumum value over all component of \var{arg} where \var{arg} 946 can be double, a \Data object or an \numarray object. 947 \end{funcdesc} 948 949 \begin{funcdesc}{length}{arg} 950 returns the length of \var{arg} which is the 951 square root of the sum of the squares of all component of \var{arg}. \var{arg} 952 can be double, a \Data object or an \numarray object. 953 \end{funcdesc} 954 955 \begin{funcdesc}{sign}{arg} 956 return the sign of \var{arg} where \var{arg} 957 can be double, a \Data object or an \numarray object. 958 \end{funcdesc} 959 960 \begin{funcdesc}{transpose}{arg,\optional{axis}} 961 returns the transpose of \var{arg} around \var{axis}. \var{axis} is a non-negative integer 962 which is less the rank $r$ of the object. Transpose swaps the indexes $0$ to \var{axis} 963 with the indexes \var{axis}+1 to $r$. If \var{axis} is not present, \var{axis}=$r/2$ is assumed. 964 \var{arg} 965 may be a \Data object or an \numarray object. 966 \end{funcdesc} 967 968 \begin{funcdesc}{transpose}{arg,\optional{axis}} 969 returns the trace the object of \var{arg}. The trace is the sum over those components 970 with identical indexed. 971 \var{arg} 972 may be a \Data object or a \numarray object. 973 \end{funcdesc} 974 975 \begin{funcdesc}{sum}{arg} 976 returns the sum over all components and all 977 \DataSamplePoints of \var{arg}, where \var{arg} 978 is a \Data object. 979 \end{funcdesc} 980 981 \begin{funcdesc}{sup}{arg} 982 returns the maximum over all components and all 983 \DataSamplePoints of \var{arg}, where \var{arg} 984 is a \Data object. 985 \end{funcdesc} 986 987 \begin{funcdesc}{inf}{arg} 988 returns the mimumum over all components and all 989 \DataSamplePoints of \var{arg}, where \var{arg} 990 is a \Data object. 991 \end{funcdesc} 992 993 \begin{funcdesc}{L2}{arg} 994 returns the $L^2$ norm of \var{arg}. This is the square root 995 of the sum of the squared value over all components and all 996 \DataSamplePoints of \var{arg}, where \var{arg} 997 is a \Data object. 998 \end{funcdesc} 999 1000 \begin{funcdesc}{Lsup}{arg} 1001 returns the $L^{sup}$ norm of \var{arg}. This is the maximum of the absolute values 1002 over all components and all 1003 \DataSamplePoints of \var{arg}, where \var{arg} 1004 is a \Data object. 1005 \end{funcdesc} 1006 1007 \begin{funcdesc}{dot}{arg1,arg2} 1008 returns the dot product of of \var{arg1} and \var{arg2}. This is sum 1009 of the product of corresponding entries in \var{arg1} and \var{arg2} over all 1010 components and and all 1011 \DataSamplePoints. \var{arg1} and \var{arg2} are \Data objects of the 1012 same \Shape and in the same \FunctionSpace. 1013 \end{funcdesc} 1014 1015 \begin{funcdesc}{grad}{arg,\optional{where}} 1016 returns the gradient of \var{arg} as a function in the \FunctionSpace \var{where}. 1017 If \var{where} is not present a reasonable \FunctionSpace is chosen. 1018 \var{arg} 1019 is a \Data object. 1020 \end{funcdesc} 1021 1022 \begin{funcdesc}{integrate}{arg} 1023 returns the integral of \var{arg} as a \numarray object. 1024 If \var{where} is not present a reasonable \FunctionSpace is chosen. 1025 \var{arg} 1026 is a \Data object. 1027 \end{funcdesc} 1028 1029 \begin{funcdesc}{interpolate}{arg,where} 1030 interpolate \Data object \var{arg} into the \FunctionSpace \var{where} 1031 \end{funcdesc} 1032 1033 1034 \section{\Operator Class} 1035 1036 The \Operator class provides an abstract access to operators build 1037 within the \LinearPDE class. \Operator objects are created 1038 when a PDE is handed over to a PDE solver library and handled 1039 by the \LinearPDE class defining the PDE. The user can gain access 1040 to the \Operator of a \LinearPDE object through the \var{getOperator} 1041 method. 1042 1043 \begin{classdesc}{Operator}{} 1044 creates an empty \Operator object. 1045 \end{classdesc} 1046 1047 \begin{methoddesc}[Operator]{isEmpty}{fileName} 1048 returns \True is the object is empty. Otherwise \True is returned. 1049 jgs 82 \end{methoddesc} 1050 1051 jgs 102 \begin{methoddesc}[Operator]{setValue}{value} 1052 resets all entires in the obeject representation to \var{value} 1053 jgs 82 \end{methoddesc} 1054 1055 jgs 102 \begin{methoddesc}[Operator]{solves}{rhs} 1056 solves the operator equation with right hand side \var{rhs} 1057 jgs 82 \end{methoddesc} 1058 1059 jgs 102 \begin{methoddesc}[Operator]{of}{u} 1060 applies the operator to the \Data object \var{u} 1061 jgs 82 \end{methoddesc} 1062 1063 jgs 102 \begin{methoddesc}[Operator]{saveMM}{fileName} 1064 jgs 82 saves the object to a matrix market format file of name 1065 \var{fileName}, see 1066 \ulink{maths.nist.gov/MatrixMarket}{\url{http://maths.nist.gov/MatrixMarket}}. 1067 \index{Matrix Market} 1068 \end{methoddesc} 1069

## Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision