dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #00991
Re: Updated elasticity: [...]
On Thu, Sep 15, 2005 at 08:52:04PM -0500, Anders Logg wrote:
> I just added it. Can you try and see if it works? I've implemented
> component-wise multiplication of scalar basis functions, functions and
> constants with vectors (Python built-in list). It was just two lines
> added to algebra.py:
>
> if isinstance(other, list) and self.rank() == 0:
> return [self*v for v in other]
>
> Is this enough, or are you using Numeric.array for something so I
> should add that too? The new operators assume Python list.
>
> /Anders
>
It works for vectors (which are represented by Python list), but as
you guessed, it doesn't work for Numeric.array objects. This matrix
becomes a Numeric.array:
epsilon = grad(u) + trans(grad(u))
I guess it should work to just add this too?:
if isinstance(other, Numeric.array) and self.rank() == 0:
return [mult(self, v) for v in other]
except it doesn't work:
TypeError: isinstance() arg 2 must be a class, type, or tuple of
classes and types
I think Numeric.array is also the name of a function, I can't figure
out how to specify the type name.
Well, it's not so critical, mult() works just as well for now.
Here's the test case I used:
element = FiniteElement("Vector Lagrange", "triangle", 1)
v = BasisFunction(element)
u = BasisFunction(element)
c = Constant()
epsilon = grad(u) + transp(grad(u))
tmp = c * epsilon
L = tmp * dx
Johan
Follow ups
References