← Back to team overview

dolfin team mailing list archive

[HG DOLFIN] Implemented x.array() and A.array() for GenericVector and GenericMatrix in PyDOLFIN,

 

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

changeset:   4381:6506b99339a4096cde9e8ad0290071c8c42f881c
tag:         tip
user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
date:        Mon Jul 07 19:14:23 2008 +0200
files:       dolfin/swig/dolfin_la_post.i
description:
Implemented x.array() and A.array() for GenericVector and GenericMatrix in PyDOLFIN,
both returning a numpy array with a copy of the data. (NB! dense matrix!).

Try f.ex.:

In [7]: A = assemble(u*v*dx, mesh)

In [8]: B = A.array()

In [12]: import scipy.linalg

In [13]: scipy.linalg.eigvals(B)
Out[13]:
array([ 0.08803702+0.j,  0.05652695+0.j,  0.05015566+0.j,  0.06728417+0.j,
        0.01369043+0.j,  0.01388889+0.j,  0.00755545+0.j,  0.02386164+0.j,
        0.02406092+0.j,  0.02966277+0.j,  0.01663435+0.j,  0.00759757+0.j,
        0.03219184+0.j,  0.02969543+0.j,  0.02255606+0.j,  0.01660086+0.j])


changeset:   4380:1d6869e94def00a759eb52388443f606781d108c
user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
date:        Mon Jul 07 11:12:16 2008 +0200
files:       dolfin/function/ConstantFunction.cpp dolfin/function/ConstantFunction.h dolfin/function/Function.cpp dolfin/function/Function.h dolfin/swig/dolfin_common_post.i dolfin/swig/dolfin_function_pre.i site-packages/dolfin/__init__.py
description:
Changed syntax of constant vector and tensor functions to use Array.
The following are equivalent and generalizes in the obvious way:

Function(mesh, 2, 0.0);

Array<real> values(0.0, 0.0);
Function(mesh, values);

Array<uint> shape(2);
Array<real> values(0.0, 0.0);
Function(mesh, shape, values);

In Python, the typemaps doesn't seem to pick up lists,
so the corresponding syntax there is currently:

f = Function(mesh, 2, 0.0)

f = Function(mesh, ArrayDouble(0.0, 0.0))

f = Function(mesh, ArrayUInt(2), ArrayDouble(0.0, 0.0))


changeset:   4379:a44f5d31503e454ddf06112654a529454aeb04dd
user:        "Garth N. Wells <gnw20@xxxxxxxxx>"
date:        Mon Jul 07 09:48:51 2008 +0100
files:       doc/misc/policy
description:
Add point on brackets following control statements to policy.

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