DOLFIN User Manual - FEniCS Project
DOLFIN User Manual - FEniCS Project
DOLFIN User Manual - FEniCS Project
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>DOLFIN</strong> <strong>User</strong> <strong>Manual</strong>Hoffman, Jansson, Logg, Wells5.3.2 Specifying a function-pointerA user-defined Function may alternatively be defined by specifying a functionpointer. The following example illustrates an alternative way of creatinga Function representing the function in (5.2):real source(const Point& p, unsigned int i){return x*y*sin(z / <strong>DOLFIN</strong>_PI);}Function f(source);As before, for vector-valued Functions, the vector dimension must be suppliedto the constructor of Function:real source(const Point& p, unsigned int i){if ( i == 0 )return 0.0;else if ( i == 1 )return x*y*sin(z / <strong>DOLFIN</strong>_PI);elsereturn x + y;}Function f(source, 3);5.3.3 Cell-dependent functionsIn some cases, it may be convenient to define a Function in terms of propertiesof the current Cell. One such example is a Function that at any givenpoint takes the value of the mesh size at that point.41