← Back to team overview

dolfin team mailing list archive

[HG DOLFIN] Add lambda function interface to GenericVector (not as pretty as Python, but still pretty neat).

 

One or more new changesets pushed to the primary dolfin repository.
A short summary of the last three changesets is included below.

changeset:   6850:84b6289891e7f8719799bb5d8290ec914891b577
tag:         tip
user:        "Garth N. Wells <gnw20@xxxxxxxxx>"
date:        Tue Aug 25 17:16:35 2009 +0100
files:       dolfin/la/GenericVector.h
description:
Add lambda function interface to GenericVector (not as pretty as Python, but still pretty neat).

Allows simple mathematical operations to be applied to each element of a vector, e.g.

- To set all elements equal to 2,

  x.lambda(_1 = 2);

- To take the cosine of each element

  x.lambda(_1 = cos(_1));

- To add the cosine of the (entry (v[i] = v[i] + cos(v[i])

  x.lambda(_1 += cos(_1));

- To set the entry equal to zero if it is less than zero or set it equal to one if it's greater than 1,

  x.lambda(if_then_else(_1 < 0.0, _1 = 0.0, if_then(_1 > 1.0, _1 = 1.0)));

To set the entries of vector v equal to the square of the entries in vector w,

  v.lambda(x, _1*_1);

See Boost.Lambda ( http://www.boost.org/doc/libs/1_39_0/doc/html/lambda.html) for more details.


changeset:   6849:d0ee53f3a27bab380ca938ba39e129aaaf3946c8
user:        "Johan Hake <hake@xxxxxxxxx>"
date:        Tue Aug 25 15:05:24 2009 +0200
files:       site-packages/dolfin/assemble.py
description:
Bug fix in assemble.py when providing an external_facet_domain using a MeshFunction
  (Need to add unit test for this...)


changeset:   6848:7f519a779475a9b8a4f0309a7cf7fe748890e9f5
user:        "Garth N. Wells <gnw20@xxxxxxxxx>"
date:        Tue Aug 25 13:16:02 2009 +0100
files:       dolfin/function/Constant.cpp dolfin/function/Constant.h dolfin/la/SLEPcEigenSolver.cpp scripts/compileforms
description:
Add assignment operator to Constant.

----------------------------------------------------------------------
For more details, visit http://www.fenics.org/hg/dolfin