On Fri, Jan 24, 2014 at 3:36 PM, yuan wang <rose.w...@tufts.edu> wrote:
> Dear fipyers,
>
> Is it possible to assign the value of the product of two Cellvariables onto
> one CellVariable in a succinct way. For example, a, b, c are CellVariables.
> I wrote something like a = b*c, but it does not work. An error pop up
> saying, "TypeError: The value of an `_OperatorVariable` cannot be assigned".
> The RHS became a binary operator variable and I have to write a.value =
> (b*c).value to work it out.

> Is there a simpler to work around this?

I think that

     a[:] = b * c

should make "a.value" an actual array. Also you can always get the
array value by simply forcing with "numpy.array(b * c)", which
removing any vestiges of FiPy from the object.

There may be a good reason to make the assignment, but it might also
indicate that there is a better way.

-- 
Daniel Wheeler
_______________________________________________
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to